Repository navigation
ci: enforce NetworkPolicies in Kind test clusters - #4172
Conversation
Kind's default CNI (kindnet) does not enforce NetworkPolicies, so the NetworkPolicies shipped by the Operator were silently ignored and the upstream tests could pass even when the policies were wrong or incomplete. Create the Kind clusters with the default CNI disabled and install Calico before running the integration, E2E, and upgrade tests. Calico is pinned to a release tested against the Kubernetes version shipped by the kind-action used in these workflows. Assisted-by: OpenCode Signed-off-by: Armel Soro <asoro@redhat.com>
…-debt-set-up-test-kind-clusters-with-networkpolicy-enforcement-in-upstream-chart-and-operator-repos
|
/cherrypick release-2.1 |
|
@rm3l: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Pin the protocol on the curl call that fetches the Calico manifest so redirects cannot downgrade to an insecure scheme (SonarCloud shell:S6506). Assisted-by: OpenCode Signed-off-by: Armel Soro <asoro@redhat.com>
|
|
/agentic_review |
|
CI-only change. Merging for 2.1.1 (CF today) |
|
@rm3l: new pull request created: #4230 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |



Description
Kind's default CNI (
kindnet) does not enforceNetworkPolicyobjects, so the NetworkPolicies shipped by the Operator were silently ignored in the upstream tests. Tests could pass even when the policies were wrong or incomplete.This changes the test Kind clusters to:
networking.disableDefaultCNI: true,networking.podSubnet: "192.168.0.0/16")hack/install-calico.shhelm/kind-action, since nodes stayNotReadyuntil a CNI is installedCalico is pinned to
v3.31.7, which is tested against the Kubernetes 1.32 shipped by the kind-action used in these workflows. The script refuses to run ifkindnetis still present.This applies to the integration, E2E, operator upgrade, and PostgreSQL upgrade Kind clusters (
pr.yaml,nightly.yaml,nightly-upgrade-test.yaml,nightly-postgresql-upgrade-test.yaml).Which issue(s) does this PR fix or relate to
PR acceptance criteria
How to test changes / Special notes to the reviewer
CI now runs the upstream tests with NetworkPolicies actually enforced. Since the Operator ships a
default-denypolicy for the Backstage pod, any missing allow rule will now surface as a failing test instead of passing silently.To reproduce locally:
kind create cluster --config hack/kind-config.yaml --wait 0 ./hack/install-calico.sh make test-e2e \ BACKSTAGE_OPERATOR_TESTS_BUILD_IMAGES=true \ BACKSTAGE_OPERATOR_TESTS_PLATFORM=kindI validated the CNI setup on disposable clusters: a
default-denypolicy blocks pod traffic and an explicit allow rule restores it, on both Kubernetes 1.32 (Calico 3.31.7) and Kubernetes 1.37 (Calico 3.33.1).Container Images
No container images are affected by this change.