diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 4d047ba27..86983df12 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -69,21 +69,21 @@ spec: - name: INIT_DATABASE_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-database - name: INIT_DATABASE_VERSION - value: 1.5.0 + value: "1.5.0" - name: DATABASE_VERSION - value: 1.5.0 + value: "1.5.0" # Ops Manager - name: OPS_MANAGER_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-enterprise-ops-manager-ubi - name: INIT_OPS_MANAGER_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-ops-manager - name: INIT_OPS_MANAGER_VERSION - value: 1.5.0 + value: "1.5.0" # AppDB - name: INIT_APPDB_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-appdb - name: INIT_APPDB_VERSION - value: 1.5.0 + value: "1.5.0" - name: OPS_MANAGER_IMAGE_PULL_POLICY value: Always - name: AGENT_IMAGE @@ -208,7 +208,7 @@ spec: value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:8.0.14" - name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_8_0_15 value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:8.0.15" - # since the official server images end with a different suffix we can re-use the same $mongodbImageEnv + # since the official server images end with a different suffix we can re-use the same $mongodbImageEnv - name: RELATED_IMAGE_MONGODB_IMAGE_4_4_0_ubi8 value: "quay.io/mongodb/mongodb-enterprise-server:4.4.0-ubi8" - name: RELATED_IMAGE_MONGODB_IMAGE_4_4_1_ubi8 diff --git a/helm_chart/templates/operator.yaml b/helm_chart/templates/operator.yaml index d047ddb9d..ebae9c878 100644 --- a/helm_chart/templates/operator.yaml +++ b/helm_chart/templates/operator.yaml @@ -172,21 +172,21 @@ spec: - name: {{ $initDatabaseImageRepositoryEnv }} value: {{ .Values.registry.initDatabase }}/{{ .Values.initDatabase.name }} - name: INIT_DATABASE_VERSION - value: {{ $initDatabaseVersion }} + value: {{ $initDatabaseVersion | quote }} - name: DATABASE_VERSION - value: {{ $databaseVersion }} + value: {{ $databaseVersion | quote }} # Ops Manager - name: {{ $opsManagerImageRepositoryEnv }} value: {{ .Values.registry.opsManager }}/{{ .Values.opsManager.name }} - name: {{ $initOpsManagerImageRepositoryEnv }} value: {{ .Values.registry.initOpsManager }}/{{ .Values.initOpsManager.name }} - name: INIT_OPS_MANAGER_VERSION - value: {{ $initOpsManagerVersion }} + value: {{ $initOpsManagerVersion | quote }} # AppDB - name: {{ $initAppDbImageRepositoryEnv }} value: {{ .Values.registry.initAppDb }}/{{ .Values.initAppDb.name }} - name: INIT_APPDB_VERSION - value: {{ $initAppDbVersion }} + value: {{ $initAppDbVersion | quote }} - name: OPS_MANAGER_IMAGE_PULL_POLICY value: {{ .Values.registry.pullPolicy }} - name: {{ $agentImageEnv }} @@ -260,7 +260,7 @@ spec: - name: RELATED_IMAGE_{{ $opsManagerImageRepositoryEnv }}_{{ $version | replace "." "_" | replace "-" "_" }} value: "{{ $.Values.registry.opsManager }}/{{ $.Values.opsManager.name }}:{{ $version }}" {{- end }} - # since the official server images end with a different suffix we can re-use the same $mongodbImageEnv + # since the official server images end with a different suffix we can re-use the same $mongodbImageEnv {{- range $version := .Values.relatedImages.mongodb }} - name: RELATED_IMAGE_{{ $mongodbImageEnv }}_{{ $version | replace "." "_" | replace "-" "_" }} value: "{{ $.Values.mongodb.repo }}/{{ $.Values.mongodb.name }}:{{ $version }}" diff --git a/helm_chart/tests/operator_env_vars_type_test.yaml b/helm_chart/tests/operator_env_vars_type_test.yaml new file mode 100644 index 000000000..e8fcaa3e3 --- /dev/null +++ b/helm_chart/tests/operator_env_vars_type_test.yaml @@ -0,0 +1,58 @@ +suite: Environment Variable Quoting Check +templates: + - operator.yaml +tests: + - it: should correctly quote the value for the env vars for container images + set: + initDatabase.version: 1234 + database.version: 12d3f4 + initOpsManager.version: 1.2.3 + initAppDb.version: abc + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: INIT_DATABASE_VERSION + value: "1234" + - contains: + path: spec.template.spec.containers[0].env + content: + name: DATABASE_VERSION + value: "12d3f4" + - contains: + path: spec.template.spec.containers[0].env + content: + name: INIT_OPS_MANAGER_VERSION + value: "1.2.3" + - contains: + path: spec.template.spec.containers[0].env + content: + name: INIT_APPDB_VERSION + value: "abc" + - it: should correctly quote the value for the env vars for container images even when they are passed quoted + set: + initDatabase.version: "1234" + database.version: "12d3f4" + initOpsManager.version: "1.2.3" + initAppDb.version: "abc" + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: INIT_DATABASE_VERSION + value: "1234" + - contains: + path: spec.template.spec.containers[0].env + content: + name: DATABASE_VERSION + value: "12d3f4" + - contains: + path: spec.template.spec.containers[0].env + content: + name: INIT_OPS_MANAGER_VERSION + value: "1.2.3" + - contains: + path: spec.template.spec.containers[0].env + content: + name: INIT_APPDB_VERSION + value: "abc" diff --git a/public/mongodb-kubernetes-multi-cluster.yaml b/public/mongodb-kubernetes-multi-cluster.yaml index e6d9c5057..2bdb16432 100644 --- a/public/mongodb-kubernetes-multi-cluster.yaml +++ b/public/mongodb-kubernetes-multi-cluster.yaml @@ -380,21 +380,21 @@ spec: - name: INIT_DATABASE_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-database - name: INIT_DATABASE_VERSION - value: 1.5.0 + value: "1.5.0" - name: DATABASE_VERSION - value: 1.5.0 + value: "1.5.0" # Ops Manager - name: OPS_MANAGER_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-enterprise-ops-manager-ubi - name: INIT_OPS_MANAGER_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-ops-manager - name: INIT_OPS_MANAGER_VERSION - value: 1.5.0 + value: "1.5.0" # AppDB - name: INIT_APPDB_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-appdb - name: INIT_APPDB_VERSION - value: 1.5.0 + value: "1.5.0" - name: OPS_MANAGER_IMAGE_PULL_POLICY value: Always - name: AGENT_IMAGE diff --git a/public/mongodb-kubernetes-openshift.yaml b/public/mongodb-kubernetes-openshift.yaml index cd5cc278c..1e2862468 100644 --- a/public/mongodb-kubernetes-openshift.yaml +++ b/public/mongodb-kubernetes-openshift.yaml @@ -375,21 +375,21 @@ spec: - name: INIT_DATABASE_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-database - name: INIT_DATABASE_VERSION - value: 1.5.0 + value: "1.5.0" - name: DATABASE_VERSION - value: 1.5.0 + value: "1.5.0" # Ops Manager - name: OPS_MANAGER_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-enterprise-ops-manager-ubi - name: INIT_OPS_MANAGER_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-ops-manager - name: INIT_OPS_MANAGER_VERSION - value: 1.5.0 + value: "1.5.0" # AppDB - name: INIT_APPDB_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-appdb - name: INIT_APPDB_VERSION - value: 1.5.0 + value: "1.5.0" - name: OPS_MANAGER_IMAGE_PULL_POLICY value: Always - name: AGENT_IMAGE @@ -512,7 +512,7 @@ spec: value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:8.0.14" - name: RELATED_IMAGE_OPS_MANAGER_IMAGE_REPOSITORY_8_0_15 value: "quay.io/mongodb/mongodb-enterprise-ops-manager-ubi:8.0.15" - # since the official server images end with a different suffix we can re-use the same $mongodbImageEnv + # since the official server images end with a different suffix we can re-use the same $mongodbImageEnv - name: RELATED_IMAGE_MONGODB_IMAGE_4_4_0_ubi8 value: "quay.io/mongodb/mongodb-enterprise-server:4.4.0-ubi8" - name: RELATED_IMAGE_MONGODB_IMAGE_4_4_1_ubi8 diff --git a/public/mongodb-kubernetes.yaml b/public/mongodb-kubernetes.yaml index ced86abb4..53de57140 100644 --- a/public/mongodb-kubernetes.yaml +++ b/public/mongodb-kubernetes.yaml @@ -376,21 +376,21 @@ spec: - name: INIT_DATABASE_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-database - name: INIT_DATABASE_VERSION - value: 1.5.0 + value: "1.5.0" - name: DATABASE_VERSION - value: 1.5.0 + value: "1.5.0" # Ops Manager - name: OPS_MANAGER_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-enterprise-ops-manager-ubi - name: INIT_OPS_MANAGER_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-ops-manager - name: INIT_OPS_MANAGER_VERSION - value: 1.5.0 + value: "1.5.0" # AppDB - name: INIT_APPDB_IMAGE_REPOSITORY value: quay.io/mongodb/mongodb-kubernetes-init-appdb - name: INIT_APPDB_VERSION - value: 1.5.0 + value: "1.5.0" - name: OPS_MANAGER_IMAGE_PULL_POLICY value: Always - name: AGENT_IMAGE