Skip to content

Commit

Permalink
fix(chart): allow sa to read metrics (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
raffis authored Jun 12, 2023
1 parent c8920aa commit c2da7c6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chart/k8sreq-duplicator-controller/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ keywords:
name: k8sreq-duplicator-controller
sources:
- https://github.com/DoodleScheduling/k8sreq-duplicator-controller
version: 0.0.2
version: 0.0.3
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ spec:
- --upstream=http://127.0.0.1:{{ .Values.metricsPort }}
- --logtostderr=true
- --v=0
image: quay.io/brancz/kube-rbac-proxy:v0.14.0
image: {{ .Values.kubeRBACProxy.image }}
imagePullPolicy: IfNotPresent
name: kube-rbac-proxy
ports:
Expand Down
18 changes: 18 additions & 0 deletions chart/k8sreq-duplicator-controller/templates/metrics-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ rules:
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "k8sreq-duplicator-controller.fullname" . }}-metrics
labels:
app.kubernetes.io/name: {{ include "k8sreq-duplicator-controller.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "k8sreq-duplicator-controller.chart" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "k8sreq-duplicator-controller.fullname" . }}-metrics-reader
subjects:
- kind: ServiceAccount
name: {{ template "k8sreq-duplicator-controller.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "k8sreq-duplicator-controller.fullname" . }}-proxy
labels:
Expand Down
5 changes: 3 additions & 2 deletions chart/k8sreq-duplicator-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ securityContext:
drop: ["all"]
readOnlyRootFilesystem: true

podSecurityContext:
podSecurityContext:
runAsGroup: 10000
runAsNonRoot: true
runAsUser: 10000
Expand Down Expand Up @@ -132,6 +132,7 @@ prometheusRule:

kubeRBACProxy:
enabled: true
image: quay.io/brancz/kube-rbac-proxy:v0.14.2
securityContext:
allowPrivilegeEscalation: false
capabilities:
Expand All @@ -145,5 +146,5 @@ kubeRBACProxy:
# requests:
# cpu: 5m
# memory: 64Mi

tolerations: []

0 comments on commit c2da7c6

Please sign in to comment.