8000 Add initContainerResources Helm configuration (#4651) · nginx/kubernetes-ingress@7fcee3d · GitHub
[go: up one dir, main page]

Skip to content

Commit 7fcee3d

Browse files
authored
Add initContainerResources Helm configuration (#4651)
Add initContainerResources Helm configuration
1 parent 6d85f27 commit 7fcee3d

File tree

5 files changed

+37
-2
lines changed

5 files changed

+37
-2
lines changed

charts/nginx-ingress/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ The following tables lists the configurable parameters of the NGINX Ingress Cont
371371
|`controller.initContainers` | InitContainers for the Ingress Controller pods. | [] |
372372
|`controller.extraContainers` | Extra (eg. sidecar) containers for the Ingress Controller pods. | [] |
373373
|`controller.resources` | The resources of the Ingress Controller pods. | requests: cpu=100m,memory=128Mi |
374+
|`controller.initContainerResources` | The resources of the init container which is used when `controller.readOnlyRootFilesystem` is set to `true` | requests: cpu=100m,memory=128Mi |
374375
|`controller.replicaCount` | The number of replicas of the Ingress Controller deployment. | 1 |
375376
|`controller.ingressClass.name` | A class of the Ingress Controller. An IngressClass resource with the name equal to the class must be deployed. Otherwise, the Ingress Controller will fail to start. The Ingress Controller only processes resources that belong to its class - i.e. have the "ingressClassName" field resource equal to the class. The Ingress Controller processes all the VirtualServer/VirtualServerRoute/TransportServer resources that do not have the "ingressClassName" field for all versions of Kubernetes. | nginx |
376377
|`controller.ingressClass.create` | Creates a new IngressClass object with the name `controller.ingressClass.name`. Set to `false` to use an existing ingressClass created using `kubectl` with the same name. If you use `helm upgrade`, do not change the values from the previous release as helm will delete IngressClass objects managed by helm. If you are upgrading from a release earlier than 3.3.2, do not set the value to false. | true |

charts/nginx-ingress/templates/controller-daemonset.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ spec:
259259
image: {{ include "nginx-ingress.image" . }}
260260
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
261261
command: ['cp', '-vdR', '/etc/nginx/.', '/mnt/etc']
262+
{{- if .Values.controller.initContainerResources }}
263+
resources:
264+
{{ toYaml .Values.controller.initContainerResources | indent 10 }}
265+
{{- end }}
262266
securityContext:
263267
allowPrivilegeEscalation: false
264268
readOnlyRootFilesystem: true

charts/nginx-ingress/templates/controller-deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ spec:
266266
image: {{ include "nginx-ingress.image" . }}
267267
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
268268
command: ['cp', '-vdR', '/etc/nginx/.', '/mnt/etc']
269+
{{- if .Values.controller.initContainerResources }}
270+
resources:
271+
{{ toYaml .Values.controller.initContainerResources | indent 10 }}
272+
{{- end }}
269273
securityContext:
270274
allowPrivilegeEscalation: false
271275
readOnlyRootFilesystem: true

charts/nginx-ingress/values.schema.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,12 @@
483483
"title": "The resources Schema",
484484
"$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.27.4/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements"
485485
},
486+
"initContainerResources": {
487+
"type": "object",
488+
"default": {},
489+
"title": "The resources Schema",
490+
"$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.27.4/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements"
491+
},
486492
"tolerations": {
487493
"type": "array",
488494
"default": [],
@@ -1341,6 +1347,12 @@
13411347
"memory": "128Mi"
13421348
}
13431349
},
1350+
"initContainerResources": {
1351+
"requests": {
1352+
"cpu": "100m",
1353+
"memory": "128Mi"
1354+
}
1355+
},
13441356
"tolerations": [],
13451357
"affinity": {},
13461358
"topologySpreadConstraints": {},
@@ -1706,6 +1718,12 @@
17061718
"memory": "128Mi"
17071719
}
17081720
},
1721+
"initContainerResources": {
1722+
"requests": {
1723+
"cpu": "100m",
1724+
"memory": "128Mi"
1725+
}
1726+
},
17091727
"tolerations": [],
17101728
"affinity": {},
17111729
"topologySpreadConstraints": {},

charts/nginx-ingress/values.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ controller:
168168
# cpu: 1
169169
# memory: 1Gi
170170

171+
## The resources for the Ingress Controller init container which is used when readOnlyRootFilesystem is set to true.
172+
initContainerResources:
173+
requests:
174+
cpu: 100m
175+
memory: 128Mi
176+
# limits:
177+
# cpu: 1
178+
# memory: 1Gi
179+
171180
## The tolerations of the Ingress Controller pods.
172181
tolerations: []
173182

@@ -287,7 +296,6 @@ controller:
287296
# port: 5353
288297
# protocol: TCP
289298

290-
291299
## Enable custom NGINX configuration snippets in Ingress, VirtualServer, VirtualServerRoute and TransportServer resources.
292300
enableSnippets: false
293301

@@ -490,7 +498,7 @@ prometheus:
490498
## A list of endpoints allowed as part of this ServiceMonitor.
491499
## Matches on the name of a Service port.
492500
endpoints:
493-
- port: prometheus
501+
- port: prometheus
494502

495503
serviceInsight:
496504
## Expose NGINX Plus Service Insight endpoint.

0 commit comments

Comments
 (0)
0