kubernetes-sigs / gateway-api

Repository for the next iteration of composite service (e.g. Ingress) and load balancing APIs.
https://gateway-api.sigs.k8s.io
Apache License 2.0
1.75k stars 453 forks source link

Make gwctl work with Policies having multiple targetRefs #3196

Open gauravkghildiyal opened 1 month ago

gauravkghildiyal commented 1 month ago

As per recent updates to the Policy related GEPs in https://github.com/kubernetes-sigs/gateway-api/discussions/2927#discussioncomment-8991869, Policies are now allowed to target multiple resources i.e. targetRefs (which previously was limited to a single targetRef).

Make gwctl work with this new pattern. Common places that need to be updated include:

/area gwctl /kind feature

deszhou commented 1 month ago

Can I assign it to myself? I want to try it @gauravkghildiyal

gauravkghildiyal commented 1 month ago

Hi @deszhou, sure go ahead, though there's a few minor open questions here which may need to be ironed out. Like for example what exactly would the following output:

gwctl get policies

gwctl describe policies

Would be nice if you can give a sample of what you have in mind before diving deep

deszhou commented 1 month ago

Hi @deszhou, sure go ahead, though there's a few minor open questions here which may need to be ironed out. Like for example what exactly would the following output:

gwctl get policies

gwctl describe policies

Would be nice if you can give a sample of what you have in mind before diving deep

gwctl get policies -A
gwctl describe policies health-check-gateway
Name: health-check-gateway
Group: foo.com
Kind: HealthCheckPolicy
Inherited: "true"
Spec:
  ...
  targetRefs:
     - group: gateway.networking.k8s.io
        kind: Gateway
        name: foo-gateway
     - group: gateway.networking.k8s.io
        kind: GatewayClass
    name: foo-gatewayclass 

Which of these two output formats do you think is better for gwctl get policies, or do you have any suggestions for improving the output format?

gauravkghildiyal commented 1 month ago

Let's choose the "comma-separated one" which is consistent with others. Let's just display 2 targets and then +n more pattern.

Though the other one also seems good but we can revisit this later.

deszhou commented 1 month ago

/assign