charts: improve bbgo chart configmap loading

This commit is contained in:
c9s 2021-03-23 15:43:37 +08:00
parent b0b2165ae4
commit c5c7b6f897
5 changed files with 21 additions and 9 deletions

View File

@ -1,6 +1,6 @@
apiVersion: v2 apiVersion: v2
name: bbgo name: bbgo
description: a helm chart for bbgo trading bot description: Helm chart for bbgo trading bot
# A chart can be either an 'application' or a 'library' chart. # A chart can be either an 'application' or a 'library' chart.
# #
@ -15,9 +15,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # 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. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0 version: 0.2.0
# This is the version number of the application being deployed. This version number should be # 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 # 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. # follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0 appVersion: 1.15.0

View File

@ -1 +0,0 @@
../../config

View File

@ -1,4 +1,4 @@
{{- if .Values.configmap.enabled }} {{- if .Values.configmap }}
--- ---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -7,6 +7,12 @@ metadata:
labels: labels:
{{- include "bbgo.labels" . | nindent 4 }} {{- include "bbgo.labels" . | nindent 4 }}
data: data:
# if configmap is given as a string, we read it as a file
{{- if eq "string" (typeOf .Values.configmap) }}
bbgo.yaml: |- bbgo.yaml: |-
{{- .Files.Get .Values.configmap.file | nindent 4 }} {{- .Files.Get .Values.configmap | nindent 4 }}
{{-end }} {{- else }}
bbgo.yaml:
{{- .Values.configmap | nindent 4 }}
{{- end }}
{{- end }}

View File

@ -59,7 +59,11 @@ spec:
volumes: volumes:
- name: config-volume - name: config-volume
configMap: configMap:
{{- if .Values.existingConfigMap }}
name: {{ .Values.existingConfigMap }}
{{- else }}
name: {{ include "bbgo.fullname" . }} name: {{ include "bbgo.fullname" . }}
{{- end }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:

View File

@ -15,9 +15,12 @@ imagePullSecrets: []
nameOverride: "" nameOverride: ""
fullnameOverride: "" fullnameOverride: ""
# existingConfigMap is used for loading the existing configmap
existingConfigMap:
# configmap could be a string pointing to the local file in the chart
# or a object with inlined bbgo yaml config
configmap: configmap:
enabled: true
file: "config/bbgo.yaml"
dotenv: dotenv:
secret: null secret: null