Skip to content

feat(operator): render a namespaced Role when watchNamespace is set - #325

Open
BryanFRD wants to merge 2 commits into
mainfrom
fix/216-namespaced-role
Open

BryanFRD wants to merge 2 commits into
mainfrom
fix/216-namespaced-role

Conversation

@BryanFRD

Copy link
Copy Markdown
Contributor

Closes #216

With watchNamespace set, the chart now renders a Role and RoleBinding in that namespace instead of the ClusterRole and ClusterRoleBinding. When leader election is on and the watched namespace differs from the release namespace, a separate lease-only Role and RoleBinding is rendered in the release namespace.

Rules are shared between both modes through helpers. Cluster-wide installs render the same rules as before.

Checked with helm lint and helm template for cluster-wide, same-namespace, other-namespace and rbac.create=false. The chart has no test suite.

@ferrfleet-interne ferrfleet-interne Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The namespaced Role matches what cmd/main.go does with --watch-namespace: the cache is restricted to that namespace and workload reads stay namespaced. The lease stays in the pod's namespace, which the split leader-election Role handles correctly. One nit inline about leader-election Events.

Comment thread charts/ferrvault-operator/templates/role.yaml

@ferrfleet-interne ferrfleet-interne Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4678c3f adds the events rule to the leader-election Role, which closes the one nit I raised. Nothing else changed, and nothing is blocking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(operator): render a namespaced Role when --watch-namespace is set (least privilege)

1 participant