Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit cc5a5c1

Browse files
authored
fix(chart): securityContext and rbac for metrics proxy (#29)
1 parent f29b9fd commit cc5a5c1

File tree

4 files changed

+38
-10
lines changed

4 files changed

+38
-10
lines changed

chart/k8skafka-controller/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ keywords:
1212
name: k8skafka-controller
1313
sources:
1414
- https://github.com/DoodleScheduling/k8skafka-controller
15-
version: 0.3.3
15+
version: 0.4.0

chart/k8skafka-controller/templates/deployment.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,17 @@ spec:
8181
{{- end }}
8282
{{- if .Values.kubeRBACProxy.enabled }}
8383
- args:
84-
- --secure-listen-address=0.0.0.0:8443
85-
- --upstream=http://127.0.0.1:{{ .Values.metricsPort }}
86-
- --logtostderr=true
87-
- --v=0
88-
image: quay.io/brancz/kube-rbac-proxy:v0.14.0
84+
- --secure-listen-address=0.0.0.0:8443
85+
- --upstream=http://127.0.0.1:{{ .Values.metricsPort }}
86+
- --logtostderr=true
87+
- --v=0
88+
image: {{ .Values.kubeRBACProxy.image }}
8989
imagePullPolicy: IfNotPresent
9090
name: kube-rbac-proxy
9191
ports:
92-
- containerPort: 8443
93-
name: https
94-
protocol: TCP
92+
- containerPort: 8443
93+
name: https
94+
protocol: TCP
9595
resources:
9696
{{- toYaml .Values.kubeRBACProxy.resources | nindent 10 }}
9797
securityContext:
@@ -108,6 +108,8 @@ spec:
108108
secret:
109109
secretName: {{ .secretName }}
110110
{{- end }}
111+
securityContext:
112+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
111113
affinity:
112114
{{- toYaml .Values.affinity | nindent 8 }}
113115
imagePullSecrets:

chart/k8skafka-controller/templates/metrics-rbac.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@ rules:
1616
---
1717
apiVersion: rbac.authorization.k8s.io/v1
1818
kind: ClusterRoleBinding
19+
metadata:
20+
name: {{ include "k8skafka-controller.fullname" . }}-metrics
21+
labels:
22+
app.kubernetes.io/name: {{ include "k8skafka-controller.name" . }}
23+
app.kubernetes.io/instance: {{ .Release.Name }}
24+
app.kubernetes.io/managed-by: {{ .Release.Service }}
25+
helm.sh/chart: {{ include "k8skafka-controller.chart" . }}
26+
roleRef:
27+
apiGroup: rbac.authorization.k8s.io
28+
kind: ClusterRole
29+
name: {{ include "k8skafka-controller.fullname" . }}-metrics-reader
30+
subjects:
31+
- kind: ServiceAccount
32+
name: {{ template "k8skafka-controller.serviceAccountName" . }}
33+
namespace: {{ .Release.Namespace }}
34+
---
35+
apiVersion: rbac.authorization.k8s.io/v1
36+
kind: ClusterRoleBinding
1937
metadata:
2038
name: {{ include "k8skafka-controller.fullname" . }}-proxy
2139
labels:

chart/k8skafka-controller/values.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ securityContext:
8181
capabilities:
8282
drop: ["all"]
8383
readOnlyRootFilesystem: true
84+
85+
podSecurityContext:
8486
runAsGroup: 10000
8587
runAsNonRoot: true
8688
runAsUser: 10000
@@ -119,13 +121,19 @@ prometheusRule:
119121

120122
kubeRBACProxy:
121123
enabled: true
122-
124+
image: quay.io/brancz/kube-rbac-proxy:v0.14.2
123125
securityContext:
124126
allowPrivilegeEscalation: false
125127
capabilities:
126128
drop: ["all"]
127129
readOnlyRootFilesystem: true
128130

129131
resources: {}
132+
# limits:
133+
# cpu: 500m
134+
# memory: 128Mi
135+
# requests:
136+
# cpu: 5m
137+
# memory: 64Mi
130138

131139
tolerations: []

0 commit comments

Comments
 (0)