fix: thread secret annotations and labels through new helm charts
The new config and pull secret helm releases need to honor user-set annotations and labels for `--resource-type secret` so existing scheduler-k3s annotation tests keep passing. The dedicated charts now render `.Values.global.annotations` and `.Values.global.labels` onto their Secret manifest, and the deploy trigger plumbs `SecretAnnotations` and `SecretLabels` from the global annotation/label config. The rollback regression bats test now uses `dokku ps:rebuild` for its second deploy because git push of an unchanged ref is rejected by the dokku remote.
This commit is contained in:
6 files changed
+69
-16
No files matched your search
@@ -17,9 +17,11 @@ type ConfigSecretValues struct {
|
||||
|
||||
// ConfigSecretGlobalValues contains the global values for the config secret chart
|
||||
type ConfigSecretGlobalValues struct {
|
||||
AppName string `yaml:"app_name"`
|
||||
Namespace string `yaml:"namespace"`
|
||||
Secrets map[string]string `yaml:"secrets,omitempty"`
|
||||
Annotations map[string]string `yaml:"annotations,omitempty"`
|
||||
AppName string `yaml:"app_name"`
|
||||
Labels map[string]string `yaml:"labels,omitempty"`
|
||||
Namespace string `yaml:"namespace"`
|
||||
Secrets map[string]string `yaml:"secrets,omitempty"`
|
||||
}
|
||||
|
||||
// GetConfigSecretReleaseName returns the helm release name for the config secret
|
||||
@@ -32,8 +34,17 @@ func GetConfigSecretName(appName string) string {
|
||||
return fmt.Sprintf("config-%s", appName)
|
||||
}
|
||||
|
||||
// CreateOrUpdateConfigSecretInput contains the inputs to CreateOrUpdateConfigSecret
|
||||
type CreateOrUpdateConfigSecretInput struct {
|
||||
AppName string
|
||||
Env map[string]string
|
||||
Annotations map[string]string
|
||||
Labels map[string]string
|
||||
}
|
||||
|
||||
// CreateOrUpdateConfigSecret creates or updates the config env secret helm chart for an app
|
||||
func CreateOrUpdateConfigSecret(ctx context.Context, appName string, env map[string]string) error {
|
||||
func CreateOrUpdateConfigSecret(ctx context.Context, input CreateOrUpdateConfigSecretInput) error {
|
||||
appName := input.AppName
|
||||
if err := isKubernetesAvailable(); err != nil {
|
||||
common.LogDebug("kubernetes not available, skipping config secret creation")
|
||||
return nil
|
||||
@@ -94,15 +105,17 @@ func CreateOrUpdateConfigSecret(ctx context.Context, appName string, env map[str
|
||||
}
|
||||
|
||||
encodedSecrets := map[string]string{}
|
||||
for key, value := range env {
|
||||
for key, value := range input.Env {
|
||||
encodedSecrets[key] = base64.StdEncoding.EncodeToString([]byte(value))
|
||||
}
|
||||
|
||||
values := &ConfigSecretValues{
|
||||
Global: ConfigSecretGlobalValues{
|
||||
AppName: appName,
|
||||
Namespace: namespace,
|
||||
Secrets: encodedSecrets,
|
||||
Annotations: input.Annotations,
|
||||
AppName: appName,
|
||||
Labels: input.Labels,
|
||||
Namespace: namespace,
|
||||
Secrets: encodedSecrets,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user