python icon indicating copy to clipboard operation
python copied to clipboard

Add `api_client` parameter to `Watch`

Open kriswuollett opened this issue 2 years ago • 4 comments

What is the feature and why do you need it:

I'm manually configuring a proxied api_client like the following with the command kubectl proxy --port=8080:

config = Configuration()
config.host = f"{host}:{port}"
api_client = ApiClient(configuration=config)

I currently can create an instance of an API like:

custom_objects = CustomObjectsApi(api_client=api_client)

But I cannot do the the same with Watch because its api_client is a private variable initialized with client.ApiClient():https://github.com/kubernetes-client/python/blob/51c481692ab0d9c71b9dd96342bfa93b721b029d/kubernetes/base/watch/watch.py#L71-L77

Is there a limitation why it seems to be using the global default configured client?

I particularly need to make sure I'm using my specific Configuration, but this would also apply to watching resources across multiple Kubernetes clusters simultaneously.

Describe the solution you'd like to see:

Add an api_client parameter to the Watch constructor with default value of client.ApiClient().

kriswuollett avatar Apr 12 '22 18:04 kriswuollett

/assign

roycaihw avatar Apr 25 '22 16:04 roycaihw

Haven't checked the watch implementation for a while. When using a watch you also need to specify a list method which comes with its own client (example). I wonder what's the difference between the two clients.

roycaihw avatar Apr 25 '22 16:04 roycaihw

Looks like it's only used for deserialize, which is static in most cases. I think that's why it doesn't need to be expose as a parameter. WDYT?

roycaihw avatar Apr 25 '22 16:04 roycaihw

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jul 24 '22 17:07 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Aug 23 '22 17:08 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Sep 22 '22 18:09 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Sep 22 '22 18:09 k8s-ci-robot