refactor!: move openshift.hostUsers to deployment.hostUsers

The PodSpec `hostUsers` field has nothing to do with the OpenShift compatibility profile. It only selects whether the
pod shares the host's user namespace, which is a plain Kubernetes feature. Nesting it below `openshift` implied that it
requires OpenShift and, worse, the helper only rendered it when `openshift.enabled` evaluated to `true`, so the setting
was silently ignored on vanilla Kubernetes clusters.

`gitea.hostUsers` now reads `deployment.hostUsers` and no longer depends on the OpenShift profile. The value is only
rendered when it is an actual boolean, so the field stays omitted for `null` and the platform default applies.

BREAKING CHANGE: `openshift.hostUsers` has been removed. Configure `deployment.hostUsers` instead.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-09-13 19:22:33 +02:00
co-authored by Copilot
parent cc99cada4d
commit 6deb39df15
7 changed files with 30 additions and 15 deletions
+7 -4
View File
@@ -289,15 +289,18 @@ openshift:
``` ```
When enabled, the chart applies `allowPrivilegeEscalation: false`, drops all When enabled, the chart applies `allowPrivilegeEscalation: false`, drops all
Linux capabilities, sets `runAsNonRoot: true`, uses Linux capabilities, sets `runAsNonRoot: true` and uses
`seccompProfile.type: RuntimeDefault`, and leaves `hostUsers` unset unless `seccompProfile.type: RuntimeDefault`.
`openshift.hostUsers` is explicitly overridden.
The deployment keeps the existing vanilla Kubernetes behavior when OpenShift The deployment keeps the existing vanilla Kubernetes behavior when OpenShift
compatibility is disabled. Auto-detection relies on the compatibility is disabled. Auto-detection relies on the
`security.openshift.io/v1/SecurityContextConstraints` API, so set `security.openshift.io/v1/SecurityContextConstraints` API, so set
`openshift.enabled: true` explicitly when rendering outside a live cluster. `openshift.enabled: true` explicitly when rendering outside a live cluster.
The PodSpec `hostUsers` field is independent of the OpenShift profile and is only
rendered when `deployment.hostUsers` is set to a boolean. When left unset, the
field is omitted so the platform default applies.
If you also want to expose Gitea through an OpenShift Route, enable the optional Route resource: If you also want to expose Gitea through an OpenShift Route, enable the optional Route resource:
```yaml ```yaml
@@ -1042,6 +1045,7 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
| `deployment.gitea.resources` | Compute Resources required by Gitea container. Cannot be updated. | `nil` | | `deployment.gitea.resources` | Compute Resources required by Gitea container. Cannot be updated. | `nil` |
| `deployment.gitea.securityContext` | Security context of the Gitea container. Used as fallback for the chart-managed init containers. | `{}` | | `deployment.gitea.securityContext` | Security context of the Gitea container. Used as fallback for the chart-managed init containers. | `{}` |
| `deployment.gitea.volumeMounts` | Additional volume mounts. | `[]` | | `deployment.gitea.volumeMounts` | Additional volume mounts. | `[]` |
| `deployment.hostUsers` | Use the host's user namespace. When unset, the field is omitted so the platform default is used. | `nil` |
| `deployment.initContainers` | List of initContainers. The order is important. First init container in the list will be executed first. The link refers to the corresponding init container configuration. | `[]` | | `deployment.initContainers` | List of initContainers. The order is important. First init container in the list will be executed first. The link refers to the corresponding init container configuration. | `[]` |
| `deployment.initDirectories.env` | Additional environment variables to pass to the init container. | `[]` | | `deployment.initDirectories.env` | Additional environment variables to pass to the init container. | `[]` |
| `deployment.initDirectories.envFrom` | List of environment variables mounted from configMaps or secrets for the initDirectories container. | `[]` | | `deployment.initDirectories.envFrom` | List of environment variables mounted from configMaps or secrets for the initDirectories container. | `[]` |
@@ -1165,7 +1169,6 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
| Name | Description | Value | | Name | Description | Value |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ----- | | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ----- |
| `openshift.enabled` | Enable OpenShift compatibility defaults for chart-managed pods. Defaults to auto-detect based on the SecurityContextConstraints API. | `nil` | | `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` |
| `podDisruptionBudget` | Pod disruption budget | `{}` | | `podDisruptionBudget` | Pod disruption budget | `{}` |
### Route ### Route
+3 -5
View File
@@ -101,13 +101,11 @@ false
{{- end -}} {{- end -}}
{{/* {{/*
Return the pod's hostUsers setting when OpenShift compatibility is enabled. Return the pod's hostUsers setting. Renders nothing unless explicitly set to a boolean.
*/}} */}}
{{- define "gitea.hostUsers" -}} {{- define "gitea.hostUsers" -}}
{{- if eq (include "gitea.openshift.enabled" . | trim) "true" -}} {{- if kindIs "bool" .Values.deployment.hostUsers -}}
{{- if kindIs "bool" .Values.openshift.hostUsers -}} {{ ternary "true" "false" .Values.deployment.hostUsers }}
{{ ternary "true" "false" .Values.openshift.hostUsers }}
{{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
+5
View File
@@ -75,6 +75,11 @@
{{- fail "`nodeSelector` does no longer exist. Please refer to the changelog and configure `deployment.nodeSelector` instead." -}} {{- fail "`nodeSelector` does no longer exist. Please refer to the changelog and configure `deployment.nodeSelector` instead." -}}
{{- end -}} {{- end -}}
{{/* OPENSHIFT HOST USERS */}}
{{- if hasKey .Values.openshift "hostUsers" -}}
{{- fail "`openshift.hostUsers` does no longer exist. Please refer to the changelog and configure `deployment.hostUsers` instead." -}}
{{- end -}}
{{/* PRIORITY CLASS NAME */}} {{/* PRIORITY CLASS NAME */}}
{{- if .Values.priorityClassName -}} {{- if .Values.priorityClassName -}}
{{- fail "`priorityClassName` does no longer exist. Please refer to the changelog and configure `deployment.priorityClassName` instead." -}} {{- fail "`priorityClassName` does no longer exist. Please refer to the changelog and configure `deployment.priorityClassName` instead." -}}
@@ -70,6 +70,12 @@ tests:
asserts: asserts:
- failedTemplate: - failedTemplate:
errorMessage: "`nodeSelector` does no longer exist. Please refer to the changelog and configure `deployment.nodeSelector` instead." errorMessage: "`nodeSelector` does no longer exist. Please refer to the changelog and configure `deployment.nodeSelector` instead."
- it: fails when the removed `openshift.hostUsers` value is set
set:
openshift.hostUsers: false
asserts:
- failedTemplate:
errorMessage: "`openshift.hostUsers` does no longer exist. Please refer to the changelog and configure `deployment.hostUsers` instead."
- it: fails when the removed `priorityClassName` value is set - it: fails when the removed `priorityClassName` value is set
set: set:
priorityClassName: high-priority priorityClassName: high-priority
+2 -1
View File
@@ -79,8 +79,8 @@ tests:
set: set:
openshift: openshift:
enabled: true enabled: true
hostUsers: true
deployment: deployment:
hostUsers: true
securityContext: securityContext:
fsGroup: 1000620000 fsGroup: 1000620000
gitea: gitea:
@@ -107,6 +107,7 @@ tests:
set: set:
openshift: openshift:
enabled: true enabled: true
deployment:
hostUsers: false hostUsers: false
asserts: asserts:
- equal: - equal:
@@ -26,6 +26,7 @@ tests:
set: set:
openshift: openshift:
enabled: true enabled: true
deployment:
hostUsers: false hostUsers: false
asserts: asserts:
- equal: - equal:
+6 -5
View File
@@ -133,6 +133,9 @@ deployment:
# mountPath: /configmap # mountPath: /configmap
# readOnly: true # readOnly: true
## @param deployment.hostUsers Use the host's user namespace. When unset, the field is omitted so the platform default is used.
hostUsers: ~
## @param deployment.initContainers [array] List of initContainers. The order is important. First init container in the list will be executed first. The link refers to the corresponding init container configuration. ## @param deployment.initContainers [array] List of initContainers. The order is important. First init container in the list will be executed first. The link refers to the corresponding init container configuration.
initContainers: initContainers:
# - container: # - container:
@@ -609,25 +612,23 @@ ingress:
## @param namespace An explicit namespace to deploy gitea into. Defaults to the release namespace if not specified ## @param namespace An explicit namespace to deploy gitea into. Defaults to the release namespace if not specified
namespace: "" namespace: ""
## @section Network ## @section Network
## @param clusterDomain Domain of the Cluster. Domain is part of internally issued certificates. ## @param clusterDomain Domain of the Cluster. Domain is part of internally issued certificates.
clusterDomain: cluster.local clusterDomain: cluster.local
## @section Image ## @section Image
## @param imagePullSecrets Secret to use for pulling the image ## @param imagePullSecrets Secret to use for pulling the image
imagePullSecrets: [] imagePullSecrets: []
## @section Security ## @section Security
# Security context is only usable with rootless image due to image design # Security context is only usable with rootless image due to image design
## @param openshift.enabled Enable OpenShift compatibility defaults for chart-managed pods. Defaults to auto-detect based on the SecurityContextConstraints API. ## @param openshift.enabled Enable OpenShift compatibility defaults for chart-managed pods. Defaults to auto-detect based on the SecurityContextConstraints API.
## @param openshift.hostUsers Override the PodSpec hostUsers field for chart-managed pods. When unset, the field is omitted so the platform default is used.
openshift: openshift:
enabled: null enabled: null
hostUsers: null
## @deprecated The securityContext variable has been split two:
## - deployment.gitea.securityContext
## - deployment.securityContext.
## @param podDisruptionBudget Pod disruption budget ## @param podDisruptionBudget Pod disruption budget
podDisruptionBudget: {} podDisruptionBudget: {}