Kong / kubernetes-ingress-controller

:gorilla: Kong for Kubernetes: The official Ingress Controller for Kubernetes.
https://docs.konghq.com/kubernetes-ingress-controller/
Apache License 2.0
2.22k stars 592 forks source link

Spike: introduce a CLI which will allow users to wait for applied manifests to be ready #4258

Open pmalek opened 1 year ago

pmalek commented 1 year ago

Is there an existing issue for this?

Problem Statement

Given a set of kubernetes resources which are to be applied by KIC to the dataplane - Kong Gateway - there exists no universal approach to wait for those resources to be applied to be programmed on the dataplane and be ready to serve traffic as configured.

Various off the shelf solutions might exist such as e.g. kubectl wait ... but those have their own limitations.

For example the Gateway API HTTPRoute, contains its conditions in status.parents[].conditions[] (ref)which prevents it from working with kubectl wait ... --for=condition=Programmed=True

One could try to work around it by using --for=jsonpath='{.status.parents[0].conditions[?(@.type=="Programmed")].status}'=True but that has its own problems e.g. https://github.com/kubernetes/kubectl/issues/1224.

Even with the above fixed, kubectl wait:

waits until the specified condition is seen in the Status field of every given resource.

which doesn't fit the use case here since users might include in the manifest resources which do not support a particular readiness condition.

Proposed Solution

Additional information

No response

Acceptance Criteria

czeslavo commented 1 year ago

To not lose it, one point from our discussion: when checking the conditions, we need to make sure that the conditions' observed generation is equal to the actual object generation (see how kubectl wait does it).

programmer04 commented 1 year ago

Probably the best approach for such CLI would be a Kubernetes plugin installed with krew. For instance, Datadog and Cillium have such ones.