@@ -37,7 +37,7 @@ Common labels
3737*/ }}
3838{{- define " lago-rails.labels" -}}
3939helm.sh /chart: {{ include " lago-rails.chart" . }}
40- {{ include " lago-rails.selectorLabels" . }}
40+ {{ include " lago-rails.architecture. selectorLabels" . }}
4141{{- if .Chart.AppVersion }}
4242app.kubernetes.io /version: {{ .Chart.AppVersion | quote }}
4343{{- end }}
@@ -73,32 +73,40 @@ amd64 name.
7373{{- end }}
7474
7575{{/*
76- Create architecture-specific selector labels. The amd64 result delegates to
77- the existing helper so its rendered labels do not change.
76+ Create architecture-specific selector labels. Each architecture keeps its own
77+ `app.kubernetes.io/name`, so a Deployment selector matches only its own pods.
78+ The Deployment selector is immutable, so this helper must not change.
7879*/ }}
7980{{- define " lago-rails.architecture.selectorLabels" -}}
8081{{- if eq (include " lago-rails.architecture.isArm64" . ) " true" -}}
81- app.kubernetes.io /name: {{ printf " %s -arm64" .Values.internalArchitectureName | trunc 63 | trimSuffix " -" }}
82+ app.kubernetes.io /name: {{ printf " %s -arm64" (include " lago-rails.name " . ) | trunc 63 | trimSuffix " -" }}
8283app.kubernetes.io /instance: {{ .Release.Name }}
8384{{- else -}}
8485{{- include " lago-rails.selectorLabels" . -}}
8586{{- end -}}
8687{{- end }}
8788
8889{{/*
89- Create architecture-specific labels. The amd64 result delegates to the
90- existing helper so its rendered labels do not change.
90+ The architecture-independent label that every pod of this workload carries. The
91+ Service and the PodDisruptionBudget select it, so they reach the pods of all
92+ architectures.
9193*/ }}
92- {{- define " lago-rails.architecture.labels" -}}
93- {{- if eq (include " lago-rails.architecture.isArm64" . ) " true" -}}
94- helm.sh /chart: {{ include " lago-rails.chart" . }}
95- {{ include " lago-rails.architecture.selectorLabels" . }}
96- {{- if .Chart.AppVersion }}
97- app.kubernetes.io /version: {{ .Chart.AppVersion | quote }}
94+ {{- define " lago-rails.componentLabel" -}}
95+ app.kubernetes.io /component: {{ include " lago-rails.name" . }}
9896{{- end }}
99- app.kubernetes.io /managed-by: {{ .Release.Service }}
97+
98+ {{/*
99+ Selector labels for the Service and the PodDisruptionBudget. arm64 pods have a
100+ different `app.kubernetes.io/name`, so the selector moves to the `component`
101+ label when arm64 is enabled. Every pod already carries that label, because the
102+ chart adds it to all pod templates.
103+ */ }}
104+ {{- define " lago-rails.service.selectorLabels" -}}
105+ {{- if .Values.global.architectures.arm64.enabled -}}
106+ app.kubernetes.io /instance: {{ .Release.Name }}
107+ {{ include " lago-rails.componentLabel" . }}
100108{{- else -}}
101- {{- include " lago-rails.labels " . -}}
109+ {{- include " lago-rails.selectorLabels " . -}}
102110{{- end -}}
103111{{- end }}
104112
0 commit comments