Skip to content

Commit

Permalink
Make SetStatusConditions not overwrite existing conditions
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Böschen <catouc@philipp.boeschen.me>
  • Loading branch information
catouc committed May 17, 2022
1 parent e2b30db commit 8476947
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions pkg/util/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,28 @@ func SetStatusConditions(ctx context.Context, client runtimeclient.StatusClient,
switch obj := runtimeObj.(type) {
case *kedav1alpha1.ScaledObject:
patch = runtimeclient.MergeFrom(obj.DeepCopy())
obj.Status.Conditions = *conditions
for _, c := range *conditions {
switch c.Type {
case kedav1alpha1.ConditionActive:
obj.Status.Conditions.SetActiveCondition(c.Status, c.Reason, c.Message)
case kedav1alpha1.ConditionReady:
obj.Status.Conditions.SetReadyCondition(c.Status, c.Reason, c.Message)
case kedav1alpha1.ConditionFallback:
obj.Status.Conditions.SetFallbackCondition(c.Status, c.Reason, c.Message)
}
}
case *kedav1alpha1.ScaledJob:
patch = runtimeclient.MergeFrom(obj.DeepCopy())
obj.Status.Conditions = *conditions
for _, c := range *conditions {
switch c.Type {
case kedav1alpha1.ConditionActive:
obj.Status.Conditions.SetActiveCondition(c.Status, c.Reason, c.Message)
case kedav1alpha1.ConditionReady:
obj.Status.Conditions.SetReadyCondition(c.Status, c.Reason, c.Message)
case kedav1alpha1.ConditionFallback:
obj.Status.Conditions.SetFallbackCondition(c.Status, c.Reason, c.Message)
}
}
default:
err := fmt.Errorf("unknown scalable object type %v", obj)
return err
Expand Down

0 comments on commit 8476947

Please sign in to comment.