Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[charts/csi-vxflexos] Reduce RBAC requirements for Leases, Secrets, ConfigMaps #606

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions charts/csi-vxflexos/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,12 @@ Return true if storage capacity tracking is enabled and is supported based on k8
{{- true -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- define "common.labels" -}}
app.kubernetes.io/name: {{ .Chart.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
46 changes: 34 additions & 12 deletions charts/csi-vxflexos/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}-controller
rules:
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "watch", "list", "delete", "update", "create"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["nodes"]
{{- if hasKey .Values "podmon" }}
Expand Down Expand Up @@ -63,13 +57,7 @@ rules:
verbs: ["get", "list", "watch"]
{{- end }}
{{- end }}
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "update"]
# below for snapshotter
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list"]
{{- if hasKey .Values "vgsnapshotter" }}
{{- if eq .Values.vgsnapshotter.enabled true }}
- apiGroups: ["volumegroup.storage.dell.com"]
Expand Down Expand Up @@ -140,6 +128,39 @@ roleRef:
name: {{ .Release.Name }}-controller
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}-controller
namespace: {{ .Release.Namespace }}
rules:
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "watch", "list", "delete", "update", "create"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "update"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}-controller
namespace: {{ .Release.Namespace }}
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-controller
namespace: {{ .Release.Namespace }}
roleRef:
kind: Role
name: {{ .Release.Name }}-controller
apiGroup: rbac.authorization.k8s.io
---
kind: Deployment
apiVersion: apps/v1
metadata:
Expand All @@ -164,6 +185,7 @@ spec:
template:
metadata:
labels:
{{- include "common.labels" . | nindent 8 }}
{{- if eq (.Values.vgsnapshotter.enabled| toString) "true" }}
vg-snapshotter-enabled: "true"
{{- else if eq (.Values.vgsnapshotter.enabled| toString) "false" }}
Expand Down
26 changes: 24 additions & 2 deletions charts/csi-vxflexos/templates/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,41 @@ rules:
verbs: ["get", "watch", "list", "delete", "update", "create"]
{{ end }}
{{ end }}
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}-node
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-node
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ .Release.Name }}-node
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}-node
namespace: {{ .Release.Namespace }}
rules:
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "update"]
---
kind: ClusterRoleBinding
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ .Release.Name }}-node
namespace: {{ .Release.Namespace }}
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-node
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
kind: Role
name: {{ .Release.Name }}-node
apiGroup: rbac.authorization.k8s.io
---
Expand All @@ -79,6 +100,7 @@ spec:
template:
metadata:
labels:
{{- include "common.labels" . | nindent 8 }}
app: {{ .Release.Name }}-node
{{- if eq .Values.podmon.enabled true }}
driver.dellemc.com: dell-storage
Expand Down