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

implementation is not matching the cwnp spec #73

Open
mwennrich opened this issue Feb 12, 2021 · 5 comments
Open

implementation is not matching the cwnp spec #73

mwennrich opened this issue Feb 12, 2021 · 5 comments
Assignees

Comments

@mwennrich
Copy link
Contributor

CRD describes spec.egress.port as numerical or named port ( https://github.com/metal-stack/firewall-controller/blob/master/config/crd/bases/metal-stack.io_clusterwidenetworkpolicies.yaml#L65-L72 ) while in validator only int ports are supported (

func validatePorts(ports []networking.NetworkPolicyPort) *multierror.Error {
var errors *multierror.Error
for _, p := range ports {
if p.Port != nil && p.Port.Type != intstr.Int {
errors = multierror.Append(errors, fmt.Errorf("only int ports are supported, but %v given", p.Port))
}
)

@GrigoriyMikhalkin GrigoriyMikhalkin self-assigned this Apr 11, 2021
@GrigoriyMikhalkin
Copy link
Contributor

@mwennrich If i'm correct, egress and ingress fields specify IPs(or subnets) outside of cluster, from which traffic is allowed. Does it even makes sense to allow to specify named port? Probably a better solution would be to replace NetworkPolicyPort fields with custom port field that would be always int.

@majst01
Copy link
Contributor

majst01 commented Apr 12, 2021

egress is for communication with outside endpoints, ingress for communication with inside endpoints.

@GrigoriyMikhalkin
Copy link
Contributor

GrigoriyMikhalkin commented Apr 12, 2021

@majst01 Yep, i got that) What i meant is that, both for egress and ingress rules we specify addresses outside of cluster, so named ports don't even make sense for that case. So, for cleanliness, it's probably better to introduce our custom structure for ports. That would be backwards compatible with NetworkPolicyPort(except that it would only allow int type for ports).

@GrigoriyMikhalkin
Copy link
Contributor

Maybe i misunderstood this. Comment to ports field says:

List of ports which should be made accessible on the cluster for this rule

So, does it mean that ports field lists ports of services in cluster?

@majst01
Copy link
Contributor

majst01 commented Apr 15, 2021

So at least description must be adopted

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

No branches or pull requests

3 participants