Skip to content

Commit

Permalink
Defrag shooted seed etcd-main every day.
Browse files Browse the repository at this point in the history
```improvement operator
Defrag shooted seed etcd-main every day. This is to temporarily mitigate the high load on seed apiserver from recent changes.
```
  • Loading branch information
Amshuman K R authored and rfranzke committed Sep 28, 2020
1 parent a6e6026 commit b50bbb1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/operation/botanist/controlplane.go
Expand Up @@ -1511,7 +1511,7 @@ func (b *Botanist) DeployETCD(ctx context.Context) error {
foundStatefulset = false
}

defragmentSchedule, err := DetermineDefragmentSchedule(b.Shoot.Info, etcd)
defragmentSchedule, err := DetermineDefragmentSchedule(b.Shoot.Info, etcd, b.ShootedSeed, role)
if err != nil {
return err
}
Expand Down Expand Up @@ -1667,12 +1667,16 @@ func DetermineBackupSchedule(shoot *gardencorev1beta1.Shoot, etcd *druidv1alpha1
}

// DetermineDefragmentSchedule determines the defragment schedule based on the shoot creation and maintenance time window.
func DetermineDefragmentSchedule(shoot *gardencorev1beta1.Shoot, etcd *druidv1alpha1.Etcd) (string, error) {
func DetermineDefragmentSchedule(shoot *gardencorev1beta1.Shoot, etcd *druidv1alpha1.Etcd, shootedSeed *gardencorev1beta1helper.ShootedSeed, role string) (string, error) {
if etcd.Spec.Etcd.DefragmentationSchedule != nil {
return *etcd.Spec.Etcd.DefragmentationSchedule, nil
}

schedule := "%d %d */3 * *"
if shootedSeed != nil && role == common.EtcdRoleMain {
// defrag etcd-main of shooted seeds daily in the maintenance window
schedule = "%d %d * * *"
}

return determineSchedule(shoot, schedule, func(maintenanceTimeWindow *utils.MaintenanceTimeWindow, shootUID types.UID) string {
// Randomize the defragment timing but within the maintainence window.
Expand Down

0 comments on commit b50bbb1

Please sign in to comment.