You've already forked helm-gitea
feat: make it configurable of the initContainers volume mount path for scripts (#848)
### Description of the change Makes it configurable volume mount path for initContainers for init scripts ### Benefits Configurable initContainers volumeMount path for init scripts ### Possible drawbacks I don't think that there will be any drawbacks ### Applicable issues - Fixes #847 Signed-off-by: Batuhan Apaydin <batuhan.apaydin@chainguard.dev> Reviewed-on: https://gitea.com/gitea/helm-gitea/pulls/848 Reviewed-by: justusbunsi <justusbunsi@noreply.gitea.com> Co-authored-by: developerguy <developerguy@noreply.gitea.com> Co-committed-by: developerguy <developerguy@noreply.gitea.com>
This commit is contained in:

committed by
justusbunsi

parent
fa36d2beef
commit
a7035ca4e5
13
README.md
13
README.md
@ -1052,12 +1052,13 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
|
|||||||
|
|
||||||
### Init
|
### Init
|
||||||
|
|
||||||
| Name | Description | Value |
|
| Name | Description | Value |
|
||||||
| ------------------------------------------ | ------------------------------------------------------------------------------------ | ------- |
|
| ------------------------------------------ | ------------------------------------------------------------------------------------ | ------------ |
|
||||||
| `initPreScript` | Bash shell script copied verbatim to the start of the init-container. | `""` |
|
| `initPreScript` | Bash shell script copied verbatim to the start of the init-container. | `""` |
|
||||||
| `initContainers.resources.limits` | initContainers.limits Kubernetes resource limits for init containers | `{}` |
|
| `initContainersScriptsVolumeMountPath` | Path to mount the scripts consumed from the Secrets | `/usr/sbinx` |
|
||||||
| `initContainers.resources.requests.cpu` | initContainers.requests.cpu Kubernetes cpu resource limits for init containers | `100m` |
|
| `initContainers.resources.limits` | initContainers.limits Kubernetes resource limits for init containers | `{}` |
|
||||||
| `initContainers.resources.requests.memory` | initContainers.requests.memory Kubernetes memory resource limits for init containers | `128Mi` |
|
| `initContainers.resources.requests.cpu` | initContainers.requests.cpu Kubernetes cpu resource limits for init containers | `100m` |
|
||||||
|
| `initContainers.resources.requests.memory` | initContainers.requests.memory Kubernetes memory resource limits for init containers | `128Mi` |
|
||||||
|
|
||||||
### Signing
|
### Signing
|
||||||
|
|
||||||
|
@ -62,7 +62,8 @@ spec:
|
|||||||
- name: init-directories
|
- name: init-directories
|
||||||
image: "{{ include "gitea.image" . }}"
|
image: "{{ include "gitea.image" . }}"
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
command: ["/usr/sbin/init_directory_structure.sh"]
|
command:
|
||||||
|
- "{{ .Values.initContainersScriptsVolumeMountPath }}/init_directory_structure.sh"
|
||||||
env:
|
env:
|
||||||
- name: GITEA_APP_INI
|
- name: GITEA_APP_INI
|
||||||
value: /data/gitea/conf/app.ini
|
value: /data/gitea/conf/app.ini
|
||||||
@ -81,7 +82,7 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: init
|
- name: init
|
||||||
mountPath: /usr/sbin
|
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
|
||||||
- name: temp
|
- name: temp
|
||||||
mountPath: /tmp
|
mountPath: /tmp
|
||||||
- name: data
|
- name: data
|
||||||
@ -97,7 +98,8 @@ spec:
|
|||||||
- name: init-app-ini
|
- name: init-app-ini
|
||||||
image: "{{ include "gitea.image" . }}"
|
image: "{{ include "gitea.image" . }}"
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
command: ["/usr/sbin/config_environment.sh"]
|
command:
|
||||||
|
- "{{ .Values.initContainersScriptsVolumeMountPath }}/config_environment.sh"
|
||||||
env:
|
env:
|
||||||
- name: GITEA_APP_INI
|
- name: GITEA_APP_INI
|
||||||
value: /data/gitea/conf/app.ini
|
value: /data/gitea/conf/app.ini
|
||||||
@ -119,7 +121,7 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: config
|
- name: config
|
||||||
mountPath: /usr/sbin
|
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
|
||||||
- name: temp
|
- name: temp
|
||||||
mountPath: /tmp
|
mountPath: /tmp
|
||||||
- name: data
|
- name: data
|
||||||
@ -141,7 +143,8 @@ spec:
|
|||||||
{{- if .Values.signing.enabled }}
|
{{- if .Values.signing.enabled }}
|
||||||
- name: configure-gpg
|
- name: configure-gpg
|
||||||
image: "{{ include "gitea.image" . }}"
|
image: "{{ include "gitea.image" . }}"
|
||||||
command: ["/usr/sbin/configure_gpg_environment.sh"]
|
command:
|
||||||
|
- "{{ .Values.initContainersScriptsVolumeMountPath }}/configure_gpg_environment.sh"
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
securityContext:
|
securityContext:
|
||||||
{{- /* By default this container runs as user 1000 unless otherwise stated */ -}}
|
{{- /* By default this container runs as user 1000 unless otherwise stated */ -}}
|
||||||
@ -157,7 +160,7 @@ spec:
|
|||||||
value: /raw/private.asc
|
value: /raw/private.asc
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: init
|
- name: init
|
||||||
mountPath: /usr/sbin
|
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
|
||||||
- name: data
|
- name: data
|
||||||
mountPath: /data
|
mountPath: /data
|
||||||
{{- if .Values.persistence.subPath }}
|
{{- if .Values.persistence.subPath }}
|
||||||
@ -174,7 +177,8 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
- name: configure-gitea
|
- name: configure-gitea
|
||||||
image: "{{ include "gitea.image" . }}"
|
image: "{{ include "gitea.image" . }}"
|
||||||
command: ["/usr/sbin/configure_gitea.sh"]
|
command:
|
||||||
|
- "{{ .Values.initContainersScriptsVolumeMountPath }}/configure_gitea.sh"
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
securityContext:
|
securityContext:
|
||||||
{{- /* By default this container runs as user 1000 unless otherwise stated */ -}}
|
{{- /* By default this container runs as user 1000 unless otherwise stated */ -}}
|
||||||
@ -257,7 +261,7 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: init
|
- name: init
|
||||||
mountPath: /usr/sbin
|
mountPath: {{ .Values.initContainersScriptsVolumeMountPath }}
|
||||||
- name: temp
|
- name: temp
|
||||||
mountPath: /tmp
|
mountPath: /tmp
|
||||||
- name: data
|
- name: data
|
||||||
|
@ -73,3 +73,23 @@ tests:
|
|||||||
requests:
|
requests:
|
||||||
cpu: 100ms
|
cpu: 100ms
|
||||||
memory: 100Mi
|
memory: 100Mi
|
||||||
|
- it: Init containers have correct volumeMount path
|
||||||
|
template: templates/gitea/deployment.yaml
|
||||||
|
set:
|
||||||
|
initContainersScriptsVolumeMountPath: "/custom/init/path"
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[*].volumeMounts[?(@.name=="init")].mountPath
|
||||||
|
value: "/custom/init/path"
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[*].volumeMounts[?(@.name=="config")].mountPath
|
||||||
|
value: "/custom/init/path"
|
||||||
|
- it: Init containers have correct volumeMount path if there is no override
|
||||||
|
template: templates/gitea/deployment.yaml
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[*].volumeMounts[?(@.name=="init")].mountPath
|
||||||
|
value: "/usr/sbinx"
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.initContainers[*].volumeMounts[?(@.name=="config")].mountPath
|
||||||
|
value: "/usr/sbinx"
|
||||||
|
@ -18,7 +18,7 @@ tests:
|
|||||||
value: configure-gpg
|
value: configure-gpg
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.initContainers[2].command
|
path: spec.template.spec.initContainers[2].command
|
||||||
value: ["/usr/sbin/configure_gpg_environment.sh"]
|
value: ["/usr/sbinx/configure_gpg_environment.sh"]
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.template.spec.initContainers[2].securityContext
|
path: spec.template.spec.initContainers[2].securityContext
|
||||||
value:
|
value:
|
||||||
@ -34,7 +34,7 @@ tests:
|
|||||||
path: spec.template.spec.initContainers[2].volumeMounts
|
path: spec.template.spec.initContainers[2].volumeMounts
|
||||||
value:
|
value:
|
||||||
- name: init
|
- name: init
|
||||||
mountPath: /usr/sbin
|
mountPath: /usr/sbinx
|
||||||
- name: data
|
- name: data
|
||||||
mountPath: /data
|
mountPath: /data
|
||||||
- name: gpg-private-key
|
- name: gpg-private-key
|
||||||
|
@ -314,6 +314,8 @@ extraVolumeMounts: []
|
|||||||
## @section Init
|
## @section Init
|
||||||
## @param initPreScript Bash shell script copied verbatim to the start of the init-container.
|
## @param initPreScript Bash shell script copied verbatim to the start of the init-container.
|
||||||
initPreScript: ""
|
initPreScript: ""
|
||||||
|
## @param initContainersScriptsVolumeMountPath Path to mount the scripts consumed from the Secrets
|
||||||
|
initContainersScriptsVolumeMountPath: "/usr/sbinx"
|
||||||
#
|
#
|
||||||
# initPreScript: |
|
# initPreScript: |
|
||||||
# mkdir -p /data/git/.postgresql
|
# mkdir -p /data/git/.postgresql
|
||||||
|
Reference in New Issue
Block a user