Skip to content

Commit a0248bf

Browse files
authored
Merge pull request nextcloud#6374 from nextcloud/enh/noid/enforce-rspp
helm: automatically enforce RPSS if configured
2 parents f49a0f0 + efce94a commit a0248bf

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.github/workflows/update-helm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
DOCKER_TAG="$(curl -H "Authorization: Bearer ${GHCR_TOKEN}" -L -s 'https://ghcr.io/v2/nextcloud-releases/all-in-one/tags/list?page_size=1024' | jq '.tags' | sed 's|"||g;s|[[:space:]]||g;s|,||g' | grep '^20[0-9_]\+' | grep -v latest | sort -r | head -1)"
2020
export DOCKER_TAG
2121
set +x
22-
if [ -n "$DOCKER_TAG" ] && ! grep -q "$DOCKER_TAG" ./nextcloud-aio-helm-chart/templates/nextcloud-aio-nextcloud-deployment.yaml; then
22+
if [ -n "$DOCKER_TAG" ] && ! grep -q "aio-nextcloud:$DOCKER_TAG" ./nextcloud-aio-helm-chart/templates/nextcloud-aio-nextcloud-deployment.yaml; then
2323
sudo bash nextcloud-aio-helm-chart/update-helm.sh "$DOCKER_TAG"
2424
fi
2525
- name: Create Pull Request

nextcloud-aio-helm-chart/update-helm.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,15 @@ find ./ \( -not -name '*service.yaml' -name '*.yaml' \) -exec sed -i "/^status:/
259259
find ./ \( -not -name '*persistentvolumeclaim.yaml' -name '*.yaml' \) -exec sed -i "/resources:/d" \{} \;
260260
# shellcheck disable=SC1083
261261
find ./ -name "*namespace.yaml" -exec sed -i "1i\\{{- if and \(ne .Values.NAMESPACE \"default\"\) \(ne .Values.NAMESPACE_DISABLED \"yes\"\) }}" \{} \;
262+
# Additional config
263+
cat << EOL > /tmp/additional-namespace.config
264+
{{- if eq (.Values.RPSS_ENABLED | default "no") "yes" }}
265+
labels:
266+
pod-security.kubernetes.io/enforce: restricted
267+
{{- end }}
268+
EOL
269+
# shellcheck disable=SC1083
270+
find ./ -name "*namespace.yaml" -exec sed -i "/namespace.*/r /tmp/additional-namespace.config" \{} \;
262271
# shellcheck disable=SC1083
263272
find ./ -name "*namespace.yaml" -exec sed -i "$ a {{- end }}" \{} \;
264273
# shellcheck disable=SC1083

0 commit comments

Comments
 (0)