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.67k stars 437 forks source link

Support wide output format for get commands (-o wide) #3129

Closed yeedove closed 3 weeks ago

yeedove commented 3 weeks ago

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #2889

Does this PR introduce a user-facing change?:

1.Support wide output format for get commands (-o wide)
2.Replace `Print` in BackendsPrinter with `PrintTable`
cat <<EOF | kubectl apply -f -
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: BackendTLSPolicy
metadata:
  name: enable-backend-tls
  namespace: default
spec:
  targetRef:
    group: ''
    kind: Service
    name: tls-backend
    sectionName: "443"
  tls:
    caCertRefs:
    - name: example-ca
      group: ''
      kind: ConfigMap
    hostname: www.example.com
EOF

➜ ✗ gwctl get backend -owide NAMESPACE NAME TYPE AGE REFERRED BY ROUTES POLICIES default backend Service 106d None 0 default kubernetes Service 106d None 0 default tls-backend Service 44h default/backend 1


- **gatewayclass**

➜ ✗ gwctl get gatewayclass
NAME CONTROLLER ACCEPTED AGE eg gateway.envoyproxy.io/gatewayclass-controller True 104d envoy-gateway gateway.envoyproxy.io/gatewayclass-controller True 95d

➜ ✗ gwctl get gatewayclass -owide NAME CONTROLLER ACCEPTED AGE GATEWAYS eg gateway.envoyproxy.io/gatewayclass-controller True 104d 1 envoy-gateway gateway.envoyproxy.io/gatewayclass-controller True 95d 0


- **gateway**

➜ ✗ gwctl get gateway
NAMESPACE NAME CLASS ADDRESSES PORTS PROGRAMMED AGE default eg eg 172.18.255.201 80 True 106d

➜ ✗ gwctl get gateway -owide NAMESPACE NAME CLASS ADDRESSES PORTS PROGRAMMED AGE POLICIES HTTPROUTES default eg eg 172.18.255.201 80 True 106d 0 1


- **httproute**

➜ ✗ gwctl get httproute NAMESPACE NAME HOSTNAMES PARENT REFS AGE default backend www.example.com 1 104d ➜ ✗ gwctl get httproute -owide NAMESPACE NAME HOSTNAMES PARENT REFS AGE POLICIES default backend www.example.com 1 104d 0


- **namespace**

➜ ✗ gwctl get ns NAME STATUS AGE default Active 104d envoy-gateway-system Active 104d kube-node-lease Active 104d kube-public Active 104d kube-system Active 104d local-path-storage Active 104d metallb-system Active 95d monitoring Active 94d ➜ ✗ gwctl get ns -owide NAME STATUS AGE POLICIES default Active 104d 0 envoy-gateway-system Active 104d 0 kube-node-lease Active 104d 0 kube-public Active 104d 0 kube-system Active 104d 0 local-path-storage Active 104d 0 metallb-system Active 95d 0 monitoring Active 94d 0

k8s-ci-robot commented 3 weeks ago

Hi @yeedove. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
gauravkghildiyal commented 3 weeks ago

Can you please also edit the release note and avoid the BackendsPrinter (to only focus on how the user experience is different)

gauravkghildiyal commented 3 weeks ago

/approve

k8s-ci-robot commented 3 weeks ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gauravkghildiyal, yeedove

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[gwctl/OWNERS](https://github.com/kubernetes-sigs/gateway-api/blob/main/gwctl/OWNERS)~~ [gauravkghildiyal] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
gauravkghildiyal commented 3 weeks ago

/lgtm