fix: clean stuck argo hook image pull jobs
This commit is contained in:
@@ -503,8 +503,12 @@ export function nodeRuntimeSync(scoped: ReturnType<typeof parseNodeScopedDelegat
|
||||
" tracking=$(kubectl -n \"$runtime_namespace\" get \"$job\" -o go-template='{{ index .metadata.annotations \"argocd.argoproj.io/tracking-id\" }}' 2>/dev/null || true)",
|
||||
" failed=$(kubectl -n \"$runtime_namespace\" get \"$job\" -o go-template='{{ range .status.conditions }}{{ if or (eq .type \"Failed\") (eq .type \"FailureTarget\") }}{{ .status }} {{ end }}{{ end }}' 2>/dev/null || true)",
|
||||
" case \"$tracking\" in \"$app:\"*) ;; *) continue ;; esac",
|
||||
" case \"$failed\" in *True*) ;; *) continue ;; esac",
|
||||
" hook_name=${job#job.batch/}",
|
||||
" waiting=$(kubectl -n \"$runtime_namespace\" get pod -l \"job-name=$hook_name\" -o 'jsonpath={range .items[*].status.containerStatuses[*]}{.state.waiting.reason}{\" \"}{end}' 2>/dev/null || true)",
|
||||
" case \"$failed\" in",
|
||||
" *True*) ;;",
|
||||
" *) case \"$waiting\" in *ImagePullBackOff*|*ErrImagePull*|*CrashLoopBackOff*) ;; *) continue ;; esac ;;",
|
||||
" esac",
|
||||
" failed_hook_count=$((failed_hook_count + 1))",
|
||||
" if [ -z \"$failed_hooks\" ]; then failed_hooks=$hook_name; else failed_hooks=$failed_hooks,$hook_name; fi",
|
||||
" if [ \"$dry_run\" = false ]; then",
|
||||
|
||||
Reference in New Issue
Block a user