-
Notifications
You must be signed in to change notification settings - Fork 380
chore: ignore pods that have unbound pvc with volumeBindingMode immediate #2415
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e7270e2
chore: ignore pods that have unbound pvc with volumeBindingMode immed…
jigisha620 3f5525a
chore: Validate metrics for pod
jigisha620 6cd5d5b
chore: Fix spelling
jigisha620 3ab358b
chore: Make storageClass validation inline
jigisha620 ec607b5
chore: Address nits
jigisha620 494c254
chore: Update to use KRef for k8s object
jigisha620 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2798,9 +2798,10 @@ var _ = Context("Scheduling", func() { | |
| ExpectReconcileSucceeded(ctx, nodeStateController, client.ObjectKeyFromObject(node)) | ||
|
|
||
| sc := test.StorageClass(test.StorageClassOptions{ | ||
| ObjectMeta: metav1.ObjectMeta{Name: "my-storage-class"}, | ||
| Provisioner: lo.ToPtr(csiProvider), | ||
| Zones: []string{"test-zone-1"}}) | ||
| ObjectMeta: metav1.ObjectMeta{Name: "my-storage-class"}, | ||
| Provisioner: lo.ToPtr(csiProvider), | ||
| VolumeBindingMode: lo.ToPtr(storagev1.VolumeBindingWaitForFirstConsumer), | ||
| Zones: []string{"test-zone-1"}}) | ||
| ExpectApplied(ctx, env.Client, sc) | ||
|
|
||
| var pods []*corev1.Pod | ||
|
|
@@ -2922,8 +2923,9 @@ var _ = Context("Scheduling", func() { | |
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "my-storage-class", | ||
| }, | ||
| Provisioner: lo.ToPtr(csiProvider), | ||
| Zones: []string{"test-zone-1"}}) | ||
| Provisioner: lo.ToPtr(csiProvider), | ||
| VolumeBindingMode: lo.ToPtr(storagev1.VolumeBindingWaitForFirstConsumer), | ||
| Zones: []string{"test-zone-1"}}) | ||
| // Create another default storage class that shouldn't be used and has no associated limits | ||
| sc2 := test.StorageClass(test.StorageClassOptions{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
|
|
@@ -2932,8 +2934,9 @@ var _ = Context("Scheduling", func() { | |
| isDefaultStorageClassAnnotation: "true", | ||
| }, | ||
| }, | ||
| Provisioner: lo.ToPtr("other-provider"), | ||
| Zones: []string{"test-zone-1"}}) | ||
| Provisioner: lo.ToPtr("other-provider"), | ||
| VolumeBindingMode: lo.ToPtr(storagev1.VolumeBindingWaitForFirstConsumer), | ||
| Zones: []string{"test-zone-1"}}) | ||
|
|
||
| initialPod := test.UnschedulablePod(test.PodOptions{}) | ||
| // Pod has an ephemeral volume claim that has a specified storage class, so it should use the one specified | ||
|
|
@@ -3037,8 +3040,9 @@ var _ = Context("Scheduling", func() { | |
| isDefaultStorageClassAnnotation: "true", | ||
| }, | ||
| }, | ||
| Provisioner: lo.ToPtr(csiProvider), | ||
| Zones: []string{"test-zone-1"}}) | ||
| Provisioner: lo.ToPtr(csiProvider), | ||
| VolumeBindingMode: lo.ToPtr(storagev1.VolumeBindingWaitForFirstConsumer), | ||
| Zones: []string{"test-zone-1"}}) | ||
|
|
||
| initialPod := test.UnschedulablePod(test.PodOptions{}) | ||
| // Pod has an ephemeral volume claim that has NO storage class, so it should use the default one | ||
|
|
@@ -3135,17 +3139,19 @@ var _ = Context("Scheduling", func() { | |
| isDefaultStorageClassAnnotation: "true", | ||
| }, | ||
| }, | ||
| Provisioner: lo.ToPtr("other-provider"), | ||
| Zones: []string{"test-zone-1"}}) | ||
| Provisioner: lo.ToPtr("other-provider"), | ||
| VolumeBindingMode: lo.ToPtr(storagev1.VolumeBindingWaitForFirstConsumer), | ||
| Zones: []string{"test-zone-1"}}) | ||
| sc2 := test.StorageClass(test.StorageClassOptions{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "newer-default-storage-class", | ||
| Annotations: map[string]string{ | ||
| isDefaultStorageClassAnnotation: "true", | ||
| }, | ||
| }, | ||
| Provisioner: lo.ToPtr(csiProvider), | ||
| Zones: []string{"test-zone-1"}}) | ||
| Provisioner: lo.ToPtr(csiProvider), | ||
| VolumeBindingMode: lo.ToPtr(storagev1.VolumeBindingWaitForFirstConsumer), | ||
| Zones: []string{"test-zone-1"}}) | ||
|
|
||
| ExpectApplied(ctx, env.Client, sc) | ||
| // Wait a few seconds to apply the second storage class to get a newer creationTimestamp | ||
|
|
@@ -3243,7 +3249,6 @@ var _ = Context("Scheduling", func() { | |
| }) | ||
| It("should not launch nodes for pod with storageClass that uses an unsupported provisioner", func() { | ||
| scheduling.UnsupportedProvisioners = lo.Assign(scheduling.UnsupportedProvisioners, sets.New("other-provider")) | ||
| // Launch an initial pod onto a node and register the CSI Node with a volume count limit of 1 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dropping this comment because it's not relevant here. |
||
| sc := test.StorageClass(test.StorageClassOptions{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "default-storage-class", | ||
|
|
@@ -3293,6 +3298,28 @@ var _ = Context("Scheduling", func() { | |
| // no nodes should be created as the storage class is using an unsupported provisioner | ||
| Expect(nodeList.Items).To(HaveLen(0)) | ||
| }) | ||
| It("should not launch nodes for pod with unbound volume for volumeBindingMode immediate", func() { | ||
| sc := test.StorageClass(test.StorageClassOptions{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "default-storage-class", | ||
| }, | ||
| Provisioner: lo.ToPtr("other-provider"), | ||
| VolumeBindingMode: lo.ToPtr(storagev1.VolumeBindingImmediate), | ||
| Zones: []string{"test-zone-1"}}, | ||
| ) | ||
| pvc := test.PersistentVolumeClaim(test.PersistentVolumeClaimOptions{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "tmp-ephemeral", | ||
| }, | ||
| StorageClassName: lo.ToPtr(sc.Name), | ||
| }) | ||
| pod := test.UnschedulablePod(test.PodOptions{ | ||
| PersistentVolumeClaims: []string{pvc.Name}, | ||
| }) | ||
| ExpectApplied(ctx, env.Client, nodePool, sc, pvc, pod) | ||
| ExpectProvisioned(ctx, env.Client, cluster, cloudProvider, prov, pod) | ||
| ExpectNotScheduled(ctx, env.Client, pod) | ||
| }) | ||
| DescribeTable( | ||
| "should launch nodes for pods with ephemeral volume without a storage class when the PVC is bound", | ||
| func(storageClassName string) { | ||
|
|
@@ -3392,8 +3419,9 @@ var _ = Context("Scheduling", func() { | |
| isDefaultStorageClassAnnotation: "true", | ||
| }, | ||
| }, | ||
| Provisioner: lo.ToPtr(plugins.AWSEBSInTreePluginName), | ||
| Zones: []string{"test-zone-1"}}) | ||
| Provisioner: lo.ToPtr(plugins.AWSEBSInTreePluginName), | ||
| VolumeBindingMode: lo.ToPtr(storagev1.VolumeBindingWaitForFirstConsumer), | ||
| Zones: []string{"test-zone-1"}}) | ||
| pvc := test.PersistentVolumeClaim(test.PersistentVolumeClaimOptions{ | ||
| StorageClassName: lo.ToPtr(sc.Name), | ||
| }) | ||
|
|
@@ -3450,8 +3478,9 @@ var _ = Context("Scheduling", func() { | |
| isDefaultStorageClassAnnotation: "true", | ||
| }, | ||
| }, | ||
| Provisioner: lo.ToPtr(plugins.AWSEBSInTreePluginName), | ||
| Zones: []string{"test-zone-1"}}) | ||
| Provisioner: lo.ToPtr(plugins.AWSEBSInTreePluginName), | ||
| VolumeBindingMode: lo.ToPtr(storagev1.VolumeBindingWaitForFirstConsumer), | ||
| Zones: []string{"test-zone-1"}}) | ||
|
|
||
| initialPod := test.UnschedulablePod(test.PodOptions{}) | ||
| // Pod has an ephemeral volume claim that references the in-tree storage provider | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.