Skip to content

Commit

Permalink
Merge pull request #645 from redpanda-data/ae/533a
Browse files Browse the repository at this point in the history
chore: allow extra init containers, volumes, and volumemounts
  • Loading branch information
alejandroEsc authored Aug 9, 2023
2 parents d624930 + be57fbf commit f865dc2
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/redpanda/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type: application
# The chart version and the app version are not the same and will not track
# together. The chart version is a semver representation of changes to this
# chart.
version: 5.0.9
version: 5.0.10

# The app version is the default version of Redpanda to install.
appVersion: v23.2.4
Expand Down
36 changes: 36 additions & 0 deletions charts/redpanda/ci/09-initcontainers-resources-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# limitations under the License.
---
statefulset:
sideCars:
configWatcher:
extraVolumeMounts: |-
- name: test-extra-volume
mountPath: /fake/lifecycle
initContainers:
configurator:
resources:
Expand All @@ -23,3 +28,34 @@ statefulset:
limits:
memory: "60Mi"
cpu: "200m"
extraVolumeMounts: |-
- name: test-extra-volume
mountPath: /fake/lifecycle
tuning:
extraVolumeMounts: |-
- name: test-extra-volume
mountPath: /fake/lifecycle
setDataDirOwnership:
extraVolumeMounts: |-
- name: test-extra-volume
mountPath: /fake/lifecycle
setTieredStorageCacheDirOwnership:
extraVolumeMounts: |-
- name: test-extra-volume
mountPath: /fake/lifecycle
extraInitContainers: |-
- name: "test-init-container"
image: "mintel/docker-alpine-bash-curl-jq:latest"
command: [ "/bin/bash", "-c" ]
args:
- |
set -xe
echo "Hello World!"
extraVolumes: |-
- name: test-extra-volume
secret:
secretName: {{ (include "redpanda.fullname" . | trunc 50 ) }}-sts-lifecycle
defaultMode: 0774
extraVolumeMounts: |-
- name: test-extra-volume
mountPath: /fake/lifecycle
24 changes: 24 additions & 0 deletions charts/redpanda/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ spec:
runAsUser: 0
runAsGroup: 0
volumeMounts:
{{- if dig "initContainers" "tuning" "extraVolumeMounts" false .Values.statefulset -}}
{{ tpl .Values.statefulset.initContainers.tuning.extraVolumeMounts . | nindent 12 }}
{{- end }}
- name: {{ template "redpanda.fullname" . }}
mountPath: /etc/redpanda
{{- if get .Values.statefulset.initContainers.tuning "resources" }}
Expand All @@ -96,6 +99,9 @@ spec:
image: {{ .Values.statefulset.initContainerImage.repository }}:{{ .Values.statefulset.initContainerImage.tag }}
command: ["/bin/sh", "-c", "chown {{ $uid }}:{{ $gid }} -R /var/lib/redpanda/data"]
volumeMounts:
{{- if dig "initContainers" "setDataDirOwnership" "extraVolumeMounts" false .Values.statefulset -}}
{{ tpl .Values.statefulset.initContainers.setDataDirOwnership.extraVolumeMounts . | nindent 12 }}
{{- end }}
- name: datadir
mountPath: /var/lib/redpanda/data
{{- if .Values.statefulset.initContainers.setDataDirOwnership.resources }}
Expand All @@ -107,6 +113,9 @@ spec:
image: {{ .Values.statefulset.initContainerImage.repository }}:{{ .Values.statefulset.initContainerImage.tag }}
command: ["/bin/sh", "-c", 'chown {{ $uid }}:{{ $gid }} -R {{ template "tieredStorage.cacheDirectory" . }}']
volumeMounts:
{{- if dig "initContainers" "setTieredStorageCacheDirOwnership" "extraVolumeMounts" false .Values.statefulset -}}
{{ tpl .Values.statefulset.initContainers.setTieredStorageCacheDirOwnership.extraVolumeMounts . | nindent 12 }}
{{- end }}
- name: tiered-storage-dir
mountPath: {{ template "tieredStorage.cacheDirectory" . }}
{{- if get .Values.statefulset.initContainers.setTieredStorageCacheDirOwnership "resources" }}
Expand Down Expand Up @@ -199,13 +208,19 @@ spec:
{{- end }}
securityContext: {{ include "container-security-context" . | nindent 12 }}
volumeMounts:
{{- if dig "initContainers" "configurator" "extraVolumeMounts" false .Values.statefulset -}}
{{ tpl .Values.statefulset.initContainers.configurator.extraVolumeMounts . | nindent 12 }}
{{- end }}
- name: {{ template "redpanda.fullname" . }}
mountPath: /tmp/base-config
- name: config
mountPath: /etc/redpanda
{{- if get .Values.statefulset.initContainers.configurator "resources" }}
resources: {{- toYaml .Values.statefulset.initContainers.configurator.resources | nindent 12 }}
{{- end }}
{{- if dig "initContainers" "extraInitContainers" false .Values.statefulset -}}
{{ tpl .Values.statefulset.initContainers.extraInitContainers . | nindent 8 }}
{{- end }}
containers:
- name: {{ template "redpanda.name" . }}
image: {{ .Values.image.repository }}:{{ template "redpanda.tag" . }}
Expand Down Expand Up @@ -296,6 +311,9 @@ spec:
{{- end }}
securityContext: {{ include "container-security-context" . | nindent 12 }}
volumeMounts:
{{- if dig "extraVolumeMounts" false .Values.statefulset -}}
{{ tpl .Values.statefulset.extraVolumeMounts . | nindent 12 }}
{{- end }}
- name: lifecycle-scripts
mountPath: /var/lifecycle
- name: datadir
Expand Down Expand Up @@ -340,6 +358,9 @@ spec:
securityContext: {{- toYaml .Values.statefulset.sideCars.configWatcher.securityContext | nindent 12 }}
{{- end }}
volumeMounts:
{{- if dig "sideCars" "configWatcher" "extraVolumeMounts" false .Values.statefulset -}}
{{ tpl .Values.statefulset.sideCars.configWatcher.extraVolumeMounts . | nindent 12 }}
{{- end }}
- name: {{ template "redpanda.fullname" . }}-config-watcher
mountPath: /etc/secrets/config-watcher/scripts
readOnly: true
Expand All @@ -357,6 +378,9 @@ spec:
{{- end }}
{{- end }}
volumes:
{{- if dig "extraVolumes" false .Values.statefulset -}}
{{ tpl .Values.statefulset.extraVolumes . | nindent 8 }}
{{- end }}
- name: lifecycle-scripts
secret:
secretName: {{ (include "redpanda.fullname" . | trunc 50 ) }}-sts-lifecycle
Expand Down
24 changes: 24 additions & 0 deletions charts/redpanda/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,9 @@
},
"securityContext": {
"type": "object"
},
"extraVolumeMounts": {
"type": "string"
}
}
}
Expand All @@ -729,6 +732,9 @@
"properties": {
"resources": {
"type": "object"
},
"extraVolumeMounts": {
"type": "string"
}
}
},
Expand All @@ -740,6 +746,9 @@
},
"enabled": {
"type": "boolean"
},
"extraVolumeMounts": {
"type": "string"
}
}
},
Expand All @@ -748,6 +757,9 @@
"properties": {
"resources": {
"type": "object"
},
"extraVolumeMounts": {
"type": "string"
}
}
},
Expand All @@ -756,16 +768,28 @@
"properties": {
"resources": {
"type": "object"
},
"extraVolumeMounts": {
"type": "string"
}
}
}
}
},
"extraInitContainers": {
"type": "object"
},
"additionalRedpandaCmdFlags": {
"type": "array"
},
"terminationGracePeriodSeconds": {
"type": "integer"
},
"extraVolumes": {
"type": "string"
},
"extraVolumeMounts": {
"type": "string"
}
}
},
Expand Down
18 changes: 18 additions & 0 deletions charts/redpanda/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -558,25 +558,43 @@ statefulset:
enabled: true
resources: {}
securityContext: {}
extraVolumeMounts: |-
initContainers:
tuning:
resources: {}
extraVolumeMounts: |-
setDataDirOwnership:
# -- In environments where root is not allowed, you cannot change the ownership of files and directories.
# Enable `setDataDirOwnership` when using default minikube cluster configuration.
enabled: false
resources: {}
extraVolumeMounts: |-
setTieredStorageCacheDirOwnership:
resources: {}
extraVolumeMounts: |-
configurator:
resources: {}
extraVolumeMounts: |-
## Additional init containers
extraInitContainers: |-
# - name: "test-init-container"
# image: "mintel/docker-alpine-bash-curl-jq:latest"
# command: [ "/bin/bash", "-c" ]
# args:
# - |
# set -xe
# echo "Hello World!"
initContainerImage:
repository: busybox
tag: latest
# -- Additional flags to pass to redpanda,
additionalRedpandaCmdFlags: []
# - --unsafe-bypass-fsync
terminationGracePeriodSeconds: 90
## Additional Volumes that you mount
extraVolumes: |-
## Additional Volume mounts for redpanda container
extraVolumeMounts: |-
# -- Service account management.
serviceAccount:
Expand Down

0 comments on commit f865dc2

Please sign in to comment.