From dccdb702e3f41b189a708280f6a663797d3497c0 Mon Sep 17 00:00:00 2001 From: Joachim Bartosik Date: Mon, 23 Oct 2023 17:10:19 +0200 Subject: [PATCH] Rules type must implement Rule interface The interface changed in #6196 but the Rules class didn't --- cluster-autoscaler/simulator/drainability/rules/rules.go | 5 +++++ .../simulator/drainability/rules/rules_test.go | 3 +++ 2 files changed, 8 insertions(+) diff --git a/cluster-autoscaler/simulator/drainability/rules/rules.go b/cluster-autoscaler/simulator/drainability/rules/rules.go index 6dfb6e4ab7ac..c9d8bc2783d9 100644 --- a/cluster-autoscaler/simulator/drainability/rules/rules.go +++ b/cluster-autoscaler/simulator/drainability/rules/rules.go @@ -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 { diff --git a/cluster-autoscaler/simulator/drainability/rules/rules_test.go b/cluster-autoscaler/simulator/drainability/rules/rules_test.go index 1c1ab7b23df6..64f005cb8da7 100644 --- a/cluster-autoscaler/simulator/drainability/rules/rules_test.go +++ b/cluster-autoscaler/simulator/drainability/rules/rules_test.go @@ -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