mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-09 06:22:56 +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:
10
.github/workflows/helm.yml
vendored
10
.github/workflows/helm.yml
vendored
@@ -5,7 +5,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
paths:
|
paths:
|
||||||
- 'manifests/casdoor/Chart.yaml'
|
- "manifests/casdoor/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release-helm-chart:
|
release-helm-chart:
|
||||||
@@ -18,6 +18,12 @@ jobs:
|
|||||||
- name: Set up Helm
|
- name: Set up Helm
|
||||||
uses: azure/setup-helm@v3
|
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
|
- name: Log in to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
@@ -37,4 +43,4 @@ jobs:
|
|||||||
- name: Commit updated helm index.yaml
|
- name: Commit updated helm index.yaml
|
||||||
uses: stefanzweifel/git-auto-commit-action@v5
|
uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
with:
|
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
|
# ignore build result
|
||||||
casdoor
|
casdoor
|
||||||
server
|
server
|
||||||
|
|
||||||
|
# include helm-chart
|
||||||
|
!manifests/casdoor
|
||||||
|
@@ -57,21 +57,27 @@ spec:
|
|||||||
resources:
|
resources:
|
||||||
{{- toYaml .Values.resources | nindent 12 }}
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
mountPath: /conf
|
mountPath: /conf
|
||||||
|
{{- if .Values.extraVolumeMounts }}
|
||||||
|
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
{{ if .Values.extraContainersEnabled }}
|
{{ if .Values.extraContainersEnabled }}
|
||||||
{{- .Values.extraContainers | nindent 8 }}
|
{{- .Values.extraContainers | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
volumes:
|
volumes:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
projected:
|
projected:
|
||||||
defaultMode: 420
|
defaultMode: 420
|
||||||
sources:
|
sources:
|
||||||
- configMap:
|
- configMap:
|
||||||
items:
|
name: {{ printf "%s-config" (include "casdoor.fullname" .) }}
|
||||||
- key: app.conf
|
items:
|
||||||
path: app.conf
|
- key: app.conf
|
||||||
name: {{ printf "%s-config" (include "casdoor.fullname" .) }}
|
path: app.conf
|
||||||
|
{{- if .Values.extraVolumes }}
|
||||||
|
{{- toYaml .Values.extraVolumes | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
{{- with .Values.nodeSelector }}
|
{{- with .Values.nodeSelector }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- 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: {}
|
@@ -115,3 +115,5 @@ extraContainers: ""
|
|||||||
# extraContainers: |
|
# extraContainers: |
|
||||||
# - name: ...
|
# - name: ...
|
||||||
# image: ...
|
# image: ...
|
||||||
|
extraVolumeMounts: []
|
||||||
|
extraVolumes: []
|
Reference in New Issue
Block a user