func buildSimplifiedStatus()

in internal/controllers/composition/controller.go [169:228]


func buildSimplifiedStatus(synth *apiv1.Synthesizer, comp *apiv1.Composition) *apiv1.SimplifiedStatus {
	status := &apiv1.SimplifiedStatus{}

	if comp.DeletionTimestamp != nil {
		status.Status = "Deleting"
		return status
	}
	if synth == nil {
		status.Status = "MissingSynthesizer"
		return status
	}

	if syn := comp.Status.InFlightSynthesis; syn != nil {
		for _, result := range syn.Results {
			if result.Severity == krmv1.ResultSeverityError {
				status.Error = result.Message
				break
			}
		}

		if syn.Canceled != nil {
			if status.Error == "" {
				status.Error = "Timeout"
			}
			status.Status = "SynthesisBackoff"
			return status
		}

		status.Status = "Synthesizing"
		return status
	}

	if !inputs.Exist(synth, comp) {
		status.Status = "MissingInputs"
		return status
	}
	if inputs.OutOfLockstep(synth, comp.Status.InputRevisions) {
		status.Status = "MismatchedInputs"
	}

	if comp.Status.CurrentSynthesis == nil && comp.Status.InFlightSynthesis == nil {
		status.Status = "PendingSynthesis"
		return status
	}
	if syn := comp.Status.CurrentSynthesis; syn.Ready != nil {
		status.Status = "Ready"
		return status
	}
	if syn := comp.Status.CurrentSynthesis; syn.Reconciled != nil {
		status.Status = "NotReady"
		return status
	}
	if syn := comp.Status.CurrentSynthesis; syn != nil && syn.Reconciled == nil {
		status.Status = "Reconciling"
		return status
	}

	status.Status = "Unknown"
	return status
}