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 kubernetes#6196 but the Rules class didn't
  • Loading branch information
jbartosik committed Oct 23, 2023
1 parent 557b0f2 commit e211a3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 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,10 @@ func Default(deleteOptions options.NodeDeleteOptions) Rules {
// Rules defines operations on a collections of rules.
type Rules []Rule

func (r *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 e211a3b

Please sign in to comment.