Skip to content

ci: enforce NetworkPolicies in Kind test clusters - #4172

Merged
rm3l merged 3 commits into
redhat-developer:mainfrom
rm3l:RHDHBUGS-4068--tech-debt-set-up-test-kind-clusters-with-networkpolicy-enforcement-in-upstream-chart-and-operator-repos
Nov 30, 2026
Merged

rm3l merged 3 commits into
redhat-developer:mainfrom
rm3l:RHDHBUGS-4068--tech-debt-set-up-test-kind-clusters-with-networkpolicy-enforcement-in-upstream-chart-and-operator-repos

Conversation

@rm3l

@rm3l rm3l commented Nov 23, 2026

Copy link
Copy Markdown
Member

Description

Kind's default CNI (kindnet) does not enforce NetworkPolicy objects, 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:

  • disable the default CNI (networking.disableDefaultCNI: true, networking.podSubnet: "192.168.0.0/16")
  • install Calico before running the tests via the new hack/install-calico.sh
  • skip the premature node wait in helm/kind-action, since nodes stay NotReady until a CNI is installed

Calico 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 if kindnet is 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

  • Tests
  • Documentation

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-deny policy 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=kind

I validated the CNI setup on disposable clusters: a default-deny policy 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.

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>
Comment thread hack/install-calico.sh Fixed
…-debt-set-up-test-kind-clusters-with-networkpolicy-enforcement-in-upstream-chart-and-operator-repos
@rm3l

rm3l commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

/cherrypick release-2.1

@openshift-cherrypick-robot

Copy link
Copy Markdown
Contributor

@rm3l: once the present PR merges, I will cherry-pick it on top of release-2.1 in a new PR and assign it to you.

Details

In response to this:

/cherrypick release-2.1

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>
@sonarqubecloud

Copy link
Copy Markdown

@rm3l

rm3l commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

/agentic_review

@rm3l
rm3l marked this pull request as ready for review November 26, 2026 18:04
@rm3l
rm3l requested a review from a team as a code owner November 26, 2026 18:04
@rm3l

rm3l commented Nov 30, 2026

Copy link
Copy Markdown
Member Author

CI-only change. Merging for 2.1.1 (CF today)

@rm3l
rm3l merged commit 93da5b3 into redhat-developer:main Nov 30, 2026
17 of 18 checks passed
@rm3l
rm3l deleted the RHDHBUGS-4068--tech-debt-set-up-test-kind-clusters-with-networkpolicy-enforcement-in-upstream-chart-and-operator-repos branch November 30, 2026 12:46
@openshift-cherrypick-robot

Copy link
Copy Markdown
Contributor

@rm3l: new pull request created: #4230

Details

In response to this:

/cherrypick release-2.1

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.

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.

3 participants