Skip to content

Update to the API changes for ClusterNetworkPolicy#303

Merged
k8s-ci-robot merged 6 commits into
kubernetes-sigs:mainfrom
bowei:pr-update-new-api
Feb 25, 2026
Merged

Update to the API changes for ClusterNetworkPolicy#303
k8s-ci-robot merged 6 commits into
kubernetes-sigs:mainfrom
bowei:pr-update-new-api

Conversation

@bowei

@bowei bowei commented Jan 30, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 30, 2026
@bowei bowei marked this pull request as draft January 30, 2026 19:55
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 30, 2026

@danwinship danwinship left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

need to update go.mod

}
} else {
// If DestinationPort is nil, it means all TCP ports are allowed.
return true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If DestinationPort is nil, then the policy is invalid. In the future, if/when we add something like flags, this clause will still not be correct. So just remove this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Missed this comment, let me check that I incorporated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it makes sense now... if we add flags in the future, there'd be a second

if matchTCPFlags(policyProtocol.TCP.Flags, tcpFlags) {
	return true
}

here, which would also do "if nil { return true }". And then if either property was filled in, it would get checked, and if it wasn't, then it wouldn't.

Comment thread plugins/npa-v1alpha2/clusternetworkpolicy_test.go Outdated
Comment thread plugins/npa-v1alpha2/clusternetworkpolicy_test.go Outdated
@bowei bowei force-pushed the pr-update-new-api branch from 849c9b4 to 74e1baf Compare February 6, 2026 23:11
@bowei bowei force-pushed the pr-update-new-api branch from 74e1baf to 926433a Compare February 6, 2026 23:24
@bowei bowei marked this pull request as ready for review February 10, 2026 17:12
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 10, 2026

@danwinship danwinship left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

}
} else {
// If DestinationPort is nil, it means all TCP ports are allowed.
return true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it makes sense now... if we add flags in the future, there'd be a second

if matchTCPFlags(policyProtocol.TCP.Flags, tcpFlags) {
	return true
}

here, which would also do "if nil { return true }". And then if either property was filled in, it would get checked, and if it wasn't, then it wouldn't.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 10, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bowei, danwinship

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 10, 2026
@danwinship

Copy link
Copy Markdown
Contributor

@bowei you need to update the policies in tests/*.bats and ./install-iptracker.yaml

@aojea

aojea commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

@bowei can you finish so we get the CI green?
I have some updated blocked on ci

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 20, 2026
@bowei

bowei commented Feb 20, 2026

Copy link
Copy Markdown
Contributor Author

investigating the failed e2e

@aojea

aojea commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

it times out on SCTP

TestConformanceProfiles/CNPBaselineTierEgressSCTP/Should_support_an_'deny-egress'_policy_for_SCTP_protocol;_ensure_rule_ordering_is_respected (3s)

is it possible that is related to the protocol and we forget about SCTP and only aadded UDP and TCP?

@bowei

bowei commented Feb 23, 2026

Copy link
Copy Markdown
Contributor Author

We were doing some experiments and it seems like the SCTP tests pass when run in isolation. Trying to pin down why it is failing.

@bowei

bowei commented Feb 24, 2026

Copy link
Copy Markdown
Contributor Author

It seems like increasing the timeout fixed the tests.

@bowei

bowei commented Feb 25, 2026

Copy link
Copy Markdown
Contributor Author

/test

@bowei

bowei commented Feb 25, 2026

Copy link
Copy Markdown
Contributor Author

/test pull-kube-network-policies-iptracker
/test pull-kube-network-policies-nftables-ipv6

@aojea

aojea commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

It seems like increasing the timeout fixed the tests.

previously it run in ~12 mins and now it runs in ~21 mins https://github.com/kubernetes-sigs/kube-network-policies/actions/workflows/.github/workflows/npa.yml

what have we changed? did we add more tests?

checking new https://github.com/kubernetes-sigs/kube-network-policies/actions/runs/22374201653/job/64760904901?pr=303 vs old https://github.com/kubernetes-sigs/kube-network-policies/actions/runs/21652851118/job/62421538562

gemini analysis

Metric Run 1 Run 2 Difference
Total Test Duration 381.879s (~6.3 min) 892.664s (~14.8 min) +133% (Over 2x slower)
Gress Test Group 55.87s 129.71s +73.84s
Individual Subtests ~3.10s avg ~7.20s avg Significantly higher latency
  1. Command-Line Arguments
    The test command was modified to include a timeout, likely to accommodate the slower execution:

Run 1: Standard go test arguments.

Run 2: Added --timeout 20m.

Note: Without this addition, Run 2 might have reached the default Go test timeout (10m), causing a failure.

  1. Log Line References
    The internal file line numbers for the helper.go log messages have shifted, indicating the second run likely used a slightly different version of the testing code or a different build of the network-policy-api repository.

Run 1: StatefulSet rollout logs were at helper.go:123.

Run 2: StatefulSet rollout logs moved to helper.go:137.

  1. Setup & Rollout Behavior
    In the setup phase where the "Harry Potter" themed namespaces and pods are created:

Run 1: Only monitored the gryffindor namespace until ready.

Run 2: Included an extra log line for the ravenclaw namespace (1/2 replicas available) before declaring the cluster ready.

Result: Run 2 took slightly longer to reach a "Ready" state for the base manifests.

@npinaeva

npinaeva commented Feb 25, 2026

Copy link
Copy Markdown
Member

n, Run 2 might have reac

Sorry forgot to mention it in the PR description.
We have added retries to make the tests more reliable kubernetes-sigs/network-policy-api#353
some more details here https://kubernetes.slack.com/archives/C01CWSHQWQJ/p1770983726167229

@npinaeva

Copy link
Copy Markdown
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 25, 2026
@k8s-ci-robot k8s-ci-robot merged commit 6fa497e into kubernetes-sigs:main Feb 25, 2026
25 of 27 checks passed
@aojea

aojea commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

great

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants