Skip to content

Commit

Permalink
Add initContainerResources Helm configuration (#4651)
Browse files Browse the repository at this point in the history
Add initContainerResources Helm configuration
  • Loading branch information
oseoin authored Nov 20, 2023
1 parent 6d85f27 commit 7fcee3d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
1 change: 1 addition & 0 deletions charts/nginx-ingress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ The following tables lists the configurable parameters of the NGINX Ingress Cont
|`controller.initContainers` | InitContainers for the Ingress Controller pods. | [] |
|`controller.extraContainers` | Extra (eg. sidecar) containers for the Ingress Controller pods. | [] |
|`controller.resources` | The resources of the Ingress Controller pods. | requests: cpu=100m,memory=128Mi |
|`controller.initContainerResources` | The resources of the init container which is used when `controller.readOnlyRootFilesystem` is set to `true` | requests: cpu=100m,memory=128Mi |
|`controller.replicaCount` | The number of replicas of the Ingress Controller deployment. | 1 |
|`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 |
|`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 |
Expand Down
4 changes: 4 additions & 0 deletions charts/nginx-ingress/templates/controller-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ spec:
image: {{ include "nginx-ingress.image" . }}
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
command: ['cp', '-vdR', '/etc/nginx/.', '/mnt/etc']
{{- if .Values.controller.initContainerResources }}
resources:
{{ toYaml .Values.controller.initContainerResources | indent 10 }}
{{- end }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
Expand Down
4 changes: 4 additions & 0 deletions charts/nginx-ingress/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ spec:
image: {{ include "nginx-ingress.image" . }}
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
command: ['cp', '-vdR', '/etc/nginx/.', '/mnt/etc']
{{- if .Values.controller.initContainerResources }}
resources:
{{ toYaml .Values.controller.initContainerResources | indent 10 }}
{{- end }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
Expand Down
18 changes: 18 additions & 0 deletions charts/nginx-ingress/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,12 @@
"title": "The resources Schema",
"$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.27.4/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements"
},
"initContainerResources": {
"type": "object",
"default": {},
"title": "The resources Schema",
"$ref": "https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.27.4/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements"
},
"tolerations": {
"type": "array",
"default": [],
Expand Down Expand Up @@ -1341,6 +1347,12 @@
"memory": "128Mi"
}
},
"initContainerResources": {
"requests": {
"cpu": "100m",
"memory": "128Mi"
}
},
"tolerations": [],
"affinity": {},
"topologySpreadConstraints": {},
Expand Down Expand Up @@ -1706,6 +1718,12 @@
"memory": "128Mi"
}
},
"initContainerResources": {
"requests": {
"cpu": "100m",
"memory": "128Mi"
}
},
"tolerations": [],
"affinity": {},
"topologySpreadConstraints": {},
Expand Down
12 changes: 10 additions & 2 deletions charts/nginx-ingress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ controller:
# cpu: 1
# memory: 1Gi

## The resources for the Ingress Controller init container which is used when readOnlyRootFilesystem is set to true.
initContainerResources:
requests:
cpu: 100m
memory: 128Mi
# limits:
# cpu: 1
# memory: 1Gi

## The tolerations of the Ingress Controller pods.
tolerations: []

Expand Down Expand Up @@ -287,7 +296,6 @@ controller:
# port: 5353
# protocol: TCP


## Enable custom NGINX configuration snippets in Ingress, VirtualServer, VirtualServerRoute and TransportServer resources.
enableSnippets: false

Expand Down Expand Up @@ -490,7 +498,7 @@ prometheus:
## A list of endpoints allowed as part of this ServiceMonitor.
## Matches on the name of a Service port.
endpoints:
- port: prometheus
- port: prometheus

serviceInsight:
## Expose NGINX Plus Service Insight endpoint.
Expand Down

0 comments on commit 7fcee3d

Please sign in to comment.