mirror of
https://github.com/truecharts/library-charts.git
synced 2026-07-05 11:26:22 -03:00
move codeserver to seperate pod
This commit is contained in:
@@ -4,18 +4,21 @@ It will include / inject the required templates based on the given values.
|
||||
*/}}
|
||||
{{- define "tc.v1.common.addon.codeserver" -}}
|
||||
{{- if .Values.addons.codeserver.enabled -}}
|
||||
{{/* Append the code-server container to the additionalContainers */}}
|
||||
{{- $container := include "tc.v1.common.addon.codeserver.container" . | fromYaml -}}
|
||||
{{- if $container -}}
|
||||
{{- $_ := set .Values.workload.main.podSpec.containers "codeserver" $container -}}
|
||||
{{/* Append the code-server workload to the workloads */}}
|
||||
{{- $workload := include "tc.v1.common.addon.codeserver.workload" . | fromYaml -}}
|
||||
{{- if $workload -}}
|
||||
{{- $_ := set $.Values.workload "codeserver" $workload -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Add the code-server service */}}
|
||||
{{- if .Values.addons.codeserver.service.enabled -}}
|
||||
{{- $serviceValues := .Values.addons.codeserver.service -}}
|
||||
{{- $_ := set $serviceValues "targetPort" 12321 -}}
|
||||
{{- $_ := set $serviceValues "targetSelector" "codeserver" -}}
|
||||
{{- $_ := set .Values.service "codeserver" $serviceValues -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{/* Add the code-server ingress */}}
|
||||
{{- if .Values.addons.codeserver.ingress.enabled -}}
|
||||
{{- $ingressValues := .Values.addons.codeserver.ingress -}}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
{{/*
|
||||
The code-server sidecar container to be inserted.
|
||||
*/}}
|
||||
{{- define "tc.v1.common.addon.codeserver.container" -}}
|
||||
imageSelector: "codeserverImage"
|
||||
imagePullPolicy: {{ .Values.codeserverImage.pullPolicy }}
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
runAsGroup: 0
|
||||
runAsNonRoot: false
|
||||
readOnlyRootFilesystem: false
|
||||
env:
|
||||
{{- range $envList := .Values.addons.codeserver.envList -}}
|
||||
{{- if and $envList.name $envList.value }}
|
||||
{{ $envList.name }}: {{ $envList.value | quote }}
|
||||
{{- else }}
|
||||
{{- fail "Please specify name/value for codeserver environment variable" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with .Values.addons.codeserver.env -}}
|
||||
{{- range $k, $v := . }}
|
||||
{{ $k }}: {{ $v | quote }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: codeserver
|
||||
containerPort: {{ .Values.addons.codeserver.service.ports.codeserver.port }}
|
||||
protocol: TCP
|
||||
args:
|
||||
{{- range .Values.addons.codeserver.args }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
- "--port"
|
||||
- "{{ .Values.addons.codeserver.service.ports.codeserver.port }}"
|
||||
- {{ .Values.addons.codeserver.workingDir | default "/" }}
|
||||
volumeMounts:
|
||||
- inherit: all
|
||||
resources:
|
||||
inherit: true
|
||||
{{- end -}}
|
||||
41
library/common/templates/addons/code-server/_workload.tpl
Normal file
41
library/common/templates/addons/code-server/_workload.tpl
Normal file
@@ -0,0 +1,41 @@
|
||||
{{/*
|
||||
The code-server sidecar container to be inserted.
|
||||
*/}}
|
||||
{{- define "tc.v1.common.addon.codeserver.workload" -}}
|
||||
enabled: true
|
||||
podSpec:
|
||||
containers:
|
||||
codeserver:
|
||||
enabled: true
|
||||
imageSelector: "codeserverImage"
|
||||
imagePullPolicy: {{ .Values.codeserverImage.pullPolicy }}
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
runAsGroup: 0
|
||||
runAsNonRoot: false
|
||||
readOnlyRootFilesystem: false
|
||||
env:
|
||||
{{- range $envList := .Values.addons.codeserver.envList -}}
|
||||
{{- if and $envList.name $envList.value }}
|
||||
{{ $envList.name }}: {{ $envList.value | quote }}
|
||||
{{- else }}
|
||||
{{- fail "Please specify name/value for codeserver environment variable" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with .Values.addons.codeserver.env -}}
|
||||
{{- range $k, $v := . }}
|
||||
{{ $k }}: {{ $v | quote }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: codeserver
|
||||
containerPort: {{ .Values.addons.codeserver.service.ports.codeserver.port }}
|
||||
protocol: TCP
|
||||
args:
|
||||
{{- range .Values.addons.codeserver.args }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
- "--port"
|
||||
- "{{ .Values.addons.codeserver.service.ports.codeserver.port }}"
|
||||
- {{ .Values.addons.codeserver.workingDir | default "/" }}
|
||||
{{- end -}}
|
||||
@@ -506,6 +506,7 @@ addons:
|
||||
existingSecret: ""
|
||||
|
||||
# -- select pods to bind vpn addon to
|
||||
# Add "codeserver" to also add the codeserver pod to VPN
|
||||
targetSelector:
|
||||
- main
|
||||
|
||||
@@ -547,11 +548,7 @@ addons:
|
||||
port: 12321
|
||||
enabled: true
|
||||
protocol: http
|
||||
targetPort: 12321
|
||||
## Specify the nodePort value for the LoadBalancer and NodePort service types.
|
||||
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
|
||||
##
|
||||
# nodePort: 36107
|
||||
|
||||
|
||||
ingress:
|
||||
# -- Enable an ingress for the code-server add-on.
|
||||
|
||||
Reference in New Issue
Block a user