Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#130 from kahun/fix/aks_keos_resour…
Browse files Browse the repository at this point in the history
…ce_manager

Fix Azure keos integration
  • Loading branch information
unai-ttxu authored May 29, 2023
2 parents c0a2c3c + 434ee10 commit 6eb4fe3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ type KEOSDescriptor struct {
EKS bool `yaml:"eks"`
} `yaml:"aws,omitempty"`
Azure struct {
Enabled bool `yaml:"enabled"`
AKS bool `yaml:"aks"`
Enabled bool `yaml:"enabled"`
AKS bool `yaml:"aks"`
ResourceGroup string `yaml:"resource_group"`
} `yaml:"azure,omitempty"`
GCP struct {
Enabled bool `yaml:"enabled"`
Expand Down Expand Up @@ -89,6 +90,7 @@ func createKEOSDescriptor(descriptorFile commons.DescriptorFile, storageClass st
if descriptorFile.InfraProvider == "azure" {
keosDescriptor.Azure.Enabled = true
keosDescriptor.Azure.AKS = descriptorFile.ControlPlane.Managed
keosDescriptor.Azure.ResourceGroup = descriptorFile.ClusterID
}

// GCP
Expand Down
3 changes: 1 addition & 2 deletions pkg/commons/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ type AWS struct {
}

type AZURE struct {
Credentials AzureCredentials `yaml:"credentials"`
ResourceGroup string `yaml:"resource_group"`
Credentials AzureCredentials `yaml:"credentials"`
}

type GCP struct {
Expand Down
12 changes: 2 additions & 10 deletions pkg/commons/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,7 @@ func EnsureSecretsFile(descriptorFile DescriptorFile, vaultPassword string) erro
if len(credentials) > 0 {
creds := convertStringMapToInterfaceMap(credentials)
creds = convertMapKeysToSnakeCase(creds)
if descriptorFile.InfraProvider == "azure" {
secretMap[descriptorFile.InfraProvider] = map[string]interface{}{"credentials": creds, "resource_group": descriptorFile.ClusterID}
} else {
secretMap[descriptorFile.InfraProvider] = map[string]interface{}{"credentials": creds}
}
secretMap[descriptorFile.InfraProvider] = map[string]interface{}{"credentials": creds}
}

if len(externalRegistry) > 0 {
Expand Down Expand Up @@ -236,11 +232,7 @@ func EnsureSecretsFile(descriptorFile DescriptorFile, vaultPassword string) erro
edited = true
creds := convertStringMapToInterfaceMap(credentials)
creds = convertMapKeysToSnakeCase(creds)
if descriptorFile.InfraProvider == "azure" {
secretMap["secrets"][descriptorFile.InfraProvider] = map[string]interface{}{"credentials": creds, "resource_group": descriptorFile.ClusterID}
} else {
secretMap["secrets"][descriptorFile.InfraProvider] = map[string]interface{}{"credentials": creds}
}
secretMap["secrets"][descriptorFile.InfraProvider] = map[string]interface{}{"credentials": creds}
}

if secretMap["secrets"]["external_registry"] == nil && len(externalRegistry) > 0 {
Expand Down

0 comments on commit 6eb4fe3

Please sign in to comment.