{{- $fullName := include "library-chart.fullname" . -}} apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ include "library-chart.fullname" . }} labels: {{- include "library-chart.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} serviceName: {{ include "library-chart.fullname" . }} selector: matchLabels: {{- include "library-chart.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "library-chart.selectorLabels" . | nindent 8 }} spec: volumes: - name: home {{- if .Values.persistence.enabled }} persistentVolumeClaim: claimName: {{ .Values.persistence.existingClaim | default (include "library-chart.fullname" .) }} {{- else }} emptyDir: {} {{- end }} {{- if .Values.discovery.hive }} - name: hive-config configMap: name: {{ include "library-chart.configMapNameHive" . }} {{- end }} {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "library-chart.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} subdomain: {{ include "library-chart.fullname" . }} hostname: jupyter containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} {{- if .Values.service.image.custom.enabled }} image: "{{ .Values.service.image.custom.version }}" {{- else }} image: "{{ .Values.service.image.version }}" {{- end }} command: ["/bin/sh","-c"] args: ["{{ .Values.init.standardInitPath }} jupyter lab --no-browser --ip '0.0.0.0' --LabApp.token='$(PASSWORD)'"] imagePullPolicy: {{ .Values.service.image.pullPolicy }} env: - name: KUBERNETES_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: IMAGE_NAME {{- if .Values.service.image.custom.enabled }} value: "{{ .Values.service.image.custom.version }}" {{- else }} value: "{{ .Values.service.image.version }}" {{- end }} - name: NB_USER value: {{ .Values.environment.user }} - name: PASSWORD value: {{ .Values.security.password }} - name: PROJECT_USER value: {{ .Values.environment.user }} - name: PROJECT_GROUP value: {{ .Values.environment.group }} - name: ROOT_PROJECT_DIRECTORY value: /home/{{ .Values.environment.user }}/work {{- if .Values.init.personalInit }} - name: PERSONAL_INIT_SCRIPT value: {{ .Values.init.personalInit }} {{- end }} {{- if .Values.init.personalInitArgs }} - name: PERSONAL_INIT_ARGS value: {{ .Values.init.personalInitArgs }} {{- end }} {{- if .Values.environment.root }} - name: GRANT_SUDO value: "yes" {{- end }} envFrom: {{- if .Values.s3.enabled }} - configMapRef: name: {{ include "library-chart.configMapNameS3" . }} {{- end }} {{- if .Values.vault.enabled }} - configMapRef: name: {{ include "library-chart.configMapNameVault" . }} {{- end }} {{- if .Values.git.enabled }} - configMapRef: name: {{ include "library-chart.configMapNameGit" . }} {{- end }} {{- if not (empty (trim (include "library-chart.configMapMLFlow" .)))}} - configMapRef: name: {{ include "library-chart.configMapNameMLFlow" . }} {{- end }} ports: - name: http containerPort: 8888 protocol: TCP livenessProbe: httpGet: path: / port: http readinessProbe: httpGet: path: / port: http startupProbe: httpGet: path: / port: http {{- toYaml .Values.startupProbe | nindent 12 }} resources: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: - mountPath: /home/{{ .Values.environment.user}}/work name: home {{- if .Values.discovery.hive }} - name: hive-config mountPath: /opt/hive/conf/hive-site.xml subPath: hive-site.xml {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }}