diff --git a/charts/snyk-broker/templates/_helpers.tpl b/charts/snyk-broker/templates/_helpers.tpl index e023ce6..b41bf36 100644 --- a/charts/snyk-broker/templates/_helpers.tpl +++ b/charts/snyk-broker/templates/_helpers.tpl @@ -54,6 +54,13 @@ app.kubernetes.io/name: {{ include "snyk-broker.name" . }}{{if not .Values.disab app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} +{{/* +Pod labels (merge normal labels and selectors) +*/}} +{{- define "snyk-broker.podLabels" -}} +{{- merge (include "snyk-broker.labels" . | fromYaml ) (include "snyk-broker.selectorLabels" . | fromYaml) | toYaml -}} +{{- end }} + {{/* Create the name of the service account to use */}} @@ -113,7 +120,7 @@ Create the name of the broker service to use {{- $serviceLength := len $service -}} {{- $releaseNameLength := len .Release.Name -}} {{- $truncatedLength := int (sub 63 (add $serviceLength $releaseNameLength)) -}} -{{- .Values.scmType | trunc $truncatedLength }}{{ $service }}{{ .Release.Name }} +{{- .Values.scmType | trunc $truncatedLength }}{{ $service }}{{ .Release.Name }} {{- else }} {{- .Values.scmType | trunc 47 }}-broker-service {{- end -}} diff --git a/charts/snyk-broker/templates/broker_deployment.yaml b/charts/snyk-broker/templates/broker_deployment.yaml index 3e4e7ae..2f07a20 100644 --- a/charts/snyk-broker/templates/broker_deployment.yaml +++ b/charts/snyk-broker/templates/broker_deployment.yaml @@ -22,7 +22,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "snyk-broker.selectorLabels" . | nindent 8 }} + {{- include "snyk-broker.podLabels" . | nindent 8 }} spec: {{- if .Values.extraPodSpecs }} {{- toYaml .Values.extraPodSpecs | nindent 6 }} diff --git a/charts/snyk-broker/tests/__snapshot__/broker_cra_deployment_disablesuffixes_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_cra_deployment_disablesuffixes_test.yaml.snap index 30b3ae3..06e1c61 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_cra_deployment_disablesuffixes_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_cra_deployment_disablesuffixes_test.yaml.snap @@ -20,7 +20,9 @@ with CRA: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/broker_cra_deployment_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_cra_deployment_test.yaml.snap index 30b3ae3..06e1c61 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_cra_deployment_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_cra_deployment_test.yaml.snap @@ -20,7 +20,9 @@ with CRA: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_apprisk_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_apprisk_test.yaml.snap index 253a846..8b6c95b 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_apprisk_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_apprisk_test.yaml.snap @@ -20,7 +20,9 @@ apprisk enabled: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_artifactory_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_artifactory_test.yaml.snap index 088f2d8..1197ba8 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_artifactory_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_artifactory_test.yaml.snap @@ -20,7 +20,9 @@ should render artifactoryUrl and brokerClientValidationUrl as secrets: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_customaccept_disablesuffixes_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_customaccept_disablesuffixes_test.yaml.snap index 37b18af..3b6e25b 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_customaccept_disablesuffixes_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_customaccept_disablesuffixes_test.yaml.snap @@ -33,7 +33,9 @@ customaccept values: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_customaccept_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_customaccept_test.yaml.snap index af515d2..73adeee 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_customaccept_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_customaccept_test.yaml.snap @@ -33,7 +33,9 @@ customaccept values: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_disablesuffixes_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_disablesuffixes_test.yaml.snap index d07b1cd..3bc0e09 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_disablesuffixes_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_disablesuffixes_test.yaml.snap @@ -20,7 +20,9 @@ HA mode on: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: @@ -167,7 +169,9 @@ HA mode on with 4 replicas: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: @@ -314,7 +318,9 @@ default values: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: @@ -459,7 +465,9 @@ preflight checks off: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_ingress_disablesuffixes_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_ingress_disablesuffixes_test.yaml.snap index 7ba21ce..0283307 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_ingress_disablesuffixes_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_ingress_disablesuffixes_test.yaml.snap @@ -20,7 +20,9 @@ ingress: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_ingress_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_ingress_test.yaml.snap index a71a172..df7d27f 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_ingress_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_ingress_test.yaml.snap @@ -20,7 +20,9 @@ ingress: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_scm_token_pool_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_scm_token_pool_test.yaml.snap index 23079b5..cbf50db 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_scm_token_pool_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_scm_token_pool_test.yaml.snap @@ -20,7 +20,9 @@ github token pool configured: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: @@ -178,7 +180,9 @@ github token pool configured with enabled useExternalSecretScmTokenPool: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: @@ -328,7 +332,9 @@ gitlab token pool configured: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap index c36da32..6ed929e 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap @@ -20,7 +20,9 @@ HA mode on: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: @@ -167,7 +169,9 @@ HA mode on with 4 replicas: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: @@ -314,7 +318,9 @@ HTTPS enabled: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: @@ -478,7 +484,9 @@ default values: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: @@ -623,7 +631,9 @@ preflight checks off: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/cra_deployment_digitalocean_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/cra_deployment_digitalocean_test.yaml.snap index 7abee19..36cd62a 100644 --- a/charts/snyk-broker/tests/__snapshot__/cra_deployment_digitalocean_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/cra_deployment_digitalocean_test.yaml.snap @@ -20,7 +20,9 @@ default values: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/cra_deployment_disablesuffixes_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/cra_deployment_disablesuffixes_test.yaml.snap index fc8f6c9..82a54e7 100644 --- a/charts/snyk-broker/tests/__snapshot__/cra_deployment_disablesuffixes_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/cra_deployment_disablesuffixes_test.yaml.snap @@ -20,7 +20,9 @@ default values: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/cra_deployment_harbor_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/cra_deployment_harbor_test.yaml.snap index 6fb3b05..a96b761 100644 --- a/charts/snyk-broker/tests/__snapshot__/cra_deployment_harbor_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/cra_deployment_harbor_test.yaml.snap @@ -20,7 +20,9 @@ default values: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/__snapshot__/cra_deployment_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/cra_deployment_test.yaml.snap index ef50b51..0c8ff2e 100644 --- a/charts/snyk-broker/tests/__snapshot__/cra_deployment_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/cra_deployment_test.yaml.snap @@ -20,7 +20,9 @@ default values: metadata: labels: app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-0.0.0 spec: containers: - env: diff --git a/charts/snyk-broker/tests/broker_deployment_labels_test.yaml b/charts/snyk-broker/tests/broker_deployment_labels_test.yaml index d81b61a..d901fa7 100644 --- a/charts/snyk-broker/tests/broker_deployment_labels_test.yaml +++ b/charts/snyk-broker/tests/broker_deployment_labels_test.yaml @@ -10,8 +10,6 @@ values: tests: - it: handles duplicative labels and adds new labels - values: - - ./fixtures/default_values.yaml set: labels: app.kubernetes.io/name: "my duplicated label" @@ -25,3 +23,20 @@ tests: app.kubernetes.io/name: snyk-broker-RELEASE-NAME helm.sh/chart: snyk-broker-0.0.0 test: node1 + - it: sets a label + set: + labels: + costCenter: prodsec + asserts: + - equal: + path: metadata.labels.costCenter + value: prodsec + - it: sets a label on the broker pod + set: + labels: + costCenter: prodsec + asserts: + - equal: + path: spec.template.metadata.labels.costCenter + value: prodsec + template: broker_deployment.yaml