Merge pull request #1704 from c9s/c9s/k8s/sync-cronjob

FEATURE: [k8s] add cronjob for sync
This commit is contained in:
c9s 2024-08-23 14:57:07 +08:00 committed by GitHub
commit 80ad5c32b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 63 additions and 4 deletions

View File

@ -15,9 +15,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.3.5
version: 0.4.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.21.0
appVersion: 1.60.0

View File

@ -0,0 +1,53 @@
---
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"
{{- if .Values.sync.since }}
- "--since"
- {{ .Values.sync.since | quote }}
{{- end }}
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
metrics:
enabled: false
enabled: true
port: 9090
logFormatter:
enabled: false
enabled: true
format: json
grpc:
@ -89,6 +89,12 @@ grpc:
debug:
enabled: false
sync:
enabled: false
schedule: "* * * * *"
## since: sync from time
since: false
resources:
# 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