Skip to content

Commit

Permalink
Fix in rotation problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
akgalwas committed Oct 24, 2023
1 parent 1d42b16 commit 0e0d1bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/controller/gardener_cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ func secretNeedsToBeRotated(cluster *imv1.GardenerCluster, secret *corev1.Secret
}

func secretRotationTimePassed(secret *corev1.Secret, rotationPeriod time.Duration) bool {
const rotationPeriodRatio = 0.95

if secret == nil {
return true
}
Expand All @@ -259,7 +261,7 @@ func secretRotationTimePassed(secret *corev1.Secret, rotationPeriod time.Duratio
now := time.Now()
alreadyValidFor := now.Sub(lastSyncTime)

return alreadyValidFor.Minutes() >= rotationPeriod.Minutes()
return alreadyValidFor.Minutes() >= rotationPeriodRatio*rotationPeriod.Minutes()
}

func secretRotationForced(cluster *imv1.GardenerCluster) bool {
Expand Down

0 comments on commit 0e0d1bc

Please sign in to comment.