-
Notifications
You must be signed in to change notification settings - Fork 39
Implements option #3 (npep-187: More protocols support) #347
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for kubernetes-sigs-network-policy-api ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: bowei The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
5d51a1c to
c347f62
Compare
Example (from kubernetes-sigs#297) apiVersion: policy.networking.k8s.io/v1alpha2 kind: ClusterNetworkPolicy metadata: name: cluster-wide-deny spec: tier: Admin priority: 0 subject: namespaces: matchLabels: kubernetes.io/metadata.name: sensitive-ns ingress: - action: Deny name: select-all-deny-all from: - pods: namespaceSelector: matchLabels: {} podSelector: matchLabels: {} protocols: - tcp: destinationPort: number: 8080 flags: [syn] # future extension example - tcp: destinationPort: range: start: 8080 end: 9090 - udp: destinationPort: number: 8080 - udp: destinationPort: number: 9090 - namedPort: http - namedPort: monitoring - icmp: # that doesn't exist yet, but may be added type: 7 code: 3
|
@bowei: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions 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. I understand the commands that are listed here. |
| // if empty, it selects all Pods. | ||
| PodSelector metav1.LabelSelector `json:"podSelector"` | ||
| // UDP specific protocol matches. | ||
| UDP *ClusterNetworkPolicyProtocolUDP `json:"udp,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sctp?
| // | ||
| Protocol corev1.Protocol `json:"protocol"` | ||
| // ClusterNetworkPolicyProtocolTCP are TCP attributes to be matched. | ||
| type ClusterNetworkPolicyProtocolTCP struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can have one definition for now for tcp, udp and sctp? and then we can split if needed in the future
|
|
||
| // NamespacedPod allows the user to select a given set of pod(s) in | ||
| // selected namespace(s). | ||
| type NamespacedPod struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you move it here?
| // DestinationNamedPort selects a destination port on a pod based on the | ||
| // ContainerPort name. You can't use this in a rule that targets resources | ||
| // without named ports (e.g. Nodes or Networks). | ||
| DestinationNamedPort *ClusterNetworkPolicyProtocolNamedPort `json:"destinationNamedPort,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this just be string? also if empty string is not a valid value, we don't need a pointer https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#serialization-of-custom-resources?
| // +kubebuilder:validation:Maximum=65535 | ||
| // | ||
| Port int32 `json:"port"` | ||
| Number *int32 `json:"number,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also a question about pointer vs non-pointer
Changes to implement option #3 for the port matching
Example (from #297)