Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to specify labels for k8s-objects like DaemonSets and Deployments #2976

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions jupyterhub/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ properties:
`{"name": "my-secret-name"}`, or you can let list elements be strings
naming the secrets directly.

labels:
type: object
additionalProperties: false
patternProperties:
".*":
type: string
description: |
Chart wide ability to add specific labels via values.yaml to K8s
objects such as DaemonSets or Deployments

hub:
type: object
additionalProperties: false
Expand Down
13 changes: 13 additions & 0 deletions jupyterhub/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@
{{- end }}


{{/*
helper function for building up labels key value pairs
*/}}
{{- define "jupyterhub.determinedLabels" -}}
{{- with .Values.labels }}
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end -}}


{{- /*
jupyterhub.commonLabels:
Foundation for "jupyterhub.labels".
Expand All @@ -118,6 +130,7 @@
app: {{ .appLabel | default (include "jupyterhub.appLabel" .) }}
release: {{ .Release.Name }}
{{- if not .matchLabels }}
{{- include "jupyterhub.determinedLabels" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
heritage: {{ .heritageLabel | default .Release.Service }}
{{- end }}
Expand Down
4 changes: 4 additions & 0 deletions jupyterhub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ imagePullSecret:
# Helm chart's pods can get credentials from to pull their images.
imagePullSecrets: []

# labels enables an opportunity to add general labels to the created K8s objects,
# e.g. DaemonSets or Deployments
labels: {}

# hub relates to the hub pod, responsible for running JupyterHub, its configured
# Authenticator class KubeSpawner, and its configured Proxy class
# ConfigurableHTTPProxy. KubeSpawner creates the user pods, and
Expand Down