Skip to content

Commit

Permalink
Rules type must implement Rule interface
Browse files Browse the repository at this point in the history
The interface changed in #6196 but the Rules class didn't
  • Loading branch information
jbartosik committed Oct 23, 2023
1 parent 557b0f2 commit dccdb70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cluster-autoscaler/simulator/drainability/rules/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ func Default(deleteOptions options.NodeDeleteOptions) Rules {
// Rules defines operations on a collections of rules.
type Rules []Rule

// Name returns the name of the rule.
func (rs *Rules) Name() string {
return "Rules"
}

// Drainable determines whether a given pod is drainable according to the
// specified set of rules.
func (rs Rules) Drainable(drainCtx *drainability.DrainContext, pod *apiv1.Pod) drainability.Status {
Expand Down
3 changes: 3 additions & 0 deletions cluster-autoscaler/simulator/drainability/rules/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import (
"k8s.io/autoscaler/cluster-autoscaler/utils/drain"
)

// Ensure that Rules type implements the Rule interface
var _ Rule = &Rules{}

func TestDrainable(t *testing.T) {
for desc, tc := range map[string]struct {
rules Rules
Expand Down

0 comments on commit dccdb70

Please sign in to comment.