Skip to content

Commit

Permalink
feat: Eviction controller (#942)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvindthiru authored Dec 7, 2024
1 parent 236cca2 commit 5706894
Show file tree
Hide file tree
Showing 12 changed files with 2,731 additions and 24 deletions.
10 changes: 4 additions & 6 deletions apis/placement/v1alpha1/disruptionbudget_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ type PlacementDisruptionBudgetSpec struct {
// * if the linked Placement object is of the PickFixed placement type,
// the percentage is against the number of clusters specified in the placement (i.e., the
// length of ClusterNames field in the placement policy);
// * if the linked Placement object is of the PickAll placement type,
// the percentage is against the total number of clusters being selected by the scheduler
// at the time of the evaluation of the disruption budget;
// * if the linked Placement object is of the PickAll placement type, MaxUnavailable cannot
// be specified since we cannot derive the total number of clusters selected.
// * if the linked Placement object is of the PickN placement type,
// the percentage is against the number of clusters specified in the placement (i.e., the
// value of the NumberOfClusters fields in the placement policy).
Expand Down Expand Up @@ -77,9 +76,8 @@ type PlacementDisruptionBudgetSpec struct {
// * if the linked Placement object is of the PickFixed placement type,
// the percentage is against the number of clusters specified in the placement (i.e., the
// length of ClusterNames field in the placement policy);
// * if the linked Placement object is of the PickAll placement type,
// the percentage is against the total number of clusters being selected by the scheduler
// at the time of the evaluation of the disruption budget;
// * if the linked Placement object is of the PickAll placement type, MinAvailable can be
// specified but only as an integer since we cannot derive the total number of clusters selected.
// * if the linked Placement object is of the PickN placement type,
// the percentage is against the number of clusters specified in the placement (i.e., the
// value of the NumberOfClusters fields in the placement policy).
Expand Down
13 changes: 13 additions & 0 deletions apis/placement/v1alpha1/eviction_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Licensed under the MIT license.
package v1alpha1

import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -118,6 +119,18 @@ type ClusterResourcePlacementEvictionList struct {
Items []ClusterResourcePlacementEviction `json:"items"`
}

// SetConditions set the given conditions on the ClusterResourcePlacementEviction.
func (e *ClusterResourcePlacementEviction) SetConditions(conditions ...metav1.Condition) {
for _, c := range conditions {
meta.SetStatusCondition(&e.Status.Conditions, c)
}
}

// GetCondition returns the condition of the given ClusterResourcePlacementEviction.
func (e *ClusterResourcePlacementEviction) GetCondition(conditionType string) *metav1.Condition {
return meta.FindStatusCondition(e.Status.Conditions, conditionType)
}

func init() {
SchemeBuilder.Register(
&ClusterResourcePlacementEviction{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ spec:
* if the linked Placement object is of the PickFixed placement type,
the percentage is against the number of clusters specified in the placement (i.e., the
length of ClusterNames field in the placement policy);
* if the linked Placement object is of the PickAll placement type,
the percentage is against the total number of clusters being selected by the scheduler
at the time of the evaluation of the disruption budget;
* if the linked Placement object is of the PickAll placement type, MaxUnavailable cannot
be specified since we cannot derive the total number of clusters selected.
* if the linked Placement object is of the PickN placement type,
the percentage is against the number of clusters specified in the placement (i.e., the
value of the NumberOfClusters fields in the placement policy).
Expand Down Expand Up @@ -113,9 +112,8 @@ spec:
* if the linked Placement object is of the PickFixed placement type,
the percentage is against the number of clusters specified in the placement (i.e., the
length of ClusterNames field in the placement policy);
* if the linked Placement object is of the PickAll placement type,
the percentage is against the total number of clusters being selected by the scheduler
at the time of the evaluation of the disruption budget;
* if the linked Placement object is of the PickAll placement type, MinAvailable can be
specified but only as an integer since we cannot derive the total number of clusters selected.
* if the linked Placement object is of the PickN placement type,
the percentage is against the number of clusters specified in the placement (i.e., the
value of the NumberOfClusters fields in the placement policy).
Expand Down
Loading

0 comments on commit 5706894

Please sign in to comment.