Skip to content

Commit b8df49e

Browse files
committed
🌱 Add condition if waiting for hook server
Adding a condition that indicates that we wait for the hook server or that the hook server is responsive. Signed-off-by: janiskemper <[email protected]>
1 parent 8305e73 commit b8df49e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

api/v1alpha1/conditions_const.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ const (
5656
ObjectsApplyingOngoingReason = "ObjectsApplyingOngoing"
5757
)
5858

59+
const (
60+
// HookServerReadyCondition reports on whether hook server is ready or not.
61+
HookServerReadyCondition clusterv1.ConditionType = "HookServerReady"
62+
63+
// HookServerUnresponsiveReason is used when hook server don't update the clusterAddon.Spec.Hook.
64+
HookServerUnresponsiveReason = "HookServerUnresponsive"
65+
)
66+
5967
const (
6068
// HelmChartDeletedCondition reports on whether the relevant helm chart has been applied.
6169
HelmChartDeletedCondition clusterv1.ConditionType = "HelmChartDeleted"

internal/controller/clusteraddon_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,15 @@ func (r *ClusterAddonReconciler) Reconcile(ctx context.Context, req reconcile.Re
412412
// If hook is empty we can don't want to proceed executing staged according to current hook
413413
// hence we can return.
414414
if clusterAddon.Spec.Hook == "" {
415+
conditions.MarkFalse(clusterAddon,
416+
csov1alpha1.HookServerReadyCondition,
417+
csov1alpha1.HookServerUnresponsiveReason,
418+
clusterv1.ConditionSeverityInfo,
419+
"hook server hasn't updated the spec.hook yet",
420+
)
415421
return reconcile.Result{}, nil
416422
}
423+
conditions.MarkTrue(clusterAddon, csov1alpha1.HookServerReadyCondition)
417424

418425
for _, stage := range clusterAddonConfig.AddonStages[clusterAddon.Spec.Hook] {
419426
shouldRequeue, err := r.executeStage(ctx, stage, in)

0 commit comments

Comments
 (0)