123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- {{ include "common.storage.hostPathValidate" .Values }}
- {{ $elastic_search := (. | mustDeepCopy) }}
- {{ $_ := set $elastic_search "common" (dict "nameSuffix" "elasticsearch") }}
- apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
- kind: Deployment
- metadata:
- name: {{ template "common.names.fullname" . }}-diskover
- labels:
- app: {{ template "common.names.name" . }}
- chart: {{ template "common.names.chart" . }}
- release: {{ .Release.Name }}
- heritage: {{ .Release.Service }}
- annotations:
- rollme: {{ randAlphaNum 5 | quote }}
- spec:
- replicas: {{ (default 1 .Values.replicas) }}
- strategy:
- type: "Recreate"
- selector:
- matchLabels:
- app: {{ template "common.names.name" . }}
- release: {{ .Release.Name }}
- template:
- metadata:
- name: {{ template "common.names.fullname" . }}
- labels:
- app: {{ template "common.names.name" . }}
- release: {{ .Release.Name }}
- {{- include "common.labels.selectorLabels" . | nindent 8 }}
- annotations: {{ include "common.annotations" . | nindent 8 }}
- spec:
- initContainers:
- - name: init-config
- {{ include "common.containers.imageConfig" .Values.python.image | nindent 10 }}
- command: ["python3", "/init_scripts/init_config.py"]
- env:
- {{ $envList := (default list .Values.environmentVariables) }}
- {{ $envList = mustAppend $envList (dict "name" "TZ" "value" .Values.timezone) }}
- {{ $envList = mustAppend $envList (dict "name" "DS_USER" "valueFromSecret" true "secretName" "diskover-credentials" "secretKey" "username") }}
- {{ $envList = mustAppend $envList (dict "name" "DS_PASS" "valueFromSecret" true "secretName" "diskover-credentials" "secretKey" "password") }}
- {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
- {{ include "elasticsearch.IP" $elastic_search | nindent 12 }}
- {{ include "elasticsearch.credentials" . | nindent 12 }}
- {{ $configPath := (dict "mountPath" (printf "%s/diskover-web.conf.d/" .Values.appVolumeMounts.config.mountPath) "configFile" "Constants.php") }}
- {{ include "config.file.path" $configPath | nindent 12 }}
- volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
- - name: diskover-initial-scripts
- mountPath: /init_scripts/
- - name: wait-es-search
- {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
- env:
- {{ include "elasticsearch.IP" $elastic_search | nindent 12 }}
- command: ["python3", "/init_scripts/wait_for_elastic_search.py"]
- volumeMounts:
- - name: diskover-initial-scripts
- mountPath: /init_scripts/
- - name: init-es-config
- {{ include "common.containers.imageConfig" .Values.python.image | nindent 10 }}
- command: ["python3", "/init_scripts/initial_es_config.py"]
- env:
- {{ $envListConfig := (default list .Values.environmentVariables) }}
- {{ include "elasticsearch.IP" $elastic_search | nindent 12 }}
- {{ include "elasticsearch.credentials" . | nindent 12 }}
- {{ $configPathES := (dict "mountPath" (printf "%s/diskover.conf.d/diskover/" .Values.appVolumeMounts.config.mountPath) "configFile" "config.yaml") }}
- {{ include "config.file.path" $configPathES | nindent 12 }}
- {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envListConfig) | nindent 12 }}
- volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
- - name: diskover-initial-scripts
- mountPath: /init_scripts/
- containers:
- - name: {{ .Chart.Name }}
- {{ include "common.resources.limitation" . | nindent 10 }}
- {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
- volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
- - name: diskover-initial-scripts
- mountPath: /init_scripts/
- {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
- - name: extrappvolume-{{ $index }}
- mountPath: {{ $hostPathConfiguration.mountPath }}
- {{ end }}
- {{ range $index, $hostPathConfiguration := .Values.extraDataVolumeMounts }}
- - name: extradatavolume-{{ $index }}
- mountPath: {{ $hostPathConfiguration.mountPath }}
- {{ end }}
- ports:
- - name: web
- containerPort: 80
- {{ $cronjobSchedule := .Values.cronjobSchedule }}
- lifecycle:
- postStart:
- exec:
- command:
- - /bin/sh
- - -c
- - |
- ./init_scripts/.default_crawler.sh /app/diskover/diskover.py /data;
- {{ range $index, $hostPathConfiguration := .Values.extraDataVolumeMounts }}
- ./init_scripts/.default_crawler.sh /app/diskover/diskover.py {{ $hostPathConfiguration.mountPath }};
- {{ end }}
- {{ range $index, $hostPathConfiguration := .Values.extraDataVolumeMounts }}
- echo "{{$cronjobSchedule}} python3 /app/diskover/diskover.py {{ $hostPathConfiguration.mountPath }}" >> /config/crontab;
- {{ end }}
- echo "{{.Values.cronjobSchedule}} python3 /app/diskover/diskover.py /data" >> /config/crontab;
- crontab /config/crontab;
- env:
- {{ $envListDiskover := (default list .Values.environmentVariables) }}
- {{ $envListDiskover = mustAppend $envListDiskover (dict "name" "PUID" "value" .Values.ownerUID) }}
- {{ $envListDiskover = mustAppend $envListDiskover (dict "name" "PGID" "value" .Values.ownerGID) }}
- {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envListDiskover) | nindent 12 }}
- livenessProbe:
- httpGet:
- path: /login.php
- port: 80
- initialDelaySeconds: 10
- periodSeconds: 10
- timeoutSeconds: 5
- failureThreshold: 5
- successThreshold: 1
- readinessProbe:
- httpGet:
- path: /login.php
- port: 80
- initialDelaySeconds: 10
- periodSeconds: 10
- timeoutSeconds: 5
- failureThreshold: 5
- successThreshold: 2
- startupProbe:
- httpGet:
- path: /login.php
- port: 80
- initialDelaySeconds: 10
- periodSeconds: 5
- timeoutSeconds: 2
- failureThreshold: 60
- successThreshold: 1
- {{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
- volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
- {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
- - name: extrappvolume-{{ $index }}
- hostPath:
- path: {{ $hostPathConfiguration.hostPath }}
- {{ end }}
- {{ range $index, $hostPathConfiguration := .Values.extraDataVolumeMounts }}
- - name: extradatavolume-{{ $index }}
- hostPath:
- path: {{ $hostPathConfiguration.hostPath }}
- {{ end }}
- - name: diskover-initial-scripts
- configMap:
- defaultMode: 0700
- name: "diskover-initial-scripts"
|