Skip to content

Commit

Permalink
Merge pull request #2211 from consideRatio/pr/hard-deprecation
Browse files Browse the repository at this point in the history
Remove deprecated logic and emit clear messages
  • Loading branch information
consideRatio authored May 26, 2021
2 parents 050c431 + 448ea7e commit 714a3d2
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 58 deletions.
9 changes: 1 addition & 8 deletions doc/source/administrator/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,7 @@ In your `hub.extraConfig`,
specified as the second parameter (default)

You need to have a `import z2jh` at the top of your `extraConfig` for
`z2jh.get_config()` to work.

```{versionchanged} 0.8
`hub.extraConfigMap` used to be required for specifying additional values
to pass, which was more restrictive.
`hub.extraConfigMap` is deprecated in favor of the new
top-level `custom` field, which allows fully arbitrary yaml.
```
`z2jh.get_config(...)` to work.

### `hub.extraEnv`

Expand Down
5 changes: 1 addition & 4 deletions jupyterhub/files/hub/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,7 @@ def camelCaseify(s):

cloud_metadata = get_config("singleuser.cloudMetadata", {})

if (
cloud_metadata.get("blockWithIptables") == True
or cloud_metadata.get("enabled") == False
):
if cloud_metadata.get("blockWithIptables") == True:
# Use iptables to block access to cloud metadata by default
network_tools_image_name = get_config("singleuser.networkTools.image.name")
network_tools_image_tag = get_config("singleuser.networkTools.image.tag")
Expand Down
80 changes: 49 additions & 31 deletions jupyterhub/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,27 @@ If you have questions, please:
Warnings for likely misconfiguration
*/}}

{{- if and (not .Values.scheduling.podPriority.enabled) (and .Values.scheduling.userPlaceholder.enabled .Values.scheduling.userPlaceholder.replicas) }}

WARNING: You are using user placeholders without pod priority enabled, either
enable pod priority or stop using the user placeholders to avoid wasting cloud
resources.
{{- if and (not .Values.scheduling.podPriority.enabled) (and .Values.scheduling.userPlaceholder.enabled .Values.scheduling.userPlaceholder.replicas) }}{{ println }}
#################################################################################
###### WARNING: You are using user placeholders without pod priority #####
###### enabled*, either enable pod priority or stop using the #####
###### user placeholders** to avoid having placeholders that #####
###### refuse to make room for a real user. #####
###### #####
###### *scheduling.podPriority.enabled #####
###### **scheduling.userPlaceholder.enabled #####
###### **scheduling.userPlaceholder.replicas #####
#################################################################################
{{- end }}


{{- if eq .Values.proxy.https.enabled false }}
{{- if or (not (eq .Values.proxy.https.type "letsencrypt")) (not (eq (.Values.proxy.https.letsencrypt.contactEmail | default "") "")) }}{{ println }}
WARNING: Configuring proxy.https without setting proxy.https.enabled to true is no longer allowed.
#################################################################################
###### WARNING: proxy.https.enabled is set to false by default since #####
###### version 0.10.0. It is now set to false but proxy.https #####
###### has been modified indicating you may want it enabled. #####
#################################################################################
{{- end }}
{{- end }}

Expand All @@ -77,61 +87,69 @@ WARNING: Configuring proxy.https without setting proxy.https.enabled to true is


{{- /*
Deprecation messages that can be removed in 2.0.0
Breaking changes.
*/}}

{{- if .Values.hub.extraConfigMap }}{{ println }}
DEPRECATION: hub.extraConfigMap is deprecated in jupyterhub chart 0.8.
Use top-level `custom` instead:
{{- $breaking := "" }}
{{- $breaking_title := "\n" }}
{{- $breaking_title = print $breaking_title "\n#################################################################################" }}
{{- $breaking_title = print $breaking_title "\n###### BREAKING: The config values passed contained no longer accepted #####" }}
{{- $breaking_title = print $breaking_title "\n###### options. See the messages below for more details. #####" }}
{{- $breaking_title = print $breaking_title "\n###### #####" }}
{{- $breaking_title = print $breaking_title "\n###### To verify your updated config is accepted, you can use #####" }}
{{- $breaking_title = print $breaking_title "\n###### the `helm template` command. #####" }}
{{- $breaking_title = print $breaking_title "\n#################################################################################" }}


custom:
{{- (merge dict .Values.custom .Values.hub.extraConfigMap) | toYaml | nindent 2 }}
{{- if hasKey .Values.hub "extraConfigMap" }}
{{- $breaking = print $breaking "\n\nRENAMED: hub.extraConfigMap has been renamed to custom" }}
{{- end }}


{{- if hasKey .Values "auth" }}
{{- if .Values.auth }}
{{ fail (include "jupyterhub.authDep.remapOldToNew" .) }}
{{- $breaking = print $breaking (include "jupyterhub.authDep.remapOldToNew" .) }}
{{- else }}
{{- $breaking = print $breaking "\n\nREMOVED: Please remove the empty 'auth' config" }}
{{- end }}
{{- end }}


{{- if .Values.proxy.containerSecurityContext }}
{{- fail "\n\nHARD DEPRECATION: proxy.containerSecurityContext has been renamed to proxy.chp.containerSecurityContext" }}
{{- if hasKey .Values.proxy "containerSecurityContext" }}
{{- $breaking = print $breaking "\n\nRENAMED: proxy.containerSecurityContext has been renamed to proxy.chp.containerSecurityContext" }}
{{- end }}


{{- if hasKey .Values.proxy "pdb" }}
{{ fail "\n\nHARD DEPRECATION: proxy.pdb has renamed to proxy.chp.pdb" }}
{{- $breaking = print $breaking "\n\nRENAMED: proxy.pdb has renamed to proxy.chp.pdb" }}
{{- end }}


{{- if .Values.proxy.networkPolicy }}
{{- fail "\n\nHARD DEPRECATION: proxy.networkPolicy has been renamed to proxy.chp.networkPolicy" }}
{{- if hasKey .Values.proxy "networkPolicy" }}
{{- $breaking = print $breaking "\n\nRENAMED: proxy.networkPolicy has been renamed to proxy.chp.networkPolicy" }}
{{- end }}


{{- if hasKey .Values.hub "uid" }}
{{- print "\n\nDEPRECATION: hub.uid is deprecated in jupyterhub chart 0.9. Set the hub.containerSecurityContext.runAsUser value directly instead." }}
{{- $breaking = print $breaking "\n\nRENAMED: hub.uid must as of 1.0.0 be configured using hub.containerSecurityContext.runAsUser" }}
{{- end }}


{{- if (.Values.hub | dig "imagePullSecret" "enabled" "") }}
{{- fail "\n\nHARD DEPRECATION: hub.imagePullSecret has renamed to imagePullSecret" }}
{{- if hasKey .Values.hub "imagePullSecret" }}
{{- $breaking = print $breaking "\n\nREMOVED: hub.imagePullSecret has been removed, but there is now a chart wide wide configuration named imagePullSecret" }}
{{- end }}


{{- if (.Values.singleuser | dig "imagePullSecret" "enabled" "") }}
{{- fail "\n\nHARD DEPRECATION: singleuser.imagePullSecret has renamed to imagePullSecret" }}
{{- if hasKey .Values.singleuser "imagePullSecret" }}
{{- $breaking = print $breaking "\n\nREMOVED: singleuser.imagePullSecret has been removed, but there is now a chart wide wide configuration named imagePullSecret" }}
{{- end }}


{{- if (.Values.singleuser | dig "cloudMetadata" "enabled" "") }}
{{- print "\n\nDEPRECATION: singleuser.cloudMetadata.enabled is deprecated, instead use singleuser.cloudMetadata.blockWithIptables with the inverted value." }}
{{- if hasKey .Values.singleuser.cloudMetadata "enabled" }}
{{- $breaking = print $breaking "\n\nCHANGED: singleuser.cloudMetadata.enabled must as of 1.0.0 be configured using singleuser.cloudMetadata.blockWithIptables with the opposite value." }}
{{- end }}





{{- /*
Deprecation messages that can be removed in 3.0.0
*/}}
{{- if $breaking }}
{{- fail (print $breaking_title $breaking) }}
{{- end }}
4 changes: 3 additions & 1 deletion jupyterhub/templates/_helpers-auth-rework.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ ldap.dn.user.useLookupName: LDAPAuthenticator.use_lookup_dn_username
{{- end }}
{{- /* UPDATE c dict authenticator_class */}}
{{- $_ := merge $c (dict "JupyterHub" (dict "authenticator_class" $class_new_entrypoint)) }}
{{- if ne $class_new_entrypoint "<no value>" }}
{{- $_ := merge $c (dict "JupyterHub" (dict "authenticator_class" $class_new_entrypoint)) }}
{{- end }}
{{- /* Output a sensible error message */}}
Expand Down
10 changes: 2 additions & 8 deletions jupyterhub/templates/hub/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,9 @@ spec:
{{- with .Values.hub.image.pullPolicy }}
imagePullPolicy: {{ . }}
{{- end }}
{{- /* Below is deprecation logic of .Values.hub.uid */}}
{{- if .Values.hub.containerSecurityContext }}
{{- $securityContext := dict }}
{{- if hasKey .Values.hub "uid" }}
{{- $_ := merge $securityContext (dict "runAsUser" .Values.hub.uid) }}
{{- end }}
{{- $_ := merge $securityContext .Values.hub.containerSecurityContext }}
{{- with .Values.hub.containerSecurityContext }}
securityContext:
{{- $securityContext | toYaml | trimSuffix "\n" | nindent 12 }}
{{- . | toYaml | trimSuffix "\n" | nindent 12 }}
{{- end }}
{{- with .Values.hub.lifecycle }}
lifecycle:
Expand Down
4 changes: 1 addition & 3 deletions jupyterhub/templates/hub/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ metadata:
type: Opaque
data:
{{- $values := merge dict .Values }}
{{- /* preserve behavior of deprecated hub.extraConfigMap */}}
{{- $_ := set $values "custom" (merge dict $values.custom .Values.hub.extraConfigMap) }}
{{- /* passthrough subset of Chart / Release */}}
{{- /* also passthrough subset of Chart / Release */}}
{{- $_ := set $values "Chart" (dict "Name" .Chart.Name "Version" .Chart.Version) }}
{{- $_ := set $values "Release" (pick .Release "Name" "Namespace" "Service") }}
values.yaml: {{ $values | toYaml | b64enc | quote }}
Expand Down
1 change: 0 additions & 1 deletion jupyterhub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ hub:
command: []
args: []
extraConfig: {}
extraConfigMap: {}
extraFiles: {}
extraEnv: {}
extraContainers: []
Expand Down
2 changes: 0 additions & 2 deletions tools/templates/lint-and-validate-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ hub:
extraConfig:
test: |-
c.Spawner.cmd = 'mock'
extraConfigMap:
mock.entry: mock-config-map-entry
extraEnv: &extraEnv
IGNORED_KEY_NAME:
name: MOCK_ENV_VAR_NAME1
Expand Down

0 comments on commit 714a3d2

Please sign in to comment.