Skip to content

Commit

Permalink
Show actual log during custom wait rule if asked specifically
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Aggarwal <[email protected]>
  • Loading branch information
rohitagg2020 committed Dec 8, 2024
1 parent 52d3484 commit ac0ceea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/kapp/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type WaitRuleConditionMatcher struct {
SupportsObservedGeneration bool
UnblockChanges bool
Timeout string
ShowActualMessage bool
}

type WaitRuleYtt struct {
Expand Down
6 changes: 5 additions & 1 deletion pkg/kapp/resourcesmisc/custom_waiting_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func (s CustomWaitingResource) IsDoneApplying() DoneApplyState {
}

unblockChangeMsg := ""
actualMsg := "No failing or successful conditions found"

// If no failure conditions found, check on successful ones
for _, condMatcher := range s.waitRule.ConditionMatchers {
Expand All @@ -151,6 +152,9 @@ func (s CustomWaitingResource) IsDoneApplying() DoneApplyState {
cond.Type, condMatcher.Status, cond.Reason)
continue
}
if condMatcher.ShowActualMessage && cond.Message != "" {
actualMsg = cond.Message
}
}
}
}
Expand All @@ -164,7 +168,7 @@ func (s CustomWaitingResource) IsDoneApplying() DoneApplyState {
return DoneApplyState{Done: false, UnblockChanges: true, Message: unblockChangeMsg}
}

return DoneApplyState{Done: false, Message: "No failing or successful conditions found"}
return DoneApplyState{Done: false, Message: actualMsg}
}

func (s CustomWaitingResource) hasTimeoutOccurred(timeout string, key string) bool {
Expand Down

0 comments on commit ac0ceea

Please sign in to comment.