-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Limit scope of flux and flux operator in helm chart. #1928
Conversation
Similar to implementation in https://github.com/zeeZ/locked-down-flux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @arturo-c please see my comments.
bec8101
to
02a8e78
Compare
thanks @stefanprodan and @2opremio for the really quick review!, updated branch with the changes requested |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arturo-c have you tested this with a namespace definition or some other cluster object? Will Flux stop function or it would keep applying the yamls that are allowed by RBAC?
@stefanprodan have not tested by having resources out of the namespace for each operator, will try and do that today and report back |
{{- $kind := "Role" -}} | ||
{{- $bind := "RoleBinding" -}} | ||
{{- if .Values.clusterScope -}} | ||
{{ $kind = "ClusterRole" }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to change the assignments in lines 4 and 5 to :=
from =
{{ $kind = "ClusterRole" }} | |
{{ $kind := "ClusterRole" }} |
Maybe my helm client is too old?
Client: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.13.0", GitCommit:"79d07943b03aea2b76c12644b4b54733bc5958d6", GitTreeState:"clean"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also had to remove the nonResourceURLs
from the Role
(apparently they only work for ClusterRoles
):
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: {{ $kind }}
metadata:
name: {{ template "flux.fullname" . }}
{{- if not .Values.clusterScope }}
namespace: {{ .Release.Namespace }}
{{- end }}
labels:
app: {{ template "flux.name" . }}
chart: {{ template "flux.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this effort. I'm using this PR as a base to deploy flux into a cluster with access to a limited list of namespaces. I think it might be best to create a new PR that contains my additional RBAC resources once this PR is merged.
@arturo-c any updates? Are you planning to continue working on this PR? |
@2opremio sorry, haven't had time to work on this, not sure if best path forward is to close this pr for now? |
Closing this in favour of #2206 |
Allows you to set
clusterScope
tofalse
in helm chart so that rbac resources and arguments to both flux and helm operator are scoped only to the namespace where flux is deployed.Partly addresses #1886 and #1085