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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider PVC with a WaitForFirstConsumer SC ready #11335

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adrien-f
Copy link

As discussed in #10733.

Charts that have PVCs associated with resources not starting immediately after install (like a CronJob) will wait forever if the associated StorageClass has a volume binding mode of WaitForFirstConsumer.

This PR attempts to solve this by querying the associated StorageClass (or the default one) and checking its volumeBindingMode field.

Signed-off-by: Adrien Fillon adrien.fillon@manomano.com

What this PR does / why we need it:

  • Consider PVCs with a SC with a volumeBindingMode of WaitForFirstConsumer to be ready

Special notes for your reviewer:

I'm not 100% sure of the UX Helm wish for this kind of behavior, I could also go for a flag similar to WaitForJobs to have a SkipWaitForPvc or something 馃

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

As discussed in helm#10733.

Charts which have PVC associated with resources not starting
immediately after install (like a CronJob) will wait forever if
the associated StorageClass has a volume binding mode of
`WaitForFirstConsumer`.

This PR attempts to solve this by querying the associated
StorageClass (or the default one) and check its `volumeBindingMode`
field.

Signed-off-by: Adrien Fillon <adrien.fillon@manomano.com>
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 12, 2022
@raxod502-plaid
Copy link

We encountered this bug in production. Is there any plan to review the PR solving it?

@@ -263,7 +273,13 @@ func (c *ReadyChecker) serviceReady(s *corev1.Service) bool {
return true
}

func (c *ReadyChecker) volumeReady(v *corev1.PersistentVolumeClaim) bool {
func (c *ReadyChecker) volumeReady(v *corev1.PersistentVolumeClaim, storageClass *storagev1.StorageClass) bool {
if storageClass != nil &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to expect storageClass could be nil here? getStorageClassFromPvc shouldn't return a nil value (except on error) I think?

Copy link
Contributor

@gjenkins8 gjenkins8 left a comment

Choose a reason for hiding this comment

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

LGTMe (non-maintainer). Couple of minor comments around structure, but logic looks good.

@@ -131,7 +135,13 @@ func (c *ReadyChecker) IsReady(ctx context.Context, v *resource.Info) (bool, err
if err != nil {
return false, err
}
if !c.volumeReady(claim) {

storageClass, err := getStorageClassFromPvc(ctx, c.client, claim)
Copy link
Contributor

Choose a reason for hiding this comment

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

If I were to nitpick, perhaps volumeReady should (continue) to have all "volume ready" logic. And should call getStorageClassFromPvc .

(perhaps this would make volumeReady a candidate for refactoring itself, since adding this call would increase complexity there; but I don't think the right approach is to put some of the functionality into the caller here)

@gjenkins8
Copy link
Contributor

@adrien-f -- #10733 was reopened recently. Would you be interested in a push to get this merged?

@ctron
Copy link

ctron commented Feb 15, 2024

This is pretty annoying, and it looks like there's a fix pending for close to year now. Can this be merged please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

None yet

4 participants