|
| 1 | +{{- /* |
| 2 | + These helpers encapsulates logic on how we name resources. They also enable |
| 3 | + parent charts to reference these dynamic resource names. |
| 4 | +
|
| 5 | + To avoid duplicating documentation, for more information, please see the the |
| 6 | + fullnameOverride entry the jupyterhub chart's configuration reference: |
| 7 | + https://z2jh.jupyter.org/en/latest/resources/reference.html#fullnameOverride |
| 8 | +*/}} |
| 9 | +
|
| 10 | +
|
| 11 | +
|
| 12 | +{{- /* |
| 13 | + Utility templates |
| 14 | +*/}} |
| 15 | +
|
| 16 | +{{- /* |
| 17 | + Renders to a prefix for the chart's resource names. This prefix is assumed to |
| 18 | + make the resource name cluster unique. |
| 19 | +*/}} |
| 20 | +{{- define "binderhub-service.fullname" -}} |
| 21 | + {{- /* |
| 22 | + We have implemented a trick to allow a parent chart depending on this |
| 23 | + chart to call these named templates. |
| 24 | +
|
| 25 | + Caveats and notes: |
| 26 | +
|
| 27 | + 1. While parent charts can reference these, grandparent charts can't. |
| 28 | + 2. Parent charts must not use an alias for this chart. |
| 29 | + 3. There is no failsafe workaround to above due to |
| 30 | + https://github.com/helm/helm/issues/9214. |
| 31 | + 4. .Chart is of its own type (*chart.Metadata) and needs to be casted |
| 32 | + using "toYaml | fromYaml" in order to be able to use normal helm |
| 33 | + template functions on it. |
| 34 | + */}} |
| 35 | + {{- $fullname_override := .Values.fullnameOverride }} |
| 36 | + {{- $name_override := .Values.nameOverride }} |
| 37 | + {{- if ne .Chart.Name "binderhub-service" }} |
| 38 | + {{- if .Values.jupyterhub }} |
| 39 | + {{- $fullname_override = .Values.jupyterhub.fullnameOverride }} |
| 40 | + {{- $name_override = .Values.jupyterhub.nameOverride }} |
| 41 | + {{- end }} |
| 42 | + {{- end }} |
| 43 | +
|
| 44 | + {{- if eq (typeOf $fullname_override) "string" }} |
| 45 | + {{- $fullname_override }} |
| 46 | + {{- else }} |
| 47 | + {{- $name := $name_override | default .Chart.Name }} |
| 48 | + {{- if contains $name .Release.Name }} |
| 49 | + {{- .Release.Name }} |
| 50 | + {{- else }} |
| 51 | + {{- .Release.Name }}-{{ $name }} |
| 52 | + {{- end }} |
| 53 | + {{- end }} |
| 54 | +{{- end }} |
| 55 | +
|
| 56 | +{{- /* |
| 57 | + Renders to a blank string or if the fullname template is truthy renders to it |
| 58 | + with an appended dash. |
| 59 | +*/}} |
| 60 | +{{- define "binderhub-service.fullname.dash" -}} |
| 61 | + {{- if (include "binderhub-service.fullname" .) }} |
| 62 | + {{- include "binderhub-service.fullname" . }}- |
| 63 | + {{- end }} |
| 64 | +{{- end }} |
| 65 | +
|
| 66 | +
|
| 67 | +
|
| 68 | +{{- /* |
| 69 | + Namespaced resources |
| 70 | +*/}} |
| 71 | +
|
| 72 | +{{- /* binderhub resources' default name */}} |
| 73 | +{{- define "binderhub-service.binderhub.fullname" -}} |
| 74 | + {{- include "binderhub-service.fullname.dash" . }}binderhub |
| 75 | +{{- end }} |
| 76 | + |
| 77 | +{{- /* binderhub's ServiceAccount name */}} |
| 78 | +{{- define "binderhub-service.binderhub.serviceaccount.fullname" -}} |
| 79 | + {{- if .Values.serviceAccount.create }} |
| 80 | + {{- .Values.serviceAccount.name | default (include "binderhub-service.binderhub.fullname" .) }} |
| 81 | + {{- else }} |
| 82 | + {{- .Values.serviceAccount.name }} |
| 83 | + {{- end }} |
| 84 | +{{- end }} |
| 85 | +
|
| 86 | +{{- /* binderhub's Ingress name */}} |
| 87 | +{{- define "binderhub-service.binderhub.ingress.fullname" -}} |
| 88 | + {{- if (include "binderhub-service.fullname" .) }} |
| 89 | + {{- include "binderhub-service.fullname" . }} |
| 90 | + {{- else -}} |
| 91 | + binderhub |
| 92 | + {{- end }} |
| 93 | +{{- end }} |
| 94 | + |
| 95 | +{{- /* docker-api resources' default name */}} |
| 96 | +{{- define "binderhub-service.docker-api.fullname" -}} |
| 97 | + {{- include "binderhub-service.fullname.dash" . }}docker-api |
| 98 | +{{- end }} |
| 99 | +
|
| 100 | +{{- /* build-pods-docker-config name */}} |
| 101 | +{{- define "binderhub-service.build-pods-docker-config.fullname" -}} |
| 102 | + {{- include "binderhub-service.fullname.dash" . }}build-pods-docker-config |
| 103 | +{{- end }} |
| 104 | +
|
| 105 | +
|
| 106 | +
|
| 107 | +{{- /* |
| 108 | + Cluster wide resources |
| 109 | +
|
| 110 | + We enforce uniqueness of names for our cluster wide resources. We assume that |
| 111 | + the prefix from setting fullnameOverride to null or a string will be cluster |
| 112 | + unique. |
| 113 | +*/}} |
| 114 | +
|
| 115 | +{{- /* |
| 116 | + We currently have no cluster wide resources, but if you add one below in the |
| 117 | + future, remove this comment and add an entry mimicing how the jupyterhub helm |
| 118 | + chart does it. |
| 119 | +*/}} |
0 commit comments