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

Accept protocol = ICMP on ClusterNetworkPolicies #3263

Closed
jsalatiel opened this issue Jan 27, 2022 · 15 comments · Fixed by #3472
Closed

Accept protocol = ICMP on ClusterNetworkPolicies #3263

jsalatiel opened this issue Jan 27, 2022 · 15 comments · Fixed by #3472
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@jsalatiel
Copy link

Describe the problem/challenge you have
I would like to allow ping as a ClusterNetworkPolicy.
Unfortunatelly ICMP is not supported yet.

Describe the solution you'd like
Accept protocol: ICMP on ClusterNetworkPolicy and maybe icmpType to describe the ICMP code allowed.

The current behaviour is wrong as explained here #3262.

@jsalatiel jsalatiel added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 27, 2022
@jsalatiel
Copy link
Author

jsalatiel commented Jan 27, 2022

I ask this because even if k8s default netpol does not support it, calico GlobalNetworkPolicies do support it. And that helps a lot debugging connectivity.

@Dyanngg
Copy link
Contributor

Dyanngg commented Jan 28, 2022

@GraysonWu Could you share some insights / do some scope investigation? Thanks

@jsalatiel
Copy link
Author

@GraysonWu could you please share your insights on this? Is this change hard to implement? ( No developer here )

@GraysonWu
Copy link
Contributor

GraysonWu commented Feb 9, 2022

Sorry for the late response. Somehow I missed this message.
From my understanding, it won't be hard to implement on our data path. OVS already has ICMP matching support.
Most work would be from the API perspective. Let me take another look and get a doc to discuss the implementation detail of this issue.

@jsalatiel
Copy link
Author

@GraysonWu will that doc be publicly available?😅

@GraysonWu
Copy link
Contributor

@jsalatiel After a few round discussions offline we got some ideas and here is the doc: https://docs.google.com/document/d/1TnAhJh-8-5XEU-wYetL5zQu_aVsXgItPWudpTmoPnaI/edit?usp=sharing
Feel free to leave a comment.

@jsalatiel
Copy link
Author

jsalatiel commented Mar 7, 2022

Hi @GraysonWu , I've read the documentation. Just perfect!
Thanks!

@jsalatiel
Copy link
Author

@GraysonWu In which release can icmp support be expected then? 😅

@GraysonWu
Copy link
Contributor

I'd like to say in 1.7

@GraysonWu
Copy link
Contributor

Had another round of discussion in the community meeting. We decided not to remove ports field. Users are familiar with ports field, and the usage of ICMP is much smaller than other protocols. If users want to use ICMP or they prefer the new struct, they could choose to use Protocols as an advanced feature. Otherwise, they could keep using ports. Also, in this way, we don’t need to bump up the API version.

type Rule struct {
   Action    *RuleAction
   Ports []NetworkPolicyPort
   Protocols []Protocol
   ...
}

type Protocol struct {
   TCP *L4Protocol
   UDP *L4Protocol
   SCTP *L4Protocol
   ICMP *ICMPProtocol
}

type L4Protocol struct {
   Port *intstr.IntOrString
   EndPort *int32
}

type ICMPProtocol struct {
   ICMPType *int32
   ICMPCode *int32
}

@jsalatiel
Copy link
Author

jsalatiel commented Mar 30, 2022

@GraysonWu Understood, tks! Probably not having to bump up the api version is a good thing.
What exactly would be the syntax to allow ECHO REQUESTS ( ping ) then ? if you can add an example it would be great.

@GraysonWu
Copy link
Contributor

GraysonWu commented Mar 30, 2022

@jsalatiel NP. This is an example.

ingress:
- action: allow
  protocols:
  - icmp:   // matching Ping request
       icmpType: 8
       icmpCode: 0

@jsalatiel
Copy link
Author

Thanks!, @GraysonWu
Still targeted for 1.7 release?

@GraysonWu
Copy link
Contributor

Thanks!, @GraysonWu Still targeted for 1.7 release?

Yes.

@jsalatiel
Copy link
Author

@GraysonWu when it gets merged to master I will deploy the latest image in my test environment, do several tests, and let you know if I see any problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
3 participants