Skip to content

Commit 9c16535

Browse files
idanovindaSchmaetz
authored andcommitted
func to add or remove annotations
1 parent cbfe201 commit 9c16535

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pkg/cluster/util.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,3 +759,24 @@ func (c *Cluster) multisiteEnabled() bool {
759759
}
760760
return enable != nil && *enable
761761
}
762+
763+
func isInMaintenanceWindow(specMaintenanceWindows []cpov1.MaintenanceWindow) bool {
764+
if len(specMaintenanceWindows) == 0 {
765+
return true
766+
}
767+
now := time.Now()
768+
currentDay := now.Weekday()
769+
currentTime := now.Format("15:04")
770+
771+
for _, window := range specMaintenanceWindows {
772+
startTime := window.StartTime.Format("15:04")
773+
endTime := window.EndTime.Format("15:04")
774+
775+
if window.Everyday || window.Weekday == currentDay {
776+
if currentTime >= startTime && currentTime <= endTime {
777+
return true
778+
}
779+
}
780+
}
781+
return false
782+
}

0 commit comments

Comments
 (0)