feat: support making configs in values.yaml (#1595)

Signed-off-by: fengxsong <fengxsong@outlook.com>
This commit is contained in:
fengxsong 2023-03-01 20:17:04 +08:00 committed by GitHub
parent db401b2046
commit d21ae8a478
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 33 deletions

View File

@ -1,23 +1,8 @@
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: casdoor-config name: {{ printf "%s-config" (include "casdoor.fullname" .) }}
labels:
{{- include "casdoor.labels" . | nindent 4 }}
data: data:
app.conf: | app.conf: {{ tpl .Values.config . | toYaml | nindent 4 }}
appname = casdoor
httpport = 80
runmode = dev
SessionOn = true
copyrequestbody = true
driverName = mysql
dataSourceName = root:123456@tcp(localhost:3306)/
dbName = casdoor
redisEndpoint =
defaultStorageProvider =
isCloudIntranet = false
authState = "casdoor"
socks5Proxy = "127.0.0.1:10808"
verificationCodeTimeout = 10
initScore = 2000
logPostOnly = true
origin = "https://door.casbin.com"

View File

@ -13,10 +13,11 @@ spec:
{{- include "casdoor.selectorLabels" . | nindent 6 }} {{- include "casdoor.selectorLabels" . | nindent 6 }}
template: template:
metadata: metadata:
{{- with .Values.podAnnotations }}
annotations: annotations:
checksum/config: {{ tpl .Values.config . | toYaml | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
labels: labels:
{{- include "casdoor.selectorLabels" . | nindent 8 }} {{- include "casdoor.selectorLabels" . | nindent 8 }}
spec: spec:
@ -34,18 +35,25 @@ spec:
image: "{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag | default .Chart.AppVersion }}" image: "{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
# command: ["sleep", "100000000"] # command: ["sleep", "100000000"]
env:
- name: RUNNING_IN_DOCKER
value: "true"
ports: ports:
- name: http - name: http
containerPort: 80 containerPort: {{ .Values.service.port }}
protocol: TCP protocol: TCP
# livenessProbe: {{ if .Values.probe.liveness.enabled }}
# httpGet: livenessProbe:
# path: / httpGet:
# port: http path: /
# readinessProbe: port: http
# httpGet: {{ end }}
# path: / {{ if .Values.probe.readiness.enabled }}
# port: http readinessProbe:
httpGet:
path: /
port: http
{{ end }}
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
volumeMounts: volumeMounts:
@ -60,7 +68,7 @@ spec:
items: items:
- key: app.conf - key: app.conf
path: app.conf path: app.conf
name: casdoor-config name: {{ printf "%s-config" (include "casdoor.fullname" .) }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}

View File

@ -6,11 +6,31 @@ replicaCount: 1
image: image:
repository: casbin repository: casbin
name: casdoor-all-in-one name: casdoor
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion. # Overrides the image tag whose default is the chart appVersion.
tag: "" tag: ""
# ref: https://casdoor.org/docs/basic/server-installation#via-ini-file
config: |
appname = casdoor
httpport = {{ .Values.service.port }}
runmode = dev
SessionOn = true
copyrequestbody = true
driverName = sqlite
dataSourceName = "file:ent?mode=memory&cache=shared&_fk=1"
dbName = casdoor
redisEndpoint =
defaultStorageProvider =
isCloudIntranet = false
authState = "casdoor"
socks5Proxy = ""
verificationCodeTimeout = 10
initScore = 2000
logPostOnly = true
origin = "https://door.casbin.com"
imagePullSecrets: [] imagePullSecrets: []
nameOverride: "" nameOverride: ""
fullnameOverride: "" fullnameOverride: ""
@ -37,9 +57,15 @@ securityContext: {}
# runAsNonRoot: true # runAsNonRoot: true
# runAsUser: 1000 # runAsUser: 1000
probe:
readiness:
enabled: true
liveness:
enabled: true
service: service:
type: ClusterIP type: ClusterIP
port: 80 port: 8000
ingress: ingress:
enabled: false enabled: false