mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 10:45:47 +08:00
feat(helm): support for extra volume mounts (#2584)
* feat(helm): support for extraVolumes and extraVolumeMounts * ci(helm): run helm unittests
This commit is contained in:
parent
fddd4a12b8
commit
9e536850fd
10
.github/workflows/helm.yml
vendored
10
.github/workflows/helm.yml
vendored
@ -5,7 +5,7 @@ on:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'manifests/casdoor/Chart.yaml'
|
||||
- "manifests/casdoor/**"
|
||||
|
||||
jobs:
|
||||
release-helm-chart:
|
||||
@ -18,6 +18,12 @@ jobs:
|
||||
- name: Set up Helm
|
||||
uses: azure/setup-helm@v3
|
||||
|
||||
- name: Run helm unittest
|
||||
id: unittest
|
||||
run: |
|
||||
helm plugin install https://github.com/helm-unittest/helm-unittest.git
|
||||
helm unittest manifests/casdoor
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
@ -37,4 +43,4 @@ jobs:
|
||||
- name: Commit updated helm index.yaml
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: 'ci: update helm index.yaml'
|
||||
commit_message: "ci: update helm index.yaml"
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -31,3 +31,6 @@ commentsRouter*.go
|
||||
# ignore build result
|
||||
casdoor
|
||||
server
|
||||
|
||||
# include helm-chart
|
||||
!manifests/casdoor
|
||||
|
@ -57,21 +57,27 @@ spec:
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: config-volume
|
||||
mountPath: /conf
|
||||
- name: config-volume
|
||||
mountPath: /conf
|
||||
{{- if .Values.extraVolumeMounts }}
|
||||
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
|
||||
{{- end }}
|
||||
{{ if .Values.extraContainersEnabled }}
|
||||
{{- .Values.extraContainers | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: config-volume
|
||||
projected:
|
||||
defaultMode: 420
|
||||
sources:
|
||||
- configMap:
|
||||
items:
|
||||
- key: app.conf
|
||||
path: app.conf
|
||||
name: {{ printf "%s-config" (include "casdoor.fullname" .) }}
|
||||
- name: config-volume
|
||||
projected:
|
||||
defaultMode: 420
|
||||
sources:
|
||||
- configMap:
|
||||
name: {{ printf "%s-config" (include "casdoor.fullname" .) }}
|
||||
items:
|
||||
- key: app.conf
|
||||
path: app.conf
|
||||
{{- if .Values.extraVolumes }}
|
||||
{{- toYaml .Values.extraVolumes | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
|
128
manifests/casdoor/tests/__snapshot__/deployment_test.yaml.snap
Normal file
128
manifests/casdoor/tests/__snapshot__/deployment_test.yaml.snap
Normal file
@ -0,0 +1,128 @@
|
||||
has extraVolume and extraVolumeMounts:
|
||||
1: |
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: casdoor-helm-charts
|
||||
app.kubernetes.io/version: 1.2.3
|
||||
helm.sh/chart: casdoor-helm-charts-1.0.0
|
||||
name: RELEASE-NAME-casdoor-helm-charts
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: casdoor-helm-charts
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
checksum/config: 529bc7ea51d30d00fefc46d24be7446d0637939827bccc1c3f03755f70059470
|
||||
labels:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: casdoor-helm-charts
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
- name: RUNNING_IN_DOCKER
|
||||
value: "true"
|
||||
image: casbin/casdoor:1.2.3
|
||||
imagePullPolicy: IfNotPresent
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
name: casdoor-helm-charts
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
name: http
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
resources: {}
|
||||
securityContext: {}
|
||||
volumeMounts:
|
||||
- mountPath: /conf
|
||||
name: config-volume
|
||||
- mountPath: /extra-volume
|
||||
name: extra-volume
|
||||
securityContext: {}
|
||||
serviceAccountName: RELEASE-NAME-casdoor-helm-charts
|
||||
volumes:
|
||||
- name: config-volume
|
||||
projected:
|
||||
defaultMode: 420
|
||||
sources:
|
||||
- configMap:
|
||||
items:
|
||||
- key: app.conf
|
||||
path: app.conf
|
||||
name: RELEASE-NAME-casdoor-helm-charts-config
|
||||
- emptyDir: {}
|
||||
name: extra-volume
|
||||
manifest should match snapshot:
|
||||
1: |
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: casdoor-helm-charts
|
||||
app.kubernetes.io/version: 1.2.3
|
||||
helm.sh/chart: casdoor-helm-charts-1.0.0
|
||||
name: RELEASE-NAME-casdoor-helm-charts
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: casdoor-helm-charts
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
checksum/config: 529bc7ea51d30d00fefc46d24be7446d0637939827bccc1c3f03755f70059470
|
||||
labels:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: casdoor-helm-charts
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
- name: RUNNING_IN_DOCKER
|
||||
value: "true"
|
||||
image: casbin/casdoor:1.2.3
|
||||
imagePullPolicy: IfNotPresent
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
name: casdoor-helm-charts
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
name: http
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
resources: {}
|
||||
securityContext: {}
|
||||
volumeMounts:
|
||||
- mountPath: /conf
|
||||
name: config-volume
|
||||
securityContext: {}
|
||||
serviceAccountName: RELEASE-NAME-casdoor-helm-charts
|
||||
volumes:
|
||||
- name: config-volume
|
||||
projected:
|
||||
defaultMode: 420
|
||||
sources:
|
||||
- configMap:
|
||||
items:
|
||||
- key: app.conf
|
||||
path: app.conf
|
||||
name: RELEASE-NAME-casdoor-helm-charts-config
|
20
manifests/casdoor/tests/deployment_test.yaml
Normal file
20
manifests/casdoor/tests/deployment_test.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
suite: test deployment
|
||||
templates:
|
||||
- deployment.yaml
|
||||
chart:
|
||||
version: 1.0.0
|
||||
appVersion: 1.2.3
|
||||
tests:
|
||||
- it: manifest should match snapshot
|
||||
asserts:
|
||||
- matchSnapshot: {}
|
||||
- it: has extraVolume and extraVolumeMounts
|
||||
set:
|
||||
extraVolumes:
|
||||
- name: extra-volume
|
||||
emptyDir: {}
|
||||
extraVolumeMounts:
|
||||
- name: extra-volume
|
||||
mountPath: /extra-volume
|
||||
asserts:
|
||||
- matchSnapshot: {}
|
@ -114,4 +114,6 @@ extraContainersEnabled: false
|
||||
extraContainers: ""
|
||||
# extraContainers: |
|
||||
# - name: ...
|
||||
# image: ...
|
||||
# image: ...
|
||||
extraVolumeMounts: []
|
||||
extraVolumes: []
|
Loading…
x
Reference in New Issue
Block a user