1+ apiVersion : batch/v1
2+ kind : Job
3+ metadata :
4+ name : drycc-quickwit-job-upgrade
5+ annotations :
6+ component.drycc.cc/version : {{ .Values.imageTag }}
7+ helm.sh/hook : post-install,post-upgrade,post-rollback
8+ helm.sh/hook-delete-policy : before-hook-creation,hook-succeeded
9+ spec :
10+ template :
11+ spec :
12+ initContainers :
13+ - name : drycc-quickwit-init
14+ image : {{.Values.imageRegistry}}/{{.Values.imageOrg}}/python-dev:latest
15+ imagePullPolicy : {{.Values.imagePullPolicy}}
16+ args :
17+ - netcat
18+ - -v
19+ - -u
20+ - $(DRYCC_DATABASE_URL),$(DRYCC_DATABASE_REPLICA_URL)
21+ {{- include "quickwit.envs" . | indent 8 }}
22+ containers :
23+ - name : drycc-quickwit-job-upgrade
24+ image : {{.Values.imageRegistry}}/{{.Values.imageOrg}}/quickwit:{{.Values.imageTag}}
25+ imagePullPolicy : {{.Values.imagePullPolicy}}
26+ {{- if .Values.diagnosticMode.enabled }}
27+ command : {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 8 }}
28+ args : {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 8 }}
29+ {{- else }}
30+ command :
31+ - init-stack
32+ args :
33+ - bash
34+ - -ec
35+ - |
36+ QUICKWIT_API="http://drycc-quickwit.{{ $.Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:7280"
37+ TEMPLATE_FILE="/opt/drycc/quickwit/config/log-indexes-template.json"
38+ response=$(curl -s -o /dev/null -w "%{http_code}" -XGET "$QUICKWIT_API/{{ .Values.logIndexTemplateName }}")
39+ if [ "$response" -eq 404 ]; then
40+ echo "Template not found, creating new template..."
41+ curl -XPOST -d @"$TEMPLATE_FILE" -H "Content-Type: application/json" "$QUICKWIT_API"
42+ elif [ "$response" -eq 200 ]; then
43+ echo "Template exists, updating..."
44+ curl -XPUT -d @"$TEMPLATE_FILE" -H "Content-Type: application/json" "$QUICKWIT_API/{{ .Values.logIndexTemplateName }}"
45+ else
46+ echo "Unexpected HTTP status: $response"
47+ exit 1
48+ fi
49+ {{- end }}
50+ {{- with index .Values "resources" }}
51+ resources :
52+ {{- toYaml . | nindent 10 }}
53+ {{- end }}
54+ {{- include "quickwit.envs" . | indent 8 }}
55+ volumeMounts :
56+ - name : quickwit-config
57+ readOnly : true
58+ mountPath : /opt/drycc/quickwit/config
59+ - name : quickwit-control-plane-data
60+ mountPath : /data
61+ volumes :
62+ - name : quickwit-config
63+ configMap :
64+ name : quickwit-config
65+ - name : quickwit-control-plane-data
66+ emptyDir : {}
67+ restartPolicy : Never
0 commit comments