{{- define "removedConfig" }}

It looks like you still have some unsupported configuration!

The binderhub chart has removed special-handling
of many simple configurables in the BinderHub source code.
Instead, the Python traits configuration is exposed directly.

See https://binderhub.readthedocs.io/en/latest/reference/ref-index.html
for what can be configured.

In general, it works like:

config:
  ClassName:
    trait_name: value

e.g. to set config on BinderHub, use:

config:
  BinderHub:
    use_registry: false

or on GitHubRepoProvider:

config:
  GitHubRepoProvider:
    access_token: "..."

where ``BinderHub.use_registry`` and ``GitHubRepoProvider.access_token``
are traits to be configured.

----------------------------------
Specific unsupported config found:


{{- if .Values.hub }}

Special handling of hub.url is removed. Set config.BinderHub.hub_url instead:

config:
  BinderHub:
    hub_url: {{ .Values.hub.url }}
{{- end }}

{{- if .Values.github }}

Top-level github configuration is removed.
Use:

config:
  GitHubRepoProvider:
    access_token: {{ .Values.github.accessToken }}
    client_id: {{ .Values.github.clientId }}
    client_secret: {{ .Values.github.clientSecret }}
{{- end }}

{{- if .Values.gitlab }}

Top-level gitlab configuration is removed.
Use:

config:
  GitLabRepoProvider:
    access_token: {{ .Values.gitlab.accessToken }}
    private_token: {{ .Values.gitlab.privateToken }}
{{- end }}

{{- if ne (typeOf .Values.registry.enabled) "<nil>" }}

registry.enabled is removed. Use:

config:
  BinderHub:
    use_registry: {{ .Values.registry.enabled }}
{{- end }}

{{- if .Values.registry.authHost }}

registry.authHost is removed.

Use:

  registry:
    url: {{ .Values.registry.authHost }}

to set the registry url.

{{- if and .Values.registry.host (ne .Values.registry.host .Values.registry.authHost) }}

If registry url and auth url differ, use:

registry:
  url: {{ .Values.registry.authHost }}
config:
  DockerRegistry:
    url: {{ .Values.registry.host }}
    config_url: {{ .Values.registry.authHost }}

{{- end }}
{{- end }}

{{- if .Values.registry.tokenUrl }}

special-handling of .registry.tokenUrl is removed.
Use:

config:
  DockerRegistry:
    token_url: {{ .Values.registry.tokenUrl }}

{{- end }}

{{- if .Values.registry.prefix }}

registry.prefix is removed. Use:

config:
  BinderHub:
    image_prefix: {{.Values.registry.prefix }}

{{- end }}

{{- if or .Values.build .Values.perRepoQuota }}

build is removed. Use:

config:
  BinderHub:
    appendix: {{ .Values.build.appendix }}
    build_cleanup_interval: {{ .Values.build.cleanupInterval }}
    build_image: {{ .Values.build.repo2dockerImage }}
    build_max_age: {{ .Values.build.maxAge }}
    build_namespace: {{ .Values.build.namespace }}
    build_node_selector: {{ .Values.build.nodeSelector }}
    log_tail_lines: {{ .Values.build.logTailLines }}
    per_repo_quota: {{ .Values.perRepoQuota }}
{{- end }}

{{- /* end removedConfig */ -}}
{{- end }}


{{- if (or .Values.hub .Values.build .Values.github .Values.gitlab .Values.perRepoQuota  .Values.registry.host .Values.registry.authHost .Values.registry.tokenUrl .Values.registry.prefix (ne (typeOf .Values.registry.enabled) "<nil>")) }}
{{- fail (include "removedConfig" .) }}
{{- end }}


1. Get the application URL by running these commands:
{{- if .Values.ingress.hostname }}
  http://{{- .Values.ingress.hostname }}
{{- else if contains "NodePort" .Values.service.type }}
  export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }})
  export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
  echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
     NOTE: It may take a few minutes for the LoadBalancer IP to be available.
           You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}'
  export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
  echo http://$SERVICE_IP:{{ .Values.service.externalPort }}
{{- else if contains "ClusterIP"  .Values.service.type }}
  export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }}
{{- end }}

{{- $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#################################################################################" }}

{{- if hasKey .Values.cors "allowOrigin" }}
{{- $breaking = print $breaking "\n\nRENAMED: cors.allowOrigin has been renamed to config.BinderHub.cors_allow_origin" }}
{{- end }}

{{- if hasKey .Values.jupyterhub.custom.cors "allowOrigin" }}
{{- $breaking = print $breaking "\n\nRENAMED: jupyterhub.custom.cors.allowOrigin has been renamed to jupyterhub.hub.config.BinderSpawner.cors_allow_origin" }}
{{- end }}

{{- if hasKey .Values.dind "enabled" }}
{{- $breaking = print $breaking "\n\nCHANGED:" }}
{{- $breaking = print $breaking "\n\ndind:" }}
{{- $breaking = print $breaking "\n  enabled: true" }}
{{- $breaking = print $breaking "\n\nmust as of version 0.3.0 be replace by" }}
{{- $breaking = print $breaking "\n\nimageBuilderType: dind" }}
{{- end }}

{{- if hasKey .Values.imageCleaner.host "enabled" }}
{{- $breaking = print $breaking "\n\nCHANGED:" }}
{{- $breaking = print $breaking "\n\nimageCleaner:" }}
{{- $breaking = print $breaking "\n  host:" }}
{{- $breaking = print $breaking "\n    enabled: true" }}
{{- $breaking = print $breaking "\n\nas of version 0.3.0 is not used anymore." }}
{{- $breaking = print $breaking "\n\nThe image cleaner is either disabled or adapted to the value of imageBuilderType." }}
{{- end }}

{{- if $breaking }}
{{- fail (print $breaking_title $breaking) }}
{{- end }}
