func classifyOp()

in internal/controllers/scheduling/op.go [62:99]


func classifyOp(synth *apiv1.Synthesizer, comp *apiv1.Composition) (opReason, bool) {
	switch {
	case comp.DeletionTimestamp != nil || !inputs.Exist(synth, comp) || inputs.OutOfLockstep(synth, comp.Status.InputRevisions) || !controllerutil.ContainsFinalizer(comp, "eno.azure.io/cleanup"):
		return 0, false

	case (comp.Status.CurrentSynthesis == nil || comp.Status.CurrentSynthesis.Synthesized == nil) && comp.Status.InFlightSynthesis == nil:
		return initialSynthesisOp, true

	case comp.ShouldForceResynthesis():
		return forcedResynthesisOp, true

	case compositionHasBeenModified(comp):
		return compositionModifiedOp, true

	case comp.ShouldIgnoreSideEffects():
		return 0, false
	}

	syn := comp.Status.CurrentSynthesis
	if comp.Status.InFlightSynthesis != nil {
		syn = comp.Status.InFlightSynthesis
	}

	nonDeferredInputChanges, deferredInputChanges := inputChangeCount(synth, comp.Status.InputRevisions, syn.InputRevisions)
	if nonDeferredInputChanges > 0 {
		return inputModifiedOp, true
	}

	if deferredInputChanges > 0 {
		return deferredInputModifiedOp, true
	}

	if syn.ObservedSynthesizerGeneration > 0 && syn.ObservedSynthesizerGeneration < synth.Generation {
		return synthesizerModifiedOp, true
	}

	return 0, false
}