gateway-api
gateway-api copied to clipboard
Improve utilities for gwctl describe and add more info to gateway descriptions
What this PR does / why we need it:
- Add helpers to print
gwctl describe
views and Tables - Add more information when describing Gateways (like attached routes)
- Discover events associated with Gateways and output them when describing Gateways.
Example:
❯ gwctl describe gateways
Name: demo-gateway-1
Namespace: default
Labels: null
Annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"gateway.networking.k8s.io/v1beta1","kind":"Gateway","metadata":{"annotations":{},"name":"demo-gateway-1","namespace":"default"},"spec":{"gatewayClassName":"foo-com-external-gateway-class","listeners":[{"name":"http","port":80,"protocol":"HTTP"}]}}
APIVersion: gateway.networking.k8s.io/v1
Kind: Gateway
Metadata:
creationTimestamp: "2024-04-03T04:27:12Z"
generation: 1
managedFields:
- apiVersion: gateway.networking.k8s.io/v1beta1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.: {}
f:kubectl.kubernetes.io/last-applied-configuration: {}
f:spec:
.: {}
f:gatewayClassName: {}
f:listeners:
.: {}
k:{"name":"http"}:
.: {}
f:allowedRoutes:
.: {}
f:namespaces:
.: {}
f:from: {}
f:name: {}
f:port: {}
f:protocol: {}
manager: kubectl-client-side-apply
operation: Update
time: "2024-04-03T04:27:12Z"
resourceVersion: "2531077"
uid: 034c4490-6b0d-41f0-8d90-3948dbae4b6c
Spec:
gatewayClassName: foo-com-external-gateway-class
listeners:
- allowedRoutes:
namespaces:
from: Same
name: http
port: 80
protocol: HTTP
Status:
conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: Waiting for controller
reason: Pending
status: Unknown
type: Accepted
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: Waiting for controller
reason: Pending
status: Unknown
type: Programmed
AttachedRoutes:
Kind Name
---- ----
HTTPRoute default/demo-httproute-1
HTTPRoute default/demo-httproute-2
HTTPRoute default/demo-httproute-3
HTTPRoute ns2/demo-httproute-4
DirectlyAttachedPolicies:
Type Name
---- ----
HealthCheckPolicy.foo.com default/demo-health-check-1
RetryOnPolicy.foo.com default/demo-retry-policy-1
EffectivePolicies:
HealthCheckPolicy.foo.com:
sampleParentField:
sampleField: hello
RetryOnPolicy.foo.com:
sampleParentField:
sampleField: namaste
TimeoutPolicy.bar.com:
timeout1: parent
timeout2: child
timeout3: parent
timeout4: child
Events:
Type Reason Age From Message
---- ------ --- ---- -------
Warning SYNC 12h my-gateway-controller Some message here
Notes for reviewer: Reviewing individual commits in order might be easier
Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?:
NONE
/cc @mlavacca
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: gauravkghildiyal, mlavacca
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~~ [gauravkghildiyal]
Approvers can indicate their approval by writing /approve
in a comment
Approvers can cancel approval by writing /approve cancel
in a comment
Thanks @gauravkghildiyal!
/lgtm