fix label matching for worker and apps
Signed-off-by: Pascal Sthamer <pascal+github@sthamer.xyz>
This commit is contained in:
@@ -76,7 +76,7 @@ app.kubernetes.io/part-of: shuffle
|
||||
{{- with .context.Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ . | replace "+" "_" | quote }}
|
||||
{{- end -}}
|
||||
{{- if .customValues }}
|
||||
{{- if .customLabels }}
|
||||
{{- range $key, $value := .customLabels }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
@@ -84,12 +84,27 @@ app.kubernetes.io/version: {{ . | replace "+" "_" | quote }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the match labels for workers.
|
||||
These must match the labels of helm-deployed workers (shuffle.workerInstance.labels),
|
||||
Return the labels to match ALL workers.
|
||||
These match the labels of helm-deployed workers (shuffle.workerInstance.labels),
|
||||
as well as orborus-deployed workers (deployk8sworker).
|
||||
*/}}
|
||||
{{- define "shuffle.worker.matchLabels" -}}
|
||||
app.kubernetes.io/name: shuffle-worker
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the labels to match a helm-deployed worker.
|
||||
Usage:
|
||||
{{ include "shuffle.workerInstance.matchLabels" (dict "customLabels" .Values.commonLabels "context" $) -}}
|
||||
*/}}
|
||||
{{- define "shuffle.workerInstance.matchLabels" -}}
|
||||
app.kubernetes.io/name: shuffle-worker
|
||||
app.kubernetes.io/instance: {{ .context.Release.Name }}
|
||||
{{- if .customLabels }}
|
||||
{{- range $key, $value := .customLabels }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
|
||||
+3
-4
@@ -9,9 +9,8 @@ metadata:
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.worker.podLabels .Values.commonLabels ) "context" . ) }}
|
||||
podSelector:
|
||||
matchLabels: {{- include "shuffle.workerInstance.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
|
||||
matchLabels: {{- include "shuffle.worker.matchLabels" . | nindent 6 }}
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
@@ -35,7 +34,7 @@ spec:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: {{ .Release.Namespace }}
|
||||
podSelector:
|
||||
matchLabels: {{ include "shuffle.appInstance.matchLabels" . | nindent 14 }}
|
||||
matchLabels: {{- include "shuffle.app.matchLabels" . | nindent 14 }}
|
||||
{{- if .Values.worker.networkPolicy.extraEgress }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.worker.networkPolicy.extraEgress "context" $ ) | nindent 4 }}
|
||||
{{- end }}
|
||||
@@ -57,7 +56,7 @@ spec:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: {{ .Release.Namespace }}
|
||||
podSelector:
|
||||
matchLabels: {{ include "shuffle.appInstance.matchLabels" . | nindent 14 }}
|
||||
matchLabels: {{- include "shuffle.app.matchLabels" . | nindent 14 }}
|
||||
{{- end }}
|
||||
{{- if .Values.worker.networkPolicy.extraIngress }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.worker.networkPolicy.extraIngress "context" $ ) | nindent 4 }}
|
||||
|
||||
+2
-1
@@ -17,5 +17,6 @@ spec:
|
||||
targetPort: 33333
|
||||
protocol: TCP
|
||||
appProtocol: http
|
||||
selector: {{- include "shuffle.workerInstance.matchLabels" $ | nindent 4 }}
|
||||
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.worker.podLabels .Values.commonLabels ) "context" . ) }}
|
||||
selector: {{- include "shuffle.workerInstance.matchLabels" (dict "customLabels" $podLabels "context" .) | nindent 4 }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user