diff --git a/pkg/cluster/majorversionupgrade.go b/pkg/cluster/majorversionupgrade.go index ad431acc4..33378abf5 100644 --- a/pkg/cluster/majorversionupgrade.go +++ b/pkg/cluster/majorversionupgrade.go @@ -128,7 +128,7 @@ func (c *Cluster) majorVersionUpgrade() error { return nil } - if !isInMainternanceWindow(c.Spec.MaintenanceWindows) { + if !IsInMainternanceWindow(c.Spec.MaintenanceWindows) { c.logger.Infof("skipping major version upgrade, not in maintenance window") return nil } diff --git a/pkg/cluster/util.go b/pkg/cluster/util.go index c570fcc3a..f8968e44d 100644 --- a/pkg/cluster/util.go +++ b/pkg/cluster/util.go @@ -663,7 +663,7 @@ func parseResourceRequirements(resourcesRequirement v1.ResourceRequirements) (ac return resources, nil } -func isInMainternanceWindow(specMaintenanceWindows []acidv1.MaintenanceWindow) bool { +func IsInMainternanceWindow(specMaintenanceWindows []acidv1.MaintenanceWindow) bool { if len(specMaintenanceWindows) == 0 { return true } diff --git a/pkg/cluster/util_test.go b/pkg/cluster/util_test.go index 2cb755c6c..3966e67e3 100644 --- a/pkg/cluster/util_test.go +++ b/pkg/cluster/util_test.go @@ -705,7 +705,7 @@ func TestIsInMaintenanceWindow(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { cluster.Spec.MaintenanceWindows = tt.windows - if isInMainternanceWindow(cluster.Spec.MaintenanceWindows) != tt.expected { + if IsInMainternanceWindow(cluster.Spec.MaintenanceWindows) != tt.expected { t.Errorf("Expected isInMainternanceWindow to return %t", tt.expected) } }) diff --git a/pkg/controller/node.go b/pkg/controller/node.go index 2836b4f7f..6ffc6566b 100644 --- a/pkg/controller/node.go +++ b/pkg/controller/node.go @@ -139,6 +139,11 @@ func (c *Controller) attemptToMoveMasterPodsOffNode(node *v1.Node) error { for pod, cl := range masterPods { podName := util.NameFromMeta(pod.ObjectMeta) + if !cluster.IsInMainternanceWindow(cl.Spec.MaintenanceWindows) { + c.logger.Infof("skipping master pod migration, not in maintenance window") + continue + } + if err := cl.MigrateMasterPod(podName); err != nil { c.logger.Errorf("could not move master pod %q: %v", podName, err) } else {