From ced91cc89faae42e21c69c702959f1dc771e4c0b Mon Sep 17 00:00:00 2001 From: Juan Ariza Toledano Date: Wed, 23 Aug 2023 17:13:45 +0200 Subject: [PATCH] [bitnami/jupyterhub] Support for customizing standard labels (#18555) --- bitnami/jupyterhub/Chart.lock | 8 ++++---- bitnami/jupyterhub/Chart.yaml | 2 +- .../jupyterhub/templates/hub/configmap.yaml | 5 +---- .../jupyterhub/templates/hub/deployment.yaml | 17 ++++++----------- .../templates/hub/externaldb-secrets.yaml | 5 +---- .../templates/hub/networkpolicy.yaml | 13 ++++++------- bitnami/jupyterhub/templates/hub/pdb.yaml | 8 +++----- bitnami/jupyterhub/templates/hub/role.yaml | 5 +---- .../jupyterhub/templates/hub/rolebinding.yaml | 5 +---- bitnami/jupyterhub/templates/hub/secret.yaml | 5 +---- .../templates/hub/service-account.yaml | 16 +++++----------- bitnami/jupyterhub/templates/hub/service.yaml | 19 +++++++------------ .../templates/hub/servicemonitor.yaml | 17 ++++------------- .../templates/image-puller/daemonset.yaml | 17 ++++++----------- .../templates/proxy/deployment.yaml | 17 ++++++----------- .../jupyterhub/templates/proxy/ingress.yaml | 13 ++++--------- .../templates/proxy/networkpolicy.yaml | 14 ++++++-------- bitnami/jupyterhub/templates/proxy/pdb.yaml | 13 +++++++------ .../templates/proxy/service-account.yaml | 16 +++++----------- .../templates/proxy/service-api.yaml | 19 +++++++------------ .../templates/proxy/service-metrics.yaml | 19 +++++++------------ .../templates/proxy/service-public.yaml | 19 +++++++------------ .../templates/proxy/servicemonitor.yaml | 17 ++++------------- .../templates/proxy/tls-secret.yaml | 10 ++-------- .../templates/singleuser/networkpolicy.yaml | 10 ++++------ .../templates/singleuser/service-account.yaml | 16 +++++----------- bitnami/jupyterhub/values.yaml | 7 ++----- 27 files changed, 113 insertions(+), 219 deletions(-) diff --git a/bitnami/jupyterhub/Chart.lock b/bitnami/jupyterhub/Chart.lock index ccfe0484ec..8817266bcd 100644 --- a/bitnami/jupyterhub/Chart.lock +++ b/bitnami/jupyterhub/Chart.lock @@ -1,9 +1,9 @@ dependencies: - name: postgresql repository: oci://registry-1.docker.io/bitnamicharts - version: 12.8.3 + version: 12.9.0 - name: common repository: oci://registry-1.docker.io/bitnamicharts - version: 2.8.0 -digest: sha256:3e0d01f64a38d3e892f9b44ed3f8bf43b82c3011f3d16cd021de491520699f5f -generated: "2023-08-19T20:48:01.182675879Z" + version: 2.9.0 +digest: sha256:3e3373b4d5b1b1fce1711b2f257e9e2414ef3287484581210a7a9f044d872943 +generated: "2023-08-23T12:42:27.243297+02:00" diff --git a/bitnami/jupyterhub/Chart.yaml b/bitnami/jupyterhub/Chart.yaml index e084862b12..490a2f022d 100644 --- a/bitnami/jupyterhub/Chart.yaml +++ b/bitnami/jupyterhub/Chart.yaml @@ -37,4 +37,4 @@ maintainers: name: jupyterhub sources: - https://github.com/bitnami/charts/tree/main/bitnami/jupyterhub -version: 4.1.11 +version: 4.2.0 diff --git a/bitnami/jupyterhub/templates/hub/configmap.yaml b/bitnami/jupyterhub/templates/hub/configmap.yaml index 008aa88767..ffeed5dfff 100644 --- a/bitnami/jupyterhub/templates/hub/configmap.yaml +++ b/bitnami/jupyterhub/templates/hub/configmap.yaml @@ -7,11 +7,8 @@ SPDX-License-Identifier: APACHE-2.0 apiVersion: v1 kind: ConfigMap metadata: - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: hub - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} name: {{ include "jupyterhub.hub.name" . }} namespace: {{ .Release.Namespace | quote }} {{- if .Values.commonAnnotations }} diff --git a/bitnami/jupyterhub/templates/hub/deployment.yaml b/bitnami/jupyterhub/templates/hub/deployment.yaml index 709efb05e9..3d400c177d 100644 --- a/bitnami/jupyterhub/templates/hub/deployment.yaml +++ b/bitnami/jupyterhub/templates/hub/deployment.yaml @@ -8,11 +8,8 @@ kind: Deployment metadata: name: {{ include "jupyterhub.hub.name" . }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: hub - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -20,8 +17,9 @@ spec: {{- if .Values.hub.updateStrategy }} strategy: {{- toYaml .Values.hub.updateStrategy | nindent 4 }} {{- end }} + {{- $podLabels := merge .Values.hub.podLabels .Values.commonLabels }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: hub template: metadata: @@ -35,14 +33,11 @@ spec: {{- if empty .Values.hub.existingSecret }} checksum/hub-secret: {{ include (print $.Template.BasePath "/hub/secret.yaml") . | sha256sum }} {{- end }} - labels: {{- include "common.labels.standard" . | nindent 8 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }} app.kubernetes.io/component: hub hub.jupyter.org/network-access-proxy-api: "true" hub.jupyter.org/network-access-proxy-http: "true" hub.jupyter.org/network-access-singleuser: "true" - {{- if .Values.hub.podLabels }} - {{- include "common.tplvalues.render" (dict "value" .Values.hub.podLabels "context" $) | nindent 8 }} - {{- end }} spec: serviceAccountName: {{ template "jupyterhub.hubServiceAccountName" . }} {{- include "jupyterhub.imagePullSecrets" . | nindent 6 }} @@ -53,8 +48,8 @@ spec: affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.hub.affinity "context" $) | nindent 8 }} {{- else }} affinity: - podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.hub.podAffinityPreset "component" "hub" "context" $) | nindent 10 }} - podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.hub.podAntiAffinityPreset "component" "hub" "context" $) | nindent 10 }} + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.hub.podAffinityPreset "component" "hub" "customLabels" $podLabels "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.hub.podAntiAffinityPreset "component" "hub" "customLabels" $podLabels "context" $) | nindent 10 }} nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.hub.nodeAffinityPreset.type "key" .Values.hub.nodeAffinityPreset.key "values" .Values.hub.nodeAffinityPreset.values) | nindent 10 }} {{- end }} {{- if .Values.hub.nodeSelector }} diff --git a/bitnami/jupyterhub/templates/hub/externaldb-secrets.yaml b/bitnami/jupyterhub/templates/hub/externaldb-secrets.yaml index 228be0c870..90b2a41532 100644 --- a/bitnami/jupyterhub/templates/hub/externaldb-secrets.yaml +++ b/bitnami/jupyterhub/templates/hub/externaldb-secrets.yaml @@ -8,10 +8,7 @@ apiVersion: v1 kind: Secret metadata: name: {{ printf "%s-%s" .Release.Name "externaldb" | trunc 63 | trimSuffix "-" }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: hub namespace: {{ .Release.Namespace | quote }} {{- if .Values.commonAnnotations }} diff --git a/bitnami/jupyterhub/templates/hub/networkpolicy.yaml b/bitnami/jupyterhub/templates/hub/networkpolicy.yaml index 20de592996..0016434058 100644 --- a/bitnami/jupyterhub/templates/hub/networkpolicy.yaml +++ b/bitnami/jupyterhub/templates/hub/networkpolicy.yaml @@ -7,19 +7,17 @@ SPDX-License-Identifier: APACHE-2.0 apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }} kind: NetworkPolicy metadata: - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: hub - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} name: {{ include "jupyterhub.hub.name" . }} namespace: {{ .Release.Namespace | quote }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} spec: + {{- $hubPodLabels := merge .Values.hub.podLabels .Values.commonLabels }} podSelector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $hubPodLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: hub policyTypes: - Ingress @@ -55,15 +53,16 @@ spec: - ports: - port: {{ .Values.proxy.containerPort.api }} to: + {{- $proxyPodLabels := merge .Values.proxy.podLabels .Values.commonLabels }} - podSelector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 14 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $proxyPodLabels "context" $ ) | nindent 14 }} app.kubernetes.io/component: proxy # Hub --> Single User - ports: - port: {{ .Values.singleuser.containerPort }} to: - podSelector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 14 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }} app.kubernetes.io/component: singleuser ## DNS access - ports: diff --git a/bitnami/jupyterhub/templates/hub/pdb.yaml b/bitnami/jupyterhub/templates/hub/pdb.yaml index 1c6607a32e..b6bde75816 100644 --- a/bitnami/jupyterhub/templates/hub/pdb.yaml +++ b/bitnami/jupyterhub/templates/hub/pdb.yaml @@ -9,18 +9,16 @@ kind: PodDisruptionBudget metadata: name: {{ include "jupyterhub.hub.name" . }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: hub - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} spec: minAvailable: {{ .Values.hub.pdb.minAvailable }} maxUnavailable: {{ .Values.hub.pdb.maxUnavailable }} + {{- $podLabels := merge .Values.hub.podLabels .Values.commonLabels }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: hub {{- end }} diff --git a/bitnami/jupyterhub/templates/hub/role.yaml b/bitnami/jupyterhub/templates/hub/role.yaml index 27b4485f88..8f5c2c23fa 100644 --- a/bitnami/jupyterhub/templates/hub/role.yaml +++ b/bitnami/jupyterhub/templates/hub/role.yaml @@ -9,11 +9,8 @@ apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ printf "%s-hub" (include "common.names.fullname" .) }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: hub - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/jupyterhub/templates/hub/rolebinding.yaml b/bitnami/jupyterhub/templates/hub/rolebinding.yaml index ff0ec8a5fc..02d637bca1 100644 --- a/bitnami/jupyterhub/templates/hub/rolebinding.yaml +++ b/bitnami/jupyterhub/templates/hub/rolebinding.yaml @@ -9,11 +9,8 @@ apiVersion: rbac.authorization.k8s.io/v1 metadata: name: {{ include "jupyterhub.hub.name" . }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: hub - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/jupyterhub/templates/hub/secret.yaml b/bitnami/jupyterhub/templates/hub/secret.yaml index b441e6cb86..4b42231ba5 100644 --- a/bitnami/jupyterhub/templates/hub/secret.yaml +++ b/bitnami/jupyterhub/templates/hub/secret.yaml @@ -9,11 +9,8 @@ kind: Secret metadata: name: {{ include "jupyterhub.hub.name" . }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: hub - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/jupyterhub/templates/hub/service-account.yaml b/bitnami/jupyterhub/templates/hub/service-account.yaml index 41790f6fff..22ea1281e2 100644 --- a/bitnami/jupyterhub/templates/hub/service-account.yaml +++ b/bitnami/jupyterhub/templates/hub/service-account.yaml @@ -9,17 +9,11 @@ kind: ServiceAccount metadata: name: {{ template "jupyterhub.hubServiceAccountName" . }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: hub - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.hub.serviceAccount.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.hub.serviceAccount.annotations "context" $ ) | nindent 4 }} - {{- end }} + {{- if or .Values.hub.serviceAccount.annotations .Values.commonAnnotations }} + {{- $annotations := merge .Values.hub.serviceAccount.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} + {{- end }} automountServiceAccountToken: {{ .Values.hub.serviceAccount.automountServiceAccountToken }} {{- end }} diff --git a/bitnami/jupyterhub/templates/hub/service.yaml b/bitnami/jupyterhub/templates/hub/service.yaml index 2b6fef4962..bd65600bc3 100644 --- a/bitnami/jupyterhub/templates/hub/service.yaml +++ b/bitnami/jupyterhub/templates/hub/service.yaml @@ -8,18 +8,12 @@ kind: Service metadata: name: {{ include "jupyterhub.hub.name" . }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: hub - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.hub.service.annotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.hub.service.annotations "context" $) | nindent 4 }} - {{- end }} + {{- if or .Values.hub.service.annotations .Values.commonAnnotations }} + {{- $annotations := merge .Values.hub.service.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} + {{- end }} spec: type: {{ .Values.hub.service.type }} {{- if and .Values.hub.service.clusterIP (eq .Values.hub.service.type "ClusterIP") }} @@ -53,5 +47,6 @@ spec: {{- if .Values.hub.service.extraPorts }} {{- include "common.tplvalues.render" (dict "value" .Values.hub.service.extraPorts "context" $) | nindent 4 }} {{- end }} - selector: {{- include "common.labels.matchLabels" . | nindent 4 }} + {{- $podLabels := merge .Values.hub.podLabels .Values.commonLabels }} + selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: hub diff --git a/bitnami/jupyterhub/templates/hub/servicemonitor.yaml b/bitnami/jupyterhub/templates/hub/servicemonitor.yaml index 579a89d03b..2fea99a013 100644 --- a/bitnami/jupyterhub/templates/hub/servicemonitor.yaml +++ b/bitnami/jupyterhub/templates/hub/servicemonitor.yaml @@ -9,19 +9,10 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ include "jupyterhub.hub.name" . }} - {{- if .Values.hub.metrics.serviceMonitor.namespace }} - namespace: {{ .Values.hub.metrics.serviceMonitor.namespace }} - {{- else }} - namespace: {{ .Release.Namespace }} - {{- end }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + namespace: {{ default .Release.Namespace .Values.hub.metrics.serviceMonitor.namespace | quote }} + {{- $labels := merge .Values.hub.metrics.serviceMonitor.labels .Values.commonLabels }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} app.kubernetes.io/component: hub - {{- if .Values.hub.metrics.serviceMonitor.labels }} - {{- include "common.tplvalues.render" (dict "value" .Values.hub.metrics.serviceMonitor.labels "context" $) | nindent 4 }} - {{- end }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -51,7 +42,7 @@ spec: matchNames: - {{ .Release.Namespace }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }} {{- if .Values.hub.metrics.serviceMonitor.selector }} {{- include "common.tplvalues.render" (dict "value" .Values.hub.metrics.serviceMonitor.selector "context" $) | nindent 6 }} {{- end }} diff --git a/bitnami/jupyterhub/templates/image-puller/daemonset.yaml b/bitnami/jupyterhub/templates/image-puller/daemonset.yaml index 575876456d..fd2d0c2951 100644 --- a/bitnami/jupyterhub/templates/image-puller/daemonset.yaml +++ b/bitnami/jupyterhub/templates/image-puller/daemonset.yaml @@ -9,11 +9,8 @@ kind: DaemonSet metadata: name: {{ printf "%s-image-puller" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: image-puller - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -21,19 +18,17 @@ spec: {{- if .Values.imagePuller.updateStrategy }} updateStrategy: {{- toYaml .Values.imagePuller.updateStrategy | nindent 4 }} {{- end }} + {{- $podLabels := merge .Values.imagePuller.podLabels .Values.commonLabels }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: image-puller template: metadata: {{- if .Values.imagePuller.podAnnotations }} annotations: {{- include "common.tplvalues.render" (dict "value" .Values.imagePuller.podAnnotations "context" $) | nindent 8 }} {{- end }} - labels: {{- include "common.labels.standard" . | nindent 8 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }} app.kubernetes.io/component: image-puller - {{- if .Values.imagePuller.podLabels }} - {{- include "common.tplvalues.render" (dict "value" .Values.imagePuller.podLabels "context" $) | nindent 8 }} - {{- end }} spec: {{- include "jupyterhub.imagePullSecrets" . | nindent 6 }} {{- if .Values.imagePuller.hostAliases }} @@ -43,8 +38,8 @@ spec: affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.imagePuller.affinity "context" $) | nindent 8 }} {{- else }} affinity: - podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.imagePuller.podAffinityPreset "component" "image-puller" "context" $) | nindent 10 }} - podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.imagePuller.podAntiAffinityPreset "component" "image-puller" "context" $) | nindent 10 }} + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.imagePuller.podAffinityPreset "component" "image-puller" "customLabels" $podLabels "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.imagePuller.podAntiAffinityPreset "component" "image-puller" "customLabels" $podLabels "context" $) | nindent 10 }} nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.imagePuller.nodeAffinityPreset.type "key" .Values.imagePuller.nodeAffinityPreset.key "values" .Values.imagePuller.nodeAffinityPreset.values) | nindent 10 }} {{- end }} {{- if .Values.imagePuller.nodeSelector }} diff --git a/bitnami/jupyterhub/templates/proxy/deployment.yaml b/bitnami/jupyterhub/templates/proxy/deployment.yaml index 2d7e7ea093..634cb6f9ef 100644 --- a/bitnami/jupyterhub/templates/proxy/deployment.yaml +++ b/bitnami/jupyterhub/templates/proxy/deployment.yaml @@ -8,11 +8,8 @@ kind: Deployment metadata: name: {{ include "jupyterhub.proxy.name" . }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: proxy - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -20,8 +17,9 @@ spec: {{- if .Values.proxy.updateStrategy }} strategy: {{- toYaml .Values.proxy.updateStrategy | nindent 4 }} {{- end }} + {{- $podLabels := merge .Values.proxy.podLabels .Values.commonLabels }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: proxy template: metadata: @@ -30,13 +28,10 @@ spec: {{- include "common.tplvalues.render" (dict "value" .Values.proxy.podAnnotations "context" $) | nindent 8 }} {{- end }} checksum/hub-secret: {{ include (print $.Template.BasePath "/hub/secret.yaml") . | sha256sum }} - labels: {{- include "common.labels.standard" . | nindent 8 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }} app.kubernetes.io/component: proxy hub.jupyter.org/network-access-hub: "true" hub.jupyter.org/network-access-singleuser: "true" - {{- if .Values.proxy.podLabels }} - {{- include "common.tplvalues.render" (dict "value" .Values.proxy.podLabels "context" $) | nindent 8 }} - {{- end }} spec: serviceAccountName: {{ template "jupyterhub.proxyServiceAccountName" . }} automountServiceAccountToken: {{ .Values.proxy.automountServiceAccountToken }} @@ -48,8 +43,8 @@ spec: affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.proxy.affinity "context" $) | nindent 8 }} {{- else }} affinity: - podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.proxy.podAffinityPreset "component" "proxy" "context" $) | nindent 10 }} - podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.proxy.podAntiAffinityPreset "component" "proxy" "context" $) | nindent 10 }} + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.proxy.podAffinityPreset "component" "proxy" "customLabels" $podLabels "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.proxy.podAntiAffinityPreset "component" "proxy" "customLabels" $podLabels "context" $) | nindent 10 }} nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.proxy.nodeAffinityPreset.type "key" .Values.proxy.nodeAffinityPreset.key "values" .Values.proxy.nodeAffinityPreset.values) | nindent 10 }} {{- end }} {{- if .Values.proxy.nodeSelector }} diff --git a/bitnami/jupyterhub/templates/proxy/ingress.yaml b/bitnami/jupyterhub/templates/proxy/ingress.yaml index b1916f7a4b..de5050fa11 100644 --- a/bitnami/jupyterhub/templates/proxy/ingress.yaml +++ b/bitnami/jupyterhub/templates/proxy/ingress.yaml @@ -8,21 +8,16 @@ apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }} kind: Ingress metadata: name: {{ include "common.names.fullname" . }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: proxy namespace: {{ .Release.Namespace | quote }} annotations: {{- if .Values.proxy.ingress.certManager }} kubernetes.io/tls-acme: "true" {{- end }} - {{- if .Values.proxy.ingress.annotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.proxy.ingress.annotations "context" $) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- if or .Values.proxy.ingress.annotations .Values.commonAnnotations }} + {{- $annotations := merge .Values.proxy.ingress.annotations .Values.commonAnnotations }} + {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} {{- end }} spec: {{- if and .Values.proxy.ingress.ingressClassName (include "common.ingress.supportsIngressClassname" .) }} diff --git a/bitnami/jupyterhub/templates/proxy/networkpolicy.yaml b/bitnami/jupyterhub/templates/proxy/networkpolicy.yaml index 03fc47b8c8..ad3547e911 100644 --- a/bitnami/jupyterhub/templates/proxy/networkpolicy.yaml +++ b/bitnami/jupyterhub/templates/proxy/networkpolicy.yaml @@ -7,19 +7,17 @@ SPDX-License-Identifier: APACHE-2.0 apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }} kind: NetworkPolicy metadata: - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: proxy - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} name: {{ include "jupyterhub.proxy.name" . }} namespace: {{ .Release.Namespace | quote }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} spec: + {{- $proxyPodLabels := merge .Values.proxy.podLabels .Values.commonLabels }} podSelector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $proxyPodLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: proxy policyTypes: - Ingress @@ -47,16 +45,16 @@ spec: - ports: - port: {{ coalesce .Values.hub.containerPorts.http .Values.hub.containerPort }} to: + {{- $hubPodLabels := merge .Values.hub.podLabels .Values.commonLabels }} - podSelector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 14 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $hubPodLabels "context" $ ) | nindent 14 }} app.kubernetes.io/component: hub # Proxy --> Single User - ports: - port: {{ .Values.singleuser.containerPort }} to: - podSelector: - matchLabels: - {{- include "common.labels.matchLabels" . | nindent 14 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 14 }} app.kubernetes.io/component: singleuser ## DNS access - ports: diff --git a/bitnami/jupyterhub/templates/proxy/pdb.yaml b/bitnami/jupyterhub/templates/proxy/pdb.yaml index 2fb7de876b..af056e6e34 100644 --- a/bitnami/jupyterhub/templates/proxy/pdb.yaml +++ b/bitnami/jupyterhub/templates/proxy/pdb.yaml @@ -7,17 +7,18 @@ SPDX-License-Identifier: APACHE-2.0 apiVersion: {{ include "common.capabilities.policy.apiVersion" . }} kind: PodDisruptionBudget metadata: - labels: {{- include "common.labels.standard" . | nindent 4 }} - app.kubernetes.io/component: proxy - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} name: {{ include "jupyterhub.proxy.name" . }} namespace: {{ .Release.Namespace | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + app.kubernetes.io/component: proxy + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} spec: minAvailable: {{ .Values.proxy.pdb.minAvailable }} maxUnavailable: {{ .Values.proxy.pdb.maxUnavailable }} + {{- $podLabels := merge .Values.proxy.podLabels .Values.commonLabels }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: proxy {{- end }} diff --git a/bitnami/jupyterhub/templates/proxy/service-account.yaml b/bitnami/jupyterhub/templates/proxy/service-account.yaml index ebf2d481a1..3c8a9925e6 100644 --- a/bitnami/jupyterhub/templates/proxy/service-account.yaml +++ b/bitnami/jupyterhub/templates/proxy/service-account.yaml @@ -9,17 +9,11 @@ kind: ServiceAccount metadata: name: {{ template "jupyterhub.proxyServiceAccountName" . }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: proxy - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.proxy.serviceAccount.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.proxy.serviceAccount.annotations "context" $ ) | nindent 4 }} - {{- end }} + {{- if or .Values.proxy.serviceAccount.annotations .Values.commonAnnotations }} + {{- $annotations := merge .Values.proxy.serviceAccount.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} + {{- end }} automountServiceAccountToken: {{ .Values.proxy.serviceAccount.automountServiceAccountToken }} {{- end }} diff --git a/bitnami/jupyterhub/templates/proxy/service-api.yaml b/bitnami/jupyterhub/templates/proxy/service-api.yaml index 0ecd8e4dfa..583959479a 100644 --- a/bitnami/jupyterhub/templates/proxy/service-api.yaml +++ b/bitnami/jupyterhub/templates/proxy/service-api.yaml @@ -8,18 +8,12 @@ kind: Service metadata: name: {{ printf "%s-proxy-api" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: proxy - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.proxy.service.api.annotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.proxy.service.api.annotations "context" $) | nindent 4 }} - {{- end }} + {{- if or .Values.proxy.service.api.annotations .Values.commonAnnotations }} + {{- $annotations := merge .Values.proxy.service.api.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} + {{- end }} spec: type: {{ .Values.proxy.service.api.type }} {{- if and .Values.proxy.service.api.clusterIP (eq .Values.proxy.service.api.type "ClusterIP") }} @@ -53,5 +47,6 @@ spec: {{- if .Values.proxy.service.api.extraPorts }} {{- include "common.tplvalues.render" (dict "value" .Values.proxy.service.api.extraPorts "context" $) | nindent 4 }} {{- end }} - selector: {{- include "common.labels.matchLabels" . | nindent 4 }} + {{- $podLabels := merge .Values.proxy.podLabels .Values.commonLabels }} + selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: proxy diff --git a/bitnami/jupyterhub/templates/proxy/service-metrics.yaml b/bitnami/jupyterhub/templates/proxy/service-metrics.yaml index de287c3337..abb4e94101 100644 --- a/bitnami/jupyterhub/templates/proxy/service-metrics.yaml +++ b/bitnami/jupyterhub/templates/proxy/service-metrics.yaml @@ -10,18 +10,12 @@ kind: Service metadata: name: {{ printf "%s-proxy-metrics" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: proxy - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.proxy.service.metrics.annotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.proxy.service.metrics.annotations "context" $) | nindent 4 }} - {{- end }} + {{- if or .Values.proxy.service.metrics.annotations .Values.commonAnnotations }} + {{- $annotations := merge .Values.proxy.service.metrics.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} + {{- end }} spec: type: {{ .Values.proxy.service.metrics.type }} {{- if and .Values.proxy.service.metrics.clusterIP (eq .Values.proxy.service.metrics.type "ClusterIP") }} @@ -55,6 +49,7 @@ spec: {{- if .Values.proxy.service.metrics.extraPorts }} {{- include "common.tplvalues.render" (dict "value" .Values.proxy.service.metrics.extraPorts "context" $) | nindent 4 }} {{- end }} - selector: {{- include "common.labels.matchLabels" . | nindent 4 }} + {{- $podLabels := merge .Values.proxy.podLabels .Values.commonLabels }} + selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: proxy {{- end }} diff --git a/bitnami/jupyterhub/templates/proxy/service-public.yaml b/bitnami/jupyterhub/templates/proxy/service-public.yaml index 252e6f9afd..9b7943dc83 100644 --- a/bitnami/jupyterhub/templates/proxy/service-public.yaml +++ b/bitnami/jupyterhub/templates/proxy/service-public.yaml @@ -8,18 +8,12 @@ kind: Service metadata: name: {{ printf "%s-proxy-public" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: proxy - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.proxy.service.public.annotations }} - {{- include "common.tplvalues.render" (dict "value" .Values.proxy.service.public.annotations "context" $) | nindent 4 }} - {{- end }} + {{- if or .Values.proxy.service.public.annotations .Values.commonAnnotations }} + {{- $annotations := merge .Values.proxy.service.public.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} + {{- end }} spec: type: {{ .Values.proxy.service.public.type }} {{- if and .Values.proxy.service.public.clusterIP (eq .Values.proxy.service.public.type "ClusterIP") }} @@ -53,5 +47,6 @@ spec: {{- if .Values.proxy.service.public.extraPorts }} {{- include "common.tplvalues.render" (dict "value" .Values.proxy.service.public.extraPorts "context" $) | nindent 4 }} {{- end }} - selector: {{- include "common.labels.matchLabels" . | nindent 4 }} + {{- $podLabels := merge .Values.proxy.podLabels .Values.commonLabels }} + selector: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: proxy diff --git a/bitnami/jupyterhub/templates/proxy/servicemonitor.yaml b/bitnami/jupyterhub/templates/proxy/servicemonitor.yaml index bc4d78bfb0..eac2f32bd9 100644 --- a/bitnami/jupyterhub/templates/proxy/servicemonitor.yaml +++ b/bitnami/jupyterhub/templates/proxy/servicemonitor.yaml @@ -9,19 +9,10 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ printf "%s-proxy-api" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} - {{- if .Values.proxy.metrics.serviceMonitor.namespace }} - namespace: {{ .Values.proxy.metrics.serviceMonitor.namespace }} - {{- else }} - namespace: {{ .Release.Namespace }} - {{- end }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + namespace: {{ default .Release.Namespace .Values.proxy.metrics.serviceMonitor.namespace | quote }} + {{- $labels := merge .Values.proxy.metrics.serviceMonitor.labels .Values.commonLabels }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} app.kubernetes.io/component: proxy - {{- if .Values.proxy.metrics.serviceMonitor.labels }} - {{- include "common.tplvalues.render" (dict "value" .Values.proxy.metrics.serviceMonitor.labels "context" $) | nindent 4 }} - {{- end }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -51,7 +42,7 @@ spec: matchNames: - {{ .Release.Namespace }} selector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }} {{- if .Values.proxy.metrics.serviceMonitor.selector }} {{- include "common.tplvalues.render" (dict "value" .Values.proxy.metrics.serviceMonitor.selector "context" $) | nindent 6 }} {{- end }} diff --git a/bitnami/jupyterhub/templates/proxy/tls-secret.yaml b/bitnami/jupyterhub/templates/proxy/tls-secret.yaml index 85698a7b19..1b4d895fcf 100644 --- a/bitnami/jupyterhub/templates/proxy/tls-secret.yaml +++ b/bitnami/jupyterhub/templates/proxy/tls-secret.yaml @@ -11,10 +11,7 @@ kind: Secret metadata: name: {{ .name }} namespace: {{ $.Release.Namespace | quote }} - labels: {{- include "common.labels.standard" $ | nindent 4 }} - {{- if $.Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $.Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: proxy {{- if $.Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }} @@ -35,10 +32,7 @@ kind: Secret metadata: name: {{ $secretName }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/jupyterhub/templates/singleuser/networkpolicy.yaml b/bitnami/jupyterhub/templates/singleuser/networkpolicy.yaml index 34e538d9fe..812e2de127 100644 --- a/bitnami/jupyterhub/templates/singleuser/networkpolicy.yaml +++ b/bitnami/jupyterhub/templates/singleuser/networkpolicy.yaml @@ -7,11 +7,8 @@ SPDX-License-Identifier: APACHE-2.0 apiVersion: {{ include "common.capabilities.networkPolicy.apiVersion" . }} kind: NetworkPolicy metadata: - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: singleuser - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} name: {{ printf "%s-singleuser" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} namespace: {{ .Release.Namespace | quote }} {{- if .Values.commonAnnotations }} @@ -19,7 +16,7 @@ metadata: {{- end }} spec: podSelector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }} app.kubernetes.io/component: singleuser policyTypes: - Ingress @@ -47,8 +44,9 @@ spec: - ports: - port: {{ coalesce .Values.hub.containerPorts.http .Values.hub.containerPort }} to: + {{- $hubPodLabels := merge .Values.hub.podLabels .Values.commonLabels }} - podSelector: - matchLabels: {{- include "common.labels.matchLabels" . | nindent 14 }} + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $hubPodLabels "context" $ ) | nindent 14 }} app.kubernetes.io/component: hub {{- if not .Values.singleuser.networkPolicy.allowCloudMetadataAccess }} ## Limit access to the Cloud Metadata API diff --git a/bitnami/jupyterhub/templates/singleuser/service-account.yaml b/bitnami/jupyterhub/templates/singleuser/service-account.yaml index f1fb3d6841..fa5c83f608 100644 --- a/bitnami/jupyterhub/templates/singleuser/service-account.yaml +++ b/bitnami/jupyterhub/templates/singleuser/service-account.yaml @@ -9,17 +9,11 @@ kind: ServiceAccount metadata: name: {{ template "jupyterhub.singleuserServiceAccountName" . }} namespace: {{ .Release.Namespace | quote }} - labels: {{- include "common.labels.standard" . | nindent 4 }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/component: singleuser - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - annotations: - {{- if .Values.commonAnnotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.singleuser.serviceAccount.annotations }} - {{- include "common.tplvalues.render" ( dict "value" .Values.singleuser.serviceAccount.annotations "context" $ ) | nindent 4 }} - {{- end }} + {{- if or .Values.singleuser.serviceAccount.annotations .Values.commonAnnotations }} + {{- $annotations := merge .Values.singleuser.serviceAccount.annotations .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} + {{- end }} automountServiceAccountToken: {{ .Values.singleuser.serviceAccount.automountServiceAccountToken }} {{- end }} diff --git a/bitnami/jupyterhub/values.yaml b/bitnami/jupyterhub/values.yaml index 92a9fddd53..7d6d78a06f 100644 --- a/bitnami/jupyterhub/values.yaml +++ b/bitnami/jupyterhub/values.yaml @@ -166,10 +166,7 @@ hub: extraLabels: hub.jupyter.org/network-access-hub: "true" app.kubernetes.io/component: singleuser - {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} + {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} {{- if .Values.singleuser.podLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.singleuser.podLabels "context" $ ) | nindent 4 }} {{- end }} @@ -200,7 +197,7 @@ hub: {{- end }} extraLabels: app.kubernetes.io/component: singleuser - {{- include "common.labels.standard" . | nindent 6 }} + {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }} {{- if .Values.singleuser.extraVolumes }} extraVolumes: {{- include "common.tplvalues.render" ( dict "value" .Values.singleuser.extraVolumes "context" $ ) | nindent 4 }} {{- end }}