feat(deployment)!: split resources into deployment.gitea.resources and deployment.resources

The top-level `resources` value was applied to the Gitea container only, while its name suggested it covered the
whole pod. Kubernetes meanwhile supports pod-level resources, so a single ambiguous key can no longer express
both scopes.

Container-scoped limits and requests now live in `deployment.gitea.resources`, next to `deployment.gitea.env`,
and the new `deployment.resources` maps to the pod-level `resources` field. The pod-level block is only rendered
when set, because the field is not accepted by older API servers and would otherwise be rejected on clusters
that do not support it yet. The GOMAXPROCS derivation follows the container-scoped value and tolerates an unset
`deployment.gitea.resources`, which defaults to `null`.

The `deployment` section marker in `values.yaml` is restored as well. Without it the generated README lost its
`### deployment` heading and the manually maintained table of contents pointed at a non-existing anchor, which
made `markdownlint` fail.

BREAKING CHANGE: `resources` no longer exists. Use `deployment.gitea.resources` for container limits and
requests, or `deployment.resources` for pod-level resources. Installations that still set `resources` will fail
unless `checkDeprecation` is set to `false`.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-09-04 11:40:09 +02:00
co-authored by Copilot
parent 25b3fff3eb
commit 20de800294
6 changed files with 141 additions and 37 deletions
+16 -15
View File
@@ -1121,21 +1121,22 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
### deployment ### deployment
| Name | Description | Value | | Name | Description | Value |
| ------------------------------------------ | ---------------------------------------------------------------- | ------ | | ------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------ |
| `resources` | Kubernetes resources | `{}` | | `schedulerName` | Use an alternate scheduler, e.g. "stork" | `""` |
| `schedulerName` | Use an alternate scheduler, e.g. "stork" | `""` | | `tolerations` | Tolerations for the deployment | `[]` |
| `tolerations` | Tolerations for the deployment | `[]` | | `topologySpreadConstraints` | TopologySpreadConstraints for the deployment | `[]` |
| `topologySpreadConstraints` | TopologySpreadConstraints for the deployment | `[]` | | `deployment.enabled` | Enable the deployment of Gitea. | `true` |
| `priorityClassName` | priorityClassName for the deployment | `""` | | `deployment.annotations` | Annotations for the Gitea deployment to be created | `{}` |
| `deployment.enabled` | Enable the deployment of Gitea. | `true` | | `deployment.labels` | Labels for the deployment | `{}` |
| `deployment.annotations` | Annotations for the Gitea deployment to be created | `{}` | | `deployment.affinity` | Affinity for the deployment. | `{}` |
| `deployment.labels` | Labels for the deployment | `{}` | | `deployment.dnsConfig` | dnsConfig of the Gitea deployment. | `{}` |
| `deployment.affinity` | Affinity for the deployment. | `{}` | | `deployment.gitea.env` | Additional environment variables to pass to the Gitea container. | `[]` |
| `deployment.dnsConfig` | dnsConfig of the Gitea deployment. | `{}` | | `deployment.gitea.resources` | Compute Resources required by Gitea container. Cannot be updated. | `nil` |
| `deployment.gitea.env` | Additional environment variables to pass to the Gitea container. | `[]` | | `deployment.nodeSelector` | NodeSelector for the deployment | `{}` |
| `deployment.nodeSelector` | NodeSelector for the deployment | `{}` | | `deployment.priorityClassName` | priorityClassName for the deployment | `""` |
| `deployment.terminationGracePeriodSeconds` | How long to wait until forcefully kill the pod | `60` | | `deployment.resources` | Resources is the total amount of CPU and Memory resources required by all containers in the pod. | `{}` |
| `deployment.terminationGracePeriodSeconds` | How long to wait until forcefully kill the pod | `60` |
### Secret ### Secret
+10 -4
View File
@@ -72,8 +72,8 @@ spec:
{{- if (or .Values.serviceAccount.create .Values.serviceAccount.name) }} {{- if (or .Values.serviceAccount.create .Values.serviceAccount.name) }}
serviceAccountName: {{ include "gitea.serviceAccountName" . }} serviceAccountName: {{ include "gitea.serviceAccountName" . }}
{{- end }} {{- end }}
{{- if .Values.priorityClassName }} {{- if .Values.deployment.priorityClassName }}
priorityClassName: "{{ .Values.priorityClassName }}" priorityClassName: "{{ .Values.deployment.priorityClassName }}"
{{- end }} {{- end }}
{{- if $hostUsers }} {{- if $hostUsers }}
hostUsers: {{ $hostUsers }} hostUsers: {{ $hostUsers }}
@@ -354,13 +354,15 @@ spec:
value: /data value: /data
- name: GITEA_TEMP - name: GITEA_TEMP
value: /tmp/gitea value: /tmp/gitea
{{- if and (hasKey .Values.resources "limits") (hasKey .Values.resources.limits "cpu") }} {{- with .Values.deployment.gitea.resources }}
{{- if and (hasKey . "limits") (hasKey (.limits | default dict) "cpu") }}
- name: GOMAXPROCS - name: GOMAXPROCS
valueFrom: valueFrom:
resourceFieldRef: resourceFieldRef:
divisor: "1" divisor: "1"
resource: limits.cpu resource: limits.cpu
{{- end }} {{- end }}
{{- end }}
- name: TMPDIR - name: TMPDIR
value: /tmp/gitea value: /tmp/gitea
{{- if .Values.image.rootless }} {{- if .Values.image.rootless }}
@@ -402,7 +404,7 @@ spec:
{{- include "gitea.deployment.probe" .Values.gitea.startupProbe | nindent 12 }} {{- include "gitea.deployment.probe" .Values.gitea.startupProbe | nindent 12 }}
{{- end }} {{- end }}
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml (.Values.deployment.gitea.resources | default dict) | nindent 12 }}
{{- if $runtimeContainerSecurityContext }} {{- if $runtimeContainerSecurityContext }}
securityContext: securityContext:
{{- $runtimeContainerSecurityContext | nindent 12 }} {{- $runtimeContainerSecurityContext | nindent 12 }}
@@ -442,6 +444,10 @@ spec:
{{- if .Values.deployment.dnsConfig }} {{- if .Values.deployment.dnsConfig }}
dnsConfig: dnsConfig:
{{- toYaml .Values.deployment.dnsConfig | nindent 8 }} {{- toYaml .Values.deployment.dnsConfig | nindent 8 }}
{{- end }}
{{- with .Values.deployment.resources }}
resources:
{{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
volumes: volumes:
- name: init - name: init
+10
View File
@@ -59,4 +59,14 @@
{{- if .Values.nodeSelector -}} {{- if .Values.nodeSelector -}}
{{- 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 -}}
{{/* PRIORITY CLASS NAME */}}
{{- if .Values.priorityClassName -}}
{{- fail "`priorityClassName` does no longer exist. Please refer to the changelog and configure `deployment.priorityClassName` instead." -}}
{{- end -}}
{{/* RESOURCES */}}
{{- if .Values.resources -}}
{{- fail "`resources` does no longer exist. Please refer to the changelog and configure `deployment.gitea.resources` instead." -}}
{{- end -}}
{{- end -}} {{- end -}}
+53 -1
View File
@@ -126,6 +126,19 @@ tests:
options: options:
- name: ndots - name: ndots
value: "2" value: "2"
- it: priorityClassName is undefined
template: templates/gitea/deployment.yaml
asserts:
- notExists:
path: spec.template.spec.priorityClassName
- it: priorityClassName is defined
template: templates/gitea/deployment.yaml
set:
deployment.priorityClassName: high-priority
asserts:
- equal:
path: spec.template.spec.priorityClassName
value: high-priority
- it: "injects TMP_EXISTING_ENVS_FILE as environment variable to 'init-app-ini' init container" - it: "injects TMP_EXISTING_ENVS_FILE as environment variable to 'init-app-ini' init container"
template: templates/gitea/deployment.yaml template: templates/gitea/deployment.yaml
@@ -173,7 +186,7 @@ tests:
- it: CPU resources are defined as well as GOMAXPROCS - it: CPU resources are defined as well as GOMAXPROCS
template: templates/gitea/deployment.yaml template: templates/gitea/deployment.yaml
set: set:
resources: deployment.gitea.resources:
limits: limits:
cpu: 200ms cpu: 200ms
memory: 200Mi memory: 200Mi
@@ -198,6 +211,45 @@ tests:
requests: requests:
cpu: 100ms cpu: 100ms
memory: 100Mi memory: 100Mi
- it: container resources default to an empty map and GOMAXPROCS is omitted
template: templates/gitea/deployment.yaml
asserts:
- equal:
path: spec.template.spec.containers[0].resources
value: {}
- notContains:
path: spec.template.spec.containers[0].env
content:
name: GOMAXPROCS
valueFrom:
resourceFieldRef:
divisor: "1"
resource: limits.cpu
- it: pod level resources are undefined
template: templates/gitea/deployment.yaml
asserts:
- notExists:
path: spec.template.spec.resources
- it: pod level resources are defined
template: templates/gitea/deployment.yaml
set:
deployment.resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 250m
memory: 256Mi
asserts:
- equal:
path: spec.template.spec.resources
value:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 250m
memory: 256Mi
- it: Init containers have correct volumeMount path - it: Init containers have correct volumeMount path
template: templates/gitea/deployment.yaml template: templates/gitea/deployment.yaml
set: set:
@@ -46,6 +46,20 @@ 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 `priorityClassName` value is set
set:
priorityClassName: high-priority
asserts:
- failedTemplate:
errorMessage: "`priorityClassName` does no longer exist. Please refer to the changelog and configure `deployment.priorityClassName` instead."
- it: fails when the removed `resources` value is set
set:
resources:
limits:
cpu: 100m
asserts:
- failedTemplate:
errorMessage: "`resources` does no longer exist. Please refer to the changelog and configure `deployment.gitea.resources` instead."
- it: skips the deprecation checks when `checkDeprecation` is disabled - it: skips the deprecation checks when `checkDeprecation` is disabled
set: set:
checkDeprecation: false checkDeprecation: false
@@ -59,6 +73,10 @@ tests:
- 192.0.2.1 - 192.0.2.1
nodeSelector: nodeSelector:
foo: bar foo: bar
priorityClassName: high-priority
resources:
limits:
cpu: 100m
asserts: asserts:
- hasDocuments: - hasDocuments:
count: 0 count: 0
+34 -17
View File
@@ -292,20 +292,6 @@ gatewayAPI:
body: {} body: {}
# maxSize: 100m # maxSize: 100m
## @section deployment
#
## @param resources Kubernetes resources
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
## Use an alternate scheduler, e.g. "stork". ## Use an alternate scheduler, e.g. "stork".
## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/ ## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/
@@ -319,9 +305,7 @@ tolerations: []
## @param topologySpreadConstraints TopologySpreadConstraints for the deployment ## @param topologySpreadConstraints TopologySpreadConstraints for the deployment
topologySpreadConstraints: [] topologySpreadConstraints: []
## @param priorityClassName priorityClassName for the deployment ## @section deployment
priorityClassName: ""
deployment: deployment:
## @param deployment.enabled Enable the deployment of Gitea. ## @param deployment.enabled Enable the deployment of Gitea.
## @param deployment.annotations Annotations for the Gitea deployment to be created ## @param deployment.annotations Annotations for the Gitea deployment to be created
@@ -367,9 +351,42 @@ deployment:
# - name: VARIABLE # - name: VARIABLE
# value: my-value # value: my-value
## @param deployment.gitea.resources Compute Resources required by Gitea container. Cannot be updated.
## @skip deployment.gitea.resources.claims Claims lists the names of resources, defined in spec.resourceClaims, that are used by this container.
## @skip deployment.gitea.resources.limits Limits describes the maximum amount of compute resources allowed for this container.
## @skip deployment.gitea.resources.requests Requests describes the minimum amount of compute resources required for this container.
resources:
# claims: []
# - name: ""
# request: ""
# limits:
# ephemeral: 100Mi
# cpu: 100m
# memory: 128Mi
# requests:
# ephemeral: 100Mi
# cpu: 100m
# memory: 128Mi
## @param deployment.nodeSelector NodeSelector for the deployment ## @param deployment.nodeSelector NodeSelector for the deployment
nodeSelector: {} nodeSelector: {}
## @param deployment.priorityClassName priorityClassName for the deployment
priorityClassName: ""
## @param deployment.resources Resources is the total amount of CPU and Memory resources required by all containers in the pod.
## @skip deployment.resources.limits Limits describes the maximum amount of compute resources allowed.
## @skip deployment.resources.requests Requests describes the minimum amount of compute resources required.
resources: {}
# limits:
# ephemeral: 100Mi
# cpu: 100m
# memory: 128Mi
# requests:
# ephemeral: 100Mi
# cpu: 100m
# memory: 128Mi
## @param deployment.terminationGracePeriodSeconds How long to wait until forcefully kill the pod ## @param deployment.terminationGracePeriodSeconds How long to wait until forcefully kill the pod
terminationGracePeriodSeconds: 60 terminationGracePeriodSeconds: 60