From 81247d8edf4bff5a6650ebd23723825e79a09c11 Mon Sep 17 00:00:00 2001 From: Jake Conkerton-Darby Date: Fri, 6 Sep 2024 11:37:42 +0100 Subject: [PATCH 1/4] CH-147 Add namespace to usesvolume labels and pod affinity selectors --- deployment-configuration/helm/templates/auto-database.yaml | 6 +++--- .../helm/templates/auto-deployments.yaml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deployment-configuration/helm/templates/auto-database.yaml b/deployment-configuration/helm/templates/auto-database.yaml index 6ec31380d..0658a47e8 100644 --- a/deployment-configuration/helm/templates/auto-database.yaml +++ b/deployment-configuration/helm/templates/auto-database.yaml @@ -32,7 +32,7 @@ metadata: name: {{ .app.harness.database.name | quote }} namespace: {{ .root.Values.namespace }} labels: - usesvolume: {{ .app.harness.database.name }} + usesvolume: {{ .app.harness.database.name }}-{{ .root.Values.namespace }} spec: replicas: 1 selector: @@ -43,7 +43,7 @@ spec: labels: app: {{ .app.harness.database.name | quote }} service: db - usesvolume: {{ .app.harness.database.name }} + usesvolume: {{ .app.harness.database.name }}-{{ .root.Values.namespace }} spec: affinity: podAffinity: @@ -53,7 +53,7 @@ spec: - key: usesvolume operator: In values: - - {{ .app.harness.database.name }} + - {{ .app.harness.database.name }}-{{ .root.Values.namespace }} topologyKey: "kubernetes.io/hostname" containers: - name: {{ .app.harness.database.name | quote }} diff --git a/deployment-configuration/helm/templates/auto-deployments.yaml b/deployment-configuration/helm/templates/auto-deployments.yaml index 6981c2fd4..2db3714d2 100644 --- a/deployment-configuration/helm/templates/auto-deployments.yaml +++ b/deployment-configuration/helm/templates/auto-deployments.yaml @@ -7,7 +7,7 @@ metadata: labels: app: {{ .app.harness.deployment.name| quote }} {{- if .app.harness.deployment.volume }} - usesvolume: {{ .app.harness.deployment.volume.name }} + usesvolume: {{ .app.harness.deployment.volume.name }}-{{ .root.Values.namespace }} {{- end }} {{- include "deploy_utils.labels" .root | indent 4 }} spec: @@ -26,7 +26,7 @@ spec: labels: app: {{ .app.harness.deployment.name| quote }} {{- if .app.harness.deployment.volume }} - usesvolume: {{ .app.harness.deployment.volume.name }} + usesvolume: {{ .app.harness.deployment.volume.name }}-{{ .root.Values.namespace }} {{- end }} {{- include "deploy_utils.labels" .root | indent 8 }} spec: @@ -44,7 +44,7 @@ spec: - key: usesvolume operator: In values: - - {{ .app.harness.deployment.volume.name }} + - {{ .app.harness.deployment.volume.name }}-{{ .root.Values.namespace }} topologyKey: "kubernetes.io/hostname" {{- end }} {{- end }} From ddaa206a91094d76582526ecfa80424dfb7548b6 Mon Sep 17 00:00:00 2001 From: Jake Conkerton-Darby Date: Mon, 9 Sep 2024 16:13:33 +0100 Subject: [PATCH 2/4] CH-137 Add obsoleted label match expression to remove issues with breaking changes --- deployment-configuration/helm/templates/auto-database.yaml | 1 + deployment-configuration/helm/templates/auto-deployments.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/deployment-configuration/helm/templates/auto-database.yaml b/deployment-configuration/helm/templates/auto-database.yaml index 0658a47e8..cd7f0bdd5 100644 --- a/deployment-configuration/helm/templates/auto-database.yaml +++ b/deployment-configuration/helm/templates/auto-database.yaml @@ -53,6 +53,7 @@ spec: - key: usesvolume operator: In values: + - {{ .app.harness.database.name }} # Obsolete, kept for backwards compatability, to be removed at a later date - {{ .app.harness.database.name }}-{{ .root.Values.namespace }} topologyKey: "kubernetes.io/hostname" containers: diff --git a/deployment-configuration/helm/templates/auto-deployments.yaml b/deployment-configuration/helm/templates/auto-deployments.yaml index 2db3714d2..66c34f55f 100644 --- a/deployment-configuration/helm/templates/auto-deployments.yaml +++ b/deployment-configuration/helm/templates/auto-deployments.yaml @@ -44,6 +44,7 @@ spec: - key: usesvolume operator: In values: + - {{ .app.harness.deployment.volume.name }} # Obsolete, kept for backwards compatability, to be removed at a later date - {{ .app.harness.deployment.volume.name }}-{{ .root.Values.namespace }} topologyKey: "kubernetes.io/hostname" {{- end }} From 89db313430b8ca4f740f0bc927c8df1606f31567 Mon Sep 17 00:00:00 2001 From: Jake Conkerton-Darby Date: Mon, 9 Sep 2024 16:32:56 +0100 Subject: [PATCH 3/4] CH-137 Move value to secondary selector to fix deployments --- deployment-configuration/helm/templates/auto-database.yaml | 7 ++++++- .../helm/templates/auto-deployments.yaml | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/deployment-configuration/helm/templates/auto-database.yaml b/deployment-configuration/helm/templates/auto-database.yaml index cd7f0bdd5..c2fb02dd9 100644 --- a/deployment-configuration/helm/templates/auto-database.yaml +++ b/deployment-configuration/helm/templates/auto-database.yaml @@ -53,8 +53,13 @@ spec: - key: usesvolume operator: In values: - - {{ .app.harness.database.name }} # Obsolete, kept for backwards compatability, to be removed at a later date - {{ .app.harness.database.name }}-{{ .root.Values.namespace }} + - labelSelector: + matchExpressions: + - key: usesvolume + operator: In + values: + - {{ .app.harness.database.name }} # Obsolete, kept for backwards compatability, to be removed at a later date topologyKey: "kubernetes.io/hostname" containers: - name: {{ .app.harness.database.name | quote }} diff --git a/deployment-configuration/helm/templates/auto-deployments.yaml b/deployment-configuration/helm/templates/auto-deployments.yaml index 66c34f55f..8c8bc047f 100644 --- a/deployment-configuration/helm/templates/auto-deployments.yaml +++ b/deployment-configuration/helm/templates/auto-deployments.yaml @@ -44,8 +44,13 @@ spec: - key: usesvolume operator: In values: - - {{ .app.harness.deployment.volume.name }} # Obsolete, kept for backwards compatability, to be removed at a later date - {{ .app.harness.deployment.volume.name }}-{{ .root.Values.namespace }} + - labelSelector: + matchExpressions: + - key: usesvolume + operator: In + values: + - {{ .app.harness.database.name }} # Obsolete, kept for backwards compatability, to be removed at a later date topologyKey: "kubernetes.io/hostname" {{- end }} {{- end }} From b972e82dbaa68148810e02a98492c24f2e91059a Mon Sep 17 00:00:00 2001 From: Jake Conkerton-Darby Date: Mon, 9 Sep 2024 18:10:19 +0100 Subject: [PATCH 4/4] CH-137 Reverting failed attempt --- deployment-configuration/helm/templates/auto-database.yaml | 5 ----- .../helm/templates/auto-deployments.yaml | 7 +------ 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/deployment-configuration/helm/templates/auto-database.yaml b/deployment-configuration/helm/templates/auto-database.yaml index c2fb02dd9..1399961a1 100644 --- a/deployment-configuration/helm/templates/auto-database.yaml +++ b/deployment-configuration/helm/templates/auto-database.yaml @@ -54,11 +54,6 @@ spec: operator: In values: - {{ .app.harness.database.name }}-{{ .root.Values.namespace }} - - labelSelector: - matchExpressions: - - key: usesvolume - operator: In - values: - {{ .app.harness.database.name }} # Obsolete, kept for backwards compatability, to be removed at a later date topologyKey: "kubernetes.io/hostname" containers: diff --git a/deployment-configuration/helm/templates/auto-deployments.yaml b/deployment-configuration/helm/templates/auto-deployments.yaml index 8c8bc047f..641d4852b 100644 --- a/deployment-configuration/helm/templates/auto-deployments.yaml +++ b/deployment-configuration/helm/templates/auto-deployments.yaml @@ -45,12 +45,7 @@ spec: operator: In values: - {{ .app.harness.deployment.volume.name }}-{{ .root.Values.namespace }} - - labelSelector: - matchExpressions: - - key: usesvolume - operator: In - values: - - {{ .app.harness.database.name }} # Obsolete, kept for backwards compatability, to be removed at a later date + - {{ .app.harness.deployment.volume.name }} # Obsolete, kept for backwards compatability, to be removed at a later date topologyKey: "kubernetes.io/hostname" {{- end }} {{- end }}