Skip to content
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

Trim kf-notebook object names to size #21

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "-" }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name field is duplicated in the metadata section. You should remove one of the name definitions to fix the error.

metadata:
  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