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

Extend Binding API for graceful eviction #2273

Merged

Conversation

RainbowMango
Copy link
Member

@RainbowMango RainbowMango commented Jul 28, 2022

What type of PR is this?
/kind api-change
/kind feature

What this PR does / why we need it:
This PR proposed the API change which is used to perform graceful eviction.

Which issue(s) this PR fixes:
Part of #2281

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@karmada-bot karmada-bot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. labels Jul 28, 2022
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 28, 2022
Copy link
Member

@kevin-wangzefeng kevin-wangzefeng left a comment

Choose a reason for hiding this comment

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

I don't see any relevant proposals or issues linked to this PR, it would be very helpful to create one, describing background/motivation and also system behaviours especially when multiple evictors working together.

pkg/apis/work/v1alpha2/binding_types.go Outdated Show resolved Hide resolved
pkg/apis/work/v1alpha2/binding_types.go Outdated Show resolved Hide resolved
@RainbowMango RainbowMango force-pushed the pr_gracefull_eviction_api branch 3 times, most recently from fdee34b to a392a7d Compare July 29, 2022 02:58
@RainbowMango
Copy link
Member Author

@Garrybest
Copy link
Member

/assign

// The intended workflow is:
// 1. Once the controller(such as 'taint-manager') decided to evict the resource that
// is referenced by current ResourceBinding or ClusterResourceBinding from a target
// cluster, it removes(or scale down the replicas) the target from Clusters(.spec.Clusters)
Copy link
Member

Choose a reason for hiding this comment

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

(or scale down the replicas)

Do we need to move the scale down replicas into GracefulEvictionTasks?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, e.g.

spec:
  clusters:
  - name: member2
    replicas: 10
  - name: member1
    replicas: 10

evict 5 replicas from member1, then

spec:
  clusters:
  - name: member2
    replicas: 10
  - name: member1
    replicas: 5
  gracefulEvictionTasks:
  - name: member1
    replicas: 5
    ...

Copy link
Member

Choose a reason for hiding this comment

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

This may cause problems. .spec.clusters describes the current cluster replicas distribution status. When the number of member2 replicas changes from 10 to 5, the number of workload replicas will be directly changed when ensuringWork in binding-controller. This will conflict with the eviction behavior.

Copy link
Member Author

Choose a reason for hiding this comment

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

When the number of member2 replicas changes from 10 to 5,

member2 do you mean member1?

Copy link
Member

Choose a reason for hiding this comment

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

Clerical error. It does refer to member1.

Copy link
Member Author

@RainbowMango RainbowMango Jul 30, 2022

Choose a reason for hiding this comment

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

Yeah, that would be too complicated, and given the real use case is uncertain yet, I suppose we can remove the replicas from gracefulEvictionTasks. Now only focus on evicting the entire resource from clusters.

@Garrybest What do you say?

[edit] we can't remove the replicas, just focus on the eviction scenario of taint-manager.

// to take over the evicting workload(resource).
// 3. The graceful eviction controller takes care of the graceful eviction tasks and
// performs the final removal after the workload(resource) is available on the substitute
// cluster or exceed the grace termination period(defaults to 10 minutes).
Copy link
Member

Choose a reason for hiding this comment

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

the grace termination period(defaults to 10 minutes).

Is this a configurable parameter?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, probably. And a new field might be needed to hold the configurable parameter.

pkg/apis/work/v1alpha2/binding_types.go Outdated Show resolved Hide resolved
pkg/apis/work/v1alpha2/binding_types.go Outdated Show resolved Hide resolved
pkg/apis/work/v1alpha2/well_known_constants.go Outdated Show resolved Hide resolved
// If SchedulerObservedGeneration is less than the generation in metadata means the scheduler hasn't confirmed
// the scheduling result or hasn't done the schedule yet.
// +optional
SchedulerObservedGeneration int64 `json:"schedulerObservedGeneration,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

So what if the evicition task has not been done yet but there comes a scaling-up event, how to deal with this situation by using SchedulerObservedGeneration?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure if I understand you correctly.

A general idea in my mind is that scheduler shouldn't schedule the resource(in binding) to a cluster which already in one of the graceful eviction tasks.

Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
@Garrybest
Copy link
Member

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 2, 2022
@XiShanYongYe-Chang
Copy link
Member

/lgtm

@RainbowMango RainbowMango added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 2, 2022
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

@karmada-bot karmada-bot merged commit 270d729 into karmada-io:master Aug 2, 2022
@RainbowMango RainbowMango deleted the pr_gracefull_eviction_api branch February 20, 2023 11:29
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. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm 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.

None yet

5 participants