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

added permission to get nodes for rbd #4302

Merged
merged 2 commits into from
Dec 11, 2023
Merged

added permission to get nodes for rbd #4302

merged 2 commits into from
Dec 11, 2023

Conversation

nemcikjan
Copy link
Contributor

Describe what this PR does

Based on the implementation in rbd driver the nodeplugin should have by default permission to get nodes in order to retrieve the node labels

Is there anything that requires special attention

  • Related rbd driver implementation can be found here

Future concerns

List items that are not part of the PR and do not impact it's
functionality, but are work items that can be taken up subsequently.

Checklist:


Show available bot commands

These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:

  • /retest ci/centos/<job-name>: retest the <job-name> after unrelated
    failure (please report the failure too!)

@Rakshith-R
Copy link
Contributor

Thanks for the pr !

@iPraveenParihar after the new changes to obtain node labels if the pods are running in k8s cluster, we'll need rbac to get nodes regardless of topology or read affinity right ?

@Rakshith-R
Copy link
Contributor

@nemcikjan Can you remove the surrounding conditions here too ?

{{- if and .Values.readAffinity .Values.readAffinity.enabled }}

@Rakshith-R Rakshith-R added bug Something isn't working backport-to-release-v3.10 Label to backport from devel to release-v3.10 branch labels Dec 6, 2023
@nixpanic nixpanic added component/rbd Issues related to RBD component/deployment Helm chart, kubernetes templates and configuration Issues/PRs labels Dec 6, 2023
@nemcikjan
Copy link
Contributor Author

nemcikjan commented Dec 6, 2023

@nemcikjan Can you remove the surrounding conditions here too ?

{{- if and .Values.readAffinity .Values.readAffinity.enabled }}

@Rakshith-R I can but I looked also into the cephfs driver implementation and got the impression that it's not necessary for the cephfs rbac but it's possible that I missed something

@Rakshith-R
Copy link
Contributor

@nemcikjan Can you remove the surrounding conditions here too ?

{{- if and .Values.readAffinity .Values.readAffinity.enabled }}

@Rakshith-R I can but I looked also into the cephfs driver implementation and got the impression that it's not necessary for the cephfs rbac but it's possible that I missed something

Yes, we're only checking if cephcsi is running inside k8s before trying to fetch the node labels now.
Therefore, That rbac is needed regardless of the read affinity condition

@Rakshith-R Rakshith-R added the component/cephfs Issues related to CephFS label Dec 6, 2023
@iPraveenParihar
Copy link
Contributor

iPraveenParihar commented Dec 6, 2023

Thanks for the pr !

@iPraveenParihar after the new changes to obtain node labels if the pods are running in k8s cluster, we'll need rbac to get nodes regardless of topology or read affinity right ?

yes, we can remove the read affinity condition.

@XtremeOwnageDotCom
Copy link

XtremeOwnageDotCom commented Dec 6, 2023

Just a note, I also had to update the provisioner role, in my cluster. It apparently also needs the ability to get nodes.

https://github.com/ceph/ceph-csi/blob/devel/charts/ceph-csi-rbd/templates/provisioner-clusterrole.yaml

The exact same resolution, would apply to it.

@nemcikjan
Copy link
Contributor Author

nemcikjan commented Dec 7, 2023

@XtremeOwnageDotCom I reviewed the implementation and it doesn't seem that the rbd provisioner needs that permission at all based on the condition here. Maybe @Rakshith-R or @iPraveenParihar could confirm.

@iPraveenParihar
Copy link
Contributor

iPraveenParihar commented Dec 7, 2023

Just a note, I also had to update the provisioner role, in my cluster. It apparently also needs the ability to get nodes.

https://github.com/ceph/ceph-csi/blob/devel/charts/ceph-csi-rbd/templates/provisioner-clusterrole.yaml

The exact same resolution, would apply to it.

In RBD, we need to add the NodeServer condition as done in CephFS

if k8s.RunsOnKubernetes() {
nodeLabels, err = k8s.GetNodeLabels(conf.NodeID)
if err != nil {
log.FatalLogMsg(err.Error())
}
}

CephFS,

if conf.IsNodeServer && k8s.RunsOnKubernetes() {
nodeLabels, err = k8s.GetNodeLabels(conf.NodeID)
if err != nil {
log.FatalLogMsg(err.Error())
}
}

Copy link
Contributor

@Rakshith-R Rakshith-R left a comment

Choose a reason for hiding this comment

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

Looks good to me,
Can you please squash both the commits into one ?

internal/rbd/driver/driver.go Outdated Show resolved Hide resolved
@Rakshith-R
Copy link
Contributor

Looks good to me, Can you please squash both the commits into one ?

The last commit came after I pressed enter for this review.
just one more change on the latest commit.

Thanks

@nemcikjan
Copy link
Contributor Author

@Rakshith-R should I then squash all the commits?

@Rakshith-R
Copy link
Contributor

@Rakshith-R should I then squash all the commits?

Just the first two since they are so similar
and modify the third commit according to #4302 (comment)

Rakshith-R
Rakshith-R previously approved these changes Dec 8, 2023
Copy link
Contributor

@Rakshith-R Rakshith-R left a comment

Choose a reason for hiding this comment

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

Thanks

Copy link
Contributor

@Rakshith-R Rakshith-R left a comment

Choose a reason for hiding this comment

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

internal/rbd/driver/driver.go Outdated Show resolved Hide resolved
Copy link
Contributor

@Rakshith-R Rakshith-R left a comment

Choose a reason for hiding this comment

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

Thanks !

@Rakshith-R Rakshith-R requested a review from a team December 11, 2023 05:25
@Rakshith-R
Copy link
Contributor

@Mergifyio rebase
@Mergifyio queue

added permission to get nodes for rbd and cephfs nodeplugin daemonset

Signed-off-by: Jan Nemcik <[email protected]>
node labels are fetched only if controller is running in k8s and is nodeserver

Signed-off-by: Jan Nemcik <[email protected]>
Copy link
Contributor

mergify bot commented Dec 11, 2023

rebase

✅ Branch has been successfully rebased

@Rakshith-R
Copy link
Contributor

@Mergifyio queue

Copy link
Contributor

mergify bot commented Dec 11, 2023

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 3443546

@mergify mergify bot added the ok-to-test Label to trigger E2E tests label Dec 11, 2023
@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-cephfs

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.26

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.28

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/upgrade-tests-rbd

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.28

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.27

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.28

@ceph-csi-bot
Copy link
Collaborator

/test ci/centos/mini-e2e/k8s-1.27

@ceph-csi-bot ceph-csi-bot removed the ok-to-test Label to trigger E2E tests label Dec 11, 2023
@mergify mergify bot merged commit 3443546 into ceph:devel Dec 11, 2023
34 checks passed
@nemcikjan nemcikjan deleted the bugfix/rbd-nodeplugin-cr branch December 11, 2023 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-release-v3.10 Label to backport from devel to release-v3.10 branch bug Something isn't working component/cephfs Issues related to CephFS component/deployment Helm chart, kubernetes templates and configuration Issues/PRs component/rbd Issues related to RBD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RBAC] Helm Chart 3.10.0: csi-rbdplugin container enters CrashLoopBackoff with failed to get node error
7 participants