Skip to content

Commit 7477e9f

Browse files
feat(chart): expose controller tuning flags in Helm values (#392)
1 parent efd47be commit 7477e9f

4 files changed

Lines changed: 159 additions & 0 deletions

File tree

charts/nrr-controller/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ The following table lists the configurable parameters of the _node-readiness-con
6060
| `fullnameOverride` | String to fully override `nrr-controller.fullname` template | `""` |
6161
| `namespaceOverride` | Override the deployment namespace; defaults to .Release.Namespace | `""` |
6262
| `replicaCount` | The replica count for Deployment | `1` |
63+
| `controller.kubeAPIQPS` | Maximum QPS to the Kubernetes API server. `-1` means no limit. | `-1` |
64+
| `controller.kubeAPIBurst` | Maximum burst for throttled API server requests. `-1` means no limit. | `-1` |
65+
| `controller.nodeConcurrentReconciles` | Maximum number of Node objects reconciled concurrently. Raise on large clusters. | `1` |
66+
| `controller.ruleConcurrentReconciles` | Maximum number of NodeReadinessRule objects reconciled concurrently. | `1` |
67+
| `controller.enableNodeStateMetrics` | Enable per-rule aggregate node state metrics (`node_readiness_nodes_by_state` gauge). | `false` |
68+
| `controller.pprofBindAddress` | Bind address for the pprof debug endpoint. Leave empty to disable. | `""` |
6369
| `leaderElection.enabled` | Enable leader election to support multiple replicas | `true` |
70+
| `leaderElection.namespace` | Namespace for the leader election lease. Defaults to the release namespace when empty. | `""` |
6471
| `priorityClassName` | The name of the priority class to add to pods | `system-cluster-critical` |
6572
| `rbac.create` | If `true`, create & use RBAC resources | `true` |
6673
| `resources` | Node Readiness Controller container CPU and memory requests/limits | _see values.yaml_ |

charts/nrr-controller/templates/deployment.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ spec:
4141
{{- if .Values.leaderElection.enabled }}
4242
- --leader-elect
4343
{{- end }}
44+
{{- if .Values.leaderElection.namespace }}
45+
- --leader-election-namespace={{ .Values.leaderElection.namespace }}
46+
{{- end }}
4447
- --health-probe-bind-address={{ .Values.healthProbeBindAddress }}
4548
- --enable-webhook={{ ternary "true" "false" .Values.webhook.enabled }}
4649
{{- if .Values.metrics.enabled }}
@@ -52,6 +55,24 @@ spec:
5255
{{- else }}
5356
- --metrics-bind-address=0
5457
{{- end }}
58+
{{- if ne (int .Values.controller.kubeAPIQPS) -1 }}
59+
- --kube-api-qps={{ .Values.controller.kubeAPIQPS }}
60+
{{- end }}
61+
{{- if ne (int .Values.controller.kubeAPIBurst) -1 }}
62+
- --kube-api-burst={{ .Values.controller.kubeAPIBurst }}
63+
{{- end }}
64+
{{- if gt (int .Values.controller.nodeConcurrentReconciles) 1 }}
65+
- --node-concurrent-reconciles={{ .Values.controller.nodeConcurrentReconciles }}
66+
{{- end }}
67+
{{- if gt (int .Values.controller.ruleConcurrentReconciles) 1 }}
68+
- --rule-concurrent-reconciles={{ .Values.controller.ruleConcurrentReconciles }}
69+
{{- end }}
70+
{{- if .Values.controller.enableNodeStateMetrics }}
71+
- --enable-node-state-metrics
72+
{{- end }}
73+
{{- if .Values.controller.pprofBindAddress }}
74+
- --pprof-bind-address={{ .Values.controller.pprofBindAddress }}
75+
{{- end }}
5576
{{- if .Values.webhook.enabled }}
5677
ports:
5778
- name: webhook-server

charts/nrr-controller/tests/deployment_test.yaml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,111 @@ tests:
5353
- equal:
5454
path: spec.template.spec.containers[0].ports[0].name
5555
value: webhook-server
56+
57+
- it: does not pass concurrency args at defaults
58+
template: templates/deployment.yaml
59+
asserts:
60+
- notContains:
61+
path: spec.template.spec.containers[0].args
62+
content: --node-concurrent-reconciles=1
63+
- notContains:
64+
path: spec.template.spec.containers[0].args
65+
content: --rule-concurrent-reconciles=1
66+
67+
- it: passes node-concurrent-reconciles when raised
68+
set:
69+
controller:
70+
nodeConcurrentReconciles: 10
71+
template: templates/deployment.yaml
72+
asserts:
73+
- contains:
74+
path: spec.template.spec.containers[0].args
75+
content: --node-concurrent-reconciles=10
76+
77+
- it: passes rule-concurrent-reconciles when raised
78+
set:
79+
controller:
80+
ruleConcurrentReconciles: 5
81+
template: templates/deployment.yaml
82+
asserts:
83+
- contains:
84+
path: spec.template.spec.containers[0].args
85+
content: --rule-concurrent-reconciles=5
86+
87+
- it: does not pass kube-api-qps at default
88+
template: templates/deployment.yaml
89+
asserts:
90+
- notContains:
91+
path: spec.template.spec.containers[0].args
92+
content: --kube-api-qps=-1
93+
94+
- it: passes kube-api-qps when overridden
95+
set:
96+
controller:
97+
kubeAPIQPS: 50
98+
template: templates/deployment.yaml
99+
asserts:
100+
- contains:
101+
path: spec.template.spec.containers[0].args
102+
content: --kube-api-qps=50
103+
104+
- it: passes kube-api-burst when overridden
105+
set:
106+
controller:
107+
kubeAPIBurst: 100
108+
template: templates/deployment.yaml
109+
asserts:
110+
- contains:
111+
path: spec.template.spec.containers[0].args
112+
content: --kube-api-burst=100
113+
114+
- it: does not pass enable-node-state-metrics by default
115+
template: templates/deployment.yaml
116+
asserts:
117+
- notContains:
118+
path: spec.template.spec.containers[0].args
119+
content: --enable-node-state-metrics
120+
121+
- it: passes enable-node-state-metrics when enabled
122+
set:
123+
controller:
124+
enableNodeStateMetrics: true
125+
template: templates/deployment.yaml
126+
asserts:
127+
- contains:
128+
path: spec.template.spec.containers[0].args
129+
content: --enable-node-state-metrics
130+
131+
- it: does not pass pprof-bind-address by default
132+
template: templates/deployment.yaml
133+
asserts:
134+
- notContains:
135+
path: spec.template.spec.containers[0].args
136+
content: --pprof-bind-address=
137+
138+
- it: passes pprof-bind-address when set
139+
set:
140+
controller:
141+
pprofBindAddress: ":6060"
142+
template: templates/deployment.yaml
143+
asserts:
144+
- contains:
145+
path: spec.template.spec.containers[0].args
146+
content: "--pprof-bind-address=:6060"
147+
148+
- it: does not pass leader-election-namespace by default
149+
template: templates/deployment.yaml
150+
asserts:
151+
- notContains:
152+
path: spec.template.spec.containers[0].args
153+
content: --leader-election-namespace=
154+
155+
- it: passes leader-election-namespace when set
156+
set:
157+
leaderElection:
158+
namespace: kube-system
159+
template: templates/deployment.yaml
160+
asserts:
161+
- contains:
162+
path: spec.template.spec.containers[0].args
163+
content: --leader-election-namespace=kube-system

charts/nrr-controller/values.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,26 @@ securityContext:
5454

5555
terminationGracePeriodSeconds: 10
5656

57+
# Controller performance tuning flags.
58+
# These map directly to the CLI flags in cmd/main.go.
59+
controller:
60+
# -- Maximum QPS to the Kubernetes API server.
61+
# -1 means no limit (controller-runtime default).
62+
kubeAPIQPS: -1
63+
# -- Maximum burst for throttled API server requests.
64+
# -1 means no limit (controller-runtime default).
65+
kubeAPIBurst: -1
66+
# -- Maximum number of Node objects reconciled concurrently.
67+
# Raise on large clusters to reduce taint latency during node joins.
68+
nodeConcurrentReconciles: 1
69+
# -- Maximum number of NodeReadinessRule objects reconciled concurrently.
70+
ruleConcurrentReconciles: 1
71+
# -- Enable per-rule aggregate node state metrics
72+
# (node_readiness_nodes_by_state gauge). Increases API reads on node updates.
73+
enableNodeStateMetrics: false
74+
# -- Bind address for the pprof endpoint. Leave empty to disable.
75+
pprofBindAddress: ""
76+
5777
rbac:
5878
create: true
5979

@@ -65,6 +85,9 @@ serviceAccount:
6585
# Enable leader election to support multiple replicas
6686
leaderElection:
6787
enabled: true
88+
# -- Namespace for the leader election lease.
89+
# Defaults to the release namespace when empty.
90+
namespace: ""
6891

6992
# The bind address for the health probe endpoints (/healthz, /readyz)
7093
healthProbeBindAddress: ":8081"

0 commit comments

Comments
 (0)