Skip to content

Commit d8d272c

Browse files
authored
feat(http-add-on): replace kube-rbac-proxy with native secure metrics (#807)
The kube-rbac-proxy sidecar is being discontinued and its images will become unavailable. This change uses controller-runtime's built-in metrics authentication instead, following kubebuilder recommendations. Changes: - Remove kube-rbac-proxy sidecar container from operator deployment - Add operator.metrics config (secure, auth, certDir) to values.yaml - Replace proxy-role ClusterRole with system:auth-delegator binding - Remove kube-rbac-proxy image and securityContext references Signed-off-by: Vincent Link <vlink@redhat.com>
1 parent 21f9beb commit d8d272c

4 files changed

Lines changed: 33 additions & 82 deletions

File tree

http-add-on/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ their default values.
8787
| `additionalLabels` | object | `{}` | Additional labels to be applied to installed resources. Note that not all resources will receive these labels. |
8888
| `crds.install` | bool | `true` | Whether to install the `HTTPScaledObject` [`CustomResourceDefinition`](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) |
8989
| `images.interceptor` | string | `"ghcr.io/kedacore/http-add-on-interceptor"` | Image name for the interceptor image component |
90-
| `images.kubeRbacProxy.name` | string | `"gcr.io/kubebuilder/kube-rbac-proxy"` | Image name for the Kube RBAC Proxy image component |
91-
| `images.kubeRbacProxy.tag` | string | `"v0.13.0"` | Image tag for the Kube RBAC Proxy image component |
9290
| `images.operator` | string | `"ghcr.io/kedacore/http-add-on-operator"` | Image name for the operator image component |
9391
| `images.scaler` | string | `"ghcr.io/kedacore/http-add-on-scaler"` | Image name for the scaler image component |
9492
| `images.tag` | string | `""` | Image tag for the http add on. This tag is applied to the images listed in `images.operator`, `images.interceptor`, and `images.scaler`. Optional, given app version of Helm chart is used by default |
@@ -97,7 +95,6 @@ their default values.
9795
| `logging.interceptor.stackTracesEnabled` | bool | `false` | Display stack traces in the logs |
9896
| `logging.interceptor.timeEncoding` | string | `"rfc3339"` | Logging time encoding for KEDA http-add-on Interceptor. allowed values are `epoch`, `millis`, `nano`, `iso8601`, `rfc3339` or `rfc3339nano` |
9997
| `logging.operator.format` | string | `"console"` | Logging format for KEDA http-add-on operator. allowed values: `json` or `console` |
100-
| `logging.operator.kubeRbacProxy.level` | int | `10` | Logging level for KEDA http-add-on operator rbac proxy allowed values: `0` for info, `4` for debug, or an integer value greater than 0 |
10198
| `logging.operator.level` | string | `"info"` | Logging level for KEDA http-add-on operator. allowed values: `debug`, `info`, `error`, or an integer value greater than 0, specified as string |
10299
| `logging.operator.stackTracesEnabled` | bool | `false` | Display stack traces in the logs |
103100
| `logging.operator.timeEncoding` | string | `"rfc3339"` | Logging time encoding for KEDA http-add-on operator. allowed values are `epoch`, `millis`, `nano`, `iso8601`, `rfc3339` or `rfc3339nano` |
@@ -122,13 +119,14 @@ their default values.
122119
| `operator.affinity` | object | `{}` | Affinity for pod scheduling ([docs](https://kubernetes.io/docs/tasks/configure-pod-container/assign-pods-nodes-using-node-affinity/)) |
123120
| `operator.extraEnvs` | object | `{}` | Extra environment variables to set (key-value map with "ENV name":"value") |
124121
| `operator.imagePullSecrets` | list | `[]` | The image pull secrets for the operator component |
125-
| `operator.kubeRbacProxy.resources.limits` | object | `{"cpu":"300m","memory":"200Mi"}` | The CPU/memory resource limit for the operator component's kube rbac proxy |
126-
| `operator.kubeRbacProxy.resources.requests` | object | `{"cpu":"10m","memory":"20Mi"}` | The CPU/memory resource request for the operator component's kube rbac proxy |
122+
| `operator.metrics.auth` | bool | `true` | Enable authentication and authorization for the metrics endpoint |
123+
| `operator.metrics.certDir` | string | `""` | Directory containing TLS certificates (tls.crt/tls.key). If empty, self-signed certs are generated. |
124+
| `operator.metrics.secure` | bool | `true` | Enable HTTPS for the metrics endpoint |
127125
| `operator.nodeSelector` | object | `{}` | Node selector for pod scheduling ([docs](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/)) |
128126
| `operator.podAnnotations` | object | `{}` | Annotations to be added to the operator pods |
129127
| `operator.port` | int | `8443` | The port for the operator main server to run on |
130128
| `operator.pullPolicy` | string | `"Always"` | The image pull policy for the operator component |
131-
| `operator.replicas` | int | `1` | Number of replicas, oerator k8s resources will not be installed if this is set to 0 |
129+
| `operator.replicas` | int | `1` | Number of replicas, operator k8s resources will not be installed if this is set to 0 |
132130
| `operator.resources.limits` | object | `{"cpu":0.5,"memory":"64Mi"}` | The CPU/memory resource limit for the operator component |
133131
| `operator.resources.requests` | object | `{"cpu":"250m","memory":"20Mi"}` | The CPU/memory resource request for the operator component |
134132
| `operator.tolerations` | list | `[]` | Tolerations for pod scheduling ([docs](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)) |
@@ -184,8 +182,8 @@ their default values.
184182
| `interceptor.replicas.max` | int | `50` | The maximum number of interceptor replicas that should ever be running |
185183
| `interceptor.replicas.min` | int | `3` | The minimum number of interceptor replicas that should ever be running |
186184
| `interceptor.replicas.waitTimeout` | string | `"20s"` | The maximum time the interceptor should wait for an HTTP request to reach a backend before it is considered a failure |
187-
| `interceptor.resources.limits` | object | `{"cpu":0.5,"memory":"64Mi"}` | The CPU/memory resource limit for the operator component |
188-
| `interceptor.resources.requests` | object | `{"cpu":"250m","memory":"20Mi"}` | The CPU/memory resource request for the operator component |
185+
| `interceptor.resources.limits` | object | `{"cpu":0.5,"memory":"64Mi"}` | The CPU/memory resource limit for the interceptor component |
186+
| `interceptor.resources.requests` | object | `{"cpu":"250m","memory":"20Mi"}` | The CPU/memory resource request for the interceptor component |
189187
| `interceptor.responseHeaderTimeout` | string | `"500ms"` | How long the interceptor will wait between forwarding a request to a backend and receiving response headers back before failing the request |
190188
| `interceptor.scaledObject.pollingInterval` | int | `1` | The interval (in milliseconds) that KEDA should poll the external scaler to fetch scaling metrics about the interceptor |
191189
| `interceptor.tcpConnectTimeout` | string | `"500ms"` | How long the interceptor waits to establish TCP connections with backends before failing a request. |

http-add-on/templates/operator/deployment.yaml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,16 @@ spec:
4040
{{- end }}
4141
containers:
4242
- args:
43-
- --secure-listen-address=0.0.0.0:{{ .Values.operator.port | default 8443 }}
44-
- --upstream=http://127.0.0.1:8080/
45-
- --logtostderr=true
46-
- --v={{ .Values.logging.operator.kubeRbacProxy.level }}
47-
image: "{{ .Values.images.kubeRbacProxy.name }}:{{ .Values.images.kubeRbacProxy.tag }}"
48-
name: kube-rbac-proxy
49-
resources:
50-
{{- toYaml .Values.operator.kubeRbacProxy.resources | nindent 10 }}
51-
{{- if .Values.securityContext.kuberbacproxy }}
52-
securityContext:
53-
{{- toYaml .Values.securityContext.kuberbacproxy | nindent 10 }}
54-
{{- else }}
55-
securityContext:
56-
{{- toYaml .Values.securityContext | nindent 10 }}
43+
- --metrics-bind-address=:{{ .Values.operator.port }}
44+
{{- if .Values.operator.metrics.secure }}
45+
- --metrics-secure=true
46+
{{- end }}
47+
{{- if .Values.operator.metrics.auth }}
48+
- --metrics-auth=true
49+
{{- end }}
50+
{{- if .Values.operator.metrics.certDir }}
51+
- --metrics-cert-dir={{ .Values.operator.metrics.certDir }}
5752
{{- end }}
58-
- args:
59-
- --metrics-bind-address=127.0.0.1:8080
6053
- --leader-elect
6154
- --zap-log-level={{ .Values.logging.operator.level }}
6255
- --zap-time-encoding={{ .Values.logging.operator.timeEncoding }}
@@ -85,7 +78,7 @@ spec:
8578
{{- end }}
8679
ports:
8780
- name: metrics
88-
containerPort: 8080
81+
containerPort: {{ .Values.operator.port }}
8982
- name: probes
9083
containerPort: 8081
9184
livenessProbe:

http-add-on/templates/operator/rbac.yml

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -83,28 +83,6 @@ rules:
8383
---
8484
apiVersion: rbac.authorization.k8s.io/v1
8585
kind: ClusterRole
86-
metadata:
87-
labels:
88-
httpscaledobjects.http.keda.sh/version: {{ .Values.images.tag | default .Chart.AppVersion }}
89-
keda.sh/addon: {{ .Chart.Name }}
90-
app: {{ .Chart.Name }}
91-
name: {{ .Chart.Name }}-proxy-role
92-
app.kubernetes.io/component: operator
93-
app.kubernetes.io/name: http-add-on
94-
{{- include "keda-http-add-on.labels" . | indent 4 }}
95-
name: {{ .Chart.Name }}-proxy-role
96-
rules:
97-
- apiGroups: ["authentication.k8s.io"]
98-
resources:
99-
- tokenreviews
100-
verbs: ["create"]
101-
- apiGroups: ["authorization.k8s.io"]
102-
resources:
103-
- subjectaccessreviews
104-
verbs: ["create"]
105-
---
106-
apiVersion: rbac.authorization.k8s.io/v1
107-
kind: ClusterRole
10886
metadata:
10987
labels:
11088
httpscaledobjects.http.keda.sh/version: {{ .Values.images.tag | default .Chart.AppVersion }}
@@ -163,6 +141,7 @@ subjects:
163141
- kind: ServiceAccount
164142
name: {{ .Chart.Name }}
165143
namespace: {{ .Release.Namespace }}
144+
{{- if .Values.operator.metrics.auth }}
166145
---
167146
apiVersion: rbac.authorization.k8s.io/v1
168147
kind: ClusterRoleBinding
@@ -171,17 +150,18 @@ metadata:
171150
httpscaledobjects.http.keda.sh/version: {{ .Values.images.tag | default .Chart.AppVersion }}
172151
keda.sh/addon: {{ .Chart.Name }}
173152
app: {{ .Chart.Name }}
174-
name: {{ .Chart.Name }}-rolebinding
153+
name: {{ .Chart.Name }}-auth-delegator
175154
app.kubernetes.io/component: operator
176155
app.kubernetes.io/name: http-add-on
177156
{{- include "keda-http-add-on.labels" . | indent 4 }}
178-
name: {{ .Chart.Name }}-proxy-rolebinding
157+
name: {{ .Chart.Name }}-auth-delegator
179158
roleRef:
180159
apiGroup: rbac.authorization.k8s.io
181160
kind: ClusterRole
182-
name: {{ .Chart.Name }}-proxy-role
161+
name: system:auth-delegator
183162
subjects:
184163
- kind: ServiceAccount
185164
name: {{ .Chart.Name }}
186165
namespace: {{ .Release.Namespace }}
187166
{{- end }}
167+
{{- end }}

http-add-on/values.yaml

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ logging:
1818
timeEncoding: rfc3339
1919
# -- Display stack traces in the logs
2020
stackTracesEnabled: false
21-
22-
kubeRbacProxy:
23-
# -- Logging level for KEDA http-add-on operator rbac proxy
24-
# allowed values: `0` for info, `4` for debug, or an integer value greater than 0
25-
level: 10
2621
scaler:
2722
# -- Logging level for KEDA http-add-on Scaler.
2823
# allowed values: `debug`, `info`, `error`, or an integer value greater than 0, specified as string
@@ -53,7 +48,7 @@ logging:
5348
operator:
5449
# -- Extra environment variables to set (key-value map with "ENV name":"value")
5550
extraEnvs: {}
56-
# -- Number of replicas, oerator k8s resources will not be installed if this is set to 0
51+
# -- Number of replicas, operator k8s resources will not be installed if this is set to 0
5752
replicas: 1
5853
# -- The image pull secrets for the operator component
5954
imagePullSecrets: []
@@ -84,16 +79,15 @@ operator:
8479
# -- Annotations to be added to the operator pods
8580
podAnnotations: {}
8681

87-
kubeRbacProxy:
88-
resources:
89-
# -- The CPU/memory resource limit for the operator component's kube rbac proxy
90-
limits:
91-
cpu: 300m
92-
memory: 200Mi
93-
# -- The CPU/memory resource request for the operator component's kube rbac proxy
94-
requests:
95-
cpu: 10m
96-
memory: 20Mi
82+
# Operator metrics endpoint configuration
83+
# NOTE: Consider defaulting to secure: false, auth: false for v1 release
84+
metrics:
85+
# -- Enable HTTPS for the metrics endpoint
86+
secure: true
87+
# -- Enable authentication and authorization for the metrics endpoint
88+
auth: true
89+
# -- Directory containing TLS certificates (tls.crt/tls.key). If empty, self-signed certs are generated.
90+
certDir: ""
9791

9892
scaler:
9993
# -- Extra environment variables to set (key-value map with "ENV name":"value")
@@ -197,11 +191,11 @@ interceptor:
197191
topologySpreadConstraints: []
198192
# interceptor pod resource limits
199193
resources:
200-
# -- The CPU/memory resource limit for the operator component
194+
# -- The CPU/memory resource limit for the interceptor component
201195
limits:
202196
cpu: 0.5
203197
memory: 64Mi
204-
# -- The CPU/memory resource request for the operator component
198+
# -- The CPU/memory resource request for the interceptor component
205199
requests:
206200
cpu: 250m
207201
memory: 20Mi
@@ -246,12 +240,6 @@ images:
246240
interceptor: ghcr.io/kedacore/http-add-on-interceptor
247241
# -- Image name for the scaler image component
248242
scaler: ghcr.io/kedacore/http-add-on-scaler
249-
# the kube-rbac-proxy image to use
250-
kubeRbacProxy:
251-
# -- Image name for the Kube RBAC Proxy image component
252-
name: gcr.io/kubebuilder/kube-rbac-proxy
253-
# -- Image tag for the Kube RBAC Proxy image component
254-
tag: v0.13.0
255243

256244
rbac:
257245
# -- Install aggregate roles for edit and view
@@ -276,14 +264,6 @@ securityContext:
276264
# readOnlyRootFilesystem: true
277265
# seccompProfile:
278266
# type: RuntimeDefault
279-
# kuberbacproxy:
280-
# capabilities:
281-
# drop:
282-
# - ALL
283-
# allowPrivilegeEscalation: false
284-
# readOnlyRootFilesystem: true
285-
# seccompProfile:
286-
# type: RuntimeDefault
287267
# scaler:
288268
# capabilities:
289269
# drop:

0 commit comments

Comments
 (0)