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

[V2] fix: replicas aren't getting cleaned up during driver uninstall #1557

Merged
merged 1 commit into from
Nov 9, 2022

Conversation

sunpa93
Copy link
Contributor

@sunpa93 sunpa93 commented Oct 21, 2022

What type of PR is this?

What this PR does / why we need it:

  • Replica AzVolumeAttachments need to be detached and deleted during driver uninstall.
  • This PR is necessary to unblock other tasks as 1) updating driver uninstall que and 2) adding allocation map.

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:

Release note:

none

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 21, 2022
@sunpa93 sunpa93 changed the title [WIP] [V2] fix: replicas aren't getting cleaned up during driver uninstall [V2] fix: replicas aren't getting cleaned up during driver uninstall Nov 8, 2022
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 8, 2022
@edreed
Copy link
Collaborator

edreed commented Nov 8, 2022

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 8, 2022
@landreasyan
Copy link
Contributor

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 9, 2022
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 9, 2022
pkg/controller/azvolume.go Outdated Show resolved Hide resolved
if err == nil {
var wg sync.WaitGroup
errors := make([]error, len(attachments))
numErrors := uint32(0)
Copy link
Contributor

@landreasyan landreasyan Nov 9, 2022

Choose a reason for hiding this comment

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

I think it would be better to communicate with channels here. errors or result itself could be a buffered channel that would have the result of deletion. We would then send all the errors thorough that channel and instead of wg.Wait () we can have

go func() {
		wg.Wait()
		close(errors )
	}()

then we will loop over errors to check for any error:

for error := range errors {
		// update status
	}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I see the benefit of using a buffered channel here. Let's merge this one and I will iterate on this in a separate PR as Huichan's change has dependency on this change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, we don't even need a buffered channel. The loop will read all the errors as reported until the channel is closed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure!

@@ -90,11 +90,11 @@ const (
pod operationRequester = "pod-controller"
)

type cleanUpMode int
type attachmentCleanUpMode int

const (
Copy link
Contributor

Choose a reason for hiding this comment

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

np: I think it would be good to document the usage here.

@landreasyan
Copy link
Contributor

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 9, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edreed, landreasyan, sunpa93

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

@sunpa93
Copy link
Contributor Author

sunpa93 commented Nov 9, 2022

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 9, 2022
@k8s-ci-robot k8s-ci-robot merged commit 3b93e4a into kubernetes-sigs:main_v2 Nov 9, 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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants