Skip to content

validate_workload: don't fail on scaled-to-zero workloads or vanished pods#1252

Open
xinWeiWei24 wants to merge 2 commits into
v2from
xinwei/validateworkload_emptyds
Open

validate_workload: don't fail on scaled-to-zero workloads or vanished pods#1252
xinWeiWei24 wants to merge 2 commits into
v2from
xinwei/validateworkload_emptyds

Conversation

@xinWeiWei24

Copy link
Copy Markdown
Collaborator

No description provided.

# The pod list is a snapshot; a pod may be deleted before we inspect it
# (e.g. rollout, eviction, completed Job pod). A gone pod is not a failure,
# so skip it instead of reporting an empty phase.
if ! kubectl -n "${namespace}" get pod "$pod" -o name >/dev/null 2>&1; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this run into an infinite loop if pods are deleted during the check

# The pod list is a snapshot; a pod may be deleted before we inspect it
# (e.g. rollout, eviction, completed Job pod). A gone pod is not a failure,
# so skip it instead of reporting an empty phase.
if ! kubectl -n "${namespace}" get pod "$pod" -o name >/dev/null 2>&1; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you only use kubectl get pod, it is possible to do this? dump all the required info of all pods into a json file, then look up the json file to decide. In this case you only talk to kube-apiserver once, thus avoids the inconsistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants