-
Notifications
You must be signed in to change notification settings - Fork 3
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
Change default naming to not include release name #119
Merged
consideRatio
merged 1 commit into
2i2c-org:main
from
consideRatio:pr/change-default-naming
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{- /* | ||
Common labels | ||
*/}} | ||
{{- define "binderhub-service.labels" -}} | ||
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{ include "binderhub-service.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{- /* | ||
Selector labels | ||
*/}} | ||
{{- define "binderhub-service.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ .Values.nameOverride | default .Chart.Name | trunc 63 | trimSuffix "-" }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
{{- /* | ||
These helpers encapsulates logic on how we name resources. They also enable | ||
parent charts to reference these dynamic resource names. | ||
|
||
To avoid duplicating documentation, for more information, please see the the | ||
fullnameOverride entry the jupyterhub chart's configuration reference: | ||
https://z2jh.jupyter.org/en/latest/resources/reference.html#fullnameOverride | ||
*/}} | ||
|
||
|
||
|
||
{{- /* | ||
Utility templates | ||
*/}} | ||
|
||
{{- /* | ||
Renders to a prefix for the chart's resource names. This prefix is assumed to | ||
make the resource name cluster unique. | ||
*/}} | ||
{{- define "binderhub-service.fullname" -}} | ||
{{- /* | ||
We have implemented a trick to allow a parent chart depending on this | ||
chart to call these named templates. | ||
|
||
Caveats and notes: | ||
|
||
1. While parent charts can reference these, grandparent charts can't. | ||
2. Parent charts must not use an alias for this chart. | ||
3. There is no failsafe workaround to above due to | ||
https://github.com/helm/helm/issues/9214. | ||
4. .Chart is of its own type (*chart.Metadata) and needs to be casted | ||
using "toYaml | fromYaml" in order to be able to use normal helm | ||
template functions on it. | ||
*/}} | ||
{{- $fullname_override := .Values.fullnameOverride }} | ||
{{- $name_override := .Values.nameOverride }} | ||
{{- if ne .Chart.Name "binderhub-service" }} | ||
{{- if .Values.jupyterhub }} | ||
{{- $fullname_override = .Values.jupyterhub.fullnameOverride }} | ||
{{- $name_override = .Values.jupyterhub.nameOverride }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- if eq (typeOf $fullname_override) "string" }} | ||
{{- $fullname_override }} | ||
{{- else }} | ||
{{- $name := $name_override | default .Chart.Name }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name }} | ||
{{- else }} | ||
{{- .Release.Name }}-{{ $name }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- /* | ||
Renders to a blank string or if the fullname template is truthy renders to it | ||
with an appended dash. | ||
*/}} | ||
{{- define "binderhub-service.fullname.dash" -}} | ||
{{- if (include "binderhub-service.fullname" .) }} | ||
{{- include "binderhub-service.fullname" . }}- | ||
{{- end }} | ||
{{- end }} | ||
|
||
|
||
|
||
{{- /* | ||
Namespaced resources | ||
*/}} | ||
|
||
{{- /* binderhub resources' default name */}} | ||
{{- define "binderhub-service.binderhub.fullname" -}} | ||
{{- include "binderhub-service.fullname.dash" . }}binderhub | ||
{{- end }} | ||
|
||
{{- /* binderhub's ServiceAccount name */}} | ||
{{- define "binderhub-service.binderhub.serviceaccount.fullname" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- .Values.serviceAccount.name | default (include "binderhub-service.binderhub.fullname" .) }} | ||
{{- else }} | ||
{{- .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- /* binderhub's Ingress name */}} | ||
{{- define "binderhub-service.binderhub.ingress.fullname" -}} | ||
{{- if (include "binderhub-service.fullname" .) }} | ||
{{- include "binderhub-service.fullname" . }} | ||
{{- else -}} | ||
binderhub | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- /* docker-api resources' default name */}} | ||
{{- define "binderhub-service.docker-api.fullname" -}} | ||
{{- include "binderhub-service.fullname.dash" . }}docker-api | ||
{{- end }} | ||
|
||
{{- /* build-pods-docker-config name */}} | ||
{{- define "binderhub-service.build-pods-docker-config.fullname" -}} | ||
{{- include "binderhub-service.fullname.dash" . }}build-pods-docker-config | ||
{{- end }} | ||
|
||
|
||
|
||
{{- /* | ||
Cluster wide resources | ||
|
||
We enforce uniqueness of names for our cluster wide resources. We assume that | ||
the prefix from setting fullnameOverride to null or a string will be cluster | ||
unique. | ||
*/}} | ||
|
||
{{- /* | ||
We currently have no cluster wide resources, but if you add one below in the | ||
future, remove this comment and add an entry mimicing how the jupyterhub helm | ||
chart does it. | ||
*/}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I relocated these to a dedicated file to keep track of what helper functions was related to: labels, names, and other misc things.