Skip to content

Improve NodePort test readiness and diagnostics - #502

Open
dajudge wants to merge 6 commits into
masterfrom
stability-nodeport-diagnostics
Open

Improve NodePort test readiness and diagnostics#502
dajudge wants to merge 6 commits into
masterfrom
stability-nodeport-diagnostics

Conversation

@dajudge

@dajudge dajudge commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • wait for the nginx pod to become Ready before starting the NodePort connectivity timeout
  • wait for the Service to have a ready endpoint before probing the mapped host port
  • on failure, log pod, service, endpoints, node state, and the mapped host port
  • probe both the pod IP and NodePort from inside the Kubernetes container
  • dump relevant iptables/nft rules when available

This separates workload/service readiness from NodePort forwarding and should make intermittent CI failures both less likely and much easier to classify.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T12:17:58.481573Z 2472e30 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d93fa31c83

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

.endSpec()
.build()));

waitForPodAndServiceEndpoint(k8s, pod, service);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include readiness waits in the diagnostic catch

When the pod never becomes Ready or the Service never receives an endpoint, either newly added Awaitility wait throws before entering this try, so logNodePortDiagnostics is skipped. Those are precisely the failures where pod, endpoint, and node state would be most useful; wrap the readiness call in the same failure-handling block so all post-creation failures collect diagnostics.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Good catch. I moved the pod/endpoint readiness waits into the same guarded block as the NodePort probe, so any post-creation failure now collects the diagnostics before rethrowing.

dajudge commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 902bf80317

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

.get());
});
LOG.warn("NodePort diagnostics - last host probe result: {}", lastHostProbeResult.get());
logNodePortDiagnostics(k8s, pod, service);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the original failure when diagnostics fail

When readiness fails because the API server or container has become unavailable, logNodePortDiagnostics immediately performs unguarded Kubernetes API calls and later container execs; a resulting runtime exception replaces the original timeout and prevents the remaining best-effort diagnostics from running. Catch and log failures from each diagnostic operation before rethrowing the saved exception so CI reports the actual test failure.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Agreed. Diagnostics are now best-effort: Kubernetes API collection is guarded, Docker inspection already was, and container exec failures (including runtime failures) are caught individually. The original test exception is always rethrown unchanged after diagnostics.

dajudge commented Sep 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 2472e3079a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant