Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for API version v1beta2 #1

Merged
merged 6 commits into from
Oct 24, 2024
Merged

Add support for API version v1beta2 #1

merged 6 commits into from
Oct 24, 2024

Conversation

nkinkade
Copy link

The only difference between v1beta2 and v1beta1, apparently, is the addition of endPort for port specifications, allowing the port ranges. There is an open PR for these changes with the upstream repo, but it is not clear that it will ever get merged.

The changeset in this PR represents the version of multi-networkpolicy that is currently running in sandbox and staging, and this PR is just trying to normalize the deployment from this repo instead of upstream.

This is purely the results of running `go mod tidy` and `go mod vendor`. The
only reason for doing this is to update the module
github.com/k8snetworkplumbingwg/multi-networkpolicy to a version in which
v1beta2 is supported.
This commit updates all references to the import to use the new import alias of
"v1beta2" and "multiinformerv1beta2".

Additionally, there are 5 or 6 small changes suggested by the Go linter in
vscode.
This commit simply adds a small conditional checking whether port.EndPort is
not nil, in which case it writes the iptable rule with flag `--dport N:N`, else
it write the same iptables rule as before.
Verfies that a port specification which includes endPort writes the expected
iptables rule with `--dport N:N`, and that one that doesn't include endPort
writes the normal iptables rule with `--dport N`.
This was an oversight on my part, as our use case only requires ingress rules,
but the functionality needs to be available for both ingress and egress rules.

Additionally, I reformated the logic, per PR reviewer suggestions, to eliminate
some redudnacy and make the code cleaner and more readable.
@nkinkade nkinkade requested review from stephen-soltesz and robertodauria and removed request for stephen-soltesz October 24, 2024 16:42
@nkinkade nkinkade merged commit 93bc6c7 into master Oct 24, 2024
1 check passed
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.

2 participants