diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 26cc61cbd..3e5d75ed7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -231,6 +231,13 @@ jobs: --values tools/templates/lint-and-validate-values.yaml \ --set imageBuilderType=pink + - name: "Helm template --validate for standalone jupyterhub (with lint-and-validate-values.yaml)" + if: matrix.test == 'helm' + run: | + helm template --validate binderhub-test helm-chart/binderhub \ + --values tools/templates/lint-and-validate-values.yaml \ + --set jupyterhub.enabled=false + - name: Validate the chart against the k8s API if: matrix.test == 'helm' run: | diff --git a/helm-chart/binderhub/Chart.yaml b/helm-chart/binderhub/Chart.yaml index 66b24727f..33d04e6bc 100644 --- a/helm-chart/binderhub/Chart.yaml +++ b/helm-chart/binderhub/Chart.yaml @@ -14,6 +14,7 @@ dependencies: - name: jupyterhub version: "3.3.7" repository: "https://jupyterhub.github.io/helm-chart" + condition: jupyterhub.enabled description: |- BinderHub is like a JupyterHub that automatically builds environments for the users based on repo2docker. A BinderHub is by default not configured to diff --git a/helm-chart/binderhub/templates/deployment.yaml b/helm-chart/binderhub/templates/deployment.yaml index 42237df36..6156e210f 100644 --- a/helm-chart/binderhub/templates/deployment.yaml +++ b/helm-chart/binderhub/templates/deployment.yaml @@ -33,9 +33,11 @@ spec: {{- . | toYaml | nindent 8 }} {{- end }} spec: + {{- if .Values.jupyterhub.enabled }} {{- with include "jupyterhub.imagePullSecrets" (dict "root" . "image" .Values.image) }} imagePullSecrets: {{ . }} {{- end }} + {{- end }} {{- with .Values.initContainers }} initContainers: {{- . | toYaml | nindent 8 }} @@ -119,11 +121,13 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + {{- if .Values.jupyterhub.enabled }} - name: JUPYTERHUB_API_TOKEN valueFrom: secretKeyRef: name: "{{ include "jupyterhub.hub.fullname" . }}" key: hub.services.binder.apiToken + {{- end }} {{- if .Values.config.BinderHub.auth_enabled }} - name: JUPYTERHUB_SERVICE_NAME value: binder @@ -142,9 +146,13 @@ spec: value: {{ .Values.jupyterhub.hub.namedServerLimitPerUser | quote }} {{- end }} {{- end }} + {{- if .Values.jupyterhub.enabled }} {{- with .Values.extraEnv }} {{- include "jupyterhub.extraEnv" . | nindent 8 }} {{- end }} + {{- else }} + {{ . | toYaml | nindent 8 }} + {{- end }} ports: - containerPort: 8585 name: binder diff --git a/helm-chart/binderhub/templates/image-cleaner.yaml b/helm-chart/binderhub/templates/image-cleaner.yaml index d51430e88..edf5faa05 100644 --- a/helm-chart/binderhub/templates/image-cleaner.yaml +++ b/helm-chart/binderhub/templates/image-cleaner.yaml @@ -21,9 +21,11 @@ spec: release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: + {{- if .Values.jupyterhub.enabled }} {{- with include "jupyterhub.imagePullSecrets" (dict "root" . "image" .Values.imageCleaner.image) }} imagePullSecrets: {{ . }} {{- end }} + {{- end }} tolerations: - effect: NoSchedule key: hub.jupyter.org/dedicated diff --git a/helm-chart/binderhub/templates/secret.yaml b/helm-chart/binderhub/templates/secret.yaml index e6ee24d5c..fae7e64bf 100644 --- a/helm-chart/binderhub/templates/secret.yaml +++ b/helm-chart/binderhub/templates/secret.yaml @@ -22,6 +22,7 @@ stringData: {{- /* key=filename: value=content */}} {{- (.Files.Glob "files/*").AsConfig | nindent 2 }} +{{- if .Values.jupyterhub.enabled }} {{- with include "jupyterhub.extraFiles.stringData" .Values.extraFiles }} {{- . | nindent 2 }} {{- end }} @@ -30,6 +31,7 @@ stringData: data: {{- . | nindent 2 }} {{- end }} +{{- end }} --- {{- if or .Values.config.BinderHub.use_registry .Values.config.BinderHub.buildDockerConfig }} kind: Secret diff --git a/helm-chart/binderhub/values.yaml b/helm-chart/binderhub/values.yaml index 29ed7fcc1..ce3293d4b 100644 --- a/helm-chart/binderhub/values.yaml +++ b/helm-chart/binderhub/values.yaml @@ -63,6 +63,7 @@ extraPodSpec: {} # likely want to set both of those to the same value. jupyterhub: + enabled: true # Deprecated values, kept here so we can provide useful error messages custom: cors: {} diff --git a/tools/templates/lint-and-validate-values.yaml b/tools/templates/lint-and-validate-values.yaml index 4b2d0ea15..972c8df6c 100644 --- a/tools/templates/lint-and-validate-values.yaml +++ b/tools/templates/lint-and-validate-values.yaml @@ -50,6 +50,7 @@ extraConfig: dummy binderhub python code ... jupyterhub: + enabled: true cull: enabled: true users: true