Skip to content

Commit

Permalink
fix(charts): least privilege on controller rbac
Browse files Browse the repository at this point in the history
  • Loading branch information
adupays committed Dec 2, 2024
1 parent 77c9f57 commit 8d83b44
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 37 deletions.
20 changes: 1 addition & 19 deletions deploy/charts/burrito/templates/controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ metadata:
{{- toYaml .metadata.annotations | nindent 4 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
kind: RoleBinding
metadata:
name: burrito-controllers
labels:
Expand All @@ -158,22 +158,4 @@ subjects:
- kind: ServiceAccount
name: burrito-controllers
namespace: {{ $.Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: burrito-controllers-secrets
namespace: {{ $.Release.Namespace }}
labels:
{{- toYaml .metadata.labels | nindent 4 }}
annotations:
{{- toYaml .metadata.annotations | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: burrito-controllers-secrets
subjects:
- kind: ServiceAccount
name: burrito-controllers
namespace: {{ $.Release.Namespace }}
{{- end }}
20 changes: 2 additions & 18 deletions deploy/charts/burrito/templates/rbac-controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ rules:
- list
- create
- update
- watch
- get
- apiGroups:
- config.terraform.padok.cloud
resources:
Expand Down Expand Up @@ -160,21 +162,3 @@ rules:
- update
- patch
- delete
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/component: controllers
app.kubernetes.io/name: burrito-controllers
app.kubernetes.io/part-of: burrito
name: burrito-controllers-secrets
rules:
- apiGroups:
- ""
resources:
- secrets
verbs:
- watch
- list
- get
17 changes: 17 additions & 0 deletions deploy/charts/burrito/templates/tenant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,21 @@ subjects:
---
{{- end }}
{{- end }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: burrito-controllers
labels:
{{- toYaml .Values.controllers.metadata.labels | nindent 4 }}
annotations:
{{- toYaml .Values.controllers.metadata.annotations | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: burrito-controllers
subjects:
- kind: ServiceAccount
name: burrito-controllers
namespace: {{ $.Release.Namespace }}
---
{{- end }}

0 comments on commit 8d83b44

Please sign in to comment.