From 40fb8a7e4640d48589cdb0d87e57f1e2aa3af927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raymond=20Aug=C3=A9?= Date: Fri, 7 Feb 2025 11:34:10 -0500 Subject: [PATCH 1/2] qualify the service selectors to make sure they don't match other internal services --- templates/headless-service.yml | 2 ++ templates/service.yaml | 5 ++++- templates/statefulset.yaml | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/templates/headless-service.yml b/templates/headless-service.yml index 74abe3b..bc40082 100644 --- a/templates/headless-service.yml +++ b/templates/headless-service.yml @@ -3,6 +3,7 @@ kind: Service metadata: name: {{ include "liferay.fullname" . }}-headless labels: + app: {{ $.Chart.Name }} {{- include "liferay.labels" . | nindent 4 }} spec: clusterIP: None # This is what makes it headless @@ -16,4 +17,5 @@ spec: protocol: TCP name: http selector: + app: {{ $.Chart.Name }} {{- include "liferay.selectorLabels" . | nindent 4 }} diff --git a/templates/service.yaml b/templates/service.yaml index 1890c4d..c6684cd 100644 --- a/templates/service.yaml +++ b/templates/service.yaml @@ -3,6 +3,7 @@ kind: Service metadata: name: {{ include "liferay.fullname" . }} labels: + app: {{ $.Chart.Name }} {{- include "liferay.labels" . | nindent 4 }} {{- with .Values.service.annotations }} annotations: @@ -15,4 +16,6 @@ spec: targetPort: http protocol: TCP name: http - selector: {{- include "liferay.selectorLabels" . | nindent 4 }} + selector: + app: {{ $.Chart.Name }} + {{- include "liferay.selectorLabels" . | nindent 4 }} diff --git a/templates/statefulset.yaml b/templates/statefulset.yaml index cb3412f..8636b28 100644 --- a/templates/statefulset.yaml +++ b/templates/statefulset.yaml @@ -3,6 +3,7 @@ kind: StatefulSet metadata: name: {{ include "liferay.fullname" . }} labels: + app: {{ $.Chart.Name }} {{- include "liferay.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} @@ -10,6 +11,7 @@ spec: {{- end }} selector: matchLabels: + app: {{ $.Chart.Name }} {{- include "liferay.selectorLabels" . | nindent 6 }} serviceName: {{ include "liferay.fullname" . }} template: @@ -19,6 +21,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: + app: {{ $.Chart.Name }} {{- include "liferay.labels" . | nindent 8 }} {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} From 5e9f37340a96a46b1d567afc1f9a14769b106041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raymond=20Aug=C3=A9?= Date: Fri, 7 Feb 2025 11:34:37 -0500 Subject: [PATCH 2/2] use selectorLabels appropriately --- templates/database/statefulset.yaml | 4 ++-- templates/objectstorage/statefulset.yaml | 4 ++-- templates/search/statefulset.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/database/statefulset.yaml b/templates/database/statefulset.yaml index 29dabcb..c6f3c22 100644 --- a/templates/database/statefulset.yaml +++ b/templates/database/statefulset.yaml @@ -101,7 +101,7 @@ metadata: spec: selector: app: {{ $.Chart.Name }}-database - {{- include "liferay.labels" $ | nindent 4 }} + {{- include "liferay.selectorLabels" $ | nindent 4 }} ports: - name: database port: {{ .config.port }} @@ -120,7 +120,7 @@ spec: clusterIP: None # This is what makes it headless selector: app: {{ $.Chart.Name }}-database - {{- include "liferay.labels" $ | nindent 4 }} + {{- include "liferay.selectorLabels" $ | nindent 4 }} ports: - name: database port: {{ .config.port }} diff --git a/templates/objectstorage/statefulset.yaml b/templates/objectstorage/statefulset.yaml index 4d95a59..7885134 100644 --- a/templates/objectstorage/statefulset.yaml +++ b/templates/objectstorage/statefulset.yaml @@ -159,7 +159,7 @@ metadata: spec: selector: app: {{ $.Chart.Name }}-objectstorage - {{- include "liferay.labels" $ | nindent 4 }} + {{- include "liferay.selectorLabels" $ | nindent 4 }} ports: - name: api port: {{ .config.ports.api }} @@ -182,7 +182,7 @@ spec: clusterIP: None # This is what makes it headless selector: app: {{ $.Chart.Name }}-objectstorage - {{- include "liferay.labels" $ | nindent 4 }} + {{- include "liferay.selectorLabels" $ | nindent 4 }} ports: - name: api port: {{ .config.ports.api }} diff --git a/templates/search/statefulset.yaml b/templates/search/statefulset.yaml index fa09837..800f609 100644 --- a/templates/search/statefulset.yaml +++ b/templates/search/statefulset.yaml @@ -152,7 +152,7 @@ metadata: spec: selector: app: {{ $.Chart.Name }}-search - {{- include "liferay.labels" $ | nindent 4 }} + {{- include "liferay.selectorLabels" $ | nindent 4 }} ports: - name: search port: {{ .config.port }} @@ -171,7 +171,7 @@ spec: clusterIP: None # This is what makes it headless selector: app: {{ $.Chart.Name }}-search - {{- include "liferay.labels" $ | nindent 4 }} + {{- include "liferay.selectorLabels" $ | nindent 4 }} ports: - name: search port: {{ .config.port }}