Skip to content

Commit

Permalink
first blush at error messaging when passthrough path is not found, fix
Browse files Browse the repository at this point in the history
crashloop when passthrough not satisfied
  • Loading branch information
Todd Ritchie committed Mar 21, 2023
1 parent dddcd9b commit 515f38b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/conditions/workload_conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ func MissingReadyInSupplyChainCondition(supplyChainReadyCondition metav1.Conditi
}
}

func MissingPassThroughInputCondition(input string, resource string) metav1.Condition {
return metav1.Condition{
Type: v1alpha1.WorkloadSupplyChainReady,
Status: metav1.ConditionFalse,
Reason: v1alpha1.PassThroughReason,
Message: fmt.Sprintf("unable to find passthrough [%s] in [%s]", input, resource),
}
}

func AddConditionForResourceSubmittedWorkload(conditionManager *ConditionManager, isOwner bool, err error) {
switch typedErr := err.(type) {
case cerrors.GetTemplateError:
Expand All @@ -82,7 +91,11 @@ func AddConditionForResourceSubmittedWorkload(conditionManager *ConditionManager
case cerrors.NoHealthyImmutableObjectsError:
(*conditionManager).AddPositive(NoHealthyImmutableObjectsCondition(isOwner, typedErr))
case cerrors.RetrieveOutputError:
(*conditionManager).AddPositive(MissingValueAtPathCondition(isOwner, typedErr.StampedObject, typedErr.JsonPathExpression(), typedErr.GetQualifiedResource()))
if typedErr.PassThroughInput == "" {
(*conditionManager).AddPositive(MissingValueAtPathCondition(isOwner, typedErr.StampedObject, typedErr.JsonPathExpression(), typedErr.GetQualifiedResource()))
} else {
(*conditionManager).AddPositive(MissingPassThroughInputCondition(typedErr.PassThroughInput, typedErr.GetQualifiedResource()))
}
case cerrors.ResolveTemplateOptionError:
(*conditionManager).AddPositive(ResolveTemplateOptionsErrorCondition(isOwner, typedErr))
case cerrors.TemplateOptionsMatchError:
Expand Down

0 comments on commit 515f38b

Please sign in to comment.