feat(ci): update helm config (#157)
This commit is contained in:
@@ -57,8 +57,10 @@ spec:
|
||||
image: "{{ .Values.cozeServer.image.repository }}:{{ .Values.cozeServer.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.cozeServer.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.cozeServer.service.port }}
|
||||
{{- range .Values.cozeServer.service.ports }}
|
||||
- name: {{ .name }}
|
||||
containerPort: {{ .targetPort }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: MYSQL_HOST
|
||||
value: "{{ include "opencoze.fullname" . }}-mysql"
|
||||
@@ -95,13 +97,18 @@ spec:
|
||||
value: {{ $val | quote }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.cozeServer.confHostPath }}
|
||||
volumeMounts:
|
||||
- name: model-config
|
||||
mountPath: /app/resources/conf/model
|
||||
{{- if .Values.cozeServer.confHostPath }}
|
||||
- name: opencoze-server-conf
|
||||
mountPath: /app/resources/conf
|
||||
{{- end }}
|
||||
{{- if .Values.cozeServer.confHostPath }}
|
||||
volumes:
|
||||
- name: model-config
|
||||
configMap:
|
||||
name: {{ include "opencoze.fullname" . }}-model-config
|
||||
{{- if .Values.cozeServer.confHostPath }}
|
||||
- name: opencoze-server-conf
|
||||
hostPath:
|
||||
path: {{ .Values.cozeServer.confHostPath }}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "opencoze.fullname" . }}-es-init-config
|
||||
data:
|
||||
{{ (.Files.Glob "files/es/*.json").AsConfig | indent 2 }}
|
||||
@@ -1,47 +0,0 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ include "opencoze.fullname" . }}-es-init
|
||||
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
initContainers:
|
||||
- name: wait-for-es
|
||||
image: {{ .Values.images.busybox }}
|
||||
command: ['sh', '-c', 'until nc -z {{ include "opencoze.fullname" . }}-elasticsearch 9200; do echo waiting for elasticsearch; sleep 2; done']
|
||||
containers:
|
||||
- name: es-init
|
||||
image: {{ .Values.images.curl }}
|
||||
env:
|
||||
- name: ES_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Release.Name }}-es-secret
|
||||
key: username
|
||||
- name: ES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Release.Name }}-es-secret
|
||||
key: password
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
set -ex
|
||||
/scripts/setup_es.sh
|
||||
volumeMounts:
|
||||
- name: es-init-script
|
||||
mountPath: /scripts
|
||||
- name: es-index-schema
|
||||
mountPath: /es_index_schema
|
||||
volumes:
|
||||
- name: es-init-script
|
||||
configMap:
|
||||
name: {{ include "opencoze.fullname" . }}-es-init-script
|
||||
defaultMode: 0755
|
||||
- name: es-index-schema
|
||||
configMap:
|
||||
name: {{ include "opencoze.fullname" . }}-es-init-config
|
||||
backoffLimit: 4
|
||||
@@ -1,44 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "opencoze.fullname" . }}-es-init-script
|
||||
data:
|
||||
setup_es.sh: |
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
|
||||
ES_HOST="http://{{ include "opencoze.fullname" . }}-elasticsearch:9200"
|
||||
|
||||
CURL_AUTH=""
|
||||
if [ -n "$ES_USERNAME" ] && [ -n "$ES_PASSWORD" ]; then
|
||||
CURL_AUTH="-u $ES_USERNAME:$ES_PASSWORD"
|
||||
fi
|
||||
|
||||
|
||||
# Upload index templates
|
||||
for file in /es_index_schema/*.json; do
|
||||
if [ -f "$file" ]; then
|
||||
template_name=$(basename "$file" .index-template.json)
|
||||
echo "Uploading index template $template_name"
|
||||
curl -X PUT $CURL_AUTH "$ES_HOST/_index_template/$template_name" -H "Content-Type: application/json" --data-binary "@$file"
|
||||
fi
|
||||
done
|
||||
|
||||
# Create indices
|
||||
for file in /es_index_schema/*.json; do
|
||||
if [ -f "$file" ]; then
|
||||
template_name=$(basename "$file" .index-template.json)
|
||||
index_name=$template_name
|
||||
echo "Creating index $index_name"
|
||||
curl -X PUT $CURL_AUTH "$ES_HOST/$index_name" -H "Content-Type: application/json" -d'{
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": 1,
|
||||
"number_of_replicas": 1
|
||||
}
|
||||
}
|
||||
}'
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Elasticsearch setup complete."
|
||||
8
helm/charts/opencoze/templates/model-configmap.yaml
Normal file
8
helm/charts/opencoze/templates/model-configmap.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "opencoze.fullname" . }}-model-config
|
||||
labels:
|
||||
{{- include "opencoze.labels" . | nindent 4 }}
|
||||
data:
|
||||
{{- (.Files.Glob "files/conf/*").AsConfig | nindent 2 }}
|
||||
7
helm/charts/opencoze/templates/mysql-secret.yaml
Normal file
7
helm/charts/opencoze/templates/mysql-secret.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "opencoze.fullname" . }}-mysql
|
||||
stringData:
|
||||
mysql-password: {{ .Values.mysql.password | quote }}
|
||||
mysql-root-password: {{ .Values.mysql.rootPassword | quote }}
|
||||
@@ -1,11 +1,3 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "opencoze.fullname" . }}-mysql
|
||||
stringData:
|
||||
mysql-password: {{ .Values.mysql.password | quote }}
|
||||
mysql-root-password: {{ .Values.mysql.rootPassword | quote }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
|
||||
@@ -7,10 +7,12 @@ metadata:
|
||||
spec:
|
||||
type: {{ .Values.cozeServer.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.cozeServer.service.port }}
|
||||
targetPort: http
|
||||
{{- range .Values.cozeServer.service.ports }}
|
||||
- name: {{ .name }}
|
||||
port: {{ .port }}
|
||||
targetPort: {{ .name }}
|
||||
protocol: TCP
|
||||
name: app-port
|
||||
{{- end }}
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "opencoze.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
|
||||
Reference in New Issue
Block a user