Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RBAC manifest creation for Hosted Cluster admin personas #1014

Merged
merged 3 commits into from
Feb 16, 2022

Conversation

geoberle
Copy link
Contributor

@geoberle geoberle commented Feb 14, 2022

What this PR does / why we need it:
introduce RBAC artifact generation for hypershift admin personas / services
those artifacts are generated when the --enable-admin-rbac-generation flag
is provided during hypershift install

persona: hypershift-client

used by a client leveraging hypershift as a service to create hosted clusters

  • hypershift-client ClusterRole
    full permissions on the hostedcluster and nodepool CRs
  • hypershift-client ServiceAccount
  • hypershift-client ClusterRoleBinding
    binds the hypershift-client ClusterRole to hypershift-client SA and Group Ref
    the groups itself must be provided by other means

persona: hypershift-readers

used by admins to investigate hosted clusters and the hypershift operator.

  • hypershift-readers ClusterRole
    same permission subjects as the hypershift-operator ClusterRole but restricted
    to get, list, watch. access to secrets is not granted
  • hypershift-readers ClusterRoleBinding
    binds the hypershift-readers ClusterRole to a Group called hypershift-readers
    the group itself must be provided by other means

fixes HOSTEDCP-306
fixes APPSRE-4335

Checklist

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Signed-off-by: Gerd Oberlechner goberlec@redhat.com

introduce RBAC artifact generation for hypershift admin personas / services
those artifacts are generated when the `--enable-admin-rbac-generation` flag
is provided during `hypershift install`

persona: hypershift-client

used by a client leveraging hypershift as a service to create hosted clusters
* hypershift-client ClusterRole
  full permissions on the hostedcluster and nodepool CRs
* hypershift-client ServiceAccount
* hypershift-client ClusterRoleBinding
  binds the hypershift-client ClusterRole to hypershift-client SA and Group Ref
  the groups itself must be provided by other means

persona: hypershift-reader

used by admins to investigate hosted clusters and the hypershift operator.
* hypershift-reader ClusterRole
  same permission subjects as the hypershift-operator ClusterRole but restricted
  to get, list, watch. access to secrets is not granted
* hypershift-reader ClusterRoleBinding
  binds the hypershift-reader ClusterRole to a Group called hypershift-readers
  the group itself must be provided by other means

Refs:
* https://issues.redhat.com/browse/HOSTEDCP-306
* https://issues.redhat.com/browse/APPSRE-4335

Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
@netlify
Copy link

netlify bot commented Feb 14, 2022

✔️ Deploy Preview for hypershift-docs ready!

🔨 Explore the source changes: 2d8749f

🔍 Inspect the deploy log: https://app.netlify.com/sites/hypershift-docs/deploys/620a80dd295dab000815872c

😎 Browse the preview: https://deploy-preview-1014--hypershift-docs.netlify.app

Copy link
Contributor

@csrwng csrwng left a comment

Choose a reason for hiding this comment

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

@geoberle thanks for the PR!
A couple of comments/questions

type HyperShiftReaderClusterRole struct{}

func (o HyperShiftReaderClusterRole) Build() *rbacv1.ClusterRole {
clusterOperatorRole := HyperShiftOperatorClusterRole{}.Build()
Copy link
Contributor

Choose a reason for hiding this comment

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

If we change HyperShiftOperatorClusterRole we won't necessarily know that this is impacted. My preference would be to explicitly include the RBAC rules here, even if it means copy-pasting code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in 99eb9c8

clientRoleBinding := assets.HyperShiftClientClusterRoleBinding{
ClusterRole: clientClusterRole,
ServiceAccount: clientServiceAccount,
GroupName: "hypershift-client",
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we were going to include these groups in the resources as well, no?

Copy link
Contributor Author

@geoberle geoberle Feb 15, 2022

Choose a reason for hiding this comment

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

maybe a misunderstanding on my end. i had the impression that it was the general sentiment to keep non-k8s-native resources limited when possible. AppSRE can deal with group creation/maintenance, because OSD/ROSA dedicated-admin allows that.

instead of copy+modify the hypershift-operator cluster role, list the permissions
required for the hypershift-readers cluster role explicitely

Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
@csrwng
Copy link
Contributor

csrwng commented Feb 16, 2022

/label tide/merge-method-squash

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Feb 16, 2022
@csrwng
Copy link
Contributor

csrwng commented Feb 16, 2022

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 16, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 16, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: csrwng, geoberle

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 16, 2022
@geoberle
Copy link
Contributor Author

/retest

1 similar comment
@alvaroaleman
Copy link
Contributor

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 16, 2022

@geoberle: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit f3b29fc into openshift:main Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants