Skip to content

Commit f0c9742

Browse files
authored
fix: create reconciler if new sub resources are added (#344)
1 parent ac17b6c commit f0c9742

4 files changed

Lines changed: 14 additions & 1 deletion

File tree

api/v1beta1/keycloakrealm_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ type KeycloakRealmStatus struct {
143143
// ObservedGeneration is the last generation reconciled by the controller
144144
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
145145

146+
// ObservedSHA256 is the last realm checksum reconciled by the controller
147+
ObservedSHA256 string `json:"observedSHA256,omitempty"`
148+
146149
// Reconciler is the reconciler pod while a reconciliation is in progress
147150
Reconciler string `json:"reconciler,omitempty"`
148151

chart/keycloak-controller/crds/keycloak.infra.doodle.com_keycloakrealms.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9571,6 +9571,10 @@ spec:
95719571
by the controller
95729572
format: int64
95739573
type: integer
9574+
observedSHA256:
9575+
description: ObservedSHA256 is the last realm checksum reconciled
9576+
by the controller
9577+
type: string
95749578
reconciler:
95759579
description: Reconciler is the reconciler pod while a reconciliation
95769580
is in progress

config/base/crd/bases/keycloak.infra.doodle.com_keycloakrealms.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9571,6 +9571,10 @@ spec:
95719571
by the controller
95729572
format: int64
95739573
type: integer
9574+
observedSHA256:
9575+
description: ObservedSHA256 is the last realm checksum reconciled
9576+
by the controller
9577+
type: string
95749578
reconciler:
95759579
description: Reconciler is the reconciler pod while a reconciliation
95769580
is in progress

internal/controllers/keycloakrealm_controller.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ func (r *KeycloakRealmReconciler) reconcile(ctx context.Context, realm infrav1be
334334
}
335335

336336
// rate limiter
337-
if readyCondition != nil && readyCondition.Status == metav1.ConditionTrue && (realm.Spec.Interval == nil || time.Since(readyCondition.LastTransitionTime.Time) < realm.Spec.Interval.Duration) && realm.Generation == readyCondition.ObservedGeneration {
337+
if readyCondition != nil && readyCondition.Status == metav1.ConditionTrue && (realm.Spec.Interval == nil || time.Since(readyCondition.LastTransitionTime.Time) < realm.Spec.Interval.Duration) && checksum == realm.Status.ObservedSHA256 {
338338
logger.V(1).Info("skip reconciliation, last transition time too recent")
339339

340340
if realm.Spec.Interval != nil {
@@ -346,6 +346,8 @@ func (r *KeycloakRealmReconciler) reconcile(ctx context.Context, realm infrav1be
346346
}
347347
}
348348

349+
realm.Status.ObservedSHA256 = checksum
350+
349351
// handle reconciler pod state
350352
if podErr == nil && pod.Name != "" {
351353
return r.handlerReconcilerState(realm, pod, logger)

0 commit comments

Comments
 (0)