Skip to content

Commit 92aa93b

Browse files
salonichf5baburciu
andauthored
feat: Add helm values for cert-generator job pod placement (#3494)
Feat: Add helm values for cert-generator Job pod placement (#3493) Problem: Deploying the new version 2.0.0 chart we see the Job/foo-cert-generator pod stuck on pending scheduling when all cluster nodes have taints. Solution: Add the ability to inject job.spec.template.spec.{affinity,nodeSelector,tolerations,topologySpreadConstraints} to alter pod placement. If you prefer to only add a subset of these, like only tolerations was needed in my case, please do inform and I can adjust. Co-authored-by: Bogdan-Adrian Burciu <[email protected]>
1 parent 179a5ea commit 92aa93b

File tree

4 files changed

+63
-1
lines changed

4 files changed

+63
-1
lines changed

charts/nginx-gateway-fabric/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,15 @@ The following table lists the configurable parameters of the NGINX Gateway Fabri
252252

253253
| Key | Description | Type | Default |
254254
|-----|-------------|------|---------|
255-
| `certGenerator` | The certGenerator section contains the configuration for the cert-generator Job. | object | `{"agentTLSSecretName":"agent-tls","annotations":{},"overwrite":false,"serverTLSSecretName":"server-tls"}` |
255+
| `certGenerator` | The certGenerator section contains the configuration for the cert-generator Job. | object | `{"affinity":{},"agentTLSSecretName":"agent-tls","annotations":{},"nodeSelector":{},"overwrite":false,"serverTLSSecretName":"server-tls","tolerations":[],"topologySpreadConstraints":[]}` |
256+
| `certGenerator.affinity` | The affinity of the cert-generator pod. | object | `{}` |
256257
| `certGenerator.agentTLSSecretName` | The name of the base Secret containing TLS CA, certificate, and key for the NGINX Agent to securely communicate with the NGINX Gateway Fabric control plane. Must exist in the same namespace that the NGINX Gateway Fabric control plane is running in (default namespace: nginx-gateway). | string | `"agent-tls"` |
257258
| `certGenerator.annotations` | The annotations of the cert-generator Job. | object | `{}` |
259+
| `certGenerator.nodeSelector` | The nodeSelector of the cert-generator pod. | object | `{}` |
258260
| `certGenerator.overwrite` | Overwrite existing TLS Secrets on startup. | bool | `false` |
259261
| `certGenerator.serverTLSSecretName` | The name of the Secret containing TLS CA, certificate, and key for the NGINX Gateway Fabric control plane to securely communicate with the NGINX Agent. Must exist in the same namespace that the NGINX Gateway Fabric control plane is running in (default namespace: nginx-gateway). | string | `"server-tls"` |
262+
| `certGenerator.tolerations` | Tolerations for the cert-generator pod. | list | `[]` |
263+
| `certGenerator.topologySpreadConstraints` | The topology spread constraints for the cert-generator pod. | list | `[]` |
260264
| `clusterDomain` | The DNS cluster domain of your Kubernetes cluster. | string | `"cluster.local"` |
261265
| `gateways` | A list of Gateway objects. View https://gateway-api.sigs.k8s.io/reference/spec/#gateway for full Gateway reference. | list | `[]` |
262266
| `nginx` | The nginx section contains the configuration for all NGINX data plane deployments installed by the NGINX Gateway Fabric control plane. | object | `{"config":{},"container":{},"debug":false,"image":{"pullPolicy":"IfNotPresent","repository":"ghcr.io/nginx/nginx-gateway-fabric/nginx","tag":"2.0.0"},"imagePullSecret":"","imagePullSecrets":[],"kind":"deployment","plus":false,"pod":{},"replicas":1,"service":{"externalTrafficPolicy":"Local","loadBalancerClass":"","loadBalancerIP":"","loadBalancerSourceRanges":[],"nodePorts":[],"type":"LoadBalancer"},"usage":{"caSecretName":"","clientSSLSecretName":"","endpoint":"","resolver":"","secretName":"nplus-license","skipVerify":false}}` |

charts/nginx-gateway-fabric/templates/certs-job.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,20 @@ spec:
153153
securityContext:
154154
fsGroup: 1001
155155
runAsNonRoot: true
156+
{{- if .Values.certGenerator.topologySpreadConstraints }}
157+
topologySpreadConstraints:
158+
{{- toYaml .Values.certGenerator.topologySpreadConstraints | nindent 6 }}
159+
{{- end }}
160+
{{- if .Values.certGenerator.affinity }}
161+
affinity:
162+
{{- toYaml .Values.certGenerator.affinity | nindent 8 }}
163+
{{- end }}
164+
{{- if .Values.certGenerator.tolerations }}
165+
tolerations:
166+
{{- toYaml .Values.certGenerator.tolerations | nindent 6 }}
167+
{{- end }}
168+
{{- if .Values.certGenerator.nodeSelector }}
169+
nodeSelector:
170+
{{- toYaml .Values.certGenerator.nodeSelector | nindent 8 }}
171+
{{- end }}
156172
ttlSecondsAfterFinished: 0

charts/nginx-gateway-fabric/values.schema.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
"certGenerator": {
55
"description": "The certGenerator section contains the configuration for the cert-generator Job.",
66
"properties": {
7+
"affinity": {
8+
"description": "The affinity of the cert-generator pod.",
9+
"required": [],
10+
"title": "affinity",
11+
"type": "object"
12+
},
713
"agentTLSSecretName": {
814
"default": "agent-tls",
915
"description": "The name of the base Secret containing TLS CA, certificate, and key for the NGINX Agent to securely\ncommunicate with the NGINX Gateway Fabric control plane. Must exist in the same namespace that the\nNGINX Gateway Fabric control plane is running in (default namespace: nginx-gateway).",
@@ -17,6 +23,12 @@
1723
"title": "annotations",
1824
"type": "object"
1925
},
26+
"nodeSelector": {
27+
"description": "The nodeSelector of the cert-generator pod.",
28+
"required": [],
29+
"title": "nodeSelector",
30+
"type": "object"
31+
},
2032
"overwrite": {
2133
"default": false,
2234
"description": "Overwrite existing TLS Secrets on startup.",
@@ -30,6 +42,24 @@
3042
"required": [],
3143
"title": "serverTLSSecretName",
3244
"type": "string"
45+
},
46+
"tolerations": {
47+
"description": "Tolerations for the cert-generator pod.",
48+
"items": {
49+
"required": []
50+
},
51+
"required": [],
52+
"title": "tolerations",
53+
"type": "array"
54+
},
55+
"topologySpreadConstraints": {
56+
"description": "The topology spread constraints for the cert-generator pod.",
57+
"items": {
58+
"required": []
59+
},
60+
"required": [],
61+
"title": "topologySpreadConstraints",
62+
"type": "array"
3363
}
3464
},
3565
"required": [],

charts/nginx-gateway-fabric/values.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,18 @@ certGenerator:
479479
# -- Overwrite existing TLS Secrets on startup.
480480
overwrite: false
481481

482+
# -- Tolerations for the cert-generator pod.
483+
tolerations: []
484+
485+
# -- The nodeSelector of the cert-generator pod.
486+
nodeSelector: {}
487+
488+
# -- The affinity of the cert-generator pod.
489+
affinity: {}
490+
491+
# -- The topology spread constraints for the cert-generator pod.
492+
topologySpreadConstraints: []
493+
482494
# -- A list of Gateway objects. View https://gateway-api.sigs.k8s.io/reference/spec/#gateway for full Gateway reference.
483495
gateways: []
484496

0 commit comments

Comments
 (0)