From e839938fc35b86c1797e88bb32810a2210764d16 Mon Sep 17 00:00:00 2001 From: Ben Starmer-Smith Date: Wed, 26 Mar 2025 15:09:55 +0000 Subject: [PATCH 1/3] Brought the way we handled the deployment and ingress labels and annotations inline with what we do for Console. --- charts/gateway/templates/deployment.yaml | 27 ++++++++++++++++++------ charts/gateway/templates/ingress.yaml | 5 ++++- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/charts/gateway/templates/deployment.yaml b/charts/gateway/templates/deployment.yaml index b2fef2be..b82c2010 100644 --- a/charts/gateway/templates/deployment.yaml +++ b/charts/gateway/templates/deployment.yaml @@ -2,7 +2,14 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "conduktor-gateway.fullname" . }} - labels: {{ include "conduktor-gateway.labels" . | nindent 4 }} + labels: {{- include "conduktor-gateway.labels" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} spec: selector: matchLabels: {{ include "conduktor-gateway.podSelectorLabels" . | nindent 6 }} @@ -12,18 +19,24 @@ spec: template: metadata: annotations: + {{- if .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 8 }} + {{- end }} + {{- if .Values.gateway.podAnnotations }} + {{- include "common.tplvalues.render" (dict "value" .Values.gateway.podAnnotations "context" $) | nindent 8 }} + {{- end }} checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/self-secrets: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} {{- if .Values.gateway.secretSha256sum }} checksum/secret: {{ .Values.gateway.secretSha256sum }} {{- end }} - {{- with .Values.gateway.podAnnotations }} - {{- toYaml . | nindent 8 }} + labels: {{- include "conduktor-gateway.labels" . | nindent 8 }} + {{- if .Values.gateway.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.gateway.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 8 }} {{- end }} - labels: {{ include "conduktor-gateway.labels" . | nindent 8 }} - {{- if .Values.gateway.podLabels }} - {{- toYaml .Values.gateway.podLabels | nindent 8 }} - {{- end }} spec: containers: - name: gateway diff --git a/charts/gateway/templates/ingress.yaml b/charts/gateway/templates/ingress.yaml index a2c27758..7841d824 100644 --- a/charts/gateway/templates/ingress.yaml +++ b/charts/gateway/templates/ingress.yaml @@ -4,7 +4,10 @@ kind: Ingress metadata: name: {{ template "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{ include "conduktor-gateway.labels" . | nindent 4 }} + labels: {{- include "conduktor-gateway.labels" . | nindent 4 }} + {{- with .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 4 }} + {{- end }} {{- if or .Values.ingress.annotations .Values.commonAnnotations }} annotations: {{- if .Values.ingress.annotations }} From 30460737f8e5bae54f624057c00707c90a1b52b3 Mon Sep 17 00:00:00 2001 From: Ben Starmer-Smith Date: Wed, 26 Mar 2025 16:22:01 +0000 Subject: [PATCH 2/3] Use with instead of if. --- charts/gateway/templates/deployment.yaml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/charts/gateway/templates/deployment.yaml b/charts/gateway/templates/deployment.yaml index b82c2010..044aa9ab 100644 --- a/charts/gateway/templates/deployment.yaml +++ b/charts/gateway/templates/deployment.yaml @@ -3,12 +3,12 @@ kind: Deployment metadata: name: {{ include "conduktor-gateway.fullname" . }} labels: {{- include "conduktor-gateway.labels" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- with .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 4 }} {{- end }} annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- with .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 4 }} {{- end }} spec: selector: @@ -19,11 +19,11 @@ spec: template: metadata: annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 8 }} + {{- with .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }} {{- end }} - {{- if .Values.gateway.podAnnotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.gateway.podAnnotations "context" $) | nindent 8 }} + {{- with .Values.gateway.podAnnotations }} + {{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 8 }} {{- end }} checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/self-secrets: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} @@ -31,11 +31,11 @@ spec: checksum/secret: {{ .Values.gateway.secretSha256sum }} {{- end }} labels: {{- include "conduktor-gateway.labels" . | nindent 8 }} - {{- if .Values.gateway.podLabels }} - {{- include "common.tplvalues.render" (dict "value" .Values.gateway.podLabels "context" $) | nindent 8 }} + {{- with .Values.gateway.podLabels }} + {{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 8 }} {{- end }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 8 }} + {{- with .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }} {{- end }} spec: containers: From 2c661eb16b34d5f6d9149541bf86812f90fbf02d Mon Sep 17 00:00:00 2001 From: Ben Starmer-Smith Date: Thu, 27 Mar 2025 12:41:09 +0000 Subject: [PATCH 3/3] Made all gateway resources use conduktor-gateway.labels --- charts/gateway/templates/deployment.yaml | 8 +------- charts/gateway/templates/ingress.yaml | 5 +---- charts/gateway/templates/service-external.yaml | 5 +---- charts/gateway/templates/service-internal.yaml | 3 --- charts/gateway/templates/serviceaccount.yaml | 3 --- 5 files changed, 3 insertions(+), 21 deletions(-) diff --git a/charts/gateway/templates/deployment.yaml b/charts/gateway/templates/deployment.yaml index 044aa9ab..443192f2 100644 --- a/charts/gateway/templates/deployment.yaml +++ b/charts/gateway/templates/deployment.yaml @@ -2,10 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "conduktor-gateway.fullname" . }} - labels: {{- include "conduktor-gateway.labels" . | nindent 4 }} - {{- with .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 4 }} - {{- end }} + labels: {{ include "conduktor-gateway.labels" . | nindent 4 }} annotations: {{- with .Values.commonAnnotations }} {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 4 }} @@ -34,9 +31,6 @@ spec: {{- with .Values.gateway.podLabels }} {{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 8 }} {{- end }} - {{- with .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }} - {{- end }} spec: containers: - name: gateway diff --git a/charts/gateway/templates/ingress.yaml b/charts/gateway/templates/ingress.yaml index 7841d824..a2c27758 100644 --- a/charts/gateway/templates/ingress.yaml +++ b/charts/gateway/templates/ingress.yaml @@ -4,10 +4,7 @@ kind: Ingress metadata: name: {{ template "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{- include "conduktor-gateway.labels" . | nindent 4 }} - {{- with .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 4 }} - {{- end }} + labels: {{ include "conduktor-gateway.labels" . | nindent 4 }} {{- if or .Values.ingress.annotations .Values.commonAnnotations }} annotations: {{- if .Values.ingress.annotations }} diff --git a/charts/gateway/templates/service-external.yaml b/charts/gateway/templates/service-external.yaml index ba904d24..7902cc6e 100644 --- a/charts/gateway/templates/service-external.yaml +++ b/charts/gateway/templates/service-external.yaml @@ -4,14 +4,11 @@ kind: Service metadata: name: {{ include "conduktor-gateway.externalServiceName" . }} namespace: {{ include "common.names.namespace" . | quote }} - labels: {{ include "common.labels.standard" . | nindent 4 }} + labels: {{ include "conduktor-gateway.labels" . | nindent 4 }} app.kubernetes.io/component: conduktor-gateway {{- with .Values.service.external.labels }} {{- include "common.tplvalues.render" ( dict "value" . "context" $) | nindent 4 }} {{- end }} - {{- with .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 4 }} - {{- end }} {{- if or .Values.service.external.annotations .Values.commonAnnotations }} annotations: {{- with .Values.service.external.annotations }} diff --git a/charts/gateway/templates/service-internal.yaml b/charts/gateway/templates/service-internal.yaml index c7eb0c42..3da14675 100644 --- a/charts/gateway/templates/service-internal.yaml +++ b/charts/gateway/templates/service-internal.yaml @@ -8,9 +8,6 @@ metadata: {{- with .Values.service.internal.labels }} {{- include "common.tplvalues.render" ( dict "value" . "context" $) | nindent 4 }} {{- end }} - {{- with .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.metrics.prometheus.enable }} metrics.conduktor.io/prometheus: {{ .Values.metrics.prometheus.enable | quote }} {{- end }} diff --git a/charts/gateway/templates/serviceaccount.yaml b/charts/gateway/templates/serviceaccount.yaml index 82a2d9a0..ea0fdcf4 100644 --- a/charts/gateway/templates/serviceaccount.yaml +++ b/charts/gateway/templates/serviceaccount.yaml @@ -5,9 +5,6 @@ metadata: name: {{ template "conduktor-gateway.serviceAccountName" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{ include "conduktor-gateway.labels" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if or .Values.serviceAccount.annotations .Values.commonAnnotations }} annotations: {{- if .Values.commonAnnotations }}