Skip to content

Commit d96b278

Browse files
fix: token expiry logic
1 parent ba0ace5 commit d96b278

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/controller/kubeconfigs.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ func (r *ControlPlaneReconciler) ensureKubeconfig(ctx context.Context, remoteCfg
4545

4646
// check if token would expire before next planned reconciliation
4747
// or less than a third of the desired lifetime is left
48-
if remainingLifetime < r.ReconcilePeriod || remainingLifetime < r.FluxTokenLifetime/3 {
48+
expired := remainingLifetime < r.ReconcilePeriod || remainingLifetime < r.FluxTokenLifetime/3
49+
50+
if !expired {
4951
// kubeconfig is still valid
5052
return &corev1.SecretReference{Name: secret.Name, Namespace: secret.Namespace}, nil
5153
}

0 commit comments

Comments
 (0)