From 3c761e96201bc1263af5620ec9ee13705e234e06 Mon Sep 17 00:00:00 2001 From: Gaspard FEREY Date: Wed, 4 Dec 2024 16:33:54 +0100 Subject: [PATCH 1/5] Deletion notes --- charts/library-chart/templates/_notes.tpl | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 charts/library-chart/templates/_notes.tpl diff --git a/charts/library-chart/templates/_notes.tpl b/charts/library-chart/templates/_notes.tpl new file mode 100644 index 00000000..70925051 --- /dev/null +++ b/charts/library-chart/templates/_notes.tpl @@ -0,0 +1,26 @@ +{{/* vim: set filetype=mustache: */}} + +{{/* Template to generate notes about service deletion */}} +{{- define "library-chart.notes-deletion" -}} + {{- if and (.Values.persistence).enabled (not .Values.persistence.existingClaim) -}} + {{- if eq .Values.userPreferences.language "fr" -}} +**NOTES concernant la suppression :** +Votre répertoire de travail `/home/{{ .Values.environment.user }}/work` +sera **immédiatement effacé** à la suppression de votre service {{ .Chart.Name }}. +Assurez-vous de sauvegarder toutes vos ressources de travail sur des supports persistants : +- Votre code peux être stocké dans une forge logicielle telle que git. +- Vos données et modèles peuvent être stockés dans un système de stockage objet tel que S3. +Il est possible d'associer un script d'initialisation à votre service pour mettre en place un environnement de travail sur mesure +(télécharger vos ressources, installer les bibliothèques et outils dont vous avez besoin, configurer votre service, etc.) + {{- else -}} +**NOTES about deletion:** +Your work directory `/home/{{ .Values.environment.user }}/work` +will be **immediately deleted** upon the termination of your {{ .Chart.Name }} service. +Make sure to save all your work resources on persistent storage: +- Your code can be stored in a version control system such as git. +- Your data and models can be stored in an object storage system such as S3. +It is possible to associate an initialization script with your service to set up a customized working environment +(download your resources, install the libraries and tools you need, configure your service, etc.). + {{- end -}} + {{- end -}} +{{- end -}} From 80e0e6889db29a03fc590a4e5ecf0aac410a4fd8 Mon Sep 17 00:00:00 2001 From: Gaspard FEREY Date: Wed, 4 Dec 2024 19:12:11 +0100 Subject: [PATCH 2/5] Custom ports and general message notes --- charts/library-chart/Chart.yaml | 2 +- charts/library-chart/templates/_common.tpl | 24 +++++++++- charts/library-chart/templates/_notes.tpl | 54 ++++++++++++++++++++-- 3 files changed, 73 insertions(+), 7 deletions(-) diff --git a/charts/library-chart/Chart.yaml b/charts/library-chart/Chart.yaml index 6a41d211..71597cec 100644 --- a/charts/library-chart/Chart.yaml +++ b/charts/library-chart/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v2 name: library-chart -version: 1.5.33 +version: 1.5.34 type: library diff --git a/charts/library-chart/templates/_common.tpl b/charts/library-chart/templates/_common.tpl index 39a449df..21cc9ee0 100644 --- a/charts/library-chart/templates/_common.tpl +++ b/charts/library-chart/templates/_common.tpl @@ -13,4 +13,26 @@ Return the target Kubernetes version {{- else }} {{- default .Capabilities.KubeVersion.Version .Values.kubeVersion -}} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} + +{{/* +Return the URL at which the service can be reached +*/}} +{{- define "library-chart.service-url" -}} + {{- if .Values.ingress.enabled -}} + {{- printf "%s://%s" (.Values.ingress.tls | ternary "https" "http") .Values.ingress.hostname -}} + {{- else if .Values.route.enabled -}} + {{- printf "https://%s" .Values.route.hostname -}} + {{- end -}} +{{- end -}} + +{{/* +Return the URL at which the custom port can be reached +*/}} +{{- define "library-chart.user-url" -}} + {{- if .Values.ingress.enabled -}} + {{- printf "%s://%s" (.Values.ingress.tls | ternary "https" "http") .Values.ingress.userHostname -}} + {{- else if .Values.route.enabled -}} + {{- printf "https://%s" .Values.route.userHostname -}} + {{- end -}} +{{- end -}} diff --git a/charts/library-chart/templates/_notes.tpl b/charts/library-chart/templates/_notes.tpl index 70925051..72f88540 100644 --- a/charts/library-chart/templates/_notes.tpl +++ b/charts/library-chart/templates/_notes.tpl @@ -1,9 +1,53 @@ {{/* vim: set filetype=mustache: */}} +{{/* Template to generate a general message as a note header */}} +{{- define "library-chart.general-message" -}} +{{- if and (eq .Values.userPreferences.language "fr" (.Values.message).fr) -}} +{{- (.Values.message).fr }} +{{ else -}} +{{- (.Values.message).en }} +{{ end -}} +{{- end -}} + + +{{/* Template to generate notes about custom user-defined port exposition */}} +{{- define "library-chart.notes-custom-ports" -}} +{{- if and + ((.Values.networking).user).enabled + (or .Values.networking.user.ports .Values.networking.user.port) + (or (.Values.ingress).enabled (.Values.route).enabled) +-}} +{{- $userPorts := .Values.networking.user.ports | default (list .Values.networking.user.port) -}} +{{- $URL := include "library-chart.user-url" . -}} +{{- if eq .Values.userPreferences.language "fr" -}} +{{- if eq (len $userPorts) 1 }} +Vous pouvez vous connecter à votre port personnalisé ({{ first $userPorts }}) en utilisant [ce lien]({{ $URL }}). +{{- else }} +Vous pouvez vous connecter à vos ports personnalisés en utilisant les liens ci-dessous : +{{ range $userPort := $userPorts -}} +- [Port {{ $userPort }}]({{ regexReplaceAll "([^\\.]+)\\.(.*)" $URL (printf "${1}-%d.${2}" (int $userPort)) }}) +{{ end -}} +{{- end -}} +Si vous accédez ces URL sans démarrer vos services personnalisés, vous obtiendrez une erreur 502 Bad Gateway. +{{ else -}} +{{- if eq (len $userPorts) 1 }} +You can connect to your custom port ({{ first $userPorts }}) using [this link]({{ $URL }}). +{{- else }} +You can connect to your custom ports using the following links: +{{ range $userPort := $userPorts -}} +- [Port {{ $userPort }}]({{ regexReplaceAll "([^\\.]+)\\.(.*)" $URL (printf "${1}-%d.${2}" (int $userPort)) }}) +{{ end -}} +{{- end -}} +If you access these URL without starting the corresponding services you will get a 502 bad gateway error. +{{ end -}} +{{- end -}} +{{- end -}} + + {{/* Template to generate notes about service deletion */}} {{- define "library-chart.notes-deletion" -}} - {{- if and (.Values.persistence).enabled (not .Values.persistence.existingClaim) -}} - {{- if eq .Values.userPreferences.language "fr" -}} +{{- if and (.Values.persistence).enabled (not .Values.persistence.existingClaim) -}} +{{- if eq .Values.userPreferences.language "fr" }} **NOTES concernant la suppression :** Votre répertoire de travail `/home/{{ .Values.environment.user }}/work` sera **immédiatement effacé** à la suppression de votre service {{ .Chart.Name }}. @@ -12,7 +56,7 @@ Assurez-vous de sauvegarder toutes vos ressources de travail sur des supports pe - Vos données et modèles peuvent être stockés dans un système de stockage objet tel que S3. Il est possible d'associer un script d'initialisation à votre service pour mettre en place un environnement de travail sur mesure (télécharger vos ressources, installer les bibliothèques et outils dont vous avez besoin, configurer votre service, etc.) - {{- else -}} +{{ else }} **NOTES about deletion:** Your work directory `/home/{{ .Values.environment.user }}/work` will be **immediately deleted** upon the termination of your {{ .Chart.Name }} service. @@ -21,6 +65,6 @@ Make sure to save all your work resources on persistent storage: - Your data and models can be stored in an object storage system such as S3. It is possible to associate an initialization script with your service to set up a customized working environment (download your resources, install the libraries and tools you need, configure your service, etc.). - {{- end -}} - {{- end -}} +{{ end -}} +{{- end -}} {{- end -}} From 8df19e96dd3fd52f00be8b4436a97ee3e3020bcd Mon Sep 17 00:00:00 2001 From: Gaspard FEREY Date: Thu, 5 Dec 2024 13:49:34 +0100 Subject: [PATCH 3/5] Added connection notes and full NOTES generation --- charts/vscode-python/templates/NOTES.txt | 97 +--------------------- charts/vscode-python/templates/_common.tpl | 1 + charts/vscode-python/templates/_notes.tpl | 1 + 3 files changed, 3 insertions(+), 96 deletions(-) create mode 120000 charts/vscode-python/templates/_common.tpl create mode 120000 charts/vscode-python/templates/_notes.tpl diff --git a/charts/vscode-python/templates/NOTES.txt b/charts/vscode-python/templates/NOTES.txt index 0a1580fa..85449634 100644 --- a/charts/vscode-python/templates/NOTES.txt +++ b/charts/vscode-python/templates/NOTES.txt @@ -1,96 +1 @@ -{{- if eq .Values.userPreferences.language "fr" -}} -{{ (.Values.message).fr }} - -{{ if .Values.ingress.enabled -}} -- Vous pouvez vous connecter à ce Visual Studio Code avec votre navigateur en utilisant ce [lien](http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.hostname }}) -{{- end }} -{{- if .Values.route.enabled }} -- Vous pouvez vous connecter à ce Visual Studio Code avec votre navigateur en utilisant ce [lien](https://{{ .Values.route.hostname }}) -{{- end }} -- Votre password: {{ .Values.security.password }} - -{{- if and - ((.Values.networking).user).enabled - (or .Values.networking.user.ports .Values.networking.user.port) - (or (.Values.ingress).enabled (.Values.route).enabled) -}} -{{ $userPorts := .Values.networking.user.ports | default (list .Values.networking.user.port) -}} -{{- if eq (len $userPorts) 1 -}} - {{- if .Values.ingress.enabled }} -Vous pouvez vous connecter à votre port personnalisé ({{ first $userPorts }}) en utilisant [ce lien](http{{ if .Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.userHostname }}). - {{- end -}} - {{- if .Values.route.enabled }} -Vous pouvez vous connecter à votre port personnalisé ({{ first $userPorts }}) en utilisant [ce lien](https://{{ .Values.route.userHostname }}). - {{- end -}} -{{- else }} -Vous pouvez vous connecter à vos services personnalisés en utilisant les liens ci-dessous : - {{- range $userPort := $userPorts -}} - {{- if $.Values.ingress.enabled -}} - {{- $hostname := (regexReplaceAll "([^\\.]+)\\.(.*)" $.Values.ingress.userHostname (printf "${1}-%d.${2}" (int $userPort))) }} -- [Port {{ $userPort }}](http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $hostname }}) - {{- end -}} - {{- if $.Values.route.enabled -}} - {{- $hostname := (regexReplaceAll "([^\\.]+)\\.(.*)" $.Values.route.userHostname (printf "${1}-%d.${2}" (int $userPort))) }} -- [Port {{ $userPort }}](https://{{ $hostname }}) - {{- end -}} - {{- end }} -{{ end }} -Si vous accédez ces URL sans démarrer vos services personnalisés, vous obtiendrez une erreur 502 Bad Gateway. -{{- end }} - -*REMARQUES concernant la suppression :* - -{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} -- Le volume associé au chemin suivant **/home/{{ .Values.environment.user }}/work** sera supprimé -- Par conséquent, vous devriez sauvegarder votre code dans un dépôt Git externe -- Vous devriez également sauvegarder vos données dans un référentiel de données externe tel que S3 -- Vous pouvez facilement créer un nouveau service {{ .Chart.Name }}, cloner votre code et réinstaller les bibliothèques dont vous avez besoin -{{- end }} -{{- else }} -{{ (.Values.message).en }} -{{- if .Values.ingress.enabled }} -- You can connect to this vscode with your browser on this [link](http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.hostname }}) -{{- end }} -{{- if .Values.route.enabled }} -- You can connect to this vscode with your browser on this [link](https://{{ .Values.route.hostname }}) -{{- end }} -- Your password: {{ .Values.security.password }} - -{{- if and - ((.Values.networking).user).enabled - (or .Values.networking.user.ports .Values.networking.user.port) - (or (.Values.ingress).enabled (.Values.route).enabled) -}} -{{ $userPorts := .Values.networking.user.ports | default (list .Values.networking.user.port) -}} -{{- if eq (len $userPorts) 1 -}} - {{- if .Values.ingress.enabled }} -You can connect to your custom port ({{ first $userPorts }}) using [this link](http{{ if .Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.userHostname }}). - {{- end -}} - {{- if .Values.route.enabled }} -You can connect to your custom port ({{ first $userPorts }}) using [this link](https://{{ .Values.route.userHostname }}). - {{- end -}} -{{- else }} -You can connect to your custom services using the following links: - {{- range $userPort := $userPorts -}} - {{- if $.Values.ingress.enabled -}} - {{- $hostname := (regexReplaceAll "([^\\.]+)\\.(.*)" $.Values.ingress.userHostname (printf "${1}-%d.${2}" (int $userPort))) }} -- [Port {{ $userPort }}](http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $hostname }}) - {{- end -}} - {{- if $.Values.route.enabled -}} - {{- $hostname := (regexReplaceAll "([^\\.]+)\\.(.*)" $.Values.route.userHostname (printf "${1}-%d.${2}" (int $userPort))) }} -- [Port {{ $userPort }}](https://{{ $hostname }}) - {{- end -}} - {{- end }} -{{ end }} -If you access these URL without starting the corresponding services you will get a 502 bad gateway error. -{{- end }} - -*NOTES about deletion :* -{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} -- The volume associated with the following path **/home/{{ .Values.environment.user }}/work** will be deleted -- So, you should save your code to an external git repository -- So, You should save your data to an external data repository like S3 -- You can easily create a new {{ .Chart.Name }} service, clone your code and install again some librairies you need -{{- end -}} - -{{- end -}} +{{- include "library-chart.notes" (dict "serviceName" "Visual Studio Code" "context" $) -}} diff --git a/charts/vscode-python/templates/_common.tpl b/charts/vscode-python/templates/_common.tpl new file mode 120000 index 00000000..117159e4 --- /dev/null +++ b/charts/vscode-python/templates/_common.tpl @@ -0,0 +1 @@ +/home/gaspi/git/helm-charts-interactive-services/charts/library-chart/templates/_common.tpl \ No newline at end of file diff --git a/charts/vscode-python/templates/_notes.tpl b/charts/vscode-python/templates/_notes.tpl new file mode 120000 index 00000000..b50cbb96 --- /dev/null +++ b/charts/vscode-python/templates/_notes.tpl @@ -0,0 +1 @@ +/home/gaspi/git/helm-charts-interactive-services/charts/library-chart/templates/_notes.tpl \ No newline at end of file From a6221d6da90c29d3749fb24819014684aa027cc6 Mon Sep 17 00:00:00 2001 From: Gaspard FEREY Date: Thu, 5 Dec 2024 13:57:32 +0100 Subject: [PATCH 4/5] Fixed third-party charts modifications --- charts/library-chart/templates/_common.tpl | 17 +++- charts/library-chart/templates/_notes.tpl | 100 ++++++++++++++++++++- charts/vscode-python/templates/NOTES.txt | 97 +++++++++++++++++++- charts/vscode-python/templates/_common.tpl | 1 - charts/vscode-python/templates/_notes.tpl | 1 - 5 files changed, 208 insertions(+), 8 deletions(-) delete mode 120000 charts/vscode-python/templates/_common.tpl delete mode 120000 charts/vscode-python/templates/_notes.tpl diff --git a/charts/library-chart/templates/_common.tpl b/charts/library-chart/templates/_common.tpl index 21cc9ee0..00ba2632 100644 --- a/charts/library-chart/templates/_common.tpl +++ b/charts/library-chart/templates/_common.tpl @@ -16,7 +16,7 @@ Return the target Kubernetes version {{- end -}} {{/* -Return the URL at which the service can be reached +Return the URL at which the service can be accessed */}} {{- define "library-chart.service-url" -}} {{- if .Values.ingress.enabled -}} @@ -27,7 +27,20 @@ Return the URL at which the service can be reached {{- end -}} {{/* -Return the URL at which the custom port can be reached +Return the URL at which the service can be accessed +*/}} +{{- define "library-chart.spark-url" -}} + {{- if (.Values.spark).sparkui -}} + {{- if .Values.ingress.enabled -}} + {{- printf "%s://%s" (.Values.ingress.tls | ternary "https" "http") .Values.ingress.sparkHostname -}} + {{- else if .Values.route.enabled -}} + {{- printf "https://%s" .Values.route.sparkHostname -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{/* +Return the URL at which the user-defined custom port(s) can be accessed */}} {{- define "library-chart.user-url" -}} {{- if .Values.ingress.enabled -}} diff --git a/charts/library-chart/templates/_notes.tpl b/charts/library-chart/templates/_notes.tpl index 72f88540..f4c72334 100644 --- a/charts/library-chart/templates/_notes.tpl +++ b/charts/library-chart/templates/_notes.tpl @@ -1,6 +1,8 @@ {{/* vim: set filetype=mustache: */}} -{{/* Template to generate a general message as a note header */}} +{{/* +Generate a general message as a NOTES header. +*/}} {{- define "library-chart.general-message" -}} {{- if and (eq .Values.userPreferences.language "fr" (.Values.message).fr) -}} {{- (.Values.message).fr }} @@ -9,8 +11,79 @@ {{ end -}} {{- end -}} +{{/* +Generate NOTES about connection to the service. -{{/* Template to generate notes about custom user-defined port exposition */}} +Usage: +{{ include "library-chart.notes-connection" (dict "serviceName" "Visual Studio Code" "context" $) }} + +Params: + - serviceName - String - Optional. The human readable name of the service. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "library-chart.notes-connection" -}} +{{- $serviceName := .serviceName | default .context.Chart.Name -}} +{{- with .context -}} +{{- if eq .Values.userPreferences.language "fr" -}} +{{- if or (.Values.ingress).enabled (.Values.route).enabled }} +- Vous pouvez vous connecter à {{ $serviceName }} depuis votre navigateur en utilisant [ce lien]({{ include "library-chart.service-url" . }}). +{{ else }} +- Votre service {{ $serviceName }} n'est pas directement exposé sur internet. +Vous pouvez tout de même y accéder en executant la commande suivante depuis un terminal : +`kubectl port-forward service/{{ include "library-chart.fullname" . }} :{{ .Values.networking.service.port }}` +puis en vous connectant depuis votre navigateur à l'URL suivante : `http://localhost:` +{{ end -}} +- Votre mot de passe : **`{{ .Values.security.password }}`** +{{ else -}} +{{- if or (.Values.ingress).enabled (.Values.route).enabled }} +- You can connect to {{ $serviceName }} with your browser using [this link]({{ include "library-chart.service-url" . }}). +{{ else }} +- Your service {{ $serviceName }} is not exposed on the internet. +You can still access it by running the following command from a terminal: +`kubectl port-forward service/{{ include "library-chart.fullname" . }} :{{ .Values.networking.service.port }}` +and then use the following URL with your browser: `http://localhost:` +{{ end -}} +- Your password: **`{{ .Values.security.password }}`** +{{ end -}} +{{- end -}} +{{- end -}} + + +{{/* +Generate NOTES about connection to the Spark UI (if enabled). +*/}} +{{- define "library-chart.notes-sparkui" -}} +{{- if (.Values.spark).sparkui -}} +{{- if eq .Values.userPreferences.language "fr" -}} +{{- if or (.Values.ingress).enabled (.Values.route).enabled }} +- Vous pouvez vous connecter à l'interface Spark depuis votre navigateur en utilisant [ce lien]({{ include "library-chart.spark-url" . }}). +{{ else }} +- Votre interface Spark n'est pas directement exposée sur internet. +Vous pouvez tout de même y accéder en executant la commande suivante depuis un terminal : +`kubectl port-forward service/{{ include "library-chart.fullname" . }} :{{ .Values.networking.sparkui.port }}` +puis en vous connectant depuis votre navigateur à l'URL suivante : `http://localhost:` +{{ end -}} +- Votre nom d'utilisateur : **`{{ .Values.environment.user }}`** +- Votre mot de passe : **`{{ .Values.security.password }}`** +{{ else -}} +{{- if or (.Values.ingress).enabled (.Values.route).enabled }} +- You can connect to the Spark UI with your browser using [this link]({{ include "library-chart.spark-url" . }}). +{{ else }} +- Your Spark interface is not exposed on the internet. +You can still access it by running the following command from a terminal: +`kubectl port-forward service/{{ include "library-chart.fullname" . }} :{{ .Values.networking.sparkui.port }}` +and then use the following URL with your browser: `http://localhost:` +{{ end -}} +- Your login: **`{{ .Values.environment.user }}`** +- Your password: **`{{ .Values.security.password }}`** +{{ end -}} +{{- end -}} +{{- end -}} + + +{{/* +Generate NOTES about custom user-defined port exposition. +*/}} {{- define "library-chart.notes-custom-ports" -}} {{- if and ((.Values.networking).user).enabled @@ -44,7 +117,9 @@ If you access these URL without starting the corresponding services you will get {{- end -}} -{{/* Template to generate notes about service deletion */}} +{{/* +Generate NOTES about service deletion. +*/}} {{- define "library-chart.notes-deletion" -}} {{- if and (.Values.persistence).enabled (not .Values.persistence.existingClaim) -}} {{- if eq .Values.userPreferences.language "fr" }} @@ -68,3 +143,22 @@ It is possible to associate an initialization script with your service to set up {{ end -}} {{- end -}} {{- end -}} + + +{{/* +Prints out all NOTES. + +Usage: +{{- template "library-chart.notes" (dict "serviceName" "Visual Studio Code" "context" $) -}} + +Params: + - serviceName - String - Optional. The human readable name of the service. + - context - Dict - Required. The context for the template evaluation. +*/}} +{{- define "library-chart.notes" -}} +{{- template "library-chart.general-message" .context -}} +{{- template "library-chart.notes-connection" . -}} +{{- template "library-chart.notes-sparkui" .context -}} +{{- template "library-chart.notes-custom-ports" .context -}} +{{- template "library-chart.notes-deletion" .context -}} +{{- end -}} diff --git a/charts/vscode-python/templates/NOTES.txt b/charts/vscode-python/templates/NOTES.txt index 85449634..0a1580fa 100644 --- a/charts/vscode-python/templates/NOTES.txt +++ b/charts/vscode-python/templates/NOTES.txt @@ -1 +1,96 @@ -{{- include "library-chart.notes" (dict "serviceName" "Visual Studio Code" "context" $) -}} +{{- if eq .Values.userPreferences.language "fr" -}} +{{ (.Values.message).fr }} + +{{ if .Values.ingress.enabled -}} +- Vous pouvez vous connecter à ce Visual Studio Code avec votre navigateur en utilisant ce [lien](http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.hostname }}) +{{- end }} +{{- if .Values.route.enabled }} +- Vous pouvez vous connecter à ce Visual Studio Code avec votre navigateur en utilisant ce [lien](https://{{ .Values.route.hostname }}) +{{- end }} +- Votre password: {{ .Values.security.password }} + +{{- if and + ((.Values.networking).user).enabled + (or .Values.networking.user.ports .Values.networking.user.port) + (or (.Values.ingress).enabled (.Values.route).enabled) +}} +{{ $userPorts := .Values.networking.user.ports | default (list .Values.networking.user.port) -}} +{{- if eq (len $userPorts) 1 -}} + {{- if .Values.ingress.enabled }} +Vous pouvez vous connecter à votre port personnalisé ({{ first $userPorts }}) en utilisant [ce lien](http{{ if .Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.userHostname }}). + {{- end -}} + {{- if .Values.route.enabled }} +Vous pouvez vous connecter à votre port personnalisé ({{ first $userPorts }}) en utilisant [ce lien](https://{{ .Values.route.userHostname }}). + {{- end -}} +{{- else }} +Vous pouvez vous connecter à vos services personnalisés en utilisant les liens ci-dessous : + {{- range $userPort := $userPorts -}} + {{- if $.Values.ingress.enabled -}} + {{- $hostname := (regexReplaceAll "([^\\.]+)\\.(.*)" $.Values.ingress.userHostname (printf "${1}-%d.${2}" (int $userPort))) }} +- [Port {{ $userPort }}](http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $hostname }}) + {{- end -}} + {{- if $.Values.route.enabled -}} + {{- $hostname := (regexReplaceAll "([^\\.]+)\\.(.*)" $.Values.route.userHostname (printf "${1}-%d.${2}" (int $userPort))) }} +- [Port {{ $userPort }}](https://{{ $hostname }}) + {{- end -}} + {{- end }} +{{ end }} +Si vous accédez ces URL sans démarrer vos services personnalisés, vous obtiendrez une erreur 502 Bad Gateway. +{{- end }} + +*REMARQUES concernant la suppression :* + +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +- Le volume associé au chemin suivant **/home/{{ .Values.environment.user }}/work** sera supprimé +- Par conséquent, vous devriez sauvegarder votre code dans un dépôt Git externe +- Vous devriez également sauvegarder vos données dans un référentiel de données externe tel que S3 +- Vous pouvez facilement créer un nouveau service {{ .Chart.Name }}, cloner votre code et réinstaller les bibliothèques dont vous avez besoin +{{- end }} +{{- else }} +{{ (.Values.message).en }} +{{- if .Values.ingress.enabled }} +- You can connect to this vscode with your browser on this [link](http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.hostname }}) +{{- end }} +{{- if .Values.route.enabled }} +- You can connect to this vscode with your browser on this [link](https://{{ .Values.route.hostname }}) +{{- end }} +- Your password: {{ .Values.security.password }} + +{{- if and + ((.Values.networking).user).enabled + (or .Values.networking.user.ports .Values.networking.user.port) + (or (.Values.ingress).enabled (.Values.route).enabled) +}} +{{ $userPorts := .Values.networking.user.ports | default (list .Values.networking.user.port) -}} +{{- if eq (len $userPorts) 1 -}} + {{- if .Values.ingress.enabled }} +You can connect to your custom port ({{ first $userPorts }}) using [this link](http{{ if .Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.userHostname }}). + {{- end -}} + {{- if .Values.route.enabled }} +You can connect to your custom port ({{ first $userPorts }}) using [this link](https://{{ .Values.route.userHostname }}). + {{- end -}} +{{- else }} +You can connect to your custom services using the following links: + {{- range $userPort := $userPorts -}} + {{- if $.Values.ingress.enabled -}} + {{- $hostname := (regexReplaceAll "([^\\.]+)\\.(.*)" $.Values.ingress.userHostname (printf "${1}-%d.${2}" (int $userPort))) }} +- [Port {{ $userPort }}](http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $hostname }}) + {{- end -}} + {{- if $.Values.route.enabled -}} + {{- $hostname := (regexReplaceAll "([^\\.]+)\\.(.*)" $.Values.route.userHostname (printf "${1}-%d.${2}" (int $userPort))) }} +- [Port {{ $userPort }}](https://{{ $hostname }}) + {{- end -}} + {{- end }} +{{ end }} +If you access these URL without starting the corresponding services you will get a 502 bad gateway error. +{{- end }} + +*NOTES about deletion :* +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +- The volume associated with the following path **/home/{{ .Values.environment.user }}/work** will be deleted +- So, you should save your code to an external git repository +- So, You should save your data to an external data repository like S3 +- You can easily create a new {{ .Chart.Name }} service, clone your code and install again some librairies you need +{{- end -}} + +{{- end -}} diff --git a/charts/vscode-python/templates/_common.tpl b/charts/vscode-python/templates/_common.tpl deleted file mode 120000 index 117159e4..00000000 --- a/charts/vscode-python/templates/_common.tpl +++ /dev/null @@ -1 +0,0 @@ -/home/gaspi/git/helm-charts-interactive-services/charts/library-chart/templates/_common.tpl \ No newline at end of file diff --git a/charts/vscode-python/templates/_notes.tpl b/charts/vscode-python/templates/_notes.tpl deleted file mode 120000 index b50cbb96..00000000 --- a/charts/vscode-python/templates/_notes.tpl +++ /dev/null @@ -1 +0,0 @@ -/home/gaspi/git/helm-charts-interactive-services/charts/library-chart/templates/_notes.tpl \ No newline at end of file From 082c489e4a173578b5825bee5f8f3248780077a0 Mon Sep 17 00:00:00 2001 From: Gaspard FEREY Date: Thu, 5 Dec 2024 15:00:36 +0100 Subject: [PATCH 5/5] Fixed comments indent, removed vim header and renamed sparkui-url --- charts/library-chart/templates/_common.tpl | 12 +++--- charts/library-chart/templates/_notes.tpl | 47 +++++++++++----------- 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/charts/library-chart/templates/_common.tpl b/charts/library-chart/templates/_common.tpl index 00ba2632..08bca639 100644 --- a/charts/library-chart/templates/_common.tpl +++ b/charts/library-chart/templates/_common.tpl @@ -1,7 +1,5 @@ -{{/* vim: set filetype=mustache: */}} - {{/* -Return the target Kubernetes version + Return the target Kubernetes version */}} {{- define "library-chart.capabilities.kubeVersion" -}} {{- if .Values.global }} @@ -16,7 +14,7 @@ Return the target Kubernetes version {{- end -}} {{/* -Return the URL at which the service can be accessed + Return the URL at which the service can be accessed */}} {{- define "library-chart.service-url" -}} {{- if .Values.ingress.enabled -}} @@ -27,9 +25,9 @@ Return the URL at which the service can be accessed {{- end -}} {{/* -Return the URL at which the service can be accessed + Return the URL at which the service can be accessed */}} -{{- define "library-chart.spark-url" -}} +{{- define "library-chart.sparkui-url" -}} {{- if (.Values.spark).sparkui -}} {{- if .Values.ingress.enabled -}} {{- printf "%s://%s" (.Values.ingress.tls | ternary "https" "http") .Values.ingress.sparkHostname -}} @@ -40,7 +38,7 @@ Return the URL at which the service can be accessed {{- end -}} {{/* -Return the URL at which the user-defined custom port(s) can be accessed + Return the URL at which the user-defined custom port(s) can be accessed */}} {{- define "library-chart.user-url" -}} {{- if .Values.ingress.enabled -}} diff --git a/charts/library-chart/templates/_notes.tpl b/charts/library-chart/templates/_notes.tpl index f4c72334..924c3025 100644 --- a/charts/library-chart/templates/_notes.tpl +++ b/charts/library-chart/templates/_notes.tpl @@ -1,7 +1,5 @@ -{{/* vim: set filetype=mustache: */}} - {{/* -Generate a general message as a NOTES header. + Generate a general message as a NOTES header. */}} {{- define "library-chart.general-message" -}} {{- if and (eq .Values.userPreferences.language "fr" (.Values.message).fr) -}} @@ -11,15 +9,16 @@ Generate a general message as a NOTES header. {{ end -}} {{- end -}} + {{/* -Generate NOTES about connection to the service. + Generate NOTES about connection to the service. -Usage: -{{ include "library-chart.notes-connection" (dict "serviceName" "Visual Studio Code" "context" $) }} + Usage: + {{ include "library-chart.notes-connection" (dict "serviceName" "Visual Studio Code" "context" $) }} -Params: - - serviceName - String - Optional. The human readable name of the service. - - context - Dict - Required. The context for the template evaluation. + Params: + - serviceName - String - Optional. The human readable name of the service. + - context - Dict - Required. The context for the template evaluation. */}} {{- define "library-chart.notes-connection" -}} {{- $serviceName := .serviceName | default .context.Chart.Name -}} @@ -33,7 +32,7 @@ Vous pouvez tout de même y accéder en executant la commande suivante depuis un `kubectl port-forward service/{{ include "library-chart.fullname" . }} :{{ .Values.networking.service.port }}` puis en vous connectant depuis votre navigateur à l'URL suivante : `http://localhost:` {{ end -}} -- Votre mot de passe : **`{{ .Values.security.password }}`** +- Votre password: {{ .Values.security.password }} {{ else -}} {{- if or (.Values.ingress).enabled (.Values.route).enabled }} - You can connect to {{ $serviceName }} with your browser using [this link]({{ include "library-chart.service-url" . }}). @@ -43,20 +42,20 @@ You can still access it by running the following command from a terminal: `kubectl port-forward service/{{ include "library-chart.fullname" . }} :{{ .Values.networking.service.port }}` and then use the following URL with your browser: `http://localhost:` {{ end -}} -- Your password: **`{{ .Values.security.password }}`** +- Your password: {{ .Values.security.password }} {{ end -}} {{- end -}} {{- end -}} {{/* -Generate NOTES about connection to the Spark UI (if enabled). + Generate NOTES about connection to the Spark UI (if enabled). */}} {{- define "library-chart.notes-sparkui" -}} {{- if (.Values.spark).sparkui -}} {{- if eq .Values.userPreferences.language "fr" -}} {{- if or (.Values.ingress).enabled (.Values.route).enabled }} -- Vous pouvez vous connecter à l'interface Spark depuis votre navigateur en utilisant [ce lien]({{ include "library-chart.spark-url" . }}). +- Vous pouvez vous connecter à l'interface Spark depuis votre navigateur en utilisant [ce lien]({{ include "library-chart.sparkui-url" . }}). {{ else }} - Votre interface Spark n'est pas directement exposée sur internet. Vous pouvez tout de même y accéder en executant la commande suivante depuis un terminal : @@ -67,7 +66,7 @@ puis en vous connectant depuis votre navigateur à l'URL suivante : `http://loca - Votre mot de passe : **`{{ .Values.security.password }}`** {{ else -}} {{- if or (.Values.ingress).enabled (.Values.route).enabled }} -- You can connect to the Spark UI with your browser using [this link]({{ include "library-chart.spark-url" . }}). +- You can connect to the Spark UI with your browser using [this link]({{ include "library-chart.sparkui-url" . }}). {{ else }} - Your Spark interface is not exposed on the internet. You can still access it by running the following command from a terminal: @@ -82,7 +81,7 @@ and then use the following URL with your browser: `http://localhost: {{/* -Generate NOTES about custom user-defined port exposition. + Generate NOTES about custom user-defined port exposition. */}} {{- define "library-chart.notes-custom-ports" -}} {{- if and @@ -118,12 +117,12 @@ If you access these URL without starting the corresponding services you will get {{/* -Generate NOTES about service deletion. + Generate NOTES about service deletion. */}} {{- define "library-chart.notes-deletion" -}} -{{- if and (.Values.persistence).enabled (not .Values.persistence.existingClaim) -}} +{{- if not (and (.Values.persistence).enabled .Values.persistence.existingClaim) -}} {{- if eq .Values.userPreferences.language "fr" }} -**NOTES concernant la suppression :** +**REMARQUES concernant la suppression :** Votre répertoire de travail `/home/{{ .Values.environment.user }}/work` sera **immédiatement effacé** à la suppression de votre service {{ .Chart.Name }}. Assurez-vous de sauvegarder toutes vos ressources de travail sur des supports persistants : @@ -146,14 +145,14 @@ It is possible to associate an initialization script with your service to set up {{/* -Prints out all NOTES. + Prints out all NOTES. -Usage: -{{- template "library-chart.notes" (dict "serviceName" "Visual Studio Code" "context" $) -}} + Usage: + {{- template "library-chart.notes" (dict "serviceName" "Visual Studio Code" "context" $) -}} -Params: - - serviceName - String - Optional. The human readable name of the service. - - context - Dict - Required. The context for the template evaluation. + Params: + - serviceName - String - Optional. The human readable name of the service. + - context - Dict - Required. The context for the template evaluation. */}} {{- define "library-chart.notes" -}} {{- template "library-chart.general-message" .context -}}