diff --git a/cmd/template_lagoonenv.go b/cmd/template_lagoonenv.go index cf1d4cd0..5275af1c 100644 --- a/cmd/template_lagoonenv.go +++ b/cmd/template_lagoonenv.go @@ -28,14 +28,27 @@ var lagoonEnvGeneration = &cobra.Command{ if err != nil { return fmt.Errorf("error reading routes flag: %v", err) } + secretName, err := cmd.Flags().GetString("secret-name") + if err != nil { + return fmt.Errorf("error reading secret-name flag: %v", err) + } dbaasCreds, err := rootCmd.PersistentFlags().GetString("dbaas-creds") if err != nil { - return fmt.Errorf("error reading images flag: %v", err) + return fmt.Errorf("error reading dbaas creds flag: %v", err) + } + configMapVars, err := cmd.Flags().GetString("configmap-vars") + if err != nil { + return fmt.Errorf("error reading configmap variables flag: %v", err) } dbaasCredRefs, err := loadCredsFromFile(dbaasCreds) if err != nil { return err } + cmVars := map[string]string{} + if err := json.Unmarshal([]byte(configMapVars), &cmVars); err != nil { + return fmt.Errorf("error unmarshalling lagoon-env configmap variables payload: %v", err) + } + generator.ConfigMapVars = cmVars dbCreds := map[string]string{} for _, v := range *dbaasCredRefs { for k, v1 := range v { @@ -43,7 +56,7 @@ var lagoonEnvGeneration = &cobra.Command{ } } generator.DBaaSVariables = dbCreds - return LagoonEnvTemplateGeneration(generator, routes) + return LagoonEnvTemplateGeneration(secretName, generator, routes) }, } @@ -54,13 +67,14 @@ func loadCredsFromFile(file string) (*DBaaSCredRefs, error) { return nil, fmt.Errorf("couldn't read file %v: %v", file, err) } if err := json.Unmarshal(dbaasCredJSON, dbaasCredRefs); err != nil { - return nil, fmt.Errorf("error unmarshalling images payload: %v", err) + return nil, fmt.Errorf("error unmarshalling dbaas creds payload: %v", err) } return dbaasCredRefs, nil } // LagoonEnvTemplateGeneration . func LagoonEnvTemplateGeneration( + name string, g generator.GeneratorInput, routes string, ) error { @@ -79,7 +93,7 @@ func LagoonEnvTemplateGeneration( if routes != "" { lagoonBuild.BuildValues.Routes = strings.Split(routes, ",") } - cm, err := lagoonenv.GenerateLagoonEnvSecret(*lagoonBuild.BuildValues) + cm, err := lagoonenv.GenerateLagoonEnvSecret(name, *lagoonBuild.BuildValues) if err != nil { return fmt.Errorf("couldn't generate template: %v", err) } @@ -89,9 +103,9 @@ func LagoonEnvTemplateGeneration( } if len(cmBytes) > 0 { if g.Debug { - fmt.Printf("Templating lagoon-env secret %s\n", fmt.Sprintf("%s/%s.yaml", savedTemplates, "lagoon-env-secret")) + fmt.Printf("Templating lagoon-env secret %s\n", fmt.Sprintf("%s/%s-secret.yaml", savedTemplates, name)) } - helpers.WriteTemplateFile(fmt.Sprintf("%s/%s.yaml", savedTemplates, "lagoon-env-secret"), cmBytes) + helpers.WriteTemplateFile(fmt.Sprintf("%s/%s-secret.yaml", savedTemplates, name), cmBytes) } return nil } @@ -100,4 +114,8 @@ func init() { templateCmd.AddCommand(lagoonEnvGeneration) lagoonEnvGeneration.Flags().StringP("routes", "R", "", "The routes from the environment") + lagoonEnvGeneration.Flags().StringP("secret-name", "S", "", + "The name of the secret") + lagoonEnvGeneration.Flags().StringP("configmap-vars", "N", "", + "Any variables from the legacy configmap that need to be retained") } diff --git a/cmd/template_lagoonenv_test.go b/cmd/template_lagoonenv_test.go index b4bcb040..841d1401 100644 --- a/cmd/template_lagoonenv_test.go +++ b/cmd/template_lagoonenv_test.go @@ -15,16 +15,19 @@ import ( func TestLagoonEnvTemplateGeneration(t *testing.T) { tests := []struct { - name string - description string - args testdata.TestData - templatePath string - want string - dbaasCreds string - vars []helpers.EnvironmentVariable + name string + description string + secretName string + args testdata.TestData + configMapVars map[string]string + templatePath string + want string + dbaasCreds string + vars []helpers.EnvironmentVariable }{ { - name: "test1 basic deployment", + name: "test-basic-deployment-lagoon-env", + description: "a basic deployment lagoon-env secret", args: testdata.GetSeedData( testdata.TestData{ ProjectName: "example-project", @@ -77,10 +80,12 @@ func TestLagoonEnvTemplateGeneration(t *testing.T) { }, }, true), templatePath: "testoutput", - want: "internal/testdata/basic/secret-templates/lagoonenv1", + secretName: "lagoon-env", + want: "internal/testdata/basic/secret-templates/test-basic-deployment-lagoon-env", }, { - name: "test1 basic deployment with mariadb creds", + name: "test-basic-deployment-mariadbcreds-lagoon-env", + description: "test a basic deployment with mariadb creds", args: testdata.GetSeedData( testdata.TestData{ ProjectName: "example-project", @@ -132,9 +137,141 @@ func TestLagoonEnvTemplateGeneration(t *testing.T) { }, }, }, true), - dbaasCreds: "internal/testdata/basic/lagoonenv2-creds.json", + dbaasCreds: "internal/testdata/basic/basic-mariadb-creds.json", templatePath: "testoutput", - want: "internal/testdata/basic/secret-templates/lagoonenv2", + secretName: "lagoon-env", + want: "internal/testdata/basic/secret-templates/test-basic-deployment-mariadbcreds-lagoon-env", + }, + { + name: "lagoon-env-with-configmap-vars", + description: "test generating a lagoon-env secret when an existing configmap exists with variables that aren't in the api", + args: testdata.GetSeedData( + testdata.TestData{ + ProjectName: "example-project", + EnvironmentName: "main", + Branch: "main", + LagoonYAML: "internal/testdata/basic/lagoon.yml", + ProjectVariables: []lagoon.EnvironmentVariable{ + { + Name: "MY_SPECIAL_VARIABLE1", + Value: "myspecialvariable1", + Scope: "global", + }, + { + Name: "MY_SPECIAL_VARIABLE2", + Value: "myspecialvariable2", + Scope: "runtime", + }, + { + Name: "MY_SPECIAL_VARIABLE3", + Value: "myspecialvariable3", + Scope: "build", + }, + { + Name: "MY_SPECIAL_VARIABLE", + Value: "myspecialvariable", + Scope: "global", + }, + { + Name: "LAGOON_SYSTEM_CORE_VERSION", + Value: "v2.19.0", + Scope: "internal_system", + }, + { + Name: "REGISTRY_PASSWORD", + Value: "myenvvarregistrypassword", + Scope: "container_registry", + }, + }, + EnvVariables: []lagoon.EnvironmentVariable{ + { + Name: "MY_SPECIAL_VARIABLE2", + Value: "myspecialvariable2-env-override", + Scope: "global", + }, + { + Name: "MY_SPECIAL_VARIABLE4", + Value: "myspecialvariable4", + Scope: "runtime", + }, + }, + }, true), + configMapVars: map[string]string{ + "MY_SPECIAL_VARIABLE": "myspecialvariable", + "MY_SPECIAL_VARIABLE1": "myspecialvariable1", + "MY_SPECIAL_VARIABLE2": "myspecialvariable2", + "MY_SPECIAL_VARIABLE3": "myspecialvariable3", + "MY_SPECIAL_VARIABLE4": "myspecialvariable4", + }, + templatePath: "testoutput", + secretName: "lagoon-env", + want: "internal/testdata/basic/secret-templates/lagoon-env-with-configmap-vars", + }, + { + name: "lagoon-platform-env-with-configmap-vars", + description: `test generating a lagoon-platform-env secret when an existing configmap exists with variables that aren't in the api. + same as lagoon-env-with-configmap-vars, just the the variables not in the API at the time of creation`, + args: testdata.GetSeedData( + testdata.TestData{ + ProjectName: "example-project", + EnvironmentName: "main", + Branch: "main", + LagoonYAML: "internal/testdata/basic/lagoon.yml", + ProjectVariables: []lagoon.EnvironmentVariable{ + { + Name: "MY_SPECIAL_VARIABLE1", + Value: "myspecialvariable1", + Scope: "global", + }, + { + Name: "MY_SPECIAL_VARIABLE2", + Value: "myspecialvariable2", + Scope: "runtime", + }, + { + Name: "MY_SPECIAL_VARIABLE3", + Value: "myspecialvariable3", + Scope: "build", + }, + { + Name: "MY_SPECIAL_VARIABLE", + Value: "myspecialvariable", + Scope: "global", + }, + { + Name: "LAGOON_SYSTEM_CORE_VERSION", + Value: "v2.19.0", + Scope: "internal_system", + }, + { + Name: "REGISTRY_PASSWORD", + Value: "myenvvarregistrypassword", + Scope: "container_registry", + }, + }, + EnvVariables: []lagoon.EnvironmentVariable{ + { + Name: "MY_SPECIAL_VARIABLE2", + Value: "myspecialvariable2-env-override", + Scope: "global", + }, + { + Name: "MY_SPECIAL_VARIABLE4", + Value: "myspecialvariable4", + Scope: "runtime", + }, + }, + }, true), + configMapVars: map[string]string{ + "MY_SPECIAL_VARIABLE": "myspecialvariable", + "MY_SPECIAL_VARIABLE1": "myspecialvariable1", + "MY_SPECIAL_VARIABLE2": "myspecialvariable2", + "MY_SPECIAL_VARIABLE3": "myspecialvariable3", + "MY_SPECIAL_VARIABLE4": "myspecialvariable4", + }, + templatePath: "testoutput", + secretName: "lagoon-platform-env", + want: "internal/testdata/basic/secret-templates/lagoon-platform-env-with-configmap-vars", }, } for _, tt := range tests { @@ -180,7 +317,8 @@ func TestLagoonEnvTemplateGeneration(t *testing.T) { } generator.DBaaSVariables = dbCreds } - err = LagoonEnvTemplateGeneration(generator, "") + generator.ConfigMapVars = tt.configMapVars + err = LagoonEnvTemplateGeneration(tt.secretName, generator, "") if err != nil { t.Errorf("%v", err) } diff --git a/internal/generator/buildvalues.go b/internal/generator/buildvalues.go index a226b15e..c4f6eeec 100644 --- a/internal/generator/buildvalues.go +++ b/internal/generator/buildvalues.go @@ -88,7 +88,8 @@ type BuildValues struct { ConfigTokenPort string `json:"configTokenPort"` ConfigSSHHost string `json:"configSSHHost"` ConfigSSHPort string `json:"configSSHPort"` - DBaaSVariables map[string]string `json:"dbaasVariables" description:"map of variables provided by dbaas consumers"` + LagoonEnvVariables map[string]string `json:"lagoonEnvVariables" description:"map of variables that will be saved into the lagoon-env secret"` + LagoonPlatformEnvVariables map[string]string `json:"agoonPlatformEnvVariables" description:"map of variables that will be saved into the lagoon-platform-env secret"` } type Resources struct { diff --git a/internal/generator/generator.go b/internal/generator/generator.go index a4af96b9..7602cb1a 100644 --- a/internal/generator/generator.go +++ b/internal/generator/generator.go @@ -71,6 +71,7 @@ type GeneratorInput struct { ConfigSSHHost string ConfigSSHPort string DBaaSVariables map[string]string + ConfigMapVars map[string]string } func NewGenerator( @@ -120,7 +121,7 @@ func NewGenerator( buildValues.IsCI = helpers.GetEnvBool("CI", generator.CI, generator.Debug) // add dbaas credentials to build values for injection into configmap - buildValues.DBaaSVariables = generator.DBaaSVariables + buildValues.LagoonPlatformEnvVariables = generator.ConfigMapVars // set the lagoon config variables buildValues.ConfigAPIHost = helpers.GetEnv("LAGOON_CONFIG_API_HOST", generator.ConfigAPIHost, generator.Debug) @@ -482,6 +483,27 @@ func NewGenerator( // this will later be used to add `runtime|global` scope into the `lagoon-env` configmap buildValues.EnvironmentVariables = lagoon.MergeVariables(buildValues.EnvironmentVariables, configVars) + // work out the variables to use in the lagoon-env secret + lagoonEnv := map[string]string{} + for _, v := range buildValues.EnvironmentVariables { + if v.Scope == "global" || v.Scope == "runtime" { + lagoonEnv[v.Name] = v.Value + } + } + // add dbaas variables to lagoon-env + for k, v := range generator.DBaaSVariables { + lagoonEnv[k] = v + } + buildValues.LagoonEnvVariables = lagoonEnv + // filter out variables that exist in the lagoon-env secret from the platform-env secret + for ck := range buildValues.LagoonEnvVariables { + for k := range buildValues.LagoonPlatformEnvVariables { + if k == ck { + delete(buildValues.LagoonPlatformEnvVariables, k) + } + } + } + // finally return the generator values, this should be a mostly complete version of the resulting data needed for a build // another step will collect the current or known state of a build. // the output of the generator and the output of that state collector will eventually replace a lot of the legacy BASH script diff --git a/internal/templating/lagoonenv/template_secret.go b/internal/templating/lagoonenv/template_secret.go index ff1f5a2a..d372024f 100644 --- a/internal/templating/lagoonenv/template_secret.go +++ b/internal/templating/lagoonenv/template_secret.go @@ -8,14 +8,15 @@ import ( // GenerateLagoonEnvSecret generates the lagoon template to apply. func GenerateLagoonEnvSecret( + name string, buildValues generator.BuildValues, ) (corev1.Secret, error) { // add the default labels labels := map[string]string{ "app.kubernetes.io/managed-by": "build-deploy-tool", - "app.kubernetes.io/instance": "lagoon-env", - "app.kubernetes.io/name": "lagoon-env", + "app.kubernetes.io/instance": name, + "app.kubernetes.io/name": name, "lagoon.sh/template": "lagoon-env-0.1.0", "lagoon.sh/project": buildValues.Project, "lagoon.sh/environment": buildValues.Environment, @@ -35,31 +36,23 @@ func GenerateLagoonEnvSecret( annotations["lagoon.sh/prBaseBranch"] = buildValues.PRBaseBranch } - variables := map[string]string{} - - // add variables from the project/environment/build created variables - for _, v := range buildValues.EnvironmentVariables { - if v.Scope == "global" || v.Scope == "runtime" { - variables[v.Name] = v.Value - } - } - - // add dbaas variables to lagoon-env - for k, v := range buildValues.DBaaSVariables { - variables[k] = v - } - lagoonEnv := corev1.Secret{ TypeMeta: metav1.TypeMeta{ Kind: "Secret", APIVersion: corev1.SchemeGroupVersion.Version, }, ObjectMeta: metav1.ObjectMeta{ - Name: "lagoon-env", + Name: name, Labels: labels, Annotations: annotations, }, - StringData: variables, + } + // pick which values to save into the secret based on the name + switch name { + case "lagoon-platform-env": + lagoonEnv.StringData = buildValues.LagoonPlatformEnvVariables + default: + lagoonEnv.StringData = buildValues.LagoonEnvVariables } return lagoonEnv, nil diff --git a/internal/templating/lagoonenv/template_secret_test.go b/internal/templating/lagoonenv/template_secret_test.go index 7686053f..dc357712 100644 --- a/internal/templating/lagoonenv/template_secret_test.go +++ b/internal/templating/lagoonenv/template_secret_test.go @@ -12,67 +12,95 @@ import ( ) func TestGenerateLagoonEnvSecret(t *testing.T) { - type args struct { - buildValues generator.BuildValues - } tests := []struct { - name string - args args - want string - wantErr bool + name string + secretName string + description string + buildValues generator.BuildValues + want string + wantErr bool }{ { - name: "test1", - args: args{ - buildValues: generator.BuildValues{ - Project: "example-project", - Environment: "environment-name", - EnvironmentType: "production", - Namespace: "myexample-project-environment-name", - BuildType: "branch", - LagoonVersion: "v2.x.x", - Kubernetes: "generator.local", - Branch: "environment-name", - EnvironmentVariables: []lagoon.EnvironmentVariable{ - { - Name: "MY_SPECIAL_VARIABLE1", - Value: "myspecialvariable1", - Scope: "global", - }, - { - Name: "MY_SPECIAL_VARIABLE2", - Value: "myspecialvariable2", - Scope: "runtime", - }, - { - Name: "MY_SPECIAL_VARIABLE3", - Value: "myspecialvariable3", - Scope: "build", - }, - { - Name: "MY_SPECIAL_VARIABLE", - Value: "myspecialvariable", - Scope: "global", - }, - { - Name: "LAGOON_SYSTEM_CORE_VERSION", - Value: "v2.19.0", - Scope: "internal_system", - }, - { - Name: "REGISTRY_PASSWORD", - Value: "myenvvarregistrypassword", - Scope: "container_registry", - }, + name: "test1", + description: "", + secretName: "lagoon-env", + buildValues: generator.BuildValues{ + Project: "example-project", + Environment: "environment-name", + EnvironmentType: "production", + Namespace: "myexample-project-environment-name", + BuildType: "branch", + LagoonVersion: "v2.x.x", + Kubernetes: "generator.local", + Branch: "environment-name", + LagoonEnvVariables: map[string]string{ + "MY_SPECIAL_VARIABLE1": "myspecialvariable1", + "MY_SPECIAL_VARIABLE2": "myspecialvariable2", + "MY_SPECIAL_VARIABLE": "myspecialvariable", + }, + EnvironmentVariables: []lagoon.EnvironmentVariable{ + { + Name: "MY_SPECIAL_VARIABLE1", + Value: "myspecialvariable1", + Scope: "global", + }, + { + Name: "MY_SPECIAL_VARIABLE2", + Value: "myspecialvariable2", + Scope: "runtime", + }, + { + Name: "MY_SPECIAL_VARIABLE3", + Value: "myspecialvariable3", + Scope: "build", + }, + { + Name: "MY_SPECIAL_VARIABLE", + Value: "myspecialvariable", + Scope: "global", + }, + { + Name: "LAGOON_SYSTEM_CORE_VERSION", + Value: "v2.19.0", + Scope: "internal_system", + }, + { + Name: "REGISTRY_PASSWORD", + Value: "myenvvarregistrypassword", + Scope: "container_registry", }, }, }, want: "test-resources/lagoon-env-1.yaml", }, + { + name: "test2", + secretName: "lagoon-platform-env", + buildValues: generator.BuildValues{ + Project: "example-project", + Environment: "environment-name", + EnvironmentType: "production", + Namespace: "myexample-project-environment-name", + BuildType: "branch", + LagoonVersion: "v2.x.x", + Kubernetes: "generator.local", + Branch: "environment-name", + LagoonEnvVariables: map[string]string{ + "MY_SPECIAL_VARIABLE1": "myspecialvariable1", + "MY_SPECIAL_VARIABLE2": "myspecialvariable2", + "MY_SPECIAL_VARIABLE": "myspecialvariable", + }, + LagoonPlatformEnvVariables: map[string]string{ + "MY_SPECIAL_VARIABLE3": "myspecialvariable3", + "MY_SPECIAL_VARIABLE4": "myspecialvariable4", + }, + }, + want: "test-resources/lagoon-platform-env-1.yaml", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := GenerateLagoonEnvSecret(tt.args.buildValues) + got, err := GenerateLagoonEnvSecret(tt.secretName, tt.buildValues) if (err != nil) != tt.wantErr { t.Errorf("GenerateLagoonEnvSecret() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/internal/templating/lagoonenv/test-resources/lagoon-platform-env-1.yaml b/internal/templating/lagoonenv/test-resources/lagoon-platform-env-1.yaml new file mode 100644 index 00000000..4f5e94e0 --- /dev/null +++ b/internal/templating/lagoonenv/test-resources/lagoon-platform-env-1.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Secret +metadata: + annotations: + lagoon.sh/branch: environment-name + creationTimestamp: null + labels: + app.kubernetes.io/instance: lagoon-platform-env + app.kubernetes.io/managed-by: build-deploy-tool + app.kubernetes.io/name: lagoon-platform-env + lagoon.sh/buildType: branch + lagoon.sh/environment: environment-name + lagoon.sh/environmentType: production + lagoon.sh/project: example-project + lagoon.sh/template: lagoon-env-0.1.0 + name: lagoon-platform-env +stringData: + MY_SPECIAL_VARIABLE3: myspecialvariable3 + MY_SPECIAL_VARIABLE4: myspecialvariable4 diff --git a/internal/templating/services/templates_cronjob.go b/internal/templating/services/templates_cronjob.go index 17455087..c2c7c7f0 100644 --- a/internal/templating/services/templates_cronjob.go +++ b/internal/templating/services/templates_cronjob.go @@ -337,6 +337,12 @@ func GenerateCronjobTemplate( container.Container.Env = append(container.Container.Env, envvars...) container.Container.EnvFrom = []corev1.EnvFromSource{ { + SecretRef: &corev1.SecretEnvSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "lagoon-platform-env", + }, + }, + }, { SecretRef: &corev1.SecretEnvSource{ LocalObjectReference: corev1.LocalObjectReference{ Name: "lagoon-env", diff --git a/internal/templating/services/templates_deployment.go b/internal/templating/services/templates_deployment.go index 42b6a63f..0ffffc86 100644 --- a/internal/templating/services/templates_deployment.go +++ b/internal/templating/services/templates_deployment.go @@ -480,6 +480,12 @@ func GenerateDeploymentTemplate( // consume the lagoon-env configmap here container.Container.EnvFrom = []corev1.EnvFromSource{ { + SecretRef: &corev1.SecretEnvSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "lagoon-platform-env", + }, + }, + }, { SecretRef: &corev1.SecretEnvSource{ LocalObjectReference: corev1.LocalObjectReference{ Name: "lagoon-env", @@ -605,6 +611,12 @@ func GenerateDeploymentTemplate( linkedContainer.Container.Env = append(linkedContainer.Container.Env, envvars...) linkedContainer.Container.EnvFrom = []corev1.EnvFromSource{ { + SecretRef: &corev1.SecretEnvSource{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "lagoon-platform-env", + }, + }, + }, { SecretRef: &corev1.SecretEnvSource{ LocalObjectReference: corev1.LocalObjectReference{ Name: "lagoon-env", diff --git a/internal/templating/services/test-resources/cronjob/result-cli-1.yaml b/internal/templating/services/test-resources/cronjob/result-cli-1.yaml index f37a8c3f..d2c5b8da 100644 --- a/internal/templating/services/test-resources/cronjob/result-cli-1.yaml +++ b/internal/templating/services/test-resources/cronjob/result-cli-1.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: myservice envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice@latest @@ -144,6 +146,8 @@ spec: - name: SERVICE_NAME value: myservice envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice@latest @@ -234,6 +238,8 @@ spec: - name: SERVICE_NAME value: myservice-persist envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice-persistent@latest diff --git a/internal/templating/services/test-resources/cronjob/result-cli-2.yaml b/internal/templating/services/test-resources/cronjob/result-cli-2.yaml index 8ca9074d..28b11b66 100644 --- a/internal/templating/services/test-resources/cronjob/result-cli-2.yaml +++ b/internal/templating/services/test-resources/cronjob/result-cli-2.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: myservice envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice@latest @@ -149,6 +151,8 @@ spec: - name: SERVICE_NAME value: myservice envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice@latest @@ -244,6 +248,8 @@ spec: - name: SERVICE_NAME value: myservice-persist envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice-persistent@latest diff --git a/internal/templating/services/test-resources/deployment/result-basic-1.yaml b/internal/templating/services/test-resources/deployment/result-basic-1.yaml index 65d953e3..ee9c7f96 100644 --- a/internal/templating/services/test-resources/deployment/result-basic-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-basic-1.yaml @@ -55,6 +55,8 @@ spec: - name: SERVICE_NAME value: myservice envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice@latest @@ -148,6 +150,8 @@ spec: - name: SERVICE_NAME value: myservice-po envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice-po@latest @@ -238,6 +242,8 @@ spec: - name: SERVICE_NAME value: myservice-persist envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice-persist@latest @@ -328,6 +334,8 @@ spec: - name: SERVICE_NAME value: myservice-persist-po envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice-persist-po@latest @@ -418,6 +426,8 @@ spec: - name: SERVICE_NAME value: myservice-persist-posize envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice-persist-posize@latest diff --git a/internal/templating/services/test-resources/deployment/result-basic-2.yaml b/internal/templating/services/test-resources/deployment/result-basic-2.yaml index 0af17354..29466b34 100644 --- a/internal/templating/services/test-resources/deployment/result-basic-2.yaml +++ b/internal/templating/services/test-resources/deployment/result-basic-2.yaml @@ -62,6 +62,8 @@ spec: - name: SERVICE_NAME value: myservice-po envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice-po@latest diff --git a/internal/templating/services/test-resources/deployment/result-basic-3.yaml b/internal/templating/services/test-resources/deployment/result-basic-3.yaml index 9b2565d6..afb000f9 100644 --- a/internal/templating/services/test-resources/deployment/result-basic-3.yaml +++ b/internal/templating/services/test-resources/deployment/result-basic-3.yaml @@ -62,6 +62,8 @@ spec: - name: SERVICE_NAME value: myservice-po envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice-po@latest diff --git a/internal/templating/services/test-resources/deployment/result-basic-4.yaml b/internal/templating/services/test-resources/deployment/result-basic-4.yaml index 2d2330be..916a8c54 100644 --- a/internal/templating/services/test-resources/deployment/result-basic-4.yaml +++ b/internal/templating/services/test-resources/deployment/result-basic-4.yaml @@ -53,6 +53,8 @@ spec: - name: SERVICE_NAME value: myservice envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice@latest diff --git a/internal/templating/services/test-resources/deployment/result-basic-5.yaml b/internal/templating/services/test-resources/deployment/result-basic-5.yaml index fd1de1a0..a81997ac 100644 --- a/internal/templating/services/test-resources/deployment/result-basic-5.yaml +++ b/internal/templating/services/test-resources/deployment/result-basic-5.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: myservice envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice@latest imagePullPolicy: Always diff --git a/internal/templating/services/test-resources/deployment/result-cli-1.yaml b/internal/templating/services/test-resources/deployment/result-cli-1.yaml index a7ebb7a8..72531e24 100644 --- a/internal/templating/services/test-resources/deployment/result-cli-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-cli-1.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: myservice envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice@latest @@ -140,6 +142,8 @@ spec: - name: SERVICE_NAME value: myservice-persist envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice-persist@latest diff --git a/internal/templating/services/test-resources/deployment/result-elasticsearch-1.yaml b/internal/templating/services/test-resources/deployment/result-elasticsearch-1.yaml index 5ef4749c..46223772 100644 --- a/internal/templating/services/test-resources/deployment/result-elasticsearch-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-elasticsearch-1.yaml @@ -56,6 +56,8 @@ spec: - name: SERVICE_NAME value: myservice envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice@latest @@ -171,6 +173,8 @@ spec: - name: SERVICE_NAME value: myservice-size envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice-size@latest diff --git a/internal/templating/services/test-resources/deployment/result-mariadb-1.yaml b/internal/templating/services/test-resources/deployment/result-mariadb-1.yaml index 60730e1b..495d6892 100644 --- a/internal/templating/services/test-resources/deployment/result-mariadb-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-mariadb-1.yaml @@ -57,6 +57,8 @@ spec: - name: SERVICE_NAME value: mariadb envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/mariadb@latest diff --git a/internal/templating/services/test-resources/deployment/result-mariadb-2.yaml b/internal/templating/services/test-resources/deployment/result-mariadb-2.yaml index 4fa896e3..f566116a 100644 --- a/internal/templating/services/test-resources/deployment/result-mariadb-2.yaml +++ b/internal/templating/services/test-resources/deployment/result-mariadb-2.yaml @@ -56,6 +56,8 @@ spec: - name: SERVICE_NAME value: mariadb envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/mariadb@latest diff --git a/internal/templating/services/test-resources/deployment/result-mongodb-1.yaml b/internal/templating/services/test-resources/deployment/result-mongodb-1.yaml index 85e954c3..528afc60 100644 --- a/internal/templating/services/test-resources/deployment/result-mongodb-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-mongodb-1.yaml @@ -56,6 +56,8 @@ spec: - name: SERVICE_NAME value: mongodb envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/mongodb@latest diff --git a/internal/templating/services/test-resources/deployment/result-nginx-1.yaml b/internal/templating/services/test-resources/deployment/result-nginx-1.yaml index 7cf9cdb3..b94f89b9 100644 --- a/internal/templating/services/test-resources/deployment/result-nginx-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-nginx-1.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: nginx envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/nginx@latest @@ -89,6 +91,8 @@ spec: - name: SERVICE_NAME value: nginx envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/php@latest @@ -178,6 +182,8 @@ spec: - name: SERVICE_NAME value: nginx-2 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/nginx2@latest @@ -216,6 +222,8 @@ spec: - name: SERVICE_NAME value: nginx-2 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/php2@latest diff --git a/internal/templating/services/test-resources/deployment/result-nginx-2.yaml b/internal/templating/services/test-resources/deployment/result-nginx-2.yaml index 63d7c950..61aef11a 100644 --- a/internal/templating/services/test-resources/deployment/result-nginx-2.yaml +++ b/internal/templating/services/test-resources/deployment/result-nginx-2.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: nginx envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/nginx@latest @@ -89,6 +91,8 @@ spec: - name: SERVICE_NAME value: nginx envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/php@latest @@ -179,6 +183,8 @@ spec: - name: SERVICE_NAME value: nginx-2 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/nginx2@latest @@ -217,6 +223,8 @@ spec: - name: SERVICE_NAME value: nginx-2 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/php2@latest diff --git a/internal/templating/services/test-resources/deployment/result-node-1.yaml b/internal/templating/services/test-resources/deployment/result-node-1.yaml index ef4aebb7..4555d436 100644 --- a/internal/templating/services/test-resources/deployment/result-node-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-node-1.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: node envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/node@latest @@ -140,6 +142,8 @@ spec: - name: SERVICE_NAME value: node-persist envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/node-persist@latest diff --git a/internal/templating/services/test-resources/deployment/result-opensearch-1.yaml b/internal/templating/services/test-resources/deployment/result-opensearch-1.yaml index 12b68941..529723a2 100644 --- a/internal/templating/services/test-resources/deployment/result-opensearch-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-opensearch-1.yaml @@ -56,6 +56,8 @@ spec: - name: SERVICE_NAME value: myservice envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice@latest @@ -171,6 +173,8 @@ spec: - name: SERVICE_NAME value: myservice-size envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice-size@latest diff --git a/internal/templating/services/test-resources/deployment/result-postgres-1.yaml b/internal/templating/services/test-resources/deployment/result-postgres-1.yaml index 41bb2d79..61098bbe 100644 --- a/internal/templating/services/test-resources/deployment/result-postgres-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-postgres-1.yaml @@ -57,6 +57,8 @@ spec: - name: SERVICE_NAME value: postgres envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/postgres@latest diff --git a/internal/templating/services/test-resources/deployment/result-postgres-single-1.yaml b/internal/templating/services/test-resources/deployment/result-postgres-single-1.yaml index 063c9084..afcb3752 100644 --- a/internal/templating/services/test-resources/deployment/result-postgres-single-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-postgres-single-1.yaml @@ -57,6 +57,8 @@ spec: - name: SERVICE_NAME value: myservice envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/myservice@latest diff --git a/internal/templating/services/test-resources/deployment/result-python-1.yaml b/internal/templating/services/test-resources/deployment/result-python-1.yaml index ef497965..eccdc5ed 100644 --- a/internal/templating/services/test-resources/deployment/result-python-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-python-1.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: python envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/python@latest @@ -140,6 +142,8 @@ spec: - name: SERVICE_NAME value: python-persist envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/python-persist@latest diff --git a/internal/templating/services/test-resources/deployment/result-rabbitmq-1.yaml b/internal/templating/services/test-resources/deployment/result-rabbitmq-1.yaml index a72cf142..90e781e3 100644 --- a/internal/templating/services/test-resources/deployment/result-rabbitmq-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-rabbitmq-1.yaml @@ -58,6 +58,8 @@ spec: - name: SERVICE_NAME value: rabbitmq envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/rabbitmq@latest diff --git a/internal/templating/services/test-resources/deployment/result-redis-1.yaml b/internal/templating/services/test-resources/deployment/result-redis-1.yaml index 801ccf1c..cf716a9c 100644 --- a/internal/templating/services/test-resources/deployment/result-redis-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-redis-1.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: redis envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/redis@latest @@ -144,6 +146,8 @@ spec: - name: SERVICE_NAME value: redis-persist envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/redis-persist@latest diff --git a/internal/templating/services/test-resources/deployment/result-solr-1.yaml b/internal/templating/services/test-resources/deployment/result-solr-1.yaml index 5fe09071..e6467617 100644 --- a/internal/templating/services/test-resources/deployment/result-solr-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-solr-1.yaml @@ -56,6 +56,8 @@ spec: - name: SERVICE_NAME value: solr envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/solr@latest diff --git a/internal/templating/services/test-resources/deployment/result-valkey-1.yaml b/internal/templating/services/test-resources/deployment/result-valkey-1.yaml index 666aca17..5e84b032 100644 --- a/internal/templating/services/test-resources/deployment/result-valkey-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-valkey-1.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: valkey envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/valkey@latest imagePullPolicy: Always @@ -146,7 +148,9 @@ spec: - name: SERVICE_NAME value: valkey-persist envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/valkey-persist@latest imagePullPolicy: Always diff --git a/internal/templating/services/test-resources/deployment/result-varnish-1.yaml b/internal/templating/services/test-resources/deployment/result-varnish-1.yaml index 0d759a46..77f88f13 100644 --- a/internal/templating/services/test-resources/deployment/result-varnish-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-varnish-1.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: varnish envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/varnish@latest @@ -146,6 +148,8 @@ spec: - name: SERVICE_NAME value: varnish-persist envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/varnish-persist@latest diff --git a/internal/templating/services/test-resources/deployment/result-worker-1.yaml b/internal/templating/services/test-resources/deployment/result-worker-1.yaml index 151b7cb4..babecba8 100644 --- a/internal/templating/services/test-resources/deployment/result-worker-1.yaml +++ b/internal/templating/services/test-resources/deployment/result-worker-1.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: worker envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/worker@latest @@ -145,6 +147,8 @@ spec: - name: SERVICE_NAME value: worker-persist envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example.com/example-project/environment-name/worker-persist@latest diff --git a/internal/testdata/basic/lagoonenv2-creds.json b/internal/testdata/basic/basic-mariadb-creds.json similarity index 100% rename from internal/testdata/basic/lagoonenv2-creds.json rename to internal/testdata/basic/basic-mariadb-creds.json diff --git a/internal/testdata/basic/secret-templates/lagoonenv1/lagoon-env-secret.yaml b/internal/testdata/basic/secret-templates/lagoon-env-with-configmap-vars/lagoon-env-secret.yaml similarity index 100% rename from internal/testdata/basic/secret-templates/lagoonenv1/lagoon-env-secret.yaml rename to internal/testdata/basic/secret-templates/lagoon-env-with-configmap-vars/lagoon-env-secret.yaml diff --git a/internal/testdata/basic/secret-templates/lagoon-platform-env-with-configmap-vars/lagoon-platform-env-secret.yaml b/internal/testdata/basic/secret-templates/lagoon-platform-env-with-configmap-vars/lagoon-platform-env-secret.yaml new file mode 100644 index 00000000..6b108f62 --- /dev/null +++ b/internal/testdata/basic/secret-templates/lagoon-platform-env-with-configmap-vars/lagoon-platform-env-secret.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Secret +metadata: + annotations: + lagoon.sh/branch: main + creationTimestamp: null + labels: + app.kubernetes.io/instance: lagoon-platform-env + app.kubernetes.io/managed-by: build-deploy-tool + app.kubernetes.io/name: lagoon-platform-env + lagoon.sh/buildType: branch + lagoon.sh/environment: main + lagoon.sh/environmentType: production + lagoon.sh/project: example-project + lagoon.sh/template: lagoon-env-0.1.0 + name: lagoon-platform-env +stringData: + MY_SPECIAL_VARIABLE3: myspecialvariable3 diff --git a/internal/testdata/basic/secret-templates/test-basic-deployment-lagoon-env/lagoon-env-secret.yaml b/internal/testdata/basic/secret-templates/test-basic-deployment-lagoon-env/lagoon-env-secret.yaml new file mode 100644 index 00000000..20913f4e --- /dev/null +++ b/internal/testdata/basic/secret-templates/test-basic-deployment-lagoon-env/lagoon-env-secret.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +kind: Secret +metadata: + annotations: + lagoon.sh/branch: main + creationTimestamp: null + labels: + app.kubernetes.io/instance: lagoon-env + app.kubernetes.io/managed-by: build-deploy-tool + app.kubernetes.io/name: lagoon-env + lagoon.sh/buildType: branch + lagoon.sh/environment: main + lagoon.sh/environmentType: production + lagoon.sh/project: example-project + lagoon.sh/template: lagoon-env-0.1.0 + name: lagoon-env +stringData: + LAGOON_AUTOGENERATED_ROUTES: https://node-example-project-main.example.com + LAGOON_CONFIG_API_HOST: "" + LAGOON_CONFIG_SSH_HOST: "" + LAGOON_CONFIG_SSH_PORT: "" + LAGOON_CONFIG_TOKEN_HOST: "" + LAGOON_CONFIG_TOKEN_PORT: "" + LAGOON_ENVIRONMENT: main + LAGOON_ENVIRONMENT_TYPE: production + LAGOON_GIT_BRANCH: main + LAGOON_GIT_SAFE_BRANCH: main + LAGOON_GIT_SHA: abcdefg123456 + LAGOON_KUBERNETES: remote-cluster1 + LAGOON_PROJECT: example-project + LAGOON_ROUTE: https://example.com + LAGOON_ROUTES: https://node-example-project-main.example.com,https://example.com + MY_SPECIAL_VARIABLE: myspecialvariable + MY_SPECIAL_VARIABLE1: myspecialvariable1 + MY_SPECIAL_VARIABLE2: myspecialvariable2-env-override + MY_SPECIAL_VARIABLE4: myspecialvariable4 diff --git a/internal/testdata/basic/secret-templates/lagoonenv2/lagoon-env-secret.yaml b/internal/testdata/basic/secret-templates/test-basic-deployment-mariadbcreds-lagoon-env/lagoon-env-secret.yaml similarity index 100% rename from internal/testdata/basic/secret-templates/lagoonenv2/lagoon-env-secret.yaml rename to internal/testdata/basic/secret-templates/test-basic-deployment-mariadbcreds-lagoon-env/lagoon-env-secret.yaml diff --git a/internal/testdata/basic/service-templates/test-basic-persistent-name/deployment-basic.yaml b/internal/testdata/basic/service-templates/test-basic-persistent-name/deployment-basic.yaml index 23ded318..e3e194ca 100644 --- a/internal/testdata/basic/service-templates/test-basic-persistent-name/deployment-basic.yaml +++ b/internal/testdata/basic/service-templates/test-basic-persistent-name/deployment-basic.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: basic envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/basic@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/basic/service-templates/test-basic-persistent-names/deployment-basic.yaml b/internal/testdata/basic/service-templates/test-basic-persistent-names/deployment-basic.yaml index 23ded318..e3e194ca 100644 --- a/internal/testdata/basic/service-templates/test-basic-persistent-names/deployment-basic.yaml +++ b/internal/testdata/basic/service-templates/test-basic-persistent-names/deployment-basic.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: basic envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/basic@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/basic/service-templates/test-basic-persistent-names/deployment-basic2.yaml b/internal/testdata/basic/service-templates/test-basic-persistent-names/deployment-basic2.yaml index 2cbc166a..21b3a84c 100644 --- a/internal/testdata/basic/service-templates/test-basic-persistent-names/deployment-basic2.yaml +++ b/internal/testdata/basic/service-templates/test-basic-persistent-names/deployment-basic2.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: basic2 envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/basic2@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/basic/service-templates/test-basic-spot-affinity/deployment-node.yaml b/internal/testdata/basic/service-templates/test-basic-spot-affinity/deployment-node.yaml index 25efa051..8d3f299d 100644 --- a/internal/testdata/basic/service-templates/test-basic-spot-affinity/deployment-node.yaml +++ b/internal/testdata/basic/service-templates/test-basic-spot-affinity/deployment-node.yaml @@ -62,6 +62,8 @@ spec: - name: SERVICE_NAME value: node envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/node@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test1-basic-deployment/deployment-node.yaml b/internal/testdata/basic/service-templates/test1-basic-deployment/deployment-node.yaml index d520c574..715c33d3 100644 --- a/internal/testdata/basic/service-templates/test1-basic-deployment/deployment-node.yaml +++ b/internal/testdata/basic/service-templates/test1-basic-deployment/deployment-node.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: node envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/node@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test10-basic-no-native-cronjobs/deployment-node.yaml b/internal/testdata/basic/service-templates/test10-basic-no-native-cronjobs/deployment-node.yaml index e1d9bb81..3265d9ca 100644 --- a/internal/testdata/basic/service-templates/test10-basic-no-native-cronjobs/deployment-node.yaml +++ b/internal/testdata/basic/service-templates/test10-basic-no-native-cronjobs/deployment-node.yaml @@ -55,6 +55,8 @@ spec: - name: SERVICE_NAME value: node envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/node@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test11-basic-polysite-cronjobs/cronjob-cronjob-node-some-other-drush-cron.yaml b/internal/testdata/basic/service-templates/test11-basic-polysite-cronjobs/cronjob-cronjob-node-some-other-drush-cron.yaml index 485c48bb..6670d804 100644 --- a/internal/testdata/basic/service-templates/test11-basic-polysite-cronjobs/cronjob-cronjob-node-some-other-drush-cron.yaml +++ b/internal/testdata/basic/service-templates/test11-basic-polysite-cronjobs/cronjob-cronjob-node-some-other-drush-cron.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: node envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/node@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test11-basic-polysite-cronjobs/deployment-node.yaml b/internal/testdata/basic/service-templates/test11-basic-polysite-cronjobs/deployment-node.yaml index 9b154c04..339a34ef 100644 --- a/internal/testdata/basic/service-templates/test11-basic-polysite-cronjobs/deployment-node.yaml +++ b/internal/testdata/basic/service-templates/test11-basic-polysite-cronjobs/deployment-node.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: node envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/node@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test12-basic-persistent-custom-volumes/deployment-node.yaml b/internal/testdata/basic/service-templates/test12-basic-persistent-custom-volumes/deployment-node.yaml index fc7fcd17..7efa3212 100644 --- a/internal/testdata/basic/service-templates/test12-basic-persistent-custom-volumes/deployment-node.yaml +++ b/internal/testdata/basic/service-templates/test12-basic-persistent-custom-volumes/deployment-node.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: node envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/node@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test13-basic-custom-volumes/deployment-node.yaml b/internal/testdata/basic/service-templates/test13-basic-custom-volumes/deployment-node.yaml index 904b9719..e7d57304 100644 --- a/internal/testdata/basic/service-templates/test13-basic-custom-volumes/deployment-node.yaml +++ b/internal/testdata/basic/service-templates/test13-basic-custom-volumes/deployment-node.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: node envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/node@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test15-basic-custom-volume-no-backup/deployment-node.yaml b/internal/testdata/basic/service-templates/test15-basic-custom-volume-no-backup/deployment-node.yaml index 16693fca..669acfcf 100644 --- a/internal/testdata/basic/service-templates/test15-basic-custom-volume-no-backup/deployment-node.yaml +++ b/internal/testdata/basic/service-templates/test15-basic-custom-volume-no-backup/deployment-node.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: node envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/node@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test3-funky-pvcs/deployment-lnd.yaml b/internal/testdata/basic/service-templates/test3-funky-pvcs/deployment-lnd.yaml index c4ea3ade..604cb193 100644 --- a/internal/testdata/basic/service-templates/test3-funky-pvcs/deployment-lnd.yaml +++ b/internal/testdata/basic/service-templates/test3-funky-pvcs/deployment-lnd.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: lnd envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/lnd@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test3-funky-pvcs/deployment-thunderhub.yaml b/internal/testdata/basic/service-templates/test3-funky-pvcs/deployment-thunderhub.yaml index f5276d05..6932da06 100644 --- a/internal/testdata/basic/service-templates/test3-funky-pvcs/deployment-thunderhub.yaml +++ b/internal/testdata/basic/service-templates/test3-funky-pvcs/deployment-thunderhub.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: thunderhub envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/thunderhub@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test3-funky-pvcs/deployment-tor.yaml b/internal/testdata/basic/service-templates/test3-funky-pvcs/deployment-tor.yaml index f281563f..62628033 100644 --- a/internal/testdata/basic/service-templates/test3-funky-pvcs/deployment-tor.yaml +++ b/internal/testdata/basic/service-templates/test3-funky-pvcs/deployment-tor.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: tor envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/tor@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test4-basic-worker/deployment-lnd.yaml b/internal/testdata/basic/service-templates/test4-basic-worker/deployment-lnd.yaml index c4ea3ade..604cb193 100644 --- a/internal/testdata/basic/service-templates/test4-basic-worker/deployment-lnd.yaml +++ b/internal/testdata/basic/service-templates/test4-basic-worker/deployment-lnd.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: lnd envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/lnd@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test4-basic-worker/deployment-tor.yaml b/internal/testdata/basic/service-templates/test4-basic-worker/deployment-tor.yaml index cd58d684..90ab17c0 100644 --- a/internal/testdata/basic/service-templates/test4-basic-worker/deployment-tor.yaml +++ b/internal/testdata/basic/service-templates/test4-basic-worker/deployment-tor.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: tor envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/tor@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test5-basic-promote/deployment-node.yaml b/internal/testdata/basic/service-templates/test5-basic-promote/deployment-node.yaml index 6ccf7345..9a361e68 100644 --- a/internal/testdata/basic/service-templates/test5-basic-promote/deployment-node.yaml +++ b/internal/testdata/basic/service-templates/test5-basic-promote/deployment-node.yaml @@ -50,6 +50,8 @@ spec: - name: SERVICE_NAME value: node envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/node@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test6-basic-networkpolicy/deployment-node.yaml b/internal/testdata/basic/service-templates/test6-basic-networkpolicy/deployment-node.yaml index 32635b2e..20a61539 100644 --- a/internal/testdata/basic/service-templates/test6-basic-networkpolicy/deployment-node.yaml +++ b/internal/testdata/basic/service-templates/test6-basic-networkpolicy/deployment-node.yaml @@ -56,6 +56,8 @@ spec: - name: SERVICE_NAME value: node envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/pr-123/node@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/basic/service-templates/test7-basic-dynamic-secrets/deployment-node.yaml b/internal/testdata/basic/service-templates/test7-basic-dynamic-secrets/deployment-node.yaml index db91ec9d..3bed2725 100644 --- a/internal/testdata/basic/service-templates/test7-basic-dynamic-secrets/deployment-node.yaml +++ b/internal/testdata/basic/service-templates/test7-basic-dynamic-secrets/deployment-node.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: node envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env - secretRef: diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-cli.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-cli.yaml index 814b9be2..063ecfe6 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-cli.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-cli.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: cli envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/cli@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-gotenberg.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-gotenberg.yaml index 1c5d9448..1df6f01f 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-gotenberg.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-gotenberg.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: gotenberg envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/gotenberg@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-nginx.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-nginx.yaml index b3bebcce..32d73866 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-nginx.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-nginx.yaml @@ -54,7 +54,9 @@ spec: - name: SERVICE_NAME value: nginx envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/nginx@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always @@ -92,7 +94,9 @@ spec: - name: SERVICE_NAME value: nginx envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/php@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-opensearch.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-opensearch.yaml index a5c9e32e..1fc2762f 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-opensearch.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-opensearch.yaml @@ -56,7 +56,9 @@ spec: - name: SERVICE_NAME value: opensearch envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/opensearch@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-entity-index.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-entity-index.yaml index 6390a099..d9ea1809 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-entity-index.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-entity-index.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: queue-worker-entity-index envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/queue-worker-entity-index@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-high.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-high.yaml index 5d9f03f0..3ffde8b5 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-high.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-high.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: queue-worker-priority-high envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/queue-worker-priority-high@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-instant.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-instant.yaml index 9a0b6db2..11aa4b7c 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-instant.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-instant.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: queue-worker-priority-instant envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/queue-worker-priority-instant@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-low.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-low.yaml index 10feb306..b1b14546 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-low.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-low.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: queue-worker-priority-low envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/queue-worker-priority-low@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-medium.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-medium.yaml index f070cd75..ecfdad81 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-medium.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-queue-worker-priority-medium.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: queue-worker-priority-medium envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/queue-worker-priority-medium@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-rabbitmq.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-rabbitmq.yaml index 8975f817..144d8794 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-rabbitmq.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-rabbitmq.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: rabbitmq envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/rabbitmq@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-redis-persist.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-redis-persist.yaml index 3cadb864..aee06d12 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-redis-persist.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-redis-persist.yaml @@ -56,7 +56,9 @@ spec: - name: SERVICE_NAME value: redis-persist envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/redis-persist@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-redis-session.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-redis-session.yaml index 4801af1f..bebc051f 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-redis-session.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-redis-session.yaml @@ -56,7 +56,9 @@ spec: - name: SERVICE_NAME value: redis-session envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/redis-session@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-redis.yaml b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-redis.yaml index 667e1a96..e72ffbd0 100644 --- a/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-redis.yaml +++ b/internal/testdata/complex/service-templates/test-complex-persistent-names/deployment-redis.yaml @@ -52,7 +52,9 @@ spec: - name: SERVICE_NAME value: redis envFrom: - - configMapRef: + - secretRef: + name: lagoon-platform-env + - secretRef: name: lagoon-env image: harbor.example/example-project/main/redis@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 imagePullPolicy: Always diff --git a/internal/testdata/complex/service-templates/test14-complex-custom-volumes/deployment-cli.yaml b/internal/testdata/complex/service-templates/test14-complex-custom-volumes/deployment-cli.yaml index 5798b632..f1b8e093 100644 --- a/internal/testdata/complex/service-templates/test14-complex-custom-volumes/deployment-cli.yaml +++ b/internal/testdata/complex/service-templates/test14-complex-custom-volumes/deployment-cli.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: cli envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/cli@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test14-complex-custom-volumes/deployment-mariadb.yaml b/internal/testdata/complex/service-templates/test14-complex-custom-volumes/deployment-mariadb.yaml index 9fee2601..514aea9d 100644 --- a/internal/testdata/complex/service-templates/test14-complex-custom-volumes/deployment-mariadb.yaml +++ b/internal/testdata/complex/service-templates/test14-complex-custom-volumes/deployment-mariadb.yaml @@ -57,6 +57,8 @@ spec: - name: SERVICE_NAME value: mariadb envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/mariadb@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test14-complex-custom-volumes/deployment-nginx.yaml b/internal/testdata/complex/service-templates/test14-complex-custom-volumes/deployment-nginx.yaml index c813e5e5..5a625119 100644 --- a/internal/testdata/complex/service-templates/test14-complex-custom-volumes/deployment-nginx.yaml +++ b/internal/testdata/complex/service-templates/test14-complex-custom-volumes/deployment-nginx.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: nginx envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/nginx@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 @@ -94,6 +96,8 @@ spec: - name: SERVICE_NAME value: nginx envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/php@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2-nginx-php/cronjob-cronjob-cli-drush-cron2.yaml b/internal/testdata/complex/service-templates/test2-nginx-php/cronjob-cronjob-cli-drush-cron2.yaml index 2918b9e5..2671b2bf 100644 --- a/internal/testdata/complex/service-templates/test2-nginx-php/cronjob-cronjob-cli-drush-cron2.yaml +++ b/internal/testdata/complex/service-templates/test2-nginx-php/cronjob-cronjob-cli-drush-cron2.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: cli envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/cli@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2-nginx-php/deployment-cli.yaml b/internal/testdata/complex/service-templates/test2-nginx-php/deployment-cli.yaml index 3f41aaa8..45de8ae1 100644 --- a/internal/testdata/complex/service-templates/test2-nginx-php/deployment-cli.yaml +++ b/internal/testdata/complex/service-templates/test2-nginx-php/deployment-cli.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: cli envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/cli@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2-nginx-php/deployment-nginx-php.yaml b/internal/testdata/complex/service-templates/test2-nginx-php/deployment-nginx-php.yaml index 6df9d0c7..f9ba0fae 100644 --- a/internal/testdata/complex/service-templates/test2-nginx-php/deployment-nginx-php.yaml +++ b/internal/testdata/complex/service-templates/test2-nginx-php/deployment-nginx-php.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: nginx-php envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/nginx@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 @@ -92,6 +94,8 @@ spec: - name: SERVICE_NAME value: nginx-php envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/php@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2-nginx-php/deployment-redis.yaml b/internal/testdata/complex/service-templates/test2-nginx-php/deployment-redis.yaml index 68e44263..e72ffbd0 100644 --- a/internal/testdata/complex/service-templates/test2-nginx-php/deployment-redis.yaml +++ b/internal/testdata/complex/service-templates/test2-nginx-php/deployment-redis.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: redis envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/redis@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2-nginx-php/deployment-varnish.yaml b/internal/testdata/complex/service-templates/test2-nginx-php/deployment-varnish.yaml index 4611178d..4781075f 100644 --- a/internal/testdata/complex/service-templates/test2-nginx-php/deployment-varnish.yaml +++ b/internal/testdata/complex/service-templates/test2-nginx-php/deployment-varnish.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: varnish envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/varnish@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2b-nginx-php/cronjob-cronjob-cli-drush-cron2.yaml b/internal/testdata/complex/service-templates/test2b-nginx-php/cronjob-cronjob-cli-drush-cron2.yaml index e2c2fc72..691ebf98 100644 --- a/internal/testdata/complex/service-templates/test2b-nginx-php/cronjob-cronjob-cli-drush-cron2.yaml +++ b/internal/testdata/complex/service-templates/test2b-nginx-php/cronjob-cronjob-cli-drush-cron2.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: cli envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/cli@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-cli.yaml b/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-cli.yaml index 454a5a6d..7bc8a7e1 100644 --- a/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-cli.yaml +++ b/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-cli.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: cli envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/cli@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-nginx-php.yaml b/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-nginx-php.yaml index 077edde9..3a2aa1ac 100644 --- a/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-nginx-php.yaml +++ b/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-nginx-php.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: nginx-php envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/nginx@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 @@ -92,6 +94,8 @@ spec: - name: SERVICE_NAME value: nginx-php envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/php@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-redis.yaml b/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-redis.yaml index 68800961..0d0b21cc 100644 --- a/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-redis.yaml +++ b/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-redis.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: redis envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/redis@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-varnish.yaml b/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-varnish.yaml index d8748b6d..4236a7c8 100644 --- a/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-varnish.yaml +++ b/internal/testdata/complex/service-templates/test2b-nginx-php/deployment-varnish.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: varnish envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/varnish@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2c-nginx-php/cronjob-cronjob-cli-drush-cron2.yaml b/internal/testdata/complex/service-templates/test2c-nginx-php/cronjob-cronjob-cli-drush-cron2.yaml index 46fb3939..c40fa71d 100644 --- a/internal/testdata/complex/service-templates/test2c-nginx-php/cronjob-cronjob-cli-drush-cron2.yaml +++ b/internal/testdata/complex/service-templates/test2c-nginx-php/cronjob-cronjob-cli-drush-cron2.yaml @@ -64,6 +64,8 @@ spec: - name: SERVICE_NAME value: cli envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/cli@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-cli.yaml b/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-cli.yaml index 454a5a6d..7bc8a7e1 100644 --- a/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-cli.yaml +++ b/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-cli.yaml @@ -54,6 +54,8 @@ spec: - name: SERVICE_NAME value: cli envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/cli@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-nginx-php.yaml b/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-nginx-php.yaml index 1e929b02..268582ad 100644 --- a/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-nginx-php.yaml +++ b/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-nginx-php.yaml @@ -64,6 +64,8 @@ spec: - name: SERVICE_NAME value: nginx-php envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/nginx@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 @@ -102,6 +104,8 @@ spec: - name: SERVICE_NAME value: nginx-php envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/php@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-redis.yaml b/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-redis.yaml index 68800961..0d0b21cc 100644 --- a/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-redis.yaml +++ b/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-redis.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: redis envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/redis@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-varnish.yaml b/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-varnish.yaml index d8748b6d..4236a7c8 100644 --- a/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-varnish.yaml +++ b/internal/testdata/complex/service-templates/test2c-nginx-php/deployment-varnish.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: varnish envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/varnish@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-mariadb-10-5.yaml b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-mariadb-10-5.yaml index 2bb0d7c2..04e1c204 100644 --- a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-mariadb-10-5.yaml +++ b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-mariadb-10-5.yaml @@ -57,6 +57,8 @@ spec: - name: SERVICE_NAME value: mariadb-10-5 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/mariadb-10-5@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-opensearch-2.yaml b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-opensearch-2.yaml index 3aadb675..c48b1719 100644 --- a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-opensearch-2.yaml +++ b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-opensearch-2.yaml @@ -56,6 +56,8 @@ spec: - name: SERVICE_NAME value: opensearch-2 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/opensearch-2@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-postgres-11.yaml b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-postgres-11.yaml index 47c326bc..720f4219 100644 --- a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-postgres-11.yaml +++ b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-postgres-11.yaml @@ -57,6 +57,8 @@ spec: - name: SERVICE_NAME value: postgres-11 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/postgres-11@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-redis-6.yaml b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-redis-6.yaml index 25cf1a9f..56405294 100644 --- a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-redis-6.yaml +++ b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-redis-6.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: redis-6 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/redis-6@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-redis-7.yaml b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-redis-7.yaml index 1ccc1a2b..7f0b2b33 100644 --- a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-redis-7.yaml +++ b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-redis-7.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: redis-7 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/redis-7@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-solr-8.yaml b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-solr-8.yaml index 4efec616..d0345465 100644 --- a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-solr-8.yaml +++ b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-solr-8.yaml @@ -56,6 +56,8 @@ spec: - name: SERVICE_NAME value: solr-8 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/solr-8@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-web.yaml b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-web.yaml index 5dabf56c..897dc3ac 100644 --- a/internal/testdata/complex/service-templates/test8-multiple-services/deployment-web.yaml +++ b/internal/testdata/complex/service-templates/test8-multiple-services/deployment-web.yaml @@ -52,6 +52,8 @@ spec: - name: SERVICE_NAME value: web envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/web@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-mariadb-10-11.yaml b/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-mariadb-10-11.yaml index d770fb3a..0090caa9 100644 --- a/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-mariadb-10-11.yaml +++ b/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-mariadb-10-11.yaml @@ -57,6 +57,8 @@ spec: - name: SERVICE_NAME value: mariadb-10-11 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/mariadb-10-11@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-mariadb-10-5.yaml b/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-mariadb-10-5.yaml index 11909a45..548863ac 100644 --- a/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-mariadb-10-5.yaml +++ b/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-mariadb-10-5.yaml @@ -57,6 +57,8 @@ spec: - name: SERVICE_NAME value: mariadb-10-5 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/mariadb-10-5@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-mongo-4.yaml b/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-mongo-4.yaml index 7d06737c..4cfc3321 100644 --- a/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-mongo-4.yaml +++ b/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-mongo-4.yaml @@ -56,6 +56,8 @@ spec: - name: SERVICE_NAME value: mongo-4 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/mongo-4@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-postgres-11.yaml b/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-postgres-11.yaml index 9e8b9b8d..ac283fa9 100644 --- a/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-postgres-11.yaml +++ b/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-postgres-11.yaml @@ -57,6 +57,8 @@ spec: - name: SERVICE_NAME value: postgres-11 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/postgres-11@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-postgres-15.yaml b/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-postgres-15.yaml index 90b8e081..eb1c121a 100644 --- a/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-postgres-15.yaml +++ b/internal/testdata/complex/service-templates/test9-meta-dbaas-types/deployment-postgres-15.yaml @@ -57,6 +57,8 @@ spec: - name: SERVICE_NAME value: postgres-15 envFrom: + - secretRef: + name: lagoon-platform-env - secretRef: name: lagoon-env image: harbor.example/example-project/main/postgres-15@sha256:b2001babafaa8128fe89aa8fd11832cade59931d14c3de5b3ca32e2a010fbaa8 diff --git a/legacy/build-deploy-docker-compose.sh b/legacy/build-deploy-docker-compose.sh index bb483da9..c30c2690 100755 --- a/legacy/build-deploy-docker-compose.sh +++ b/legacy/build-deploy-docker-compose.sh @@ -1190,13 +1190,103 @@ mkdir -p $LAGOON_ENV_YAML_FOLDER # we have to source them this way for now. In the future though, we'll be able to omit this flag and remove it from the tool # also would be part of https://github.com/uselagoon/build-deploy-tool/blob/f527a89ad5efb46e19a2f59d9ff3ffbff541e2a2/legacy/build-deploy-docker-compose.sh#L1090 echo "Updating lagoon-env secret" -build-deploy-tool template lagoon-env --saved-templates-path ${LAGOON_ENV_YAML_FOLDER} --dbaas-creds /kubectl-build-deploy/dbaas-creds.json --routes "${ROUTES}" +build-deploy-tool template lagoon-env \ + --secret-name "lagoon-env" \ + --saved-templates-path ${LAGOON_ENV_YAML_FOLDER} \ + --dbaas-creds /kubectl-build-deploy/dbaas-creds.json \ + --routes "${ROUTES}" kubectl apply -n ${NAMESPACE} -f ${LAGOON_ENV_YAML_FOLDER}/lagoon-env-secret.yaml -# delete the old lagoon-env configmap + if kubectl -n ${NAMESPACE} get configmap lagoon-env &> /dev/null; then - kubectl -n ${NAMESPACE} delete configmap lagoon-env + # this section will only run once on the initial change from configmap to secret + # convert the existing configmap into a secret and then remove anything that the API has provided to the `lagoon-env` secret + # this is going to make it so that anything that isn't in the API is added to a new secret called `lagoon-platform-env` which is where non-api variables can be added + # by platform operators without impacting the main lagoon-env secret, this is to fix https://github.com/uselagoon/build-deploy-tool/issues/136 + # this will also make it so that if a user has deleted a variable from the api in the past, it will still exist in the lagoon-platform-env secret so that there + # is no change in behaviour for the user and not seeing unexpectedly a variable they may have deleted they were still relying on + # unfortunately, variables that remain in the lagoon-platform-env secret will never be deleted + # this secret may end up being empty if everything in the API is correct and there are no discrepancies. + CURRENT_CONFIGMAP_VARS=$(kubectl -n ${NAMESPACE} get configmap lagoon-env -o json | jq -cr '.data') + build-deploy-tool template lagoon-env \ + --secret-name "lagoon-platform-env" \ + --saved-templates-path ${LAGOON_ENV_YAML_FOLDER} \ + --dbaas-creds /kubectl-build-deploy/dbaas-creds.json \ + --configmap-vars "${CURRENT_CONFIGMAP_VARS}" \ + --routes "${ROUTES}" + kubectl apply -n ${NAMESPACE} -f ${LAGOON_ENV_YAML_FOLDER}/lagoon-platform-env-secret.yaml + # the old lagoon-env configmap will be removed at the end of the applying deployments step so that in the event of a failure between this point + # and the rollouts completing, the configmap will still exist if the failure occurs before the deployments are applied fi +# now remove any vars from the lagoon-env secret that were deleted from the API +EXISTING_LAGOONENV_VARS=$(kubectl -n ${NAMESPACE} get secret lagoon-env -o json 2> /dev/null | jq -r '.data | keys[]') +# if there were existing vars in the secret +# work out which ones no longer exist in the API and run patch op remove on them +if [ ! -z "$EXISTING_LAGOONENV_VARS" ]; then + # get what is in the secret now that the patch operations to add what is in the API has been done already + CURRENT_LAGOONENV_VARS=$(kubectl -n ${NAMESPACE} get secret lagoon-env -o json | jq -r '.data | keys[]') + # get the keys of the vars that were added from the api + API_PROJECT_VARS=$(echo $LAGOON_PROJECT_VARIABLES | jq -r 'map( select(.scope == "runtime" or .scope == "global") ) | map( { (.name) : .value } ) | add | keys[]') + API_ENVIRONMENT_VARS=$(echo $LAGOON_ENVIRONMENT_VARIABLES | jq -r 'map( select(.scope == "runtime" or .scope == "global") ) | map( { (.name) : .value } ) | add | keys[]') + # get all the unique keys from the API and current secret + # and remove anything that isn't in the API anymore from the secret + VARS_TO_REMOVE1=$(comm -23 <(echo $CURRENT_LAGOONENV_VARS | tr ' ' '\n' | sort) <(echo $API_ENVIRONMENT_VARS | tr ' ' '\n' | sort)) + VARS_TO_REMOVE2=$(comm -23 <(echo $VARS_TO_REMOVE1 | tr ' ' '\n' | sort) <(echo $API_PROJECT_VARS | tr ' ' '\n' | sort)) + + # now work out the patch operations to remove the unneeded keys from the secret + REMOVE_OPERATION_JSON="" + # if there are vars to remove, then craft the remove operation patch + if [ ! -z "$VARS_TO_REMOVE2" ]; then + for VAR_TO_REMOVE in $VARS_TO_REMOVE2 + do + REMOVE_OPERATION_JSON="${REMOVE_OPERATION_JSON:+$REMOVE_OPERATION_JSON, }$(echo -n {\"op\": \"remove\", \"path\": \"/data/$VAR_TO_REMOVE\"})" + done + # then actually apply the patch to remove the vars from the secret + kubectl patch \ + -n ${NAMESPACE} \ + secret lagoon-env \ + --type=json -p "[$REMOVE_OPERATION_JSON]" + fi +fi + +# do a comparison between what is in the current lagoon-env secret and the lagoon-platform-env secret +# collect the current vars from both secrets +CURRENT_LAGOONPLATFORMENV_VARS=$(kubectl -n ${NAMESPACE} get secret lagoon-platform-env -o json 2> /dev/null | jq -r '.data | keys[]') +CURRENT_LAGOONENV_VARS=$(kubectl -n ${NAMESPACE} get secret lagoon-env -o json 2> /dev/null | jq -r '.data | keys[]') +if [[ ! -z "${CURRENT_LAGOONPLATFORMENV_VARS}" ]] && [[ ! -z "${CURRENT_LAGOONENV_VARS}" ]]; then + # since the lagoon-platform-env secret is never populated by machine, only human + # we can check if a user has added a variable that may have previously existed and was deleted from the API has been added again + # then we can remove it from the `lagoon-platform-env` secret, allowing for the user to delete it again from the API + # the variable will then correctly get deleted from the `lagoon-env` secret like it should in the step prior to this + + # get variable names present in BOTH secrets, if it exists in both, we need to remove it from the `lagoon-platform-env` secret + # this will then allow its deletion from the main `lagoon-env` secret if it ever gets deleted from the lagoon api + # the preference is for variables in the API to exist, rather than being set manually in kubernetes, hence the `lagoon-platform-env` secret remains + # mostly untouched except to remove variables from if they're ever detected from the lagoon api + # yes, this means that the value of the variables could be different, but the assumption will be that a user adding the variable to the api + # assumes they understand what it does, as it would have overwritten a variable in the lagoon-env configmap in the past anyway + # so this process is just to correct the bug with removing variables from the api should remove them from the secret too + VARS_TO_REMOVE=$(comm -12 <(echo $CURRENT_LAGOONPLATFORMENV_VARS | tr ' ' '\n' | sort) <(echo $CURRENT_LAGOONENV_VARS | tr ' ' '\n' | sort)) + # now work out the patch operations to remove the unneeded keys from the secret + REMOVE_OPERATION_JSON="" + # if there are vars to remove, then craft the remove operation patch + if [ ! -z "$VARS_TO_REMOVE" ]; then + for VAR_TO_REMOVE in $VARS_TO_REMOVE + do + REMOVE_OPERATION_JSON="${REMOVE_OPERATION_JSON:+$REMOVE_OPERATION_JSON, }$(echo -n {\"op\": \"remove\", \"path\": \"/data/$VAR_TO_REMOVE\"})" + done + # then actually apply the patch to remove the vars from the secret + kubectl patch \ + -n ${NAMESPACE} \ + secret lagoon-platform-env \ + --type=json -p "[$REMOVE_OPERATION_JSON]" + fi +fi + +# display a warning if there are variables present in the `lagoon-platform-env` secret that don't exist in the api +# and instruct the user to either add the variable to the API, or contact support if they are unsure what the variable is +# insert warning message generator here? + currentStepEnd="$(date +"%Y-%m-%d %H:%M:%S")" patchBuildStep "${buildStartTime}" "${previousStepEnd}" "${currentStepEnd}" "${NAMESPACE}" "updateConfigmapComplete" "Update Configmap" "false" previousStepEnd=${currentStepEnd} @@ -1206,7 +1296,11 @@ beginBuildStep "Image Push to Registry" "pushingImages" ### REDEPLOY DEPLOYMENTS IF CONFIG MAP CHANGES ############################################## -CONFIG_MAP_SHA=$(kubectl -n ${NAMESPACE} get secret lagoon-env -o yaml | yq -M '.data' | sha256sum | awk '{print $1}') +# calculate the combined lagoon-env and lagoon-platform-env sha to determine if changes to any secrets have been made +# which will force the deployments to restart as required +LAGOONENV_SHA=$(kubectl --insecure-skip-tls-verify -n ${NAMESPACE} get secret lagoon-env -o yaml | yq -M '.data' | sha256sum | awk '{print $1}') +LAGOONPLATFORMENV_SHA=$(kubectl --insecure-skip-tls-verify -n ${NAMESPACE} get secret lagoon-platform-env -o yaml | yq -M '.data' | sha256sum | awk '{print $1}') +CONFIG_MAP_SHA=$(echo $LAGOONENV_SHA$LAGOONPLATFORMENV_SHA | sha256sum | awk '{print $1}') export CONFIG_MAP_SHA # write the secret to the values file so when we `exec-kubectl-resources-with-images.sh` the deployments will get the value of the secret # which will cause a change in the deployment and trigger a rollout if only the secret has changed @@ -1525,6 +1619,13 @@ do fi done +if kubectl -n ${NAMESPACE} get configmap lagoon-env &> /dev/null; then + # now delete the configmap after all the lagoon-env and lagoon-platform-env calcs have been done + # and the deployments have rolled out successfully, this makes less problems rolling back if a build fails + # somewhere between the new secret being created, and the deployments rolling out + kubectl -n ${NAMESPACE} delete configmap lagoon-env +fi + currentStepEnd="$(date +"%Y-%m-%d %H:%M:%S")" patchBuildStep "${buildStartTime}" "${previousStepEnd}" "${currentStepEnd}" "${NAMESPACE}" "deploymentApplyComplete" "Applying Deployments" "false" previousStepEnd=${currentStepEnd}