Skip to content

refactor: addition of rbac needed for instascale controller #304

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

Merged
merged 4 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions config/rbac/instascale_role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: instascale-role
rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- list
- patch
- update
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- apiGroups:
- apps
resources:
- machineset
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
resources:
- machineset/status
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.

Are MachineSet APIs really in the apps group? It seems it's a wrong duplicate of the machine.openshift.io one.

Copy link
Contributor Author

@dimakis dimakis Sep 26, 2023

Choose a reason for hiding this comment

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

nope, I didn't think they were in the apps group, I thought first class objects like replicasets, deployments etc were.

but I was just copying what was in the original role to try get it working.

I can't really figure out why this is the case, even getting rid of those and allowing the wildcard on the machine.openshift.io group doesn't work and just returns the same error as ye got.
I also can't seem to find a machinepool resource for any api-group in any of the docs.
Any ideas here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I don't think the error is related to the RBAC changes. I suspect there is an issue with the OCM client configuration.

- apiGroups:
- config.openshift.io
resources:
- clusterversions
verbs:
- get
- list
- watch
- apiGroups:
- machine.openshift.io
resources:
- controlplanemachinesets
- machinehealthchecks
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these two resources really used by InstaScale?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should have specified I've pushed this as myself and mark are testing which are actually used and what we can cut away.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but if you know off hand...that would save us some time?

I was doubtful that we used those TBH

Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is that InstaScale only uses the Machine and MachineSet APIs but better double checking.

- machines
- machinesets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
12 changes: 12 additions & 0 deletions config/rbac/instascale_role_binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: instascale-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: instascale-role
subjects:
- kind: ServiceAccount
name: controller-manager
namespace: system