Skip to content

Commit

Permalink
update kf-notebooks chart to trim object names to size
Browse files Browse the repository at this point in the history
  • Loading branch information
Sameer Kulkarni committed Sep 25, 2024
1 parent a9193ef commit 0756053
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion charts/kf-notebooks/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.1.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
20 changes: 20 additions & 0 deletions charts/kf-notebooks/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@ If release name contains chart name it will be used as a full name.
{{- end }}
{{- end }}

{{/*
Create a default name for notebook pvc.
*/}}

{{- define "kf-notebooks.notebooks.jupyter.pvc.name.base" -}}
{{- printf "%s-%s" (include "kf-notebooks.fullname" .) .Values.notebooks.jupyter.name | trunc 53 | trimSuffix "-" -}}
{{- end }}

{{- define "kf-notebooks.notebooks.vscode.pvc.name.base" -}}
{{- printf "%s-%s" (include "kf-notebooks.fullname" .) .Values.notebooks.vscode.name | trunc 53 | trimSuffix "-" -}}
{{- end }}

{{- define "kf-notebooks.notebooks.jupyter.pvc.name" -}}
{{- printf "%s-%s" (include "kf-notebooks.notebooks.jupyter.pvc.name.base" .) "workspace" -}}
{{- end }}

{{- define "kf-notebooks.notebooks.vscode.pvc.name" -}}
{{- printf "%s-%s" (include "kf-notebooks.notebooks.vscode.pvc.name.base" .) "workspace" -}}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
Expand Down
2 changes: 1 addition & 1 deletion charts/kf-notebooks/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "kf-notebooks.fullname" $ }}-{{ $notebook.name }}-workspace
name: {{ printf "%s-%s" (include "kf-notebooks.fullname" $) $notebook.name | trunc 53 | trimSuffix "-" }}-workspace
labels:
{{- include "kf-notebooks.labels" $ | nindent 4 }}
app: {{ $notebook.name }}
Expand Down
4 changes: 2 additions & 2 deletions charts/kf-notebooks/templates/pytorch-cuda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: kubeflow.org/v1
kind: Notebook
metadata:
name: {{ include "kf-notebooks.fullname" . }}-{{ .Values.notebooks.jupyter.name }}
name: {{ printf "%s-%s" (include "kf-notebooks.fullname" .) .Values.notebooks.jupyter.name | trunc 41 | trimSuffix "-" }}
labels:
{{- include "kf-notebooks.labels" . | nindent 4 }}
app: {{ .Values.notebooks.jupyter.name }}
Expand All @@ -27,5 +27,5 @@ spec:
name: dshm
- name: workspace
persistentVolumeClaim:
claimName: {{ include "kf-notebooks.fullname" . }}-{{ .Values.notebooks.jupyter.name }}-workspace
claimName: {{ include "kf-notebooks.notebooks.jupyter.pvc.name" . }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/kf-notebooks/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "kf-notebooks.fullname" $ }}-{{ $notebook.name }}
name: {{ printf "%s-%s" (include "kf-notebooks.fullname" $) $notebook.name | trunc 41 | trimSuffix "-" }}
labels:
{{- include "kf-notebooks.labels" $ | nindent 4 }}
app: {{ $notebook.name }}
Expand Down
4 changes: 2 additions & 2 deletions charts/kf-notebooks/templates/vscode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: kubeflow.org/v1
kind: Notebook
metadata:
name: {{ include "kf-notebooks.fullname" . }}-{{ .Values.notebooks.vscode.name }}
name: {{ printf "%s-%s" (include "kf-notebooks.fullname" .) .Values.notebooks.vscode.name | trunc 41 | trimSuffix "-" }}
labels:
{{- include "kf-notebooks.labels" . | nindent 4 }}
app: {{ .Values.notebooks.vscode.name }}
Expand All @@ -27,5 +27,5 @@ spec:
name: dshm
- name: workspace
persistentVolumeClaim:
claimName: {{ include "kf-notebooks.fullname" . }}-{{ .Values.notebooks.vscode.name }}-workspace
claimName: {{ include "kf-notebooks.notebooks.vscode.pvc.name" . }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/kf-notebooks/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ service:
notebooks:
jupyter:
enabled: false
name: jupyter-pytorch-cuda
name: jupyter
image:
repository: kubeflownotebookswg/jupyter-pytorch-cuda-full
tag: ""
Expand All @@ -36,7 +36,7 @@ notebooks:

vscode:
enabled: false
name: codeserver-python
name: vscode
image:
repository: kubeflownotebookswg/codeserver-python
tag: ""
Expand Down

0 comments on commit 0756053

Please sign in to comment.