From 871c2a14bf2dd81c41b2b8db4c2309c518a47a5e Mon Sep 17 00:00:00 2001 From: Hidehito Yabuuchi Date: Tue, 18 May 2021 17:44:38 +0900 Subject: [PATCH] Fix validation and application timeout handling Signed-off-by: Hidehito Yabuuchi --- controllers/kustomization_controller.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/controllers/kustomization_controller.go b/controllers/kustomization_controller.go index 5bf8f897..3a05106e 100644 --- a/controllers/kustomization_controller.go +++ b/controllers/kustomization_controller.go @@ -611,8 +611,8 @@ func (r *KustomizationReconciler) validate(ctx context.Context, kustomization ku command := exec.CommandContext(applyCtx, "/bin/sh", "-c", cmd) output, err := command.CombinedOutput() if err != nil { - if errors.Is(err, context.DeadlineExceeded) { - return fmt.Errorf("validation timeout: %w", err) + if errors.Is(applyCtx.Err(), context.DeadlineExceeded) { + return fmt.Errorf("validation timeout: %w", applyCtx.Err()) } return fmt.Errorf("validation failed: %s", parseApplyError(output)) } @@ -651,8 +651,8 @@ func (r *KustomizationReconciler) apply(ctx context.Context, kustomization kusto command := exec.CommandContext(applyCtx, "/bin/sh", "-c", cmd) output, err := command.CombinedOutput() if err != nil { - if errors.Is(err, context.DeadlineExceeded) { - return "", fmt.Errorf("apply timeout: %w", err) + if errors.Is(applyCtx.Err(), context.DeadlineExceeded) { + return "", fmt.Errorf("apply timeout: %w", applyCtx.Err()) } if string(output) == "" {