Skip to content

Commit fdc4524

Browse files
authored
[bitnami/pytorch] Support for customizing standard labels (#18415)
1 parent d982daa commit fdc4524

File tree

8 files changed

+36
-65
lines changed

8 files changed

+36
-65
lines changed

bitnami/pytorch/Chart.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dependencies:
22
- name: common
33
repository: oci://registry-1.docker.io/bitnamicharts
4-
version: 2.8.0
5-
digest: sha256:0119fce6b509ebf3eaf5218f87f6ec0af64ec7da15f272115673b0716c4b6919
6-
generated: "2023-08-17T19:14:23.567627188Z"
4+
version: 2.9.0
5+
digest: sha256:416ad278a896f0e9b51d5305bef5d875c7cca6fbb64b75e1f131b04763e2aff9
6+
generated: "2023-08-22T14:29:31.647117+02:00"

bitnami/pytorch/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ maintainers:
3232
url: https://github.com/bitnami/charts
3333
name: pytorch
3434
sources:
35-
- https://github.com/bitnami/charts/tree/main/bitnami/pytorch
36-
version: 3.2.11
35+
- https://github.com/bitnami/charts/tree/main/bitnami/pytorch
36+
version: 3.3.0

bitnami/pytorch/templates/configmap.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ kind: ConfigMap
99
metadata:
1010
name: {{ printf "%s-files" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
1111
namespace: {{ include "common.names.namespace" . | quote }}
12-
labels: {{- include "common.labels.standard" . | nindent 4 }}
13-
{{- if .Values.commonLabels }}
14-
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
15-
{{- end }}
12+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1613
{{- if .Values.commonAnnotations }}
1714
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
1815
{{- end }}

bitnami/pytorch/templates/deployment.yaml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ kind: Deployment
88
metadata:
99
name: {{ include "pytorch.master.name" . }}
1010
namespace: {{ include "common.names.namespace" . | quote }}
11-
labels: {{- include "common.labels.standard" . | nindent 4 }}
11+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1212
app.kubernetes.io/component: master
13-
{{- if .Values.commonLabels }}
14-
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
15-
{{- end }}
1613
{{- if .Values.commonAnnotations }}
1714
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
1815
{{- end }}
@@ -21,19 +18,17 @@ spec:
2118
{{- if .Values.updateStrategy }}
2219
strategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
2320
{{- end }}
21+
{{- $podLabels := merge .Values.podLabels .Values.commonLabels }}
2422
selector:
25-
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
23+
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
2624
app.kubernetes.io/component: master
2725
template:
2826
metadata:
2927
{{- if .Values.podAnnotations }}
3028
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
3129
{{- end }}
32-
labels: {{- include "common.labels.standard" . | nindent 8 }}
30+
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
3331
app.kubernetes.io/component: master
34-
{{- if .Values.podLabels }}
35-
{{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
36-
{{- end }}
3732
spec:
3833
{{- include "pytorch.imagePullSecrets" . | nindent 6 }}
3934
{{- if .Values.hostAliases }}
@@ -43,8 +38,8 @@ spec:
4338
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }}
4439
{{- else }}
4540
affinity:
46-
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "component" "master" "context" $) | nindent 10 }}
47-
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "component" "master" "context" $) | nindent 10 }}
41+
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "component" "master" "customLabels" $podLabels "context" $) | nindent 10 }}
42+
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "component" "master" "customLabels" $podLabels "context" $) | nindent 10 }}
4843
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
4944
{{- end }}
5045
{{- if .Values.nodeSelector }}

bitnami/pytorch/templates/headless-svc.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,16 @@ kind: Service
1010
metadata:
1111
name: {{ printf "%s-headless" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
1212
namespace: {{ include "common.names.namespace" . | quote }}
13-
labels: {{- include "common.labels.standard" . | nindent 4 }}
13+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1414
app.kubernetes.io/component: worker
1515
{{- if or .Values.commonAnnotations .Values.service.headless.annotations }}
16-
annotations:
17-
{{- if .Values.service.headless.annotations }}
18-
{{- include "common.tplvalues.render" ( dict "value" .Values.service.headless.annotations "context" $ ) | nindent 4 }}
19-
{{- end }}
20-
{{- if .Values.commonAnnotations }}
21-
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
22-
{{- end }}
16+
{{- $annotations := merge .Values.service.headless.annotations .Values.commonAnnotations }}
17+
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
2318
{{- end }}
2419
spec:
2520
type: ClusterIP
2621
clusterIP: None
27-
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
22+
{{- $podLabels := merge .Values.podLabels .Values.commonLabels }}
23+
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
2824
app.kubernetes.io/component: worker
2925
{{- end }}

bitnami/pytorch/templates/pvc.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,10 @@ apiVersion: v1
99
metadata:
1010
name: {{ template "pytorch.master.name" . }}
1111
namespace: {{ include "common.names.namespace" . | quote }}
12-
labels: {{- include "common.labels.standard" . | nindent 4 }}
13-
{{- if .Values.commonLabels }}
14-
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
15-
{{- end }}
12+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1613
{{- if or .Values.persistence.annotations .Values.commonAnnotations }}
17-
annotations:
18-
{{- if .Values.persistence.annotations }}
19-
{{- include "common.tplvalues.render" ( dict "value" .Values.persistence.annotations "context" $ ) | nindent 4 }}
20-
{{- end }}
21-
{{- if .Values.commonAnnotations }}
22-
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
23-
{{- end }}
14+
{{- $annotations := merge .Values.persistence.annotations .Values.commonAnnotations }}
15+
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
2416
{{- end }}
2517
spec:
2618
accessModes:

bitnami/pytorch/templates/service.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ kind: Service
88
metadata:
99
name: {{ include "common.names.fullname" . }}
1010
namespace: {{ include "common.names.namespace" . | quote }}
11-
labels: {{- include "common.labels.standard" . | nindent 4 }}
11+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1212
app.kubernetes.io/component: master
13-
{{- if .Values.commonLabels }}
14-
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
15-
{{- end }}
16-
{{- if .Values.service.annotations }}
17-
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $) | nindent 4 }}
13+
{{- if or .Values.commonAnnotations .Values.service.annotations }}
14+
{{- $annotations := merge .Values.service.annotations .Values.commonAnnotations }}
15+
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
1816
{{- end }}
1917
spec:
2018
type: {{ .Values.service.type }}
@@ -42,5 +40,6 @@ spec:
4240
{{- if .Values.service.extraPorts }}
4341
{{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }}
4442
{{- end }}
45-
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
43+
{{- $podLabels := merge .Values.podLabels .Values.commonLabels }}
44+
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
4645
app.kubernetes.io/component: master

bitnami/pytorch/templates/statefulset.yaml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,15 @@ kind: StatefulSet
1010
metadata:
1111
name: {{ printf "%s-worker" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
1212
namespace: {{ include "common.names.namespace" . | quote }}
13-
labels: {{- include "common.labels.standard" . | nindent 4 }}
13+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
1414
app.kubernetes.io/component: worker
15-
{{- if .Values.commonLabels }}
16-
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
17-
{{- end }}
1815
spec:
1916
replicas: 1
2017
podManagementPolicy: {{ .Values.podManagementPolicy | quote }}
2118
serviceName: {{ printf "%s-headless" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
19+
{{- $podLabels := merge .Values.podLabels .Values.commonLabels }}
2220
selector:
23-
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
21+
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }}
2422
app.kubernetes.io/component: worker
2523
{{- if .Values.updateStrategy }}
2624
updateStrategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
@@ -30,11 +28,8 @@ spec:
3028
{{- if .Values.podAnnotations }}
3129
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
3230
{{- end }}
33-
labels: {{- include "common.labels.standard" . | nindent 8 }}
31+
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }}
3432
app.kubernetes.io/component: worker
35-
{{- if .Values.podLabels }}
36-
{{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
37-
{{- end }}
3833
spec:
3934
{{- include "pytorch.imagePullSecrets" . | nindent 6 }}
4035
{{- if .Values.hostAliases }}
@@ -44,8 +39,8 @@ spec:
4439
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }}
4540
{{- else }}
4641
affinity:
47-
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "component" "worker" "context" $) | nindent 10 }}
48-
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "component" "worker" "context" $) | nindent 10 }}
42+
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "component" "worker" "customLabels" $podLabels "context" $) | nindent 10 }}
43+
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "component" "worker" "customLabels" $podLabels "context" $) | nindent 10 }}
4944
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
5045
{{- end }}
5146
{{- if .Values.nodeSelector }}
@@ -234,13 +229,10 @@ spec:
234229
volumeClaimTemplates:
235230
- metadata:
236231
name: data
237-
annotations:
238-
{{- if .Values.persistence.annotations }}
239-
{{- include "common.tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
240-
{{- end }}
241-
{{- if .Values.commonAnnotations }}
242-
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 10 }}
243-
{{- end }}
232+
{{- if or .Values.commonAnnotations .Values.persistence.annotations }}
233+
{{- $annotations := merge .Values.persistence.annotations .Values.commonAnnotations }}
234+
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 10 }}
235+
{{- end }}
244236
{{- if .Values.commonLabels }}
245237
labels: {{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 10 }}
246238
{{- end }}

0 commit comments

Comments
 (0)