From 873a3171b06dde6751d4bc0abc516b3b87437343 Mon Sep 17 00:00:00 2001 From: aahel Date: Thu, 8 Jun 2023 14:25:38 +0530 Subject: [PATCH 1/8] added imagePullPolicy for images in values.yaml --- charts/consul/templates/_helpers.tpl | 1 + .../api-gateway-controller-deployment.yaml | 3 +++ charts/consul/templates/client-daemonset.yaml | 1 + charts/consul/templates/cni-daemonset.yaml | 1 + .../consul/templates/enterprise-license-job.yaml | 1 + charts/consul/templates/gateway-cleanup-job.yaml | 1 + charts/consul/templates/gateway-resources-job.yaml | 1 + .../consul/templates/mesh-gateway-deployment.yaml | 2 ++ charts/consul/templates/partition-init-job.yaml | 1 + .../templates/server-acl-init-cleanup-job.yaml | 1 + charts/consul/templates/server-acl-init-job.yaml | 1 + charts/consul/templates/server-statefulset.yaml | 1 + .../templates/webhook-cert-manager-deployment.yaml | 1 + charts/consul/values.yaml | 14 +++++++++++++- 14 files changed, 29 insertions(+), 1 deletion(-) diff --git a/charts/consul/templates/_helpers.tpl b/charts/consul/templates/_helpers.tpl index 1b866888c0..39fcc44de9 100644 --- a/charts/consul/templates/_helpers.tpl +++ b/charts/consul/templates/_helpers.tpl @@ -194,6 +194,7 @@ This template is for an init container. {{- define "consul.getAutoEncryptClientCA" -}} - name: get-auto-encrypt-client-ca image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} command: - "/bin/sh" - "-ec" diff --git a/charts/consul/templates/api-gateway-controller-deployment.yaml b/charts/consul/templates/api-gateway-controller-deployment.yaml index 8c5c2fa73e..683de6ac5d 100644 --- a/charts/consul/templates/api-gateway-controller-deployment.yaml +++ b/charts/consul/templates/api-gateway-controller-deployment.yaml @@ -57,6 +57,7 @@ spec: containers: - name: api-gateway-controller image: {{ .Values.apiGateway.image }} + imagePullPolicy: {{- default Always .Values.apiGateway.pullPolicy }} ports: - containerPort: 9090 name: sds @@ -219,6 +220,7 @@ spec: {{- if .Values.global.acls.manageSystemACLs }} - name: copy-consul-bin image: {{ .Values.global.image | quote }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} command: - cp - /bin/consul @@ -256,6 +258,7 @@ spec: {{- end}} {{- include "consul.consulK8sConsulServerEnvVars" . | nindent 8 }} image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} volumeMounts: - mountPath: /consul/login name: consul-data diff --git a/charts/consul/templates/client-daemonset.yaml b/charts/consul/templates/client-daemonset.yaml index 09a70b394e..f406f39add 100644 --- a/charts/consul/templates/client-daemonset.yaml +++ b/charts/consul/templates/client-daemonset.yaml @@ -493,6 +493,7 @@ spec: {{- if .Values.global.acls.manageSystemACLs }} - name: client-acl-init image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} env: - name: NAMESPACE valueFrom: diff --git a/charts/consul/templates/cni-daemonset.yaml b/charts/consul/templates/cni-daemonset.yaml index ae04d9e657..49cc1e84c4 100644 --- a/charts/consul/templates/cni-daemonset.yaml +++ b/charts/consul/templates/cni-daemonset.yaml @@ -61,6 +61,7 @@ spec: # This container installs the consul CNI binaries and CNI network config file on each node - name: install-cni image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} securityContext: privileged: true command: diff --git a/charts/consul/templates/enterprise-license-job.yaml b/charts/consul/templates/enterprise-license-job.yaml index 0122690104..3729947101 100644 --- a/charts/consul/templates/enterprise-license-job.yaml +++ b/charts/consul/templates/enterprise-license-job.yaml @@ -124,6 +124,7 @@ spec: initContainers: - name: ent-license-acl-init image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} command: - "/bin/sh" - "-ec" diff --git a/charts/consul/templates/gateway-cleanup-job.yaml b/charts/consul/templates/gateway-cleanup-job.yaml index ff6f295357..e322e8528f 100644 --- a/charts/consul/templates/gateway-cleanup-job.yaml +++ b/charts/consul/templates/gateway-cleanup-job.yaml @@ -37,6 +37,7 @@ spec: containers: - name: gateway-cleanup image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/gateway-resources-job.yaml b/charts/consul/templates/gateway-resources-job.yaml index f8f92f799d..80392cd908 100644 --- a/charts/consul/templates/gateway-resources-job.yaml +++ b/charts/consul/templates/gateway-resources-job.yaml @@ -37,6 +37,7 @@ spec: containers: - name: gateway-resources image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/mesh-gateway-deployment.yaml b/charts/consul/templates/mesh-gateway-deployment.yaml index 449d6ae492..0ec3f62f7f 100644 --- a/charts/consul/templates/mesh-gateway-deployment.yaml +++ b/charts/consul/templates/mesh-gateway-deployment.yaml @@ -121,6 +121,7 @@ spec: initContainers: - name: mesh-gateway-init image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} env: - name: NAMESPACE valueFrom: @@ -179,6 +180,7 @@ spec: containers: - name: mesh-gateway image: {{ .Values.global.imageConsulDataplane | quote }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} {{- if .Values.meshGateway.resources }} resources: {{- if eq (typeOf .Values.meshGateway.resources) "string" }} diff --git a/charts/consul/templates/partition-init-job.yaml b/charts/consul/templates/partition-init-job.yaml index db73ef783b..1b4cee7e6e 100644 --- a/charts/consul/templates/partition-init-job.yaml +++ b/charts/consul/templates/partition-init-job.yaml @@ -81,6 +81,7 @@ spec: containers: - name: partition-init-job image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} env: {{- include "consul.consulK8sConsulServerEnvVars" . | nindent 10 }} {{- if (and .Values.global.acls.bootstrapToken.secretName .Values.global.acls.bootstrapToken.secretKey) }} diff --git a/charts/consul/templates/server-acl-init-cleanup-job.yaml b/charts/consul/templates/server-acl-init-cleanup-job.yaml index 35b0877ab4..120eaa3ead 100644 --- a/charts/consul/templates/server-acl-init-cleanup-job.yaml +++ b/charts/consul/templates/server-acl-init-cleanup-job.yaml @@ -53,6 +53,7 @@ spec: containers: - name: server-acl-init-cleanup image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/server-acl-init-job.yaml b/charts/consul/templates/server-acl-init-job.yaml index e62db41ec2..13d206e22b 100644 --- a/charts/consul/templates/server-acl-init-job.yaml +++ b/charts/consul/templates/server-acl-init-job.yaml @@ -122,6 +122,7 @@ spec: containers: - name: server-acl-init-job image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} env: - name: NAMESPACE valueFrom: diff --git a/charts/consul/templates/server-statefulset.yaml b/charts/consul/templates/server-statefulset.yaml index 0bde9b881a..73844b9a04 100644 --- a/charts/consul/templates/server-statefulset.yaml +++ b/charts/consul/templates/server-statefulset.yaml @@ -225,6 +225,7 @@ spec: initContainers: - name: locality-init image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} env: - name: NODE_NAME valueFrom: diff --git a/charts/consul/templates/webhook-cert-manager-deployment.yaml b/charts/consul/templates/webhook-cert-manager-deployment.yaml index dd93c039d2..aeea114595 100644 --- a/charts/consul/templates/webhook-cert-manager-deployment.yaml +++ b/charts/consul/templates/webhook-cert-manager-deployment.yaml @@ -50,6 +50,7 @@ spec: -deployment-name={{ template "consul.fullname" . }}-webhook-cert-manager \ -deployment-namespace={{ .Release.Namespace }} image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{- default Always .Values.global.pullPolicy }} name: webhook-cert-manager resources: limits: diff --git a/charts/consul/values.yaml b/charts/consul/values.yaml index 0e325ca66c..587f468109 100644 --- a/charts/consul/values.yaml +++ b/charts/consul/values.yaml @@ -67,6 +67,8 @@ global: # ``` # @default: hashicorp/consul: image: docker.mirror.hashicorp.services/hashicorppreview/consul-enterprise:1.16-dev + pullPolicy: "" + # Array of objects containing image pull secret names that will be applied to each service account. # This can be used to reference image pull secrets if using a custom consul or consul-k8s-control-plane Docker image. @@ -87,6 +89,7 @@ global: # This can be overridden per component. # @default: hashicorp/consul-k8s-control-plane: imageK8S: docker.mirror.hashicorp.services/hashicorppreview/consul-k8s-control-plane:1.2.0-dev + pullPolicy: "" # The name of the datacenter that the agents should # register as. This can't be changed once the Consul cluster is up and running @@ -558,6 +561,7 @@ global: # connect-injected sidecar proxies and mesh, terminating, and ingress gateways. # @default: hashicorp/consul-dataplane: imageConsulDataplane: "hashicorppreview/consul-dataplane:1.1-dev" + pullPolicy: "" # Configuration for running this Helm chart on the Red Hat OpenShift platform. # This Helm chart currently supports OpenShift v4.x+. @@ -680,6 +684,7 @@ server: # Consul server agents. # @type: string image: null + pullPolicy: "" # The number of server agents to run. This determines the fault tolerance of # the cluster. Please refer to the [deployment table](https://developer.hashicorp.com/consul/docs/architecture/consensus#deployment-table) @@ -1252,6 +1257,7 @@ client: # running Consul client agents. # @type: string image: null + pullPolicy: "" # A list of valid [`-retry-join` values](https://developer.hashicorp.com/consul/docs/agent/config/cli-flags#_retry_join). # If this is `null` (default), then the clients will attempt to automatically @@ -1711,6 +1717,7 @@ syncCatalog: # to run the sync program. # @type: string image: null + pullPolicy: "" # If true, all valid services in K8S are # synced by default. If false, the service must be [annotated](https://developer.hashicorp.com/consul/docs/k8s/service-sync#enable-and-disable-sync) @@ -1959,6 +1966,7 @@ connectInject: # Image for consul-k8s-control-plane that contains the injector. # @type: string image: null + pullPolicy: "" # If true, the injector will inject the # Connect sidecar into all pods by default. Otherwise, pods must specify the @@ -2259,6 +2267,7 @@ connectInject: # Defaults to global.image. # @type: string imageConsul: null + pullPolicy: "" # Override global log verbosity level. One of "debug", "info", "warn", or "error". # @type: string @@ -3022,11 +3031,12 @@ apiGateway: # ~> **Note:** Using API Gateway <= 0.4 with external servers requires setting `client.enabled: true`. # @type: string image: null - + pullPolicy: "" # The name (and tag) of the Envoy Docker image used for the # apiGateway. For other Consul compoenents, imageEnvoy has been replaced with Consul Dataplane. # @default: envoyproxy/envoy: imageEnvoy: "envoyproxy/envoy:v1.25.1" + pullPolicy: "" # Override global log verbosity level for api-gateway-controller pods. One of "debug", "info", "warn", or "error". # @type: string @@ -3223,6 +3233,8 @@ telemetryCollector: # the consul-telemetry-collector # @type: string image: "hashicorp/consul-telemetry-collector:0.0.1" + pullPolicy: "" + # The resource settings for consul-telemetry-collector pods. # @recurse: false From 7d233ec4eef920159dea326fef6c3a3f8581bade Mon Sep 17 00:00:00 2001 From: aahel Date: Thu, 8 Jun 2023 18:51:14 +0530 Subject: [PATCH 2/8] fix: renamed pullPolicy key according to image --- charts/consul/templates/_helpers.tpl | 2 +- .../templates/api-gateway-controller-deployment.yaml | 2 +- charts/consul/templates/client-daemonset.yaml | 2 +- charts/consul/templates/cni-daemonset.yaml | 2 +- charts/consul/templates/enterprise-license-job.yaml | 2 +- charts/consul/templates/gateway-cleanup-job.yaml | 2 +- charts/consul/templates/gateway-resources-job.yaml | 2 +- charts/consul/templates/mesh-gateway-deployment.yaml | 4 ++-- charts/consul/templates/partition-init-job.yaml | 2 +- charts/consul/templates/server-acl-init-cleanup-job.yaml | 2 +- charts/consul/templates/server-acl-init-job.yaml | 2 +- charts/consul/templates/server-statefulset.yaml | 2 +- .../consul/templates/webhook-cert-manager-deployment.yaml | 2 +- charts/consul/values.yaml | 8 ++++---- 14 files changed, 18 insertions(+), 18 deletions(-) diff --git a/charts/consul/templates/_helpers.tpl b/charts/consul/templates/_helpers.tpl index 39fcc44de9..823a727f9d 100644 --- a/charts/consul/templates/_helpers.tpl +++ b/charts/consul/templates/_helpers.tpl @@ -194,7 +194,7 @@ This template is for an init container. {{- define "consul.getAutoEncryptClientCA" -}} - name: get-auto-encrypt-client-ca image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} command: - "/bin/sh" - "-ec" diff --git a/charts/consul/templates/api-gateway-controller-deployment.yaml b/charts/consul/templates/api-gateway-controller-deployment.yaml index 683de6ac5d..b0d76739ec 100644 --- a/charts/consul/templates/api-gateway-controller-deployment.yaml +++ b/charts/consul/templates/api-gateway-controller-deployment.yaml @@ -258,7 +258,7 @@ spec: {{- end}} {{- include "consul.consulK8sConsulServerEnvVars" . | nindent 8 }} image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} volumeMounts: - mountPath: /consul/login name: consul-data diff --git a/charts/consul/templates/client-daemonset.yaml b/charts/consul/templates/client-daemonset.yaml index f406f39add..6e4adea382 100644 --- a/charts/consul/templates/client-daemonset.yaml +++ b/charts/consul/templates/client-daemonset.yaml @@ -493,7 +493,7 @@ spec: {{- if .Values.global.acls.manageSystemACLs }} - name: client-acl-init image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} env: - name: NAMESPACE valueFrom: diff --git a/charts/consul/templates/cni-daemonset.yaml b/charts/consul/templates/cni-daemonset.yaml index 49cc1e84c4..5597ed69d2 100644 --- a/charts/consul/templates/cni-daemonset.yaml +++ b/charts/consul/templates/cni-daemonset.yaml @@ -61,7 +61,7 @@ spec: # This container installs the consul CNI binaries and CNI network config file on each node - name: install-cni image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} securityContext: privileged: true command: diff --git a/charts/consul/templates/enterprise-license-job.yaml b/charts/consul/templates/enterprise-license-job.yaml index 3729947101..1b9c48f25b 100644 --- a/charts/consul/templates/enterprise-license-job.yaml +++ b/charts/consul/templates/enterprise-license-job.yaml @@ -124,7 +124,7 @@ spec: initContainers: - name: ent-license-acl-init image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} command: - "/bin/sh" - "-ec" diff --git a/charts/consul/templates/gateway-cleanup-job.yaml b/charts/consul/templates/gateway-cleanup-job.yaml index e322e8528f..0efdce0263 100644 --- a/charts/consul/templates/gateway-cleanup-job.yaml +++ b/charts/consul/templates/gateway-cleanup-job.yaml @@ -37,7 +37,7 @@ spec: containers: - name: gateway-cleanup image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/gateway-resources-job.yaml b/charts/consul/templates/gateway-resources-job.yaml index 80392cd908..67d9027c59 100644 --- a/charts/consul/templates/gateway-resources-job.yaml +++ b/charts/consul/templates/gateway-resources-job.yaml @@ -37,7 +37,7 @@ spec: containers: - name: gateway-resources image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/mesh-gateway-deployment.yaml b/charts/consul/templates/mesh-gateway-deployment.yaml index 0ec3f62f7f..32ccffb0b7 100644 --- a/charts/consul/templates/mesh-gateway-deployment.yaml +++ b/charts/consul/templates/mesh-gateway-deployment.yaml @@ -121,7 +121,7 @@ spec: initContainers: - name: mesh-gateway-init image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} env: - name: NAMESPACE valueFrom: @@ -180,7 +180,7 @@ spec: containers: - name: mesh-gateway image: {{ .Values.global.imageConsulDataplane | quote }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageConsulDataplanePullPolicy }} {{- if .Values.meshGateway.resources }} resources: {{- if eq (typeOf .Values.meshGateway.resources) "string" }} diff --git a/charts/consul/templates/partition-init-job.yaml b/charts/consul/templates/partition-init-job.yaml index 1b4cee7e6e..a203c612b8 100644 --- a/charts/consul/templates/partition-init-job.yaml +++ b/charts/consul/templates/partition-init-job.yaml @@ -81,7 +81,7 @@ spec: containers: - name: partition-init-job image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} env: {{- include "consul.consulK8sConsulServerEnvVars" . | nindent 10 }} {{- if (and .Values.global.acls.bootstrapToken.secretName .Values.global.acls.bootstrapToken.secretKey) }} diff --git a/charts/consul/templates/server-acl-init-cleanup-job.yaml b/charts/consul/templates/server-acl-init-cleanup-job.yaml index 120eaa3ead..93cd8dedbf 100644 --- a/charts/consul/templates/server-acl-init-cleanup-job.yaml +++ b/charts/consul/templates/server-acl-init-cleanup-job.yaml @@ -53,7 +53,7 @@ spec: containers: - name: server-acl-init-cleanup image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/server-acl-init-job.yaml b/charts/consul/templates/server-acl-init-job.yaml index 13d206e22b..0c69b575c5 100644 --- a/charts/consul/templates/server-acl-init-job.yaml +++ b/charts/consul/templates/server-acl-init-job.yaml @@ -122,7 +122,7 @@ spec: containers: - name: server-acl-init-job image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} env: - name: NAMESPACE valueFrom: diff --git a/charts/consul/templates/server-statefulset.yaml b/charts/consul/templates/server-statefulset.yaml index 73844b9a04..a4120c7856 100644 --- a/charts/consul/templates/server-statefulset.yaml +++ b/charts/consul/templates/server-statefulset.yaml @@ -225,7 +225,7 @@ spec: initContainers: - name: locality-init image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} env: - name: NODE_NAME valueFrom: diff --git a/charts/consul/templates/webhook-cert-manager-deployment.yaml b/charts/consul/templates/webhook-cert-manager-deployment.yaml index aeea114595..5cf866fe48 100644 --- a/charts/consul/templates/webhook-cert-manager-deployment.yaml +++ b/charts/consul/templates/webhook-cert-manager-deployment.yaml @@ -50,7 +50,7 @@ spec: -deployment-name={{ template "consul.fullname" . }}-webhook-cert-manager \ -deployment-namespace={{ .Release.Namespace }} image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} name: webhook-cert-manager resources: limits: diff --git a/charts/consul/values.yaml b/charts/consul/values.yaml index 587f468109..ebef10c8cf 100644 --- a/charts/consul/values.yaml +++ b/charts/consul/values.yaml @@ -89,7 +89,7 @@ global: # This can be overridden per component. # @default: hashicorp/consul-k8s-control-plane: imageK8S: docker.mirror.hashicorp.services/hashicorppreview/consul-k8s-control-plane:1.2.0-dev - pullPolicy: "" + imageK8SpullPolicy: "" # The name of the datacenter that the agents should # register as. This can't be changed once the Consul cluster is up and running @@ -561,7 +561,7 @@ global: # connect-injected sidecar proxies and mesh, terminating, and ingress gateways. # @default: hashicorp/consul-dataplane: imageConsulDataplane: "hashicorppreview/consul-dataplane:1.1-dev" - pullPolicy: "" + imageConsulDataplanePullPolicy: "" # Configuration for running this Helm chart on the Red Hat OpenShift platform. # This Helm chart currently supports OpenShift v4.x+. @@ -2267,7 +2267,7 @@ connectInject: # Defaults to global.image. # @type: string imageConsul: null - pullPolicy: "" + imageConsulPullPolicy: "" # Override global log verbosity level. One of "debug", "info", "warn", or "error". # @type: string @@ -3036,7 +3036,7 @@ apiGateway: # apiGateway. For other Consul compoenents, imageEnvoy has been replaced with Consul Dataplane. # @default: envoyproxy/envoy: imageEnvoy: "envoyproxy/envoy:v1.25.1" - pullPolicy: "" + imageEnvoyPullPolicy: "" # Override global log verbosity level for api-gateway-controller pods. One of "debug", "info", "warn", or "error". # @type: string From 50ff429febb9d48d42da8b85d2c6b5872cd4f211 Mon Sep 17 00:00:00 2001 From: aahel Date: Fri, 9 Jun 2023 12:11:25 +0530 Subject: [PATCH 3/8] fixed dafault always in tmpl --- charts/consul/templates/_helpers.tpl | 2 +- .../consul/templates/api-gateway-controller-deployment.yaml | 6 +++--- charts/consul/templates/client-daemonset.yaml | 2 +- charts/consul/templates/cni-daemonset.yaml | 2 +- charts/consul/templates/enterprise-license-job.yaml | 2 +- charts/consul/templates/gateway-cleanup-job.yaml | 2 +- charts/consul/templates/gateway-resources-job.yaml | 2 +- charts/consul/templates/mesh-gateway-deployment.yaml | 4 ++-- charts/consul/templates/partition-init-job.yaml | 2 +- charts/consul/templates/server-acl-init-cleanup-job.yaml | 2 +- charts/consul/templates/server-acl-init-job.yaml | 2 +- charts/consul/templates/server-statefulset.yaml | 2 +- .../consul/templates/webhook-cert-manager-deployment.yaml | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/charts/consul/templates/_helpers.tpl b/charts/consul/templates/_helpers.tpl index 823a727f9d..c1554c2373 100644 --- a/charts/consul/templates/_helpers.tpl +++ b/charts/consul/templates/_helpers.tpl @@ -194,7 +194,7 @@ This template is for an init container. {{- define "consul.getAutoEncryptClientCA" -}} - name: get-auto-encrypt-client-ca image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} command: - "/bin/sh" - "-ec" diff --git a/charts/consul/templates/api-gateway-controller-deployment.yaml b/charts/consul/templates/api-gateway-controller-deployment.yaml index b0d76739ec..e8d2569d06 100644 --- a/charts/consul/templates/api-gateway-controller-deployment.yaml +++ b/charts/consul/templates/api-gateway-controller-deployment.yaml @@ -57,7 +57,7 @@ spec: containers: - name: api-gateway-controller image: {{ .Values.apiGateway.image }} - imagePullPolicy: {{- default Always .Values.apiGateway.pullPolicy }} + imagePullPolicy: {{ default "Always" .Values.apiGateway.pullPolicy }} ports: - containerPort: 9090 name: sds @@ -220,7 +220,7 @@ spec: {{- if .Values.global.acls.manageSystemACLs }} - name: copy-consul-bin image: {{ .Values.global.image | quote }} - imagePullPolicy: {{- default Always .Values.global.pullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.pullPolicy }} command: - cp - /bin/consul @@ -258,7 +258,7 @@ spec: {{- end}} {{- include "consul.consulK8sConsulServerEnvVars" . | nindent 8 }} image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} volumeMounts: - mountPath: /consul/login name: consul-data diff --git a/charts/consul/templates/client-daemonset.yaml b/charts/consul/templates/client-daemonset.yaml index 6e4adea382..d753e85ef1 100644 --- a/charts/consul/templates/client-daemonset.yaml +++ b/charts/consul/templates/client-daemonset.yaml @@ -493,7 +493,7 @@ spec: {{- if .Values.global.acls.manageSystemACLs }} - name: client-acl-init image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} env: - name: NAMESPACE valueFrom: diff --git a/charts/consul/templates/cni-daemonset.yaml b/charts/consul/templates/cni-daemonset.yaml index 5597ed69d2..cf6ff96440 100644 --- a/charts/consul/templates/cni-daemonset.yaml +++ b/charts/consul/templates/cni-daemonset.yaml @@ -61,7 +61,7 @@ spec: # This container installs the consul CNI binaries and CNI network config file on each node - name: install-cni image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} securityContext: privileged: true command: diff --git a/charts/consul/templates/enterprise-license-job.yaml b/charts/consul/templates/enterprise-license-job.yaml index 1b9c48f25b..615e995e1d 100644 --- a/charts/consul/templates/enterprise-license-job.yaml +++ b/charts/consul/templates/enterprise-license-job.yaml @@ -124,7 +124,7 @@ spec: initContainers: - name: ent-license-acl-init image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} command: - "/bin/sh" - "-ec" diff --git a/charts/consul/templates/gateway-cleanup-job.yaml b/charts/consul/templates/gateway-cleanup-job.yaml index 0efdce0263..09f5b736ac 100644 --- a/charts/consul/templates/gateway-cleanup-job.yaml +++ b/charts/consul/templates/gateway-cleanup-job.yaml @@ -37,7 +37,7 @@ spec: containers: - name: gateway-cleanup image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/gateway-resources-job.yaml b/charts/consul/templates/gateway-resources-job.yaml index 67d9027c59..f666412112 100644 --- a/charts/consul/templates/gateway-resources-job.yaml +++ b/charts/consul/templates/gateway-resources-job.yaml @@ -37,7 +37,7 @@ spec: containers: - name: gateway-resources image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/mesh-gateway-deployment.yaml b/charts/consul/templates/mesh-gateway-deployment.yaml index 32ccffb0b7..87fe8afcda 100644 --- a/charts/consul/templates/mesh-gateway-deployment.yaml +++ b/charts/consul/templates/mesh-gateway-deployment.yaml @@ -121,7 +121,7 @@ spec: initContainers: - name: mesh-gateway-init image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} env: - name: NAMESPACE valueFrom: @@ -180,7 +180,7 @@ spec: containers: - name: mesh-gateway image: {{ .Values.global.imageConsulDataplane | quote }} - imagePullPolicy: {{- default Always .Values.global.imageConsulDataplanePullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageConsulDataplanePullPolicy }} {{- if .Values.meshGateway.resources }} resources: {{- if eq (typeOf .Values.meshGateway.resources) "string" }} diff --git a/charts/consul/templates/partition-init-job.yaml b/charts/consul/templates/partition-init-job.yaml index a203c612b8..3bfacbf5d6 100644 --- a/charts/consul/templates/partition-init-job.yaml +++ b/charts/consul/templates/partition-init-job.yaml @@ -81,7 +81,7 @@ spec: containers: - name: partition-init-job image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} env: {{- include "consul.consulK8sConsulServerEnvVars" . | nindent 10 }} {{- if (and .Values.global.acls.bootstrapToken.secretName .Values.global.acls.bootstrapToken.secretKey) }} diff --git a/charts/consul/templates/server-acl-init-cleanup-job.yaml b/charts/consul/templates/server-acl-init-cleanup-job.yaml index 93cd8dedbf..d5c1b66c3b 100644 --- a/charts/consul/templates/server-acl-init-cleanup-job.yaml +++ b/charts/consul/templates/server-acl-init-cleanup-job.yaml @@ -53,7 +53,7 @@ spec: containers: - name: server-acl-init-cleanup image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/server-acl-init-job.yaml b/charts/consul/templates/server-acl-init-job.yaml index 0c69b575c5..752fe7c91b 100644 --- a/charts/consul/templates/server-acl-init-job.yaml +++ b/charts/consul/templates/server-acl-init-job.yaml @@ -122,7 +122,7 @@ spec: containers: - name: server-acl-init-job image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} env: - name: NAMESPACE valueFrom: diff --git a/charts/consul/templates/server-statefulset.yaml b/charts/consul/templates/server-statefulset.yaml index a4120c7856..fcebd6f5be 100644 --- a/charts/consul/templates/server-statefulset.yaml +++ b/charts/consul/templates/server-statefulset.yaml @@ -225,7 +225,7 @@ spec: initContainers: - name: locality-init image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} env: - name: NODE_NAME valueFrom: diff --git a/charts/consul/templates/webhook-cert-manager-deployment.yaml b/charts/consul/templates/webhook-cert-manager-deployment.yaml index 5cf866fe48..325ed79c1f 100644 --- a/charts/consul/templates/webhook-cert-manager-deployment.yaml +++ b/charts/consul/templates/webhook-cert-manager-deployment.yaml @@ -50,7 +50,7 @@ spec: -deployment-name={{ template "consul.fullname" . }}-webhook-cert-manager \ -deployment-namespace={{ .Release.Namespace }} image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{- default Always .Values.global.imageK8SpullPolicy }} + imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} name: webhook-cert-manager resources: limits: From 2e0e33ce6adacf7f04e9092ad13a0b85d75b4f29 Mon Sep 17 00:00:00 2001 From: aahel Date: Mon, 12 Jun 2023 18:12:08 +0530 Subject: [PATCH 4/8] changed structure of image in yaml --- charts/consul/templates/_helpers.tpl | 4 +- .../api-gateway-controller-deployment.yaml | 10 +-- .../api-gateway-gatewayclassconfig.yaml | 4 +- charts/consul/templates/client-daemonset.yaml | 4 +- charts/consul/templates/cni-daemonset.yaml | 4 +- .../templates/enterprise-license-job.yaml | 4 +- .../consul/templates/gateway-cleanup-job.yaml | 4 +- .../templates/gateway-resources-job.yaml | 4 +- .../templates/mesh-gateway-deployment.yaml | 8 +-- .../consul/templates/partition-init-job.yaml | 4 +- .../server-acl-init-cleanup-job.yaml | 4 +- .../consul/templates/server-acl-init-job.yaml | 4 +- .../consul/templates/server-statefulset.yaml | 4 +- .../webhook-cert-manager-deployment.yaml | 4 +- .../api-gateway-controller-clusterrole.bats | 6 +- charts/consul/test/unit/cni-daemonset.bats | 2 +- charts/consul/values.yaml | 64 +++++++++++++------ 17 files changed, 80 insertions(+), 58 deletions(-) diff --git a/charts/consul/templates/_helpers.tpl b/charts/consul/templates/_helpers.tpl index c1554c2373..200b4e5487 100644 --- a/charts/consul/templates/_helpers.tpl +++ b/charts/consul/templates/_helpers.tpl @@ -193,8 +193,8 @@ This template is for an init container. */}} {{- define "consul.getAutoEncryptClientCA" -}} - name: get-auto-encrypt-client-ca - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} command: - "/bin/sh" - "-ec" diff --git a/charts/consul/templates/api-gateway-controller-deployment.yaml b/charts/consul/templates/api-gateway-controller-deployment.yaml index e8d2569d06..510a2f2536 100644 --- a/charts/consul/templates/api-gateway-controller-deployment.yaml +++ b/charts/consul/templates/api-gateway-controller-deployment.yaml @@ -56,8 +56,8 @@ spec: serviceAccountName: {{ template "consul.fullname" . }}-api-gateway-controller containers: - name: api-gateway-controller - image: {{ .Values.apiGateway.image }} - imagePullPolicy: {{ default "Always" .Values.apiGateway.pullPolicy }} + image: "{{ .Values.apiGateway.image.repository }}:{{ .Values.apiGateway.image.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.apiGateway.image.pullPolicy }} ports: - containerPort: 9090 name: sds @@ -220,7 +220,7 @@ spec: {{- if .Values.global.acls.manageSystemACLs }} - name: copy-consul-bin image: {{ .Values.global.image | quote }} - imagePullPolicy: {{ default "Always" .Values.global.pullPolicy }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} command: - cp - /bin/consul @@ -257,8 +257,8 @@ spec: value: {{ .Values.global.datacenter }} {{- end}} {{- include "consul.consulK8sConsulServerEnvVars" . | nindent 8 }} - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} volumeMounts: - mountPath: /consul/login name: consul-data diff --git a/charts/consul/templates/api-gateway-gatewayclassconfig.yaml b/charts/consul/templates/api-gateway-gatewayclassconfig.yaml index ba0e6c63db..e655abf329 100644 --- a/charts/consul/templates/api-gateway-gatewayclassconfig.yaml +++ b/charts/consul/templates/api-gateway-gatewayclassconfig.yaml @@ -63,8 +63,8 @@ spec: {{- toYaml . | nindent 4 }} {{- end }} image: - consulAPIGateway: {{ .Values.apiGateway.image }} - envoy: {{ .Values.apiGateway.imageEnvoy }} + consulAPIGateway: "{{ .Values.apiGateway.image.repository }}:{{ .Values.apiGateway.image.tag }}" + envoy: "{{ .Values.apiGateway.imageEnvoy.repository }}:{{ .Values.apiGateway.imageEnvoy.tag }}" {{- if .Values.apiGateway.managedGatewayClass.nodeSelector }} nodeSelector: {{ tpl .Values.apiGateway.managedGatewayClass.nodeSelector . | indent 4 | trim }} diff --git a/charts/consul/templates/client-daemonset.yaml b/charts/consul/templates/client-daemonset.yaml index d753e85ef1..319525b2d2 100644 --- a/charts/consul/templates/client-daemonset.yaml +++ b/charts/consul/templates/client-daemonset.yaml @@ -492,8 +492,8 @@ spec: initContainers: {{- if .Values.global.acls.manageSystemACLs }} - name: client-acl-init - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} env: - name: NAMESPACE valueFrom: diff --git a/charts/consul/templates/cni-daemonset.yaml b/charts/consul/templates/cni-daemonset.yaml index cf6ff96440..e16182f9eb 100644 --- a/charts/consul/templates/cni-daemonset.yaml +++ b/charts/consul/templates/cni-daemonset.yaml @@ -60,8 +60,8 @@ spec: containers: # This container installs the consul CNI binaries and CNI network config file on each node - name: install-cni - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} securityContext: privileged: true command: diff --git a/charts/consul/templates/enterprise-license-job.yaml b/charts/consul/templates/enterprise-license-job.yaml index 615e995e1d..c95946ef19 100644 --- a/charts/consul/templates/enterprise-license-job.yaml +++ b/charts/consul/templates/enterprise-license-job.yaml @@ -123,8 +123,8 @@ spec: {{- if .Values.global.acls.manageSystemACLs }} initContainers: - name: ent-license-acl-init - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} command: - "/bin/sh" - "-ec" diff --git a/charts/consul/templates/gateway-cleanup-job.yaml b/charts/consul/templates/gateway-cleanup-job.yaml index 09f5b736ac..c8363914d9 100644 --- a/charts/consul/templates/gateway-cleanup-job.yaml +++ b/charts/consul/templates/gateway-cleanup-job.yaml @@ -36,8 +36,8 @@ spec: serviceAccountName: {{ template "consul.fullname" . }}-gateway-cleanup containers: - name: gateway-cleanup - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/gateway-resources-job.yaml b/charts/consul/templates/gateway-resources-job.yaml index f666412112..c8c982e8fe 100644 --- a/charts/consul/templates/gateway-resources-job.yaml +++ b/charts/consul/templates/gateway-resources-job.yaml @@ -36,8 +36,8 @@ spec: serviceAccountName: {{ template "consul.fullname" . }}-gateway-resources containers: - name: gateway-resources - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/mesh-gateway-deployment.yaml b/charts/consul/templates/mesh-gateway-deployment.yaml index 87fe8afcda..e9a62674cb 100644 --- a/charts/consul/templates/mesh-gateway-deployment.yaml +++ b/charts/consul/templates/mesh-gateway-deployment.yaml @@ -120,8 +120,8 @@ spec: {{- end }} initContainers: - name: mesh-gateway-init - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} env: - name: NAMESPACE valueFrom: @@ -179,8 +179,8 @@ spec: {{- end }} containers: - name: mesh-gateway - image: {{ .Values.global.imageConsulDataplane | quote }} - imagePullPolicy: {{ default "Always" .Values.global.imageConsulDataplanePullPolicy }} + image: {{ "{{.Values.global.imageConsulDataplane.repository}}:{{.Values.global.imageConsulDataplane.tag}}" | quote }} + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageConsulDataplane.pullPolicy }} {{- if .Values.meshGateway.resources }} resources: {{- if eq (typeOf .Values.meshGateway.resources) "string" }} diff --git a/charts/consul/templates/partition-init-job.yaml b/charts/consul/templates/partition-init-job.yaml index 3bfacbf5d6..1eda81ea3d 100644 --- a/charts/consul/templates/partition-init-job.yaml +++ b/charts/consul/templates/partition-init-job.yaml @@ -80,8 +80,8 @@ spec: {{- end }} containers: - name: partition-init-job - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} env: {{- include "consul.consulK8sConsulServerEnvVars" . | nindent 10 }} {{- if (and .Values.global.acls.bootstrapToken.secretName .Values.global.acls.bootstrapToken.secretKey) }} diff --git a/charts/consul/templates/server-acl-init-cleanup-job.yaml b/charts/consul/templates/server-acl-init-cleanup-job.yaml index d5c1b66c3b..c507e924dd 100644 --- a/charts/consul/templates/server-acl-init-cleanup-job.yaml +++ b/charts/consul/templates/server-acl-init-cleanup-job.yaml @@ -52,8 +52,8 @@ spec: serviceAccountName: {{ template "consul.fullname" . }}-server-acl-init-cleanup containers: - name: server-acl-init-cleanup - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/server-acl-init-job.yaml b/charts/consul/templates/server-acl-init-job.yaml index 752fe7c91b..268a9fd19f 100644 --- a/charts/consul/templates/server-acl-init-job.yaml +++ b/charts/consul/templates/server-acl-init-job.yaml @@ -121,8 +121,8 @@ spec: {{- end }} containers: - name: server-acl-init-job - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} env: - name: NAMESPACE valueFrom: diff --git a/charts/consul/templates/server-statefulset.yaml b/charts/consul/templates/server-statefulset.yaml index fcebd6f5be..8159924b47 100644 --- a/charts/consul/templates/server-statefulset.yaml +++ b/charts/consul/templates/server-statefulset.yaml @@ -224,8 +224,8 @@ spec: {{- end }} initContainers: - name: locality-init - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} env: - name: NODE_NAME valueFrom: diff --git a/charts/consul/templates/webhook-cert-manager-deployment.yaml b/charts/consul/templates/webhook-cert-manager-deployment.yaml index 325ed79c1f..2ce20299c9 100644 --- a/charts/consul/templates/webhook-cert-manager-deployment.yaml +++ b/charts/consul/templates/webhook-cert-manager-deployment.yaml @@ -49,8 +49,8 @@ spec: -config-file=/bootstrap/config/webhook-config.json \ -deployment-name={{ template "consul.fullname" . }}-webhook-cert-manager \ -deployment-namespace={{ .Release.Namespace }} - image: {{ .Values.global.imageK8S }} - imagePullPolicy: {{ default "Always" .Values.global.imageK8SpullPolicy }} + image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" + imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} name: webhook-cert-manager resources: limits: diff --git a/charts/consul/test/unit/api-gateway-controller-clusterrole.bats b/charts/consul/test/unit/api-gateway-controller-clusterrole.bats index f26fdfeebd..3f3cdd76c7 100644 --- a/charts/consul/test/unit/api-gateway-controller-clusterrole.bats +++ b/charts/consul/test/unit/api-gateway-controller-clusterrole.bats @@ -14,7 +14,7 @@ load _helpers local actual=$(helm template \ -s templates/api-gateway-controller-clusterrole.yaml \ --set 'apiGateway.enabled=true' \ - --set 'apiGateway.image=foo' \ + --set 'apiGateway.image.repository=foo' \ . | tee /dev/stderr | yq 'length > 0' | tee /dev/stderr) [ "${actual}" = "true" ] @@ -26,7 +26,7 @@ load _helpers -s templates/api-gateway-controller-clusterrole.yaml \ --set 'global.enablePodSecurityPolicies=true' \ --set 'apiGateway.enabled=true' \ - --set 'apiGateway.image=foo' \ + --set 'apiGateway.image.repository=foo' \ . | tee /dev/stderr | yq '.rules[] | select((.resources[0] == "podsecuritypolicies") and (.verbs[0] == "use")) | length > 0' | tee /dev/stderr) [ "${actual}" = "true" ] @@ -38,7 +38,7 @@ load _helpers -s templates/api-gateway-controller-clusterrole.yaml \ --set 'global.enablePodSecurityPolicies=true' \ --set 'apiGateway.enabled=true' \ - --set 'apiGateway.image=foo' \ + --set 'apiGateway.image.repository=foo' \ . | tee /dev/stderr | yq '.rules[] | select((.resources[0] == "roles") and (.resources[1] == "rolebindings") and (.verbs | contains(["create","get","list","watch"]))) | length > 0' | tee /dev/stderr) [ "${actual}" = "true" ] diff --git a/charts/consul/test/unit/cni-daemonset.bats b/charts/consul/test/unit/cni-daemonset.bats index 675d6b877f..9004f1fb06 100644 --- a/charts/consul/test/unit/cni-daemonset.bats +++ b/charts/consul/test/unit/cni-daemonset.bats @@ -47,7 +47,7 @@ load _helpers -s templates/cni-daemonset.yaml \ --set 'connectInject.cni.enabled=true' \ --set 'connectInject.enabled=true' \ - --set 'global.imageK8S=foo' \ + --set 'global.imageK8S.repository=foo' \ . | tee /dev/stderr | yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr) [ "${actual}" = "foo" ] diff --git a/charts/consul/values.yaml b/charts/consul/values.yaml index ebef10c8cf..6ab7671c69 100644 --- a/charts/consul/values.yaml +++ b/charts/consul/values.yaml @@ -52,6 +52,8 @@ global: # Changing the partition name would require an un-install and a re-install with the updated name. # Must be "default" in the server cluster ie the Kubernetes cluster that the Consul server pods are deployed onto. name: "default" + + imagePullPolicy: "Always" # The name (and tag) of the Consul Docker image for clients and servers. # This can be overridden per component. This should be pinned to a specific @@ -66,8 +68,10 @@ global: # image: "hashicorp/consul-enterprise:1.10.0-ent" # ``` # @default: hashicorp/consul: - image: docker.mirror.hashicorp.services/hashicorppreview/consul-enterprise:1.16-dev - pullPolicy: "" + image: + repository: "docker.mirror.hashicorp.services/hashicorppreview/consul-enterprise" + tag: "1.16-dev" + pullPolicy: "" # Array of objects containing image pull secret names that will be applied to each service account. @@ -88,8 +92,10 @@ global: # image that is used for functionality such as catalog sync. # This can be overridden per component. # @default: hashicorp/consul-k8s-control-plane: - imageK8S: docker.mirror.hashicorp.services/hashicorppreview/consul-k8s-control-plane:1.2.0-dev - imageK8SpullPolicy: "" + imageK8S: + repository: "docker.mirror.hashicorp.services/hashicorppreview/consul-k8s-control-plane" + tag: "1.2.0-dev" + pullPolicy: "" # The name of the datacenter that the agents should # register as. This can't be changed once the Consul cluster is up and running @@ -560,8 +566,10 @@ global: # The name (and tag) of the consul-dataplane Docker image used for the # connect-injected sidecar proxies and mesh, terminating, and ingress gateways. # @default: hashicorp/consul-dataplane: - imageConsulDataplane: "hashicorppreview/consul-dataplane:1.1-dev" - imageConsulDataplanePullPolicy: "" + imageConsulDataplane: + repository: "hashicorppreview/consul-dataplane" + tag: "1.1-dev" + pullPolicy: "" # Configuration for running this Helm chart on the Red Hat OpenShift platform. # This Helm chart currently supports OpenShift v4.x+. @@ -683,8 +691,10 @@ server: # The name of the Docker image (including any tag) for the containers running # Consul server agents. # @type: string - image: null - pullPolicy: "" + image: + repository: "" + tag: "" + pullPolicy: "" # The number of server agents to run. This determines the fault tolerance of # the cluster. Please refer to the [deployment table](https://developer.hashicorp.com/consul/docs/architecture/consensus#deployment-table) @@ -1256,9 +1266,11 @@ client: # The name of the Docker image (including any tag) for the containers # running Consul client agents. # @type: string - image: null - pullPolicy: "" - + imageK8S: + repository: "" + tag: "" + pullPolicy: "" + # A list of valid [`-retry-join` values](https://developer.hashicorp.com/consul/docs/agent/config/cli-flags#_retry_join). # If this is `null` (default), then the clients will attempt to automatically # join the server cluster running within Kubernetes. @@ -1716,8 +1728,10 @@ syncCatalog: # The name of the Docker image (including any tag) for consul-k8s-control-plane # to run the sync program. # @type: string - image: null - pullPolicy: "" + image: + repository: "" + tag: "" + pullPolicy: "" # If true, all valid services in K8S are # synced by default. If false, the service must be [annotated](https://developer.hashicorp.com/consul/docs/k8s/service-sync#enable-and-disable-sync) @@ -1965,8 +1979,10 @@ connectInject: # Image for consul-k8s-control-plane that contains the injector. # @type: string - image: null - pullPolicy: "" + image: + repository: "" + tag: "" + pullPolicy: "" # If true, the injector will inject the # Connect sidecar into all pods by default. Otherwise, pods must specify the @@ -3030,13 +3046,17 @@ apiGateway: # # ~> **Note:** Using API Gateway <= 0.4 with external servers requires setting `client.enabled: true`. # @type: string - image: null - pullPolicy: "" + image: + repository: "" + tag: "" + pullPolicy: "" # The name (and tag) of the Envoy Docker image used for the # apiGateway. For other Consul compoenents, imageEnvoy has been replaced with Consul Dataplane. # @default: envoyproxy/envoy: - imageEnvoy: "envoyproxy/envoy:v1.25.1" - imageEnvoyPullPolicy: "" + imageEnvoy: + repository: "envoyproxy/envoy" + tag: "v1.25.1" + pullPolicy: "" # Override global log verbosity level for api-gateway-controller pods. One of "debug", "info", "warn", or "error". # @type: string @@ -3232,8 +3252,10 @@ telemetryCollector: # The name of the Docker image (including any tag) for the containers running # the consul-telemetry-collector # @type: string - image: "hashicorp/consul-telemetry-collector:0.0.1" - pullPolicy: "" + image: + repository: "hashicorp/consul-telemetry-collector" + tag: "0.0.1" + pullPolicy: "" # The resource settings for consul-telemetry-collector pods. From 5b418e173f049db1c00d4bc3743fd9b63386ad80 Mon Sep 17 00:00:00 2001 From: aahel Date: Mon, 12 Jun 2023 20:44:03 +0530 Subject: [PATCH 5/8] revert changes --- charts/consul/templates/_helpers.tpl | 3 +- .../api-gateway-controller-deployment.yaml | 7 +-- .../api-gateway-gatewayclassconfig.yaml | 4 +- charts/consul/templates/client-daemonset.yaml | 3 +- charts/consul/templates/cni-daemonset.yaml | 3 +- .../templates/enterprise-license-job.yaml | 3 +- .../consul/templates/gateway-cleanup-job.yaml | 5 +- .../templates/gateway-resources-job.yaml | 7 +-- .../templates/mesh-gateway-deployment.yaml | 6 +- .../consul/templates/partition-init-job.yaml | 3 +- .../server-acl-init-cleanup-job.yaml | 3 +- .../consul/templates/server-acl-init-job.yaml | 3 +- .../consul/templates/server-statefulset.yaml | 3 +- .../webhook-cert-manager-deployment.yaml | 3 +- .../api-gateway-controller-clusterrole.bats | 6 +- charts/consul/test/unit/cni-daemonset.bats | 2 +- charts/consul/values.yaml | 58 ++++--------------- 17 files changed, 36 insertions(+), 86 deletions(-) diff --git a/charts/consul/templates/_helpers.tpl b/charts/consul/templates/_helpers.tpl index 200b4e5487..1b866888c0 100644 --- a/charts/consul/templates/_helpers.tpl +++ b/charts/consul/templates/_helpers.tpl @@ -193,8 +193,7 @@ This template is for an init container. */}} {{- define "consul.getAutoEncryptClientCA" -}} - name: get-auto-encrypt-client-ca - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} command: - "/bin/sh" - "-ec" diff --git a/charts/consul/templates/api-gateway-controller-deployment.yaml b/charts/consul/templates/api-gateway-controller-deployment.yaml index 510a2f2536..8c5c2fa73e 100644 --- a/charts/consul/templates/api-gateway-controller-deployment.yaml +++ b/charts/consul/templates/api-gateway-controller-deployment.yaml @@ -56,8 +56,7 @@ spec: serviceAccountName: {{ template "consul.fullname" . }}-api-gateway-controller containers: - name: api-gateway-controller - image: "{{ .Values.apiGateway.image.repository }}:{{ .Values.apiGateway.image.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.apiGateway.image.pullPolicy }} + image: {{ .Values.apiGateway.image }} ports: - containerPort: 9090 name: sds @@ -220,7 +219,6 @@ spec: {{- if .Values.global.acls.manageSystemACLs }} - name: copy-consul-bin image: {{ .Values.global.image | quote }} - imagePullPolicy: {{ .Values.global.imagePullPolicy }} command: - cp - /bin/consul @@ -257,8 +255,7 @@ spec: value: {{ .Values.global.datacenter }} {{- end}} {{- include "consul.consulK8sConsulServerEnvVars" . | nindent 8 }} - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} volumeMounts: - mountPath: /consul/login name: consul-data diff --git a/charts/consul/templates/api-gateway-gatewayclassconfig.yaml b/charts/consul/templates/api-gateway-gatewayclassconfig.yaml index e655abf329..ba0e6c63db 100644 --- a/charts/consul/templates/api-gateway-gatewayclassconfig.yaml +++ b/charts/consul/templates/api-gateway-gatewayclassconfig.yaml @@ -63,8 +63,8 @@ spec: {{- toYaml . | nindent 4 }} {{- end }} image: - consulAPIGateway: "{{ .Values.apiGateway.image.repository }}:{{ .Values.apiGateway.image.tag }}" - envoy: "{{ .Values.apiGateway.imageEnvoy.repository }}:{{ .Values.apiGateway.imageEnvoy.tag }}" + consulAPIGateway: {{ .Values.apiGateway.image }} + envoy: {{ .Values.apiGateway.imageEnvoy }} {{- if .Values.apiGateway.managedGatewayClass.nodeSelector }} nodeSelector: {{ tpl .Values.apiGateway.managedGatewayClass.nodeSelector . | indent 4 | trim }} diff --git a/charts/consul/templates/client-daemonset.yaml b/charts/consul/templates/client-daemonset.yaml index 319525b2d2..09a70b394e 100644 --- a/charts/consul/templates/client-daemonset.yaml +++ b/charts/consul/templates/client-daemonset.yaml @@ -492,8 +492,7 @@ spec: initContainers: {{- if .Values.global.acls.manageSystemACLs }} - name: client-acl-init - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} env: - name: NAMESPACE valueFrom: diff --git a/charts/consul/templates/cni-daemonset.yaml b/charts/consul/templates/cni-daemonset.yaml index e16182f9eb..ae04d9e657 100644 --- a/charts/consul/templates/cni-daemonset.yaml +++ b/charts/consul/templates/cni-daemonset.yaml @@ -60,8 +60,7 @@ spec: containers: # This container installs the consul CNI binaries and CNI network config file on each node - name: install-cni - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} securityContext: privileged: true command: diff --git a/charts/consul/templates/enterprise-license-job.yaml b/charts/consul/templates/enterprise-license-job.yaml index c95946ef19..0122690104 100644 --- a/charts/consul/templates/enterprise-license-job.yaml +++ b/charts/consul/templates/enterprise-license-job.yaml @@ -123,8 +123,7 @@ spec: {{- if .Values.global.acls.manageSystemACLs }} initContainers: - name: ent-license-acl-init - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} command: - "/bin/sh" - "-ec" diff --git a/charts/consul/templates/gateway-cleanup-job.yaml b/charts/consul/templates/gateway-cleanup-job.yaml index c8363914d9..44f032b5fd 100644 --- a/charts/consul/templates/gateway-cleanup-job.yaml +++ b/charts/consul/templates/gateway-cleanup-job.yaml @@ -36,13 +36,12 @@ spec: serviceAccountName: {{ template "consul.fullname" . }}-gateway-cleanup containers: - name: gateway-cleanup - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} command: - consul-k8s-control-plane args: - gateway-cleanup - - -gateway-class-name=consul-api-gateway + - -gateway-class-name=consul - -gateway-class-config-name=consul-api-gateway resources: requests: diff --git a/charts/consul/templates/gateway-resources-job.yaml b/charts/consul/templates/gateway-resources-job.yaml index c8c982e8fe..441e64eb14 100644 --- a/charts/consul/templates/gateway-resources-job.yaml +++ b/charts/consul/templates/gateway-resources-job.yaml @@ -36,15 +36,14 @@ spec: serviceAccountName: {{ template "consul.fullname" . }}-gateway-resources containers: - name: gateway-resources - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} command: - consul-k8s-control-plane args: - gateway-resources - - -gateway-class-name=consul-api-gateway + - -gateway-class-name=consul - -gateway-class-config-name=consul-api-gateway - - -controller-name=hashicorp.com/consul-api-gateway-controller + - -controller-name=consul.hashicorp.com/gateway-controller - -app={{template "consul.name" .}} - -chart={{template "consul.chart" .}} - -heritage={{ .Release.Service }} diff --git a/charts/consul/templates/mesh-gateway-deployment.yaml b/charts/consul/templates/mesh-gateway-deployment.yaml index e9a62674cb..449d6ae492 100644 --- a/charts/consul/templates/mesh-gateway-deployment.yaml +++ b/charts/consul/templates/mesh-gateway-deployment.yaml @@ -120,8 +120,7 @@ spec: {{- end }} initContainers: - name: mesh-gateway-init - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} env: - name: NAMESPACE valueFrom: @@ -179,8 +178,7 @@ spec: {{- end }} containers: - name: mesh-gateway - image: {{ "{{.Values.global.imageConsulDataplane.repository}}:{{.Values.global.imageConsulDataplane.tag}}" | quote }} - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageConsulDataplane.pullPolicy }} + image: {{ .Values.global.imageConsulDataplane | quote }} {{- if .Values.meshGateway.resources }} resources: {{- if eq (typeOf .Values.meshGateway.resources) "string" }} diff --git a/charts/consul/templates/partition-init-job.yaml b/charts/consul/templates/partition-init-job.yaml index 1eda81ea3d..db73ef783b 100644 --- a/charts/consul/templates/partition-init-job.yaml +++ b/charts/consul/templates/partition-init-job.yaml @@ -80,8 +80,7 @@ spec: {{- end }} containers: - name: partition-init-job - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} env: {{- include "consul.consulK8sConsulServerEnvVars" . | nindent 10 }} {{- if (and .Values.global.acls.bootstrapToken.secretName .Values.global.acls.bootstrapToken.secretKey) }} diff --git a/charts/consul/templates/server-acl-init-cleanup-job.yaml b/charts/consul/templates/server-acl-init-cleanup-job.yaml index c507e924dd..35b0877ab4 100644 --- a/charts/consul/templates/server-acl-init-cleanup-job.yaml +++ b/charts/consul/templates/server-acl-init-cleanup-job.yaml @@ -52,8 +52,7 @@ spec: serviceAccountName: {{ template "consul.fullname" . }}-server-acl-init-cleanup containers: - name: server-acl-init-cleanup - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/server-acl-init-job.yaml b/charts/consul/templates/server-acl-init-job.yaml index 268a9fd19f..e62db41ec2 100644 --- a/charts/consul/templates/server-acl-init-job.yaml +++ b/charts/consul/templates/server-acl-init-job.yaml @@ -121,8 +121,7 @@ spec: {{- end }} containers: - name: server-acl-init-job - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} env: - name: NAMESPACE valueFrom: diff --git a/charts/consul/templates/server-statefulset.yaml b/charts/consul/templates/server-statefulset.yaml index 8159924b47..0bde9b881a 100644 --- a/charts/consul/templates/server-statefulset.yaml +++ b/charts/consul/templates/server-statefulset.yaml @@ -224,8 +224,7 @@ spec: {{- end }} initContainers: - name: locality-init - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} env: - name: NODE_NAME valueFrom: diff --git a/charts/consul/templates/webhook-cert-manager-deployment.yaml b/charts/consul/templates/webhook-cert-manager-deployment.yaml index 2ce20299c9..dd93c039d2 100644 --- a/charts/consul/templates/webhook-cert-manager-deployment.yaml +++ b/charts/consul/templates/webhook-cert-manager-deployment.yaml @@ -49,8 +49,7 @@ spec: -config-file=/bootstrap/config/webhook-config.json \ -deployment-name={{ template "consul.fullname" . }}-webhook-cert-manager \ -deployment-namespace={{ .Release.Namespace }} - image: "{{ .Values.global.imageK8S.repository }}:{{ .Values.global.imageK8S.tag }}" - imagePullPolicy: {{ default .Values.global.imagePullPolicy .Values.global.imageK8S.pullPolicy }} + image: {{ .Values.global.imageK8S }} name: webhook-cert-manager resources: limits: diff --git a/charts/consul/test/unit/api-gateway-controller-clusterrole.bats b/charts/consul/test/unit/api-gateway-controller-clusterrole.bats index 3f3cdd76c7..f26fdfeebd 100644 --- a/charts/consul/test/unit/api-gateway-controller-clusterrole.bats +++ b/charts/consul/test/unit/api-gateway-controller-clusterrole.bats @@ -14,7 +14,7 @@ load _helpers local actual=$(helm template \ -s templates/api-gateway-controller-clusterrole.yaml \ --set 'apiGateway.enabled=true' \ - --set 'apiGateway.image.repository=foo' \ + --set 'apiGateway.image=foo' \ . | tee /dev/stderr | yq 'length > 0' | tee /dev/stderr) [ "${actual}" = "true" ] @@ -26,7 +26,7 @@ load _helpers -s templates/api-gateway-controller-clusterrole.yaml \ --set 'global.enablePodSecurityPolicies=true' \ --set 'apiGateway.enabled=true' \ - --set 'apiGateway.image.repository=foo' \ + --set 'apiGateway.image=foo' \ . | tee /dev/stderr | yq '.rules[] | select((.resources[0] == "podsecuritypolicies") and (.verbs[0] == "use")) | length > 0' | tee /dev/stderr) [ "${actual}" = "true" ] @@ -38,7 +38,7 @@ load _helpers -s templates/api-gateway-controller-clusterrole.yaml \ --set 'global.enablePodSecurityPolicies=true' \ --set 'apiGateway.enabled=true' \ - --set 'apiGateway.image.repository=foo' \ + --set 'apiGateway.image=foo' \ . | tee /dev/stderr | yq '.rules[] | select((.resources[0] == "roles") and (.resources[1] == "rolebindings") and (.verbs | contains(["create","get","list","watch"]))) | length > 0' | tee /dev/stderr) [ "${actual}" = "true" ] diff --git a/charts/consul/test/unit/cni-daemonset.bats b/charts/consul/test/unit/cni-daemonset.bats index 9004f1fb06..675d6b877f 100644 --- a/charts/consul/test/unit/cni-daemonset.bats +++ b/charts/consul/test/unit/cni-daemonset.bats @@ -47,7 +47,7 @@ load _helpers -s templates/cni-daemonset.yaml \ --set 'connectInject.cni.enabled=true' \ --set 'connectInject.enabled=true' \ - --set 'global.imageK8S.repository=foo' \ + --set 'global.imageK8S=foo' \ . | tee /dev/stderr | yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr) [ "${actual}" = "foo" ] diff --git a/charts/consul/values.yaml b/charts/consul/values.yaml index 6ab7671c69..0e325ca66c 100644 --- a/charts/consul/values.yaml +++ b/charts/consul/values.yaml @@ -52,8 +52,6 @@ global: # Changing the partition name would require an un-install and a re-install with the updated name. # Must be "default" in the server cluster ie the Kubernetes cluster that the Consul server pods are deployed onto. name: "default" - - imagePullPolicy: "Always" # The name (and tag) of the Consul Docker image for clients and servers. # This can be overridden per component. This should be pinned to a specific @@ -68,11 +66,7 @@ global: # image: "hashicorp/consul-enterprise:1.10.0-ent" # ``` # @default: hashicorp/consul: - image: - repository: "docker.mirror.hashicorp.services/hashicorppreview/consul-enterprise" - tag: "1.16-dev" - pullPolicy: "" - + image: docker.mirror.hashicorp.services/hashicorppreview/consul-enterprise:1.16-dev # Array of objects containing image pull secret names that will be applied to each service account. # This can be used to reference image pull secrets if using a custom consul or consul-k8s-control-plane Docker image. @@ -92,10 +86,7 @@ global: # image that is used for functionality such as catalog sync. # This can be overridden per component. # @default: hashicorp/consul-k8s-control-plane: - imageK8S: - repository: "docker.mirror.hashicorp.services/hashicorppreview/consul-k8s-control-plane" - tag: "1.2.0-dev" - pullPolicy: "" + imageK8S: docker.mirror.hashicorp.services/hashicorppreview/consul-k8s-control-plane:1.2.0-dev # The name of the datacenter that the agents should # register as. This can't be changed once the Consul cluster is up and running @@ -566,10 +557,7 @@ global: # The name (and tag) of the consul-dataplane Docker image used for the # connect-injected sidecar proxies and mesh, terminating, and ingress gateways. # @default: hashicorp/consul-dataplane: - imageConsulDataplane: - repository: "hashicorppreview/consul-dataplane" - tag: "1.1-dev" - pullPolicy: "" + imageConsulDataplane: "hashicorppreview/consul-dataplane:1.1-dev" # Configuration for running this Helm chart on the Red Hat OpenShift platform. # This Helm chart currently supports OpenShift v4.x+. @@ -691,10 +679,7 @@ server: # The name of the Docker image (including any tag) for the containers running # Consul server agents. # @type: string - image: - repository: "" - tag: "" - pullPolicy: "" + image: null # The number of server agents to run. This determines the fault tolerance of # the cluster. Please refer to the [deployment table](https://developer.hashicorp.com/consul/docs/architecture/consensus#deployment-table) @@ -1266,11 +1251,8 @@ client: # The name of the Docker image (including any tag) for the containers # running Consul client agents. # @type: string - imageK8S: - repository: "" - tag: "" - pullPolicy: "" - + image: null + # A list of valid [`-retry-join` values](https://developer.hashicorp.com/consul/docs/agent/config/cli-flags#_retry_join). # If this is `null` (default), then the clients will attempt to automatically # join the server cluster running within Kubernetes. @@ -1728,10 +1710,7 @@ syncCatalog: # The name of the Docker image (including any tag) for consul-k8s-control-plane # to run the sync program. # @type: string - image: - repository: "" - tag: "" - pullPolicy: "" + image: null # If true, all valid services in K8S are # synced by default. If false, the service must be [annotated](https://developer.hashicorp.com/consul/docs/k8s/service-sync#enable-and-disable-sync) @@ -1979,10 +1958,7 @@ connectInject: # Image for consul-k8s-control-plane that contains the injector. # @type: string - image: - repository: "" - tag: "" - pullPolicy: "" + image: null # If true, the injector will inject the # Connect sidecar into all pods by default. Otherwise, pods must specify the @@ -2283,7 +2259,6 @@ connectInject: # Defaults to global.image. # @type: string imageConsul: null - imageConsulPullPolicy: "" # Override global log verbosity level. One of "debug", "info", "warn", or "error". # @type: string @@ -3046,17 +3021,12 @@ apiGateway: # # ~> **Note:** Using API Gateway <= 0.4 with external servers requires setting `client.enabled: true`. # @type: string - image: - repository: "" - tag: "" - pullPolicy: "" + image: null + # The name (and tag) of the Envoy Docker image used for the # apiGateway. For other Consul compoenents, imageEnvoy has been replaced with Consul Dataplane. # @default: envoyproxy/envoy: - imageEnvoy: - repository: "envoyproxy/envoy" - tag: "v1.25.1" - pullPolicy: "" + imageEnvoy: "envoyproxy/envoy:v1.25.1" # Override global log verbosity level for api-gateway-controller pods. One of "debug", "info", "warn", or "error". # @type: string @@ -3252,11 +3222,7 @@ telemetryCollector: # The name of the Docker image (including any tag) for the containers running # the consul-telemetry-collector # @type: string - image: - repository: "hashicorp/consul-telemetry-collector" - tag: "0.0.1" - pullPolicy: "" - + image: "hashicorp/consul-telemetry-collector:0.0.1" # The resource settings for consul-telemetry-collector pods. # @recurse: false From 473a18b46a4ca9d9ee2f970cb24cd24b364cd380 Mon Sep 17 00:00:00 2001 From: aahel Date: Mon, 12 Jun 2023 21:27:45 +0530 Subject: [PATCH 6/8] added global imagePullPolicy --- .../consul/templates/api-gateway-controller-deployment.yaml | 4 ++++ charts/consul/templates/api-gateway-gatewayclassconfig.yaml | 1 + charts/consul/templates/client-daemonset.yaml | 1 + charts/consul/templates/cni-daemonset.yaml | 1 + charts/consul/templates/enterprise-license-job.yaml | 1 + charts/consul/templates/gateway-cleanup-job.yaml | 1 + charts/consul/templates/gateway-resources-job.yaml | 1 + charts/consul/templates/mesh-gateway-deployment.yaml | 2 ++ charts/consul/templates/partition-init-job.yaml | 1 + charts/consul/templates/server-acl-init-cleanup-job.yaml | 1 + charts/consul/templates/server-acl-init-job.yaml | 1 + charts/consul/templates/server-statefulset.yaml | 1 + .../consul/templates/webhook-cert-manager-deployment.yaml | 1 + charts/consul/values.yaml | 6 ++++++ 14 files changed, 23 insertions(+) diff --git a/charts/consul/templates/api-gateway-controller-deployment.yaml b/charts/consul/templates/api-gateway-controller-deployment.yaml index 8c5c2fa73e..0caa1bc148 100644 --- a/charts/consul/templates/api-gateway-controller-deployment.yaml +++ b/charts/consul/templates/api-gateway-controller-deployment.yaml @@ -57,6 +57,8 @@ spec: containers: - name: api-gateway-controller image: {{ .Values.apiGateway.image }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} + pull ports: - containerPort: 9090 name: sds @@ -219,6 +221,7 @@ spec: {{- if .Values.global.acls.manageSystemACLs }} - name: copy-consul-bin image: {{ .Values.global.image | quote }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} command: - cp - /bin/consul @@ -256,6 +259,7 @@ spec: {{- end}} {{- include "consul.consulK8sConsulServerEnvVars" . | nindent 8 }} image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} volumeMounts: - mountPath: /consul/login name: consul-data diff --git a/charts/consul/templates/api-gateway-gatewayclassconfig.yaml b/charts/consul/templates/api-gateway-gatewayclassconfig.yaml index ba0e6c63db..8688ee6ae7 100644 --- a/charts/consul/templates/api-gateway-gatewayclassconfig.yaml +++ b/charts/consul/templates/api-gateway-gatewayclassconfig.yaml @@ -65,6 +65,7 @@ spec: image: consulAPIGateway: {{ .Values.apiGateway.image }} envoy: {{ .Values.apiGateway.imageEnvoy }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} {{- if .Values.apiGateway.managedGatewayClass.nodeSelector }} nodeSelector: {{ tpl .Values.apiGateway.managedGatewayClass.nodeSelector . | indent 4 | trim }} diff --git a/charts/consul/templates/client-daemonset.yaml b/charts/consul/templates/client-daemonset.yaml index 09a70b394e..ba19343652 100644 --- a/charts/consul/templates/client-daemonset.yaml +++ b/charts/consul/templates/client-daemonset.yaml @@ -493,6 +493,7 @@ spec: {{- if .Values.global.acls.manageSystemACLs }} - name: client-acl-init image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} env: - name: NAMESPACE valueFrom: diff --git a/charts/consul/templates/cni-daemonset.yaml b/charts/consul/templates/cni-daemonset.yaml index ae04d9e657..33ffb0a77e 100644 --- a/charts/consul/templates/cni-daemonset.yaml +++ b/charts/consul/templates/cni-daemonset.yaml @@ -61,6 +61,7 @@ spec: # This container installs the consul CNI binaries and CNI network config file on each node - name: install-cni image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} securityContext: privileged: true command: diff --git a/charts/consul/templates/enterprise-license-job.yaml b/charts/consul/templates/enterprise-license-job.yaml index 0122690104..2a3fa01d00 100644 --- a/charts/consul/templates/enterprise-license-job.yaml +++ b/charts/consul/templates/enterprise-license-job.yaml @@ -124,6 +124,7 @@ spec: initContainers: - name: ent-license-acl-init image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} command: - "/bin/sh" - "-ec" diff --git a/charts/consul/templates/gateway-cleanup-job.yaml b/charts/consul/templates/gateway-cleanup-job.yaml index 44f032b5fd..e4656916de 100644 --- a/charts/consul/templates/gateway-cleanup-job.yaml +++ b/charts/consul/templates/gateway-cleanup-job.yaml @@ -37,6 +37,7 @@ spec: containers: - name: gateway-cleanup image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/gateway-resources-job.yaml b/charts/consul/templates/gateway-resources-job.yaml index 441e64eb14..ea38d7af32 100644 --- a/charts/consul/templates/gateway-resources-job.yaml +++ b/charts/consul/templates/gateway-resources-job.yaml @@ -37,6 +37,7 @@ spec: containers: - name: gateway-resources image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/mesh-gateway-deployment.yaml b/charts/consul/templates/mesh-gateway-deployment.yaml index 449d6ae492..4150b2bdfd 100644 --- a/charts/consul/templates/mesh-gateway-deployment.yaml +++ b/charts/consul/templates/mesh-gateway-deployment.yaml @@ -121,6 +121,7 @@ spec: initContainers: - name: mesh-gateway-init image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} env: - name: NAMESPACE valueFrom: @@ -179,6 +180,7 @@ spec: containers: - name: mesh-gateway image: {{ .Values.global.imageConsulDataplane | quote }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} {{- if .Values.meshGateway.resources }} resources: {{- if eq (typeOf .Values.meshGateway.resources) "string" }} diff --git a/charts/consul/templates/partition-init-job.yaml b/charts/consul/templates/partition-init-job.yaml index db73ef783b..b351d10027 100644 --- a/charts/consul/templates/partition-init-job.yaml +++ b/charts/consul/templates/partition-init-job.yaml @@ -81,6 +81,7 @@ spec: containers: - name: partition-init-job image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} env: {{- include "consul.consulK8sConsulServerEnvVars" . | nindent 10 }} {{- if (and .Values.global.acls.bootstrapToken.secretName .Values.global.acls.bootstrapToken.secretKey) }} diff --git a/charts/consul/templates/server-acl-init-cleanup-job.yaml b/charts/consul/templates/server-acl-init-cleanup-job.yaml index 35b0877ab4..3676144b40 100644 --- a/charts/consul/templates/server-acl-init-cleanup-job.yaml +++ b/charts/consul/templates/server-acl-init-cleanup-job.yaml @@ -53,6 +53,7 @@ spec: containers: - name: server-acl-init-cleanup image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} command: - consul-k8s-control-plane args: diff --git a/charts/consul/templates/server-acl-init-job.yaml b/charts/consul/templates/server-acl-init-job.yaml index e62db41ec2..e42a073c42 100644 --- a/charts/consul/templates/server-acl-init-job.yaml +++ b/charts/consul/templates/server-acl-init-job.yaml @@ -122,6 +122,7 @@ spec: containers: - name: server-acl-init-job image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} env: - name: NAMESPACE valueFrom: diff --git a/charts/consul/templates/server-statefulset.yaml b/charts/consul/templates/server-statefulset.yaml index 0bde9b881a..0c2eb1bffa 100644 --- a/charts/consul/templates/server-statefulset.yaml +++ b/charts/consul/templates/server-statefulset.yaml @@ -225,6 +225,7 @@ spec: initContainers: - name: locality-init image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} env: - name: NODE_NAME valueFrom: diff --git a/charts/consul/templates/webhook-cert-manager-deployment.yaml b/charts/consul/templates/webhook-cert-manager-deployment.yaml index dd93c039d2..25e382be84 100644 --- a/charts/consul/templates/webhook-cert-manager-deployment.yaml +++ b/charts/consul/templates/webhook-cert-manager-deployment.yaml @@ -50,6 +50,7 @@ spec: -deployment-name={{ template "consul.fullname" . }}-webhook-cert-manager \ -deployment-namespace={{ .Release.Namespace }} image: {{ .Values.global.imageK8S }} + imagePullPolicy: {{ .Values.global.imagePullPolicy }} name: webhook-cert-manager resources: limits: diff --git a/charts/consul/values.yaml b/charts/consul/values.yaml index 0e325ca66c..8de7eecc01 100644 --- a/charts/consul/values.yaml +++ b/charts/consul/values.yaml @@ -52,6 +52,12 @@ global: # Changing the partition name would require an un-install and a re-install with the updated name. # Must be "default" in the server cluster ie the Kubernetes cluster that the Consul server pods are deployed onto. name: "default" + + # Set imagePullPolicy for all images used. This is applies to all the images being used. + # One of "IfNotPresent", "Always", "Never" + # Refer to https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy + # @type: string + imagePullPolicy: "" # The name (and tag) of the Consul Docker image for clients and servers. # This can be overridden per component. This should be pinned to a specific From a4c9d96114c74dd26e4bf0081e17baf6eb2be2d6 Mon Sep 17 00:00:00 2001 From: aahel Date: Mon, 12 Jun 2023 21:29:32 +0530 Subject: [PATCH 7/8] fixed typo --- charts/consul/templates/api-gateway-controller-deployment.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/charts/consul/templates/api-gateway-controller-deployment.yaml b/charts/consul/templates/api-gateway-controller-deployment.yaml index 0caa1bc148..c942576034 100644 --- a/charts/consul/templates/api-gateway-controller-deployment.yaml +++ b/charts/consul/templates/api-gateway-controller-deployment.yaml @@ -58,7 +58,6 @@ spec: - name: api-gateway-controller image: {{ .Values.apiGateway.image }} imagePullPolicy: {{ .Values.global.imagePullPolicy }} - pull ports: - containerPort: 9090 name: sds From ca9b27199ccab82aefe809674cae80a2a322a428 Mon Sep 17 00:00:00 2001 From: aahel Date: Tue, 13 Jun 2023 19:45:12 +0530 Subject: [PATCH 8/8] added changelog file --- .changelog/2310.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/2310.txt diff --git a/.changelog/2310.txt b/.changelog/2310.txt new file mode 100644 index 0000000000..5e37de44ea --- /dev/null +++ b/.changelog/2310.txt @@ -0,0 +1,3 @@ +```release-note:feature +helm: Added imagePullPolicy global field which can be configured to override the default behaviour. +``` \ No newline at end of file