Skip to content

Commit a64fc01

Browse files
authored
Merge pull request #21 from fluxcd/progressing-status
Report progressing status
2 parents 9007286 + 86f6e84 commit a64fc01

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

api/v1alpha1/condition_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ const (
7575
// InitializedReason represents the fact that a given resource has been initialized.
7676
InitializedReason string = "Initialized"
7777

78+
// ProgressingReason represents the fact that a kustomization reconciliation
79+
// is underway.
80+
ProgressingReason string = "Progressing"
81+
7882
// SuspendedReason represents the fact that the kustomization execution is suspended.
7983
SuspendedReason string = "Suspended"
8084

api/v1alpha1/kustomization_types.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,19 @@ func KustomizationReady(kustomization Kustomization, revision, reason, message s
117117
return kustomization
118118
}
119119

120+
func KustomizationProgressing(kustomization Kustomization) Kustomization {
121+
kustomization.Status.Conditions = []Condition{
122+
{
123+
Type: ReadyCondition,
124+
Status: corev1.ConditionUnknown,
125+
LastTransitionTime: metav1.Now(),
126+
Reason: ProgressingReason,
127+
Message: "reconciliation in progress",
128+
},
129+
}
130+
return kustomization
131+
}
132+
120133
func KustomizationNotReady(kustomization Kustomization, reason, message string) Kustomization {
121134
kustomization.Status.Conditions = []Condition{
122135
{

controllers/kustomization_controller.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ func (r *KustomizationReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
6565

6666
log := r.Log.WithValues(strings.ToLower(kustomization.Kind), req.NamespacedName)
6767

68+
kustomization = kustomizev1.KustomizationProgressing(kustomization)
69+
if err := r.Status().Update(ctx, &kustomization); err != nil {
70+
log.Error(err, "unable to update Kustomization status")
71+
return ctrl.Result{Requeue: true}, err
72+
}
73+
6874
if kustomization.Spec.Suspend {
6975
msg := "Kustomization is suspended, skipping execution"
7076
kustomization = kustomizev1.KustomizationNotReady(kustomization, kustomizev1.SuspendedReason, msg)
@@ -345,7 +351,7 @@ transformers:
345351
var data bytes.Buffer
346352
writer := bufio.NewWriter(&data)
347353
if err := t.Execute(writer, selectors); err != nil {
348-
return fmt.Errorf("labelTransformer template excution failed: %w", err)
354+
return fmt.Errorf("labelTransformer template execution failed: %w", err)
349355
}
350356

351357
if err := writer.Flush(); err != nil {

0 commit comments

Comments
 (0)