diff --git a/pkg/kapp/resourcesmisc/custom_waiting_resource.go b/pkg/kapp/resourcesmisc/custom_waiting_resource.go index d1a3ef3f2..110ea5689 100644 --- a/pkg/kapp/resourcesmisc/custom_waiting_resource.go +++ b/pkg/kapp/resourcesmisc/custom_waiting_resource.go @@ -97,7 +97,7 @@ func (s CustomWaitingResource) IsDoneApplying() DoneApplyState { if condMatcher.Timeout != "" { isTimeOutConditionPresent = true - if s.hasTimeoutOccurred(condMatcher.Timeout, fmt.Sprintf("%s.%s", s.resource.Namespace(), s.resource.Name())) { + if s.hasTimeoutOccurred(condMatcher.Timeout, s.resource.Description()) { return DoneApplyState{Done: true, Successful: false, Message: fmt.Sprintf( "Encountered failure condition %s == %s: %s (message: %s) continuously for %s duration", cond.Type, condMatcher.Status, cond.Reason, cond.Message, condMatcher.Timeout)} @@ -115,9 +115,10 @@ func (s CustomWaitingResource) IsDoneApplying() DoneApplyState { } } - // Reset the timer in case timeout condition flipped from being present to not present in the Cluster resource status - if !isTimeOutConditionPresent { - timeoutMap.Delete(fmt.Sprintf("%s.%s", s.resource.Namespace(), s.resource.Name())) + // Reset the timer in case timeout condition flipped from being present to not present in the Cluster resource status. + // Reset should only happen if condMatcher has timeout. Otherwise, it is possible that condMatcher which dont have timeout will try to reset the map. + if condMatcher.Timeout != "" && !isTimeOutConditionPresent { + timeoutMap.Delete(s.resource.Description()) continue } } diff --git a/test/e2e/wait_timeout_test.go b/test/e2e/wait_timeout_test.go index 29e4ac5e0..b6b4ccecb 100644 --- a/test/e2e/wait_timeout_test.go +++ b/test/e2e/wait_timeout_test.go @@ -50,12 +50,12 @@ kind: Config waitRules: - supportsObservedGeneration: true conditionMatchers: - - type: ContainersReady - status: "False" - timeout: 50s - type: Ready status: "True" success: true + - type: ContainersReady + status: "False" + timeout: 50s resourceMatchers: - apiVersionKindMatcher: {apiVersion: v1, kind: Pod} `