Skip to content

Commit fe9e63b

Browse files
authored
Merge pull request #346 from ordovicia/fix-timeout-handling
Fix validation and application timeout handling
2 parents 185ba32 + 871c2a1 commit fe9e63b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

controllers/kustomization_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,8 @@ func (r *KustomizationReconciler) validate(ctx context.Context, kustomization ku
611611
command := exec.CommandContext(applyCtx, "/bin/sh", "-c", cmd)
612612
output, err := command.CombinedOutput()
613613
if err != nil {
614-
if errors.Is(err, context.DeadlineExceeded) {
615-
return fmt.Errorf("validation timeout: %w", err)
614+
if errors.Is(applyCtx.Err(), context.DeadlineExceeded) {
615+
return fmt.Errorf("validation timeout: %w", applyCtx.Err())
616616
}
617617
return fmt.Errorf("validation failed: %s", parseApplyError(output))
618618
}
@@ -651,8 +651,8 @@ func (r *KustomizationReconciler) apply(ctx context.Context, kustomization kusto
651651
command := exec.CommandContext(applyCtx, "/bin/sh", "-c", cmd)
652652
output, err := command.CombinedOutput()
653653
if err != nil {
654-
if errors.Is(err, context.DeadlineExceeded) {
655-
return "", fmt.Errorf("apply timeout: %w", err)
654+
if errors.Is(applyCtx.Err(), context.DeadlineExceeded) {
655+
return "", fmt.Errorf("apply timeout: %w", applyCtx.Err())
656656
}
657657

658658
if string(output) == "" {

0 commit comments

Comments
 (0)