Skip to content

Commit

Permalink
Merge pull request #3 from kahun/fix/external_registry_refactoring_cr…
Browse files Browse the repository at this point in the history
…edentials

Fix schema (part II)
  • Loading branch information
lreciomelero committed Mar 6, 2023
2 parents 0cad15a + 3a18aac commit 8fc87b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 31 deletions.
21 changes: 0 additions & 21 deletions pkg/cluster/internal/create/actions/createworker/createworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ type GCP struct {
Credentials cluster.GCPCredentials `yaml:"credentials"`
}

type DockerRegistryCredentials struct {
URL string `yaml:"url"`
User string `yaml:"user"`
Pass string `yaml:"pass"`
}

// SecretsFile represents the YAML structure in the secrets.yml file
type SecretsFile struct {
Secrets Secrets `yaml:"secrets"`
Expand All @@ -61,21 +55,6 @@ type Secrets struct {
DockerRegistries []cluster.DockerRegistryCredentials `yaml:"docker_registries"`
}

// type AWSCredentials struct {
// AccessKey string `yaml:"access_key"`
// SecretKey string `yaml:"secret_key"`
// Region string `yaml:"region"`
// Account string `yaml:"account"`
// }

// type GCPCredentials struct {
// ProjectID string `yaml:"project_id"`
// PrivateKeyID string `yaml:"private_key_id"`
// PrivateKey string `yaml:"private_key"`
// ClientEmail string `yaml:"client_email"`
// ClientID string `yaml:"client_id"`
// }

const allowAllEgressNetPol = `
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
Expand Down
20 changes: 10 additions & 10 deletions pkg/cluster/internal/create/actions/createworker/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,16 @@ func getSecrets(descriptorFile cluster.DescriptorFile, vaultPassword string) (ma
} else {
resultGHT = secretFile.Secrets.GithubToken
}
// if secretFile.Secrets.ExternalRegistry == (cluster.ExternalRegistryCredentials{}) {
// if descriptorFile.Credentials.ExternalRegistry != (cluster.ExternalRegistryCredentials{}) {
// resultRegMap := structs.Map(descriptorFile.Credentials.ExternalRegistry)
// resultExternalReg = convertToMapStringString(resultRegMap)

// }
// } else {
// resultRegMap := structs.Map(secretFile.Secrets.ExternalRegistryCredentials)
// resultExternalReg = convertToMapStringString(resultRegMap)
// }
if secretFile.Secrets.ExternalRegistry == (cluster.DockerRegistryCredentials{}) {
if len(descriptorFile.Credentials.DockerRegistries) > 0 &&
descriptorFile.Credentials.DockerRegistries[0] != (cluster.DockerRegistryCredentials{}) {
resultRegMap := structs.Map(descriptorFile.Credentials.DockerRegistries)
resultExternalReg = convertToMapStringString(resultRegMap)
}
} else {
resultRegMap := structs.Map(secretFile.Secrets.ExternalRegistry)
resultExternalReg = convertToMapStringString(resultRegMap)
}

if len(secretFile.Secrets.DockerRegistries) == 0 {
if len(descriptorFile.DockerRegistries) > 0 {
Expand Down

0 comments on commit 8fc87b4

Please sign in to comment.