Repository navigation
docs: explain hostNetwork port defaulting in C-0044 and C-0204 - #205
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
matthyx
left a comment
There was a problem hiding this comment.
Reviewed head d61da83 against main (74e4b2e; PR is 11 commits behind).
Verdict: request changes (one project-policy blocker; content itself looks correct).
Content check: The docs now match the policy YAML. C-0044 and C-0204 both deny a nonzero hostPort. For hostNetwork Pods they also deny a nonzero containerPort when hostPort is omitted or 0. Both check init containers. C-0204 additionally matches pods/ephemeralcontainers and includes ephemeral containers. This resolves #189. No duplicate or superseded PR found: #188 is the code change this follows, #134 and #140 are the related history, and none were rejected. The author has 3 open PRs (#205–#207), which is within the policy.
Blocker – Before/After proof missing (policy): The description lists what was verified but gives no before/after comparison using the same command and input. Please add, for example, the kubectl apply --dry-run=server -o yaml output for the same host-networked Pod and Deployment template showing hostPort defaulted on the Pod and unset on the template. Alternatively, show the previous C-0204 text claiming hostPort: 0 is allowed next to the corrected behavior.
CI: test-all-policies is red on d61da83, but the failure is unrelated to this docs-only diff. The failed tests are controls/C-0050 and the privileged runtime policy, and the base f29cc53 failed the same way (main-policy-automation run on that commit). The last three main runs are green. Please rebase onto main and get a green run. I did not approve any workflow runs or run tests locally.
Nonblocking: None to track.
Signed-off-by: Gaurav Chaudhary <chaudharygaurav2004@gmail.com>
d61da83 to
2af14b4
Compare
matthyx
left a comment
There was a problem hiding this comment.
Re-reviewed head 2af14b4 against main (4bd6dec). The PR is rebased, the docs match the C-0044/C-0204 policy behavior (nonzero hostPort denied; host-networked Pods with a nonzero containerPort denied via API defaulting; templates not defaulted; C-0204 also covers ephemeral containers), and it resolves #189. The description now has Before/After proof, and main-policy-automation is green on this commit. No blockers. Not rerun: the kind admission cases after the rebase (docs-only diff).
Fixes #189. Follow-up to #188.
What changed
Explain that Kubernetes defaults an omitted or zero
hostPorttocontainerPorton regular and init containers in host-networked Pods. Both controls deny those port declarations. The pages now clarify that workload templates are evaluated before this Pod-specific default takes effect.Correct the C-0204 comparison with C-0044. Both policies check init containers and treat zero
hostPortthe same way. C-0204 also matchespods/ephemeralcontainersupdates.Verification
hostPortdefaulting for omitted and explicit-zero values on Pods and for an init container port. The Deployment template'shostPortremained unset.git diff --checkpassed.Before and after
Compared the same C-0204 Markdown page on
main(4bd6dec) and the rebased PR (2af14b4).hostPort: 0was allowed without distinguishing a host-networked Pod from a workload template.hostPortto its nonzerocontainerPort, so the policy denies that Pod. A workload template does not receive this Pod-specific default.On the rebased branch, both updated pages rendered with Pandoc,
git diff --checkpassed, and all 14 test-runner unit tests passed. I did not repeat the Kubernetes admission runs from the original verification after the rebase.Summary by CodeRabbit
hostPortvalues.pods/ephemeralcontainers.