onyxia
onyxia copied to clipboard
Make use of initContainer instead of dockerfile for entrypoint.sh so custom-resources are better design-handled
-
[ ] take out https://github.com/InseeFrLab/onyxia/blob/main/web/Dockerfile#L34-L41
-
[ ] Instead of deployment-web.yaml put something like this :
deployment.yaml suggestion
apiVersion: apps/v1 kind: Deployment ... spec: ... template: ... spec: ... apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "onyxia.web.fullname" . }} labels: {{- include "onyxia.web.labels" . | nindent 4 }} spec: replicas: {{ .Values.web.replicaCount }} selector: matchLabels: {{- include "onyxia.web.selectorLabels" . | nindent 6 }} template: metadata: labels: {{- include "onyxia.web.selectorLabels" . | nindent 8 }} {{- with .Values.web.podLabels }} {{ toYaml . | indent 8 }} {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "onyxia.web.serviceAccountName" . }} securityContext: {{- toYaml .Values.web.podSecurityContext | nindent 8 }} initContainers: #<-- needs initContainers - name: init-unzip image: "<init-container-image>" #<-- needs image that has the tools necessary for unzipping command: ["/bin/sh", "-c"] args: - wget -O /tmp/custom-resources.zip {{ .Values.web.customResourcesTarGzFileURL }} && unzip /tmp/custom-resources.zip -d /usr/share/nginx/html/custom-resources volumeMounts: - name: custom-resources mountPath: /usr/share/nginx/html/custom-resources containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.web.securityContext | nindent 12 }} image: "{{ .Values.web.image.repository }}:{{ .Values.web.image.tag }}" imagePullPolicy: {{ .Values.web.image.pullPolicy }} env: - name: ONYXIA_VERSION value: "{{ .Chart.Version }}" - name: ONYXIA_VERSION_URL value: "https://github.com/InseeFrLab/onyxia/releases/tag/v{{ .Chart.Version }}" {{- if .Values.web.env }} {{- range $key, $value := .Values.web.env }} - name: {{ $key }} value: {{ $value | quote }} {{- end -}} {{- end }} ports: - name: http containerPort: {{ .Values.web.containerPort }} protocol: TCP livenessProbe: httpGet: path: / port: http readinessProbe: httpGet: path: / port: http resources: {{- toYaml .Values.web.resources | nindent 12 }} {{- if .Values.web.extraVolumeMounts }} volumeMounts: {{- toYaml .Values.web.extraVolumeMounts | nindent 12 }} {{- end }} {{- with .Values.web.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.web.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.web.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} volumes: #<-- added volumes bit - name: custom-resources emptyDir: {} {{- if .Values.web.extraVolumes }} {{- toYaml .Values.web.extraVolumes | nindent 8 }} #<-- not sure about indent {{- end }} {{- if .Values.web.priorityClassName }} priorityClassName: "{{ .Values.web.priorityClassName }}" {{- end }}
-
[ ] add
web: customResourcesTarGzFileURL: ""