Skip to content

Commit

Permalink
allow secret access permissions in release namespace only
Browse files Browse the repository at this point in the history
Signed-off-by: rksharma95 <[email protected]>
  • Loading branch information
rksharma95 committed Apr 17, 2024
1 parent f2ccb43 commit 1f0c864
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ subjects:
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Values.kubearmorOperator.name }}-tls-secrets-rolebinding
namespace: {{.Release.Namespace}}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ .Values.kubearmorOperator.name }}-tls-secrets-role
subjects:
- kind: ServiceAccount
name: {{ .Values.kubearmorOperator.name }}
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Values.kubearmorOperator.name }}-manage-controller-clusterrole-binding
Expand Down
31 changes: 29 additions & 2 deletions deployments/helm/KubeArmorOperator/templates/clusterrole-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ rules:
- apiGroups:
- ""
resources:
- secrets
- serviceaccounts
- services
- configmaps
Expand Down Expand Up @@ -214,4 +213,32 @@ rules:
- nonResourceURLs:
- /metrics
verbs:
- get
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ .Values.kubearmorOperator.name }}-tls-secrets-role
namespace: {{ .Release.Namespace }}
rules:
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- update
- delete
resourceNames:
- {{ .Values.tlsSecrets.kubearmorCa }}
- {{ .Values.tlsSecrets.kubearmorClient }}
- {{ .Values.tlsSecrets.relayServer }}
- {{ .Values.tlsSecrets.controllerWebhook }}
# cannot restric create by resource name, https://kubernetes.io/docs/reference/access-authn-authz/rbac/
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
---
9 changes: 9 additions & 0 deletions deployments/helm/KubeArmorOperator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ kubearmorConfig:
enableStdOutAlerts: false
enableStdOutMsgs: false
seccompEnabled: true

# DO NOT CHANGE THIS VALUES
# changing these values will require code changes with the operator
# these secret names should match with the secrets managed by the operator
tlsSecrets:
kubearmorCa: kubearmor-ca
kubearmorClient: kubearmor-client-certs
relayServer: kubearmor-relay-server-certs
controllerWebhook: kubearmor-controller-webhook-server-cert

0 comments on commit 1f0c864

Please sign in to comment.