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

reclaimspace: detect Kubernetes version for right StagingTargetPath #165

Merged
merged 2 commits into from
Jun 15, 2022

Conversation

nixpanic
Copy link
Collaborator

Kubernetes 1.24 and newer use a different path for staging the volume.
That means the CSI-driver is requested to mount the volume at an other
location, compared to previous versions of Kubernetes. CSI-drivers
implementing the CSI-Addons NodeReclaimSpace procedure, must receive the
correct path, otherwise the driver will not be able to free space and
possibly return an error.

See-also: kubernetes/kubernetes#107065
See-also: https://bugzilla.redhat.com/2096209

Kubernetes 1.24 and newer use a different path for staging the volume.
That means the CSI-driver is requested to mount the volume at an other
location, compared to previous versions of Kubernetes. CSI-drivers
implementing the CSI-Addons NodeReclaimSpace procedure, must receive the
correct path, otherwise the driver will not be able to free space and
possibly return an error.

See-also: kubernetes/kubernetes#107065
See-also: https://bugzilla.redhat.com/2096209
Signed-off-by: Niels de Vos <ndevos@redhat.com>
@nixpanic nixpanic force-pushed the reclaimspace/k8s-1.24/staging-path branch from 9351866 to 1bbc6c1 Compare June 15, 2022 08:03
@nixpanic nixpanic marked this pull request as ready for review June 15, 2022 08:04
Kubernetes versions < 1.24 should use the `-legacy` option, newer
versions require `-drivername` to build the StagingTargetPath where the
volume is mounted.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
@nixpanic nixpanic force-pushed the reclaimspace/k8s-1.24/staging-path branch from 1bbc6c1 to 1f63bfc Compare June 15, 2022 08:08
Copy link
Contributor

@yati1998 yati1998 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -83,7 +84,17 @@ func (nrs *NodeReclaimSpace) Init(c *command) error {
if c.stagingPath == "" {
return fmt.Errorf("stagingpath is not set")
}
nrs.stagingTargetPath = fmt.Sprintf("%s/%s/globalmount", c.stagingPath, c.persistentVolume)

if !c.legacy {
Copy link
Member

Choose a reason for hiding this comment

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

Can we not do with only kube server version check?
Do we need another bool legacy parameter?
Maybe I am missing something 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we could, but the command does not use any Kubernetes client at all, it is intended to be functional outside of Kubernetes too.

Copy link
Member

Choose a reason for hiding this comment

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

Okay,

If it can run seamlessly on k8s version less than 1.24 than I am fine.

Or do we need to tweak legacy variable depending on the k8s version too?

(This change will need to go into rook)

Copy link
Member

Choose a reason for hiding this comment

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

okay this is for the testing tool 🤦 my bad

@nixpanic nixpanic requested a review from Rakshith-R June 15, 2022 08:58
@Rakshith-R Rakshith-R requested a review from Madhu-1 June 15, 2022 09:07
@mergify mergify bot merged commit 267719c into csi-addons:main Jun 15, 2022
Rakshith-R pushed a commit to Rakshith-R/kubernetes-csi-addons that referenced this pull request Sep 2, 2024
Syncing latest changes from main for kubernetes-csi-addons
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.

3 participants