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

feat: changes to rollout controller for eviction #959

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Arvindthiru
Copy link
Contributor

@Arvindthiru Arvindthiru commented Nov 15, 2024

Description of your changes

Fixes #

I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Special notes for your reviewer

Copy link
Contributor

@ryanzhang-oss ryanzhang-oss left a comment

Choose a reason for hiding this comment

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

We need to add a few e2e test for the eviction cases

@Arvindthiru Arvindthiru marked this pull request as ready for review November 28, 2024 00:49
@Arvindthiru
Copy link
Contributor Author

Will add another PR to add more E2Es

@@ -607,6 +607,202 @@ var _ = Describe("Test the rollout Controller", func() {
}, 5*time.Minute, interval).Should(BeTrue(), "rollout controller should roll all the bindings to use the latest resource snapshot")
})

It("Rollout should be blocked, then unblocked by eviction - evict unscheduled binding", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

what about the base case that a bound binding is evicted and scheduler creates another binding, make sure we rollout that binding?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added as an E2E test since it involves the entire flow

pkg/controllers/rollout/controller_test.go Outdated Show resolved Hide resolved
pkg/controllers/rollout/controller_test.go Outdated Show resolved Hide resolved
test/e2e/placement_eviction_test.go Outdated Show resolved Hide resolved
test/e2e/placement_eviction_test.go Outdated Show resolved Hide resolved
test/e2e/placement_eviction_test.go Show resolved Hide resolved
test/e2e/placement_eviction_test.go Outdated Show resolved Hide resolved
@Arvindthiru Arvindthiru marked this pull request as draft December 17, 2024 19:09
@Arvindthiru Arvindthiru marked this pull request as ready for review December 18, 2024 23:17
pkg/controllers/rollout/controller_integration_test.go Outdated Show resolved Hide resolved
@@ -205,23 +206,23 @@ func TestWaitForResourcesToCleanUp(t *testing.T) {
"test deleting binding block schedule binding on the same cluster": {
allBindings: []*fleetv1beta1.ClusterResourceBinding{
generateClusterResourceBinding(fleetv1beta1.BindingStateScheduled, "snapshot-1", cluster1),
generateDeletingClusterResourceBinding(cluster1),
setDeletionTimeStampForBinding(generateClusterResourceBinding(fleetv1beta1.BindingStateUnscheduled, "snapshot-1", cluster1)),
Copy link
Contributor

Choose a reason for hiding this comment

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

why add the delete timestamp here? The function it tests doesn't care.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pkg/controllers/rollout/controller_test.go Show resolved Hide resolved
pkg/controllers/rollout/controller_test.go Show resolved Hide resolved
pkg/controllers/rollout/controller_test.go Outdated Show resolved Hide resolved
},
},
wantTobeUpdatedBindings: []int{2}, // specified MaxSurge helps us pick one scheduled binding to rollout. we don't have any ready binding so we don't remove any binding.
Copy link
Contributor

Choose a reason for hiding this comment

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

In theory, we pick one from 2 or 3. is it guaranteed to pick 2?

Strategy: fleetv1beta1.RolloutStrategy{
Type: fleetv1beta1.RollingUpdateRolloutStrategyType,
RollingUpdate: &fleetv1beta1.RollingUpdateConfig{
wantTobeUpdatedBindings: []int{1}, // specified MaxUnavailable helps us remove unscheduled binding, deleting unscheduled binding even though ready is a canBeUnavailable binding.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
wantTobeUpdatedBindings: []int{1}, // specified MaxUnavailable helps us remove unscheduled binding, deleting unscheduled binding even though ready is a canBeUnavailable binding.
wantTobeUpdatedBindings: []int{1}, // specified MaxUnavailable helps us remove unscheduled binding, deleting unscheduled binding even though it is a canBeUnavailable binding.

Type: fleetv1beta1.RollingUpdateRolloutStrategyType,
RollingUpdate: &fleetv1beta1.RollingUpdateConfig{
wantTobeUpdatedBindings: []int{1}, // specified MaxUnavailable helps us remove unscheduled binding, deleting unscheduled binding even though ready is a canBeUnavailable binding.
wantStaleUnselectedBindings: []int{2, 3},
Copy link
Contributor

Choose a reason for hiding this comment

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

add a comment here too? something like we can't pick them because the max Surge is 0?

@@ -397,20 +398,27 @@ func (r *Reconciler) pickBindingsToRoll(ctx context.Context, allBindings []*flee
} else {
canBeReadyBindings = append(canBeReadyBindings, binding)
Copy link
Contributor

Choose a reason for hiding this comment

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

if the bindingReady then it can't be failed, so shouldn't this be in line 388 block?

pkg/controllers/rollout/controller_test.go Outdated Show resolved Hide resolved
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.

2 participants