diff --git a/README.md b/README.md index fe583d8..a209a6f 100644 --- a/README.md +++ b/README.md @@ -1089,7 +1089,6 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ----- | | `openshift.enabled` | Enable OpenShift compatibility defaults for chart-managed pods. Defaults to auto-detect based on the SecurityContextConstraints API. | `nil` | | `openshift.hostUsers` | Override the PodSpec hostUsers field for chart-managed pods. When unset, the field is omitted so the platform default is used. | `nil` | -| `securityContext` | Run init and Gitea containers as a specific securityContext | `{}` | | `podDisruptionBudget` | Pod disruption budget | `{}` | ### Route diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 7a7b627..2af960d 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -146,17 +146,6 @@ These default to runAsUser 1000 outside OpenShift to preserve existing behavior. {{- include "gitea.containerSecurityContext" (list $root $containerSecurityContext) -}} {{- end -}} -{{/* -Render the runtime container securityContext while honoring the deprecated securityContext value. -*/}} -{{- define "gitea.runtimeContainerSecurityContext" -}} -{{- $containerSecurityContext := deepCopy .Values.deployment.gitea.securityContext -}} -{{- if and (eq (len $containerSecurityContext) 0) .Values.securityContext -}} -{{- $containerSecurityContext = deepCopy .Values.securityContext -}} -{{- end -}} -{{- include "gitea.containerSecurityContext" (list . $containerSecurityContext) -}} -{{- end -}} - {{/* Storage Class diff --git a/templates/gitea/deployment.yaml b/templates/gitea/deployment.yaml index 6753937..9499a4a 100644 --- a/templates/gitea/deployment.yaml +++ b/templates/gitea/deployment.yaml @@ -65,7 +65,6 @@ spec: {{- $securityContext := include "gitea.deployment.securityContext" . | trim }} {{- $containerSecurityContext := include "gitea.containerSecurityContext" (list . (deepCopy .Values.deployment.gitea.securityContext)) | trim }} {{- $commandInitContainerSecurityContext := include "gitea.commandInitContainerSecurityContext" (list . (deepCopy .Values.deployment.gitea.securityContext)) | trim }} - {{- $runtimeContainerSecurityContext := include "gitea.runtimeContainerSecurityContext" . | trim }} {{- if .Values.deployment.schedulerName }} schedulerName: "{{ .Values.deployment.schedulerName }}" {{- end }} @@ -405,9 +404,9 @@ spec: {{- end }} resources: {{- toYaml (.Values.deployment.gitea.resources | default dict) | nindent 12 }} - {{- if $runtimeContainerSecurityContext }} + {{- if $containerSecurityContext }} securityContext: - {{- $runtimeContainerSecurityContext | nindent 12 }} + {{- $containerSecurityContext | nindent 12 }} {{- end }} volumeMounts: - name: temp diff --git a/templates/gitea/deprecation.yaml b/templates/gitea/deprecation.yaml index aeece41..dcf4641 100644 --- a/templates/gitea/deprecation.yaml +++ b/templates/gitea/deprecation.yaml @@ -90,6 +90,11 @@ {{- fail "`schedulerName` does no longer exist. Please refer to the changelog and configure `deployment.schedulerName` instead." -}} {{- end -}} + {{/* SECURITY CONTEXT */}} + {{- if .Values.securityContext -}} + {{- fail "`securityContext` does no longer exist. Please refer to the changelog and configure `deployment.securityContext` and `deployment.gitea.securityContext` instead." -}} + {{- end -}} + {{/* STRATEGY */}} {{- if .Values.strategy -}} {{- fail "`strategy` does no longer exist. Please refer to the changelog and configure `deployment.strategy` instead." -}} diff --git a/unittests/helm/deployment/deprecations.yaml b/unittests/helm/deployment/deprecations.yaml index 528cdad..5b7f6aa 100644 --- a/unittests/helm/deployment/deprecations.yaml +++ b/unittests/helm/deployment/deprecations.yaml @@ -86,6 +86,13 @@ tests: asserts: - failedTemplate: errorMessage: "`schedulerName` does no longer exist. Please refer to the changelog and configure `deployment.schedulerName` instead." + - it: fails when the removed `securityContext` value is set + set: + securityContext: + runAsUser: 1000 + asserts: + - failedTemplate: + errorMessage: "`securityContext` does no longer exist. Please refer to the changelog and configure `deployment.securityContext` and `deployment.gitea.securityContext` instead." - it: fails when the removed `strategy` value is set set: strategy: @@ -133,6 +140,8 @@ tests: limits: cpu: 100m schedulerName: stork + securityContext: + runAsUser: 1000 strategy: type: Recreate tolerations: diff --git a/values.yaml b/values.yaml index e0f75b8..c286e61 100644 --- a/values.yaml +++ b/values.yaml @@ -306,8 +306,6 @@ openshift: ## @deprecated The securityContext variable has been split two: ## - deployment.gitea.securityContext ## - deployment.securityContext. -## @param securityContext Run init and Gitea containers as a specific securityContext -securityContext: {} ## @param podDisruptionBudget Pod disruption budget podDisruptionBudget: {}