Fix validation and application timeout handling

Signed-off-by: Hidehito Yabuuchi <hdht.ybuc@gmail.com>
This commit is contained in:
Hidehito Yabuuchi 2021-05-18 17:44:38 +09:00
parent 185ba3216f
commit 871c2a14bf
1 changed files with 4 additions and 4 deletions

View File

@ -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) == "" {