Add helm's quote function to various fields

The constellationUID is sometimes interpreted as integer if it contains
0e, as the yaml parsing interprets that as scientific notation.
Since it is a best practices to quote string fields anyways this patch
also quotes other fields where an actual string is required.
This commit is contained in:
Otto Bittner 2022-11-25 10:01:41 +01:00
parent 64f03cf675
commit 038ea5fade
30 changed files with 53 additions and 56 deletions

View File

@ -22,7 +22,7 @@ spec:
spec: spec:
containers: containers:
- name: cluster-autoscaler - name: cluster-autoscaler
image: {{ .Values.image }} image: {{ .Values.image | quote }}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
livenessProbe: livenessProbe:
httpGet: httpGet:

View File

@ -22,7 +22,7 @@ spec:
spec: spec:
containers: containers:
- name: cluster-autoscaler - name: cluster-autoscaler
image: {{ .Values.image }} image: {{ .Values.image | quote }}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
livenessProbe: livenessProbe:
httpGet: httpGet:

View File

@ -22,7 +22,7 @@ spec:
spec: spec:
containers: containers:
- name: cluster-autoscaler - name: cluster-autoscaler
image: {{ .Values.image }} image: {{ .Values.image | quote }}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
livenessProbe: livenessProbe:
httpGet: httpGet:

View File

@ -17,7 +17,7 @@ spec:
spec: spec:
containers: containers:
- name: cloud-controller-manager - name: cloud-controller-manager
image: {{ .Values.AWS.image }} image: {{ .Values.AWS.image | quote }}
args: args:
- --cloud-provider=aws - --cloud-provider=aws
- --leader-elect=true - --leader-elect=true

View File

@ -3,7 +3,7 @@ apiVersion: apps/v1
kind: DaemonSet kind: DaemonSet
metadata: metadata:
name: cloud-controller-manager name: cloud-controller-manager
namespace: {{ .Release.Namespace}} namespace: {{ .Release.Namespace }}
labels: labels:
k8s-app: cloud-controller-manager k8s-app: cloud-controller-manager
spec: spec:
@ -17,7 +17,7 @@ spec:
spec: spec:
containers: containers:
- name: cloud-controller-manager - name: cloud-controller-manager
image: {{ .Values.Azure.image }} image: {{ .Values.Azure.image | quote }}
command: command:
- cloud-controller-manager - cloud-controller-manager
- --cloud-provider=azure - --cloud-provider=azure

View File

@ -17,7 +17,7 @@ spec:
spec: spec:
containers: containers:
- name: cloud-controller-manager - name: cloud-controller-manager
image: {{ .Values.GCP.image }} image: {{ .Values.GCP.image | quote }}
command: command:
- /cloud-controller-manager - /cloud-controller-manager
- --cloud-provider=gce - --cloud-provider=gce

View File

@ -20,7 +20,7 @@ spec:
spec: spec:
containers: containers:
- name: cloud-node-manager - name: cloud-node-manager
image: {{ .Values.image }} image: {{ .Values.image | quote }}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
command: command:
- cloud-node-manager - cloud-node-manager

View File

@ -13,4 +13,4 @@ roleRef:
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: cloud-node-manager name: cloud-node-manager
namespace: {{ .Release.Namespace}} namespace: {{ .Release.Namespace }}

View File

@ -2,7 +2,7 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: cloud-node-manager name: cloud-node-manager
namespace: {{ .Release.Namespace}} namespace: {{ .Release.Namespace }}
labels: labels:
addonmanager.kubernetes.io/mode: Reconcile addonmanager.kubernetes.io/mode: Reconcile
k8s-app: cloud-node-manager k8s-app: cloud-node-manager

View File

@ -17,7 +17,7 @@ spec:
k8s-app: gcp-guest-agent k8s-app: gcp-guest-agent
spec: spec:
containers: containers:
- image: {{ .Values.image }} - image: {{ .Values.image | quote }}
name: gcp-guest-agent name: gcp-guest-agent
resources: {} resources: {}
securityContext: securityContext:

View File

@ -35,12 +35,12 @@ spec:
node-role.kubernetes.io/control-plane: "" node-role.kubernetes.io/control-plane: ""
containers: containers:
- name: join-service - name: join-service
image: {{ .Values.image }} image: {{ .Values.image | quote }}
args: args:
- --cloud-provider={{ .Values.csp }} - --cloud-provider={{ .Values.csp }}
- --kms-endpoint=kms.{{ .Release.Namespace }}:{{ .Values.global.kmsPort }} - --kms-endpoint=kms.{{ .Release.Namespace }}:{{ .Values.global.kmsPort }}
volumeMounts: volumeMounts:
- mountPath: {{ .Values.global.serviceBasePath }} - mountPath: {{ .Values.global.serviceBasePath | quote }}
name: config name: config
readOnly: true readOnly: true
- mountPath: /etc/kubernetes - mountPath: /etc/kubernetes
@ -57,11 +57,11 @@ spec:
projected: projected:
sources: sources:
- configMap: - configMap:
name: {{ .Values.global.joinConfigCMName }} name: {{ .Values.global.joinConfigCMName | quote }}
- configMap: - configMap:
name: {{ .Values.global.k8sVersionCMName }} name: {{ .Values.global.k8sVersionCMName | quote }}
- configMap: - configMap:
name: {{ .Values.global.internalCMName }} name: {{ .Values.global.internalCMName | quote }}
- name: kubeadm - name: kubeadm
hostPath: hostPath:
path: /etc/kubernetes path: /etc/kubernetes

View File

@ -18,11 +18,11 @@ spec:
spec: spec:
containers: containers:
- name: kms - name: kms
image: {{ .Values.image }} image: {{ .Values.image | quote }}
args: args:
- --port={{ .Values.global.kmsPort }} - --port={{ .Values.global.kmsPort }}
volumeMounts: volumeMounts:
- mountPath: {{ .Values.global.serviceBasePath }} - mountPath: {{ .Values.global.serviceBasePath | quote }}
name: config name: config
readOnly: true readOnly: true
resources: {} resources: {}
@ -49,14 +49,14 @@ spec:
sources: sources:
- configMap: - configMap:
items: items:
- key: {{ .Values.measurementsFilename }} - key: {{ .Values.measurementsFilename | quote }}
path: {{ .Values.measurementsFilename }} path: {{ .Values.measurementsFilename | quote }}
name: {{ .Values.global.joinConfigCMName }} name: {{ .Values.global.joinConfigCMName | quote }}
- secret: - secret:
items: items:
- key: {{ .Values.masterSecretKeyName }} - key: {{ .Values.masterSecretKeyName | quote }}
path: {{ .Values.masterSecretKeyName }} path: {{ .Values.masterSecretKeyName | quote }}
- key: {{ .Values.saltKeyName }} - key: {{ .Values.saltKeyName | quote }}
path: {{ .Values.saltKeyName }} path: {{ .Values.saltKeyName | quote }}
name: {{ .Values.masterSecretName }} name: {{ .Values.masterSecretName | quote }}
updateStrategy: {} updateStrategy: {}

View File

@ -2,8 +2,8 @@ apiVersion: v1
kind: Secret kind: Secret
type: Opaque type: Opaque
metadata: metadata:
name: {{ .Values.masterSecretName }} name: {{ .Values.masterSecretName | quote }}
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
data: data:
mastersecret: {{ .Values.masterSecret }} mastersecret: {{ .Values.masterSecret | quote }}
salt: {{ .Values.salt }} salt: {{ .Values.salt | quote }}

View File

@ -39,7 +39,7 @@ spec:
fieldRef: fieldRef:
apiVersion: v1 apiVersion: v1
fieldPath: status.hostIP fieldPath: status.hostIP
image: {{ .Values.image }} image: {{ .Values.image | quote }}
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /healthz path: /healthz

View File

@ -18,7 +18,7 @@ spec:
containers: containers:
- args: - args:
- --cloud-provider={{ .Values.csp }} - --cloud-provider={{ .Values.csp }}
image: {{ .Values.image }} image: {{ .Values.image | quote }}
name: verification-service name: verification-service
ports: ports:
- containerPort: {{ .Values.httpContainerPort }} - containerPort: {{ .Values.httpContainerPort }}

View File

@ -6,7 +6,7 @@ metadata:
spec: spec:
allocateLoadBalancerNodePorts: false allocateLoadBalancerNodePorts: false
externalIPs: externalIPs:
- {{ .Values.loadBalancerIP }} - {{ .Values.loadBalancerIP | quote }}
loadBalancerClass: constellation loadBalancerClass: constellation
ports: ports:
- name: grpc - name: grpc

View File

@ -56,10 +56,10 @@ spec:
- name: KUBERNETES_CLUSTER_DOMAIN - name: KUBERNETES_CLUSTER_DOMAIN
value: {{ .Values.kubernetesClusterDomain }} value: {{ .Values.kubernetesClusterDomain }}
- name: CONSTEL_CSP - name: CONSTEL_CSP
value: {{ .Values.csp }} value: {{ .Values.csp | quote }}
- name: constellation-uid - name: constellation-uid
value: {{ .Values.constellationUID }} value: {{ .Values.constellationUID | quote }}
image: {{ .Values.controllerManager.manager.image }} image: {{ .Values.controllerManager.manager.image | quote }}
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /healthz path: /healthz

View File

@ -13,12 +13,9 @@ data:
| quote }} | quote }}
kind: ControllerManagerConfig kind: ControllerManagerConfig
leaderElection: leaderElection:
leaderElect: {{ .Values.managerConfig.controllerManagerConfigYaml.leaderElection.leaderElect leaderElect: {{ .Values.managerConfig.controllerManagerConfigYaml.leaderElection.leaderElect }}
}} resourceName: {{ .Values.managerConfig.controllerManagerConfigYaml.leaderElection.resourceName | quote }}
resourceName: {{ .Values.managerConfig.controllerManagerConfigYaml.leaderElection.resourceName
| quote }}
metrics: metrics:
bindAddress: {{ .Values.managerConfig.controllerManagerConfigYaml.metrics.bindAddress bindAddress: {{ .Values.managerConfig.controllerManagerConfigYaml.metrics.bindAddress | quote }}
| quote }}
webhook: webhook:
port: {{ .Values.managerConfig.controllerManagerConfigYaml.webhook.port }} port: {{ .Values.managerConfig.controllerManagerConfigYaml.webhook.port }}

View File

@ -55,8 +55,8 @@ spec:
fieldRef: fieldRef:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: KUBERNETES_CLUSTER_DOMAIN - name: KUBERNETES_CLUSTER_DOMAIN
value: {{ .Values.kubernetesClusterDomain }} value: {{ .Values.kubernetesClusterDomain | quote }}
image: {{ .Values.controllerManager.manager.image }} image: {{ .Values.controllerManager.manager.image | quote }}
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /healthz path: /healthz
@ -74,8 +74,7 @@ spec:
port: 8081 port: 8081
initialDelaySeconds: 5 initialDelaySeconds: 5
periodSeconds: 10 periodSeconds: 10
resources: {{- toYaml .Values.controllerManager.manager.resources | nindent 10 resources: {{- toYaml .Values.controllerManager.manager.resources | nindent 10 }}
}}
securityContext: securityContext:
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
volumeMounts: volumeMounts:

View File

@ -8,7 +8,7 @@ metadata:
node-maintenance-operator: "" node-maintenance-operator: ""
{{- include "chart.labels" . | nindent 4 }} {{- include "chart.labels" . | nindent 4 }}
spec: spec:
type: {{ .Values.metricsService.type }} type: {{ .Values.metricsService.type | quote }}
selector: selector:
control-plane: controller-manager control-plane: controller-manager
node-maintenance-operator: "" node-maintenance-operator: ""

View File

@ -8,8 +8,7 @@ metadata:
spec: spec:
dnsNames: dnsNames:
- 'node-maintenance-operator-webhook-service.{{ .Release.Namespace }}.svc' - 'node-maintenance-operator-webhook-service.{{ .Release.Namespace }}.svc'
- 'node-maintenance-operator-webhook-service.{{ .Release.Namespace }}.svc.{{ - 'node-maintenance-operator-webhook-service.{{ .Release.Namespace }}.svc.{{ .Values.kubernetesClusterDomain }}'
.Values.kubernetesClusterDomain }}'
issuerRef: issuerRef:
kind: Issuer kind: Issuer
name: node-maintenance-operator-selfsigned-issuer name: node-maintenance-operator-selfsigned-issuer

View File

@ -7,7 +7,7 @@ metadata:
node-maintenance-operator: "" node-maintenance-operator: ""
{{- include "chart.labels" . | nindent 4 }} {{- include "chart.labels" . | nindent 4 }}
spec: spec:
type: {{ .Values.webhookService.type }} type: {{ .Values.webhookService.type | quote }}
selector: selector:
control-plane: controller-manager control-plane: controller-manager
node-maintenance-operator: "" node-maintenance-operator: ""

View File

@ -94,6 +94,8 @@ func TestConstellationServices(t *testing.T) {
cnmImage: tc.cnmImage, cnmImage: tc.cnmImage,
autoscalerImage: "autoscalerImage", autoscalerImage: "autoscalerImage",
verificationServiceImage: "verificationImage", verificationServiceImage: "verificationImage",
konnectivityImage: "konnectivityImage",
gcpGuestAgentImage: "gcpGuestAgentImage",
} }
chart, values, err := chartLoader.loadConstellationServicesHelper(tc.config, []byte("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), []byte("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")) chart, values, err := chartLoader.loadConstellationServicesHelper(tc.config, []byte("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), []byte("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))
require.NoError(err) require.NoError(err)

View File

@ -70,7 +70,7 @@ spec:
- name: CONSTEL_CSP - name: CONSTEL_CSP
value: Azure value: Azure
- name: constellation-uid - name: constellation-uid
value: 42424242424242 value: "42424242424242"
image: ghcr.io/edgelesssys/constellation/node-operator:v2.3.0-pre.0.20221125134926-1af3ff00adbc@sha256:fae7160eba0259d3dcbe974460ff983ae2c6cab18319a5b8ef585dd1630cb077 image: ghcr.io/edgelesssys/constellation/node-operator:v2.3.0-pre.0.20221125134926-1af3ff00adbc@sha256:fae7160eba0259d3dcbe974460ff983ae2c6cab18319a5b8ef585dd1630cb077
livenessProbe: livenessProbe:
httpGet: httpGet:

View File

@ -39,7 +39,7 @@ spec:
fieldRef: fieldRef:
apiVersion: v1 apiVersion: v1
fieldPath: status.hostIP fieldPath: status.hostIP
image: image: konnectivityImage
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /healthz path: /healthz

View File

@ -70,7 +70,7 @@ spec:
- name: CONSTEL_CSP - name: CONSTEL_CSP
value: GCP value: GCP
- name: constellation-uid - name: constellation-uid
value: 42424242424242 value: "42424242424242"
image: ghcr.io/edgelesssys/constellation/node-operator:v2.3.0-pre.0.20221125134926-1af3ff00adbc@sha256:fae7160eba0259d3dcbe974460ff983ae2c6cab18319a5b8ef585dd1630cb077 image: ghcr.io/edgelesssys/constellation/node-operator:v2.3.0-pre.0.20221125134926-1af3ff00adbc@sha256:fae7160eba0259d3dcbe974460ff983ae2c6cab18319a5b8ef585dd1630cb077
livenessProbe: livenessProbe:
httpGet: httpGet:

View File

@ -17,7 +17,7 @@ spec:
k8s-app: gcp-guest-agent k8s-app: gcp-guest-agent
spec: spec:
containers: containers:
- image: - image: gcpGuestAgentImage
name: gcp-guest-agent name: gcp-guest-agent
resources: {} resources: {}
securityContext: securityContext:

View File

@ -39,7 +39,7 @@ spec:
fieldRef: fieldRef:
apiVersion: v1 apiVersion: v1
fieldPath: status.hostIP fieldPath: status.hostIP
image: image: konnectivityImage
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /healthz path: /healthz

View File

@ -70,7 +70,7 @@ spec:
- name: CONSTEL_CSP - name: CONSTEL_CSP
value: QEMU value: QEMU
- name: constellation-uid - name: constellation-uid
value: 42424242424242 value: "42424242424242"
image: ghcr.io/edgelesssys/constellation/node-operator:v2.3.0-pre.0.20221108173951-34435e439604 image: ghcr.io/edgelesssys/constellation/node-operator:v2.3.0-pre.0.20221108173951-34435e439604
livenessProbe: livenessProbe:
httpGet: httpGet:

View File

@ -39,7 +39,7 @@ spec:
fieldRef: fieldRef:
apiVersion: v1 apiVersion: v1
fieldPath: status.hostIP fieldPath: status.hostIP
image: image: konnectivityImage
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /healthz path: /healthz