Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[installer]: secret validation #6702

Merged
merged 2 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions installer/cmd/validate-cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ var validateClusterCmd = &cobra.Command{
return err
}

// Update the status
switch res.Status {
case cluster.ValidationStatusError:
// Always change the status if error
result.Status = cluster.ValidationStatusError
case cluster.ValidationStatusWarning:
// Only put to warning if status is ok
if result.Status == cluster.ValidationStatusOk {
result.Status = cluster.ValidationStatusWarning
}
}

result.Items = append(result.Items, res.Items...)
}

Expand Down
10 changes: 10 additions & 0 deletions installer/pkg/config/v1/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,15 @@ func (v version) ClusterValidation(rcfg interface{}) cluster.ValidationChecks {
res = append(res, cluster.CheckSecret(secretName, cluster.CheckSecretRequiredData("service-account.json")))
}

if cfg.ContainerRegistry.External != nil {
secretName := cfg.ContainerRegistry.External.Certificate.Name
res = append(res, cluster.CheckSecret(secretName, cluster.CheckSecretRequiredData(".dockerconfigjson")))
}

if cfg.Database.CloudSQL != nil {
secretName := cfg.Database.CloudSQL.ServiceAccount.Name
res = append(res, cluster.CheckSecret(secretName, cluster.CheckSecretRequiredData("credentials.json", "encryptionKeys", "password", "username")))
}

return res
}