Skip to content

Commit

Permalink
Chore: Tighten RBAC permissions (#1954)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellistarn authored Jun 21, 2022
1 parent dfc377b commit eab7dea
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 33 deletions.
45 changes: 26 additions & 19 deletions charts/karpenter/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,43 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
# Read
- apiGroups: ["karpenter.sh"]
resources: ["provisioners"]
resources: ["provisioners", "provisioners/status"]
verbs: ["get", "list", "watch"]
- apiGroups: ["karpenter.k8s.aws"]
resources: ["awsnodetemplates"]
verbs: ["get", "list", "watch"]
- apiGroups: ["karpenter.sh"]
resources: ["provisioners/status"]
verbs: ["create", "delete", "patch", "get", "list", "watch"]
- apiGroups: [""]
resources: ["persistentvolumes", "persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["pods", "nodes", "configmaps"]
resources: ["pods", "nodes", "persistentvolumes", "persistentvolumeclaims"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses", "csinodes"]
verbs: ["get", "watch", "list"]
- apiGroups: ["apps"]
resources: ["daemonsets"]
verbs: ["list", "watch"]
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["validatingwebhookconfigurations", "mutatingwebhookconfigurations"]
verbs: ["get", "watch", "list"]
# Write
- apiGroups: ["karpenter.sh"]
resources: ["provisioners/status"]
verbs: ["create", "delete", "patch"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["create", "patch", "delete"]
- apiGroups: [""]
resources: ["pods/eviction"]
verbs: ["create"]
- apiGroups: ["apps"]
resources: ["daemonsets"]
verbs: ["list", "watch"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["update"]
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["validatingwebhookconfigurations", "mutatingwebhookconfigurations"]
verbs: ["get", "watch", "list", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["csinodes"]
verbs: ["get", "watch", "list"]
resources: ["validatingwebhookconfigurations"]
verbs: ["update"]
resourceNames: ["validation.webhook.provisioners.karpenter.sh", "validation.webhook.config.karpenter.sh"]
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["mutatingwebhookconfigurations"]
verbs: ["update"]
resourceNames: ["defaulting.webhook.provisioners.karpenter.sh"]
37 changes: 23 additions & 14 deletions charts/karpenter/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,34 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
resources: ["configmaps/status"]
verbs: ["get", "update", "patch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create"]
# Read
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["create", "get", "patch", "update", "watch"]
verbs: ["get", "watch"]
- apiGroups: [""]
resources: ["namespaces"]
resources: ["configmaps", "namespaces", "secrets"]
verbs: ["get", "list", "watch"]
# Write
- apiGroups: [""]
resources: ["events"]
verbs: ["create"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["update"]
resourceNames: ["{{ include "karpenter.fullname" . }}-cert"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "watch"]
resources: ["configmaps"]
verbs: ["create", "update", "patch", "delete"]
resourceNames:
- karpenter-global-settings
- karpenter-leader-election
- config-logging
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["create", "patch", "update"]
resourceNames:
- "karpenter-leader-election"
- "webhook.configmapwebhook.00-of-01"
- "webhook.defaultingwebhook.00-of-01"
- "webhook.validationwebhook.00-of-01"
- "webhook.webhookcertificates.00-of-01"

0 comments on commit eab7dea

Please sign in to comment.