Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions internal/composition/composition.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,18 +542,8 @@ func (h *handler) Update(ctx context.Context, mg *unstructured.Unstructured) err
message: "Composition values updated",
chartURL: pkg.URL,
chartVersion: pkg.Version,
conditionType: ConditionTypeAvailable,
}

if compositionMeta.IsGracefullyPaused(mg) {
statusOpts.conditionType = ConditionTypeReconcileGracefullyPaused
compositionMeta.SetGracefullyPausedTime(mg, time.Now())
log.Debug("Composition gracefully paused.")
h.eventRecorder.Event(mg, event.Normal(reasonReconciliationGracefullyPaused, "Update", "Reconciliation paused via the gracefully paused annotation."))
} else {
statusOpts.conditionType = ConditionTypeAvailable
meta.RemoveAnnotations(mg, compositionMeta.AnnotationKeyReconciliationGracefullyPausedTime)
}

err = setStatus(mg, statusOpts)
if err != nil {
return fmt.Errorf("setting status: %w", err)
Expand All @@ -566,7 +556,19 @@ func (h *handler) Update(ctx context.Context, mg *unstructured.Unstructured) err
if err != nil {
return fmt.Errorf("updating cr status with values: %w", err)
}
_, err = tools.Update(ctx, mg, updateOpts)

if compositionMeta.IsGracefullyPaused(mg) {
statusOpts.conditionType = ConditionTypeReconcileGracefullyPaused
compositionMeta.SetGracefullyPausedTime(mg, time.Now())
log.Debug("Composition gracefully paused.")
h.eventRecorder.Event(mg, event.Normal(reasonReconciliationGracefullyPaused, "Update", "Reconciliation paused via the gracefully paused annotation."))

} else {
statusOpts.conditionType = ConditionTypeAvailable
meta.RemoveAnnotations(mg, compositionMeta.AnnotationKeyReconciliationGracefullyPausedTime)
}

mg, err = tools.Update(ctx, mg, updateOpts)
if err != nil {
return fmt.Errorf("updating cr with values: %w", err)
}
Expand Down
Loading