ericchiang / k8s

A simple Kubernetes Go client
Apache License 2.0
599 stars 108 forks source link

Set “name” path parameter for endpoint watch #107

Open ekoome opened 5 years ago

ekoome commented 5 years ago

How do I set “name” path parameter for endpoint watch in GET /api/v1/watch/namespaces/{namespace}/endpoints/{name} - https://v1-9.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.9/#watch-145

The current api for watch does not have a “name” parameter for the service in this case.

func (c Client) Watch(ctx context.Context, namespace string, r Resource, options ...Option) (Watcher, error)

ericchiang commented 5 years ago

I wasn't aware that you were able to watch an individual instance of a resource. Does this work for things other than endpoints?

There's currently no way to do this with this client.

ekoome commented 5 years ago

Ability to watch by name is also available on Services - https://v1-9.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.9/#watch-174; and Ingresses- https://v1-9.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.9/#-strong-read-operations-strong--154

This simplifies watch operations. It would be great to have this in the client for completeness.

ericchiang commented 5 years ago

I took a crack at this and couldn't get watch on an individual configmap working https://github.com/ericchiang/k8s/pull/108

The docs do say that this should work though... https://v1-9.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.9/#watch-210

Going to try to take another go at this later.