Skip to content

fix: update project-scoped permissions to include missing harvester r…#503

Merged
ihcsim merged 1 commit intoharvester:masterfrom
ihcsim:harvester-rancher-rbac
Mar 27, 2026
Merged

fix: update project-scoped permissions to include missing harvester r…#503
ihcsim merged 1 commit intoharvester:masterfrom
ihcsim:harvester-rancher-rbac

Conversation

@ihcsim
Copy link
Copy Markdown
Contributor

@ihcsim ihcsim commented Mar 26, 2026

Problem:

This PR addresses these two issues:

  1. 1.8-rc2 QA test result reported that the project users can't manage or see the backup schedules defined in their namespaces.
  2. The value of the catalog.cattle.io/rancher-version annotation also doesn't match the Rancher v2.14 convention.

Solution:

This PR adds the harvesterhci.io API groups to the project roles so that project users can manage/view all namespaced-scoped Harvester resources. This compensates for the missing RBAC rules within the harvesterhci.io:view and harvesterhci.io:edit cluster roles. Currently, not all the Harvester RBAC rules are aggregated into these two cluster roles. Hence, when the new role templates inherit their RBAC rules from the built-in view and edit cluster roles, some Harvester permissions are missed.

Related Issue(s):

harvester/harvester#7909

Test plan:

The full test plan can be found in the HEP at https://github.com/ihcsim/harvester/blob/a06b3e4a6d372c53e19ba2a6081be15d7c81da60/enhancements/20260130-rancher-integration-rbac/test-plan-ui.md

For this change, we only need to retest the proj-manager and proj-viewer scenarios to make sure they can continue to only manage and see Harvester project-scoped resources. The new addition is that they can now manage and see the backup schedules.

Additional documentation or context

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the harvester-rbac Helm chart to ensure Rancher project-scoped role templates include missing Harvester API group permissions (so project users can manage/view namespaced Harvester resources like backup schedules) and aligns the chart’s Rancher version annotation with the Rancher v2.14 catalog convention.

Changes:

  • Add harvesterhci.io API group rules to project-scoped RoleTemplates (virt-project-view, virt-project-manage).
  • Grant additional permissions for supportbundles under the harvesterhci.io API group.
  • Update catalog.cattle.io/rancher-version annotation to the Rancher v2.14 range format.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
charts/harvester-rbac/templates/virt-project-view.yaml Adds harvesterhci.io rules to the project “view” RoleTemplate (including a new supportbundles rule).
charts/harvester-rbac/templates/virt-project-manage.yaml Adds harvesterhci.io rules to the project “manage” RoleTemplate (including a redundant supportbundles rule).
charts/harvester-rbac/Chart.yaml Updates the Rancher catalog compatibility annotation to the v2.14 convention.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

resources:
- supportbundles
verbs:
- "*"
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

virt-project-view is a view-only RoleTemplate, but this rule grants supportbundles full access (verbs: ["*"]). That’s a significant privilege escalation compared to the rest of the rules here (get/list/watch) and seems inconsistent with the role’s purpose. Consider restricting this to read-only verbs (or the minimal set actually required), or moving write verbs for supportbundles to the manage role only.

Suggested change
- "*"
- get
- list
- watch

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This allows read-only project user to generate support bundle. However, project users will require permissions into the harvester-system namespace for the support bundle workload to run, which isn't granted by default.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you mean: by default, the project-view can't successfully generate supportbundle even with this rbac?

As support-bundle includes too many system related infromation, maybe we could remove this from chart default value; if user wants to, we have a document guide about how to edit the chart Values.yaml below parts to grant this. User takes the risk.

  {{- with .Values.projectRole.virtProjectView.additionalRules }}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you mean: by default, the project-view can't successfully generate supportbundle even with this rbac?

Correct. This change only grants permission to the supportbundles.harvesterhci.io API resource; nothing more. It is something that all cluster/project users need. We will follow this up with a backend issue to discuss how to approach this. The controller needs to identify the namespaces where the user has permissions to run the support bundle generators. Thanks.

Copy link
Copy Markdown
Contributor Author

@ihcsim ihcsim Mar 27, 2026

Choose a reason for hiding this comment

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

User takes the risk.
{{- with .Values.projectRole.virtProjectView.additionalRules }}

My thinking is that, until we have a backend enhancement, if admin wants to give project users ability to generate support bundle, they can grant these users additional permissions via other custom roles on an individual basis. Using {{- with .Values.projectRole.virtProjectView.additionalRules }} means all project users end up with these extra permissions, not just those who are approved. By including the supportbundles.harvesterhci.io rule in the built-in role, admin won't have to keep repeating them in their own custom roles.

…esources

Signed-off-by: Ivan Sim <ivan.sim@suse.com>
@ihcsim ihcsim force-pushed the harvester-rancher-rbac branch from d003835 to 4e5d8e4 Compare March 26, 2026 18:24
@ihcsim ihcsim requested a review from Vicente-Cheng March 26, 2026 18:50
Copy link
Copy Markdown
Member

@w13915984028 w13915984028 left a comment

Choose a reason for hiding this comment

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

Some questions, thanks.

resources:
- supportbundles
verbs:
- "*"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you mean: by default, the project-view can't successfully generate supportbundle even with this rbac?

As support-bundle includes too many system related infromation, maybe we could remove this from chart default value; if user wants to, we have a document guide about how to edit the chart Values.yaml below parts to grant this. User takes the risk.

  {{- with .Values.projectRole.virtProjectView.additionalRules }}

@ihcsim ihcsim merged commit 4704f21 into harvester:master Mar 27, 2026
5 checks passed
@ihcsim ihcsim deleted the harvester-rancher-rbac branch March 27, 2026 16:56
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.

4 participants