Skip to content

Commit

Permalink
dont write workload identity to yaml file on deployment inspect (#1565)
Browse files Browse the repository at this point in the history
* dont write workload identity to yaml file on deployment inspect

* fix unit tests

---------

Co-authored-by: Julian LaNeve <lanevejulian@gmail.com>
  • Loading branch information
2 people authored and kushalmalani committed Feb 23, 2024
1 parent 5d18ec5 commit c60e97c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 1 addition & 4 deletions cloud/deployment/inspect/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type deploymentConfig struct {
ResourceQuotaCPU string `mapstructure:"resource_quota_cpu,omitempty" yaml:"resource_quota_cpu,omitempty" json:"resource_quota_cpu,omitempty"`
ResourceQuotaMemory string `mapstructure:"resource_quota_memory,omitempty" yaml:"resource_quota_memory,omitempty" json:"resource_quota_memory,omitempty"`
DefaultWorkerType string `mapstructure:"default_worker_type,omitempty" yaml:"default_worker_type,omitempty" json:"default_worker_type,omitempty"`
WorkloadIdentity string `mapstructure:"workload_identity,omitempty" yaml:"workload_identity,omitempty" json:"workload_identity,omitempty"`
WorkloadIdentity string `mapstructure:"workload_identity" yaml:"workload_identity" json:"workload_identity"` // intentionally removing omitempty so we have an empty placeholder for this value if someone wants to set it
}

type Workerq struct {
Expand Down Expand Up @@ -255,9 +255,6 @@ func getDeploymentConfig(coreDeploymentPointer *astroplatformcore.Deployment, pl
if coreDeployment.Region != nil {
deploymentMap["region"] = *coreDeployment.Region
}
if coreDeployment.WorkloadIdentity != nil {
deploymentMap["workload_identity"] = *coreDeployment.WorkloadIdentity
}

return deploymentMap, nil
}
Expand Down
6 changes: 4 additions & 2 deletions cloud/deployment/inspect/inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ func TestGetDeploymentConfig(t *testing.T) {
Region: *sourceDeployment.Region,
DeploymentType: string(*sourceDeployment.Type),
CloudProvider: *sourceDeployment.CloudProvider,
WorkloadIdentity: *sourceDeployment.WorkloadIdentity,
IsDevelopmentMode: *sourceDeployment.IsDevelopmentMode,
}
rawDeploymentConfig, err := getDeploymentConfig(&sourceDeployment, mockPlatformCoreClient)
Expand Down Expand Up @@ -743,6 +742,7 @@ func TestFormatPrintableDeployment(t *testing.T) {
deployment_type: HYBRID
cloud_provider: ""
region: ""
workload_identity: ""
worker_queues:
- name: default
max_worker_count: 130
Expand Down Expand Up @@ -831,6 +831,7 @@ func TestFormatPrintableDeployment(t *testing.T) {
default_task_pod_memory: "1"
resource_quota_cpu: "1"
resource_quota_memory: "1"
workload_identity: ""
worker_queues:
- name: default
max_worker_count: 130
Expand Down Expand Up @@ -1015,7 +1016,8 @@ func TestFormatPrintableDeployment(t *testing.T) {
"workspace_name": "test-ws",
"deployment_type": "HYBRID",
"cloud_provider": "",
"region": ""
"region": "",
"workload_identity": ""
},
"worker_queues": [],
"alert_emails": [
Expand Down

0 comments on commit c60e97c

Please sign in to comment.