Skip to content

Commit c0df318

Browse files
feat: enable concurrent reconciles (#113)
* Improve check when to refresh flux token * Set MaxConcurrentReconciles to 10 * fix: token expiry logic * feat: release v0.1.16
1 parent f69c193 commit c0df318

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.1.15-dev
1+
v0.1.16

charts/control-plane-operator/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apiVersion: v2
22
name: control-plane-operator
33
description: A Helm chart for the Cloud Orchestration Control Plane Operator
44
type: application
5-
version: v0.1.15
6-
appVersion: v0.1.15
5+
version: v0.1.16
6+
appVersion: v0.1.16
77
home: https://github.com/openmcp-project/control-plane-operator
88
sources:
99
- https://github.com/openmcp-project/control-plane-operator

charts/control-plane-operator/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ image:
88
repository: ghcr.io/openmcp-project/images/control-plane-operator
99
pullPolicy: IfNotPresent
1010
# Overrides the image tag whose default is the chart appVersion.
11-
tag: v0.1.15
11+
tag: v0.1.16
1212

1313
imagePullSecrets: []
1414
nameOverride: ""

internal/controller/controlplane_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ import (
4848
"k8s.io/client-go/tools/record"
4949
ctrl "sigs.k8s.io/controller-runtime"
5050
"sigs.k8s.io/controller-runtime/pkg/client"
51+
"sigs.k8s.io/controller-runtime/pkg/controller"
5152
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
5253
"sigs.k8s.io/controller-runtime/pkg/log"
54+
"sigs.k8s.io/controller-runtime/pkg/reconcile"
5355

5456
corev1beta1 "github.com/openmcp-project/control-plane-operator/api/v1beta1"
5557
"github.com/openmcp-project/control-plane-operator/pkg/controlplane/components"
@@ -191,6 +193,9 @@ func (r *ControlPlaneReconciler) getReleaseChannels(ctx context.Context) corev1b
191193
func (r *ControlPlaneReconciler) SetupWithManager(mgr ctrl.Manager) error {
192194
return ctrl.NewControllerManagedBy(mgr).
193195
For(&corev1beta1.ControlPlane{}).
196+
WithOptions(controller.TypedOptions[reconcile.Request]{
197+
MaxConcurrentReconciles: 10,
198+
}).
194199
Complete(r)
195200
}
196201

internal/controller/kubeconfigs.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@ func (r *ControlPlaneReconciler) ensureKubeconfig(ctx context.Context, remoteCfg
4141
return nil, err
4242
}
4343

44+
remainingLifetime := time.Until(expiration)
45+
4446
// check if token would expire before next planned reconciliation
45-
if time.Now().Before(expiration.Add(-r.ReconcilePeriod)) {
47+
// or less than a third of the desired lifetime is left
48+
expired := remainingLifetime < r.ReconcilePeriod || remainingLifetime < r.FluxTokenLifetime/3
49+
50+
if !expired {
4651
// kubeconfig is still valid
4752
return &corev1.SecretReference{Name: secret.Name, Namespace: secret.Namespace}, nil
4853
}

0 commit comments

Comments
 (0)