add cronjob for sync

This commit is contained in:
c9s 2024-08-23 14:19:33 +08:00
parent bb06a6a046
commit 4bbb9c5e38
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 55 additions and 2 deletions

View File

@ -0,0 +1,49 @@
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "bbgo.fullname" . }}-sync
{{- with .Values.deploymentAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "bbgo.labels" . | nindent 4 }}
spec:
schedule: {{ .Values.sync.schedule | quote }}
jobTemplate:
spec:
template:
spec:
containers:
- name: bbgo
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
{{- if .Values.metrics.enabled }}
- "--metrics"
- "--metrics-port"
- {{ .Values.metrics.port | quote }}
{{- end }}
- "sync"
- "--config"
- "/config/bbgo.yaml"
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: config-volume
mountPath: /config
envFrom:
- secretRef:
name: {{ .Values.dotenv.secret | default .Release.Name }}
restartPolicy: OnFailure
volumes:
- name: config-volume
configMap:
{{- if .Values.existingConfigMap }}
name: {{ .Values.existingConfigMap }}
{{- else }}
name: {{ include "bbgo.fullname" . }}
{{- end }}

View File

@ -75,11 +75,11 @@ webserver:
enabled: false enabled: false
metrics: metrics:
enabled: false enabled: true
port: 9090 port: 9090
logFormatter: logFormatter:
enabled: false enabled: true
format: json format: json
grpc: grpc:
@ -89,6 +89,10 @@ grpc:
debug: debug:
enabled: false enabled: false
sync:
enabled: false
schedule: "* * * * *"
resources: resources:
# We usually recommend not to specify default resources and to leave this as a conscious # We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little # choice for the user. This also increases chances charts run on environments with little