Skip to content

Conversation

@synhershko
Copy link
Collaborator

Fixes #1130

When useRoleBindings is set to true, the operator should create Role and RoleBinding resources instead of ClusterRole and ClusterRoleBinding to allow installation with namespace-level privileges.

This fix updates the following templates to conditionally use Role when useRoleBindings is true:

  • opensearch-operator-manager-role-cr.yaml: Now creates Role when useRoleBindings is true, otherwise creates ClusterRole
  • opensearch-operator-manager-rolebinding.yaml: Now references Role when useRoleBindings is true
  • opensearch-operator-metrics-reader-cr.yaml: Now creates Role when useRoleBindings is true, otherwise creates ClusterRole
  • opensearch-operator-proxy-role-cr.yaml: Now creates Role when useRoleBindings is true, otherwise creates ClusterRole
  • opensearch-operator-proxy-rolebinding.yaml: Now references Role when useRoleBindings is true

This enables users with only namespace admin privileges to install the operator successfully.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Fixes #1130

When useRoleBindings is set to true, the operator should create Role
and RoleBinding resources instead of ClusterRole and ClusterRoleBinding
to allow installation with namespace-level privileges.

This fix updates the following templates to conditionally use Role when
useRoleBindings is true:

- opensearch-operator-manager-role-cr.yaml: Now creates Role when
  useRoleBindings is true, otherwise creates ClusterRole
- opensearch-operator-manager-rolebinding.yaml: Now references Role
  when useRoleBindings is true
- opensearch-operator-metrics-reader-cr.yaml: Now creates Role when
  useRoleBindings is true, otherwise creates ClusterRole
- opensearch-operator-proxy-role-cr.yaml: Now creates Role when
  useRoleBindings is true, otherwise creates ClusterRole
- opensearch-operator-proxy-rolebinding.yaml: Now references Role when
  useRoleBindings is true

This enables users with only namespace admin privileges to install the
operator successfully.
Comment on lines +7 to +10
- nonResourceURLs:
- /metrics
verbs:
- get
Copy link
Contributor

Choose a reason for hiding this comment

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

Namespaced rules cannot apply to non-resource URLs.

@josedev-union
Copy link
Contributor

I'd close this PR because Namespaced rules cannot apply to non-resource URLs.

@synhershko synhershko closed this Oct 27, 2025
@synhershko synhershko deleted the fix/use-role-bindings-rbac branch October 27, 2025 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

[BUG] useRoleBindings: True still continues to use ClusterRole and role bindings that use ClusterRole

3 participants