-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kube-config: add custom client configuration injection #1968
kube-config: add custom client configuration injection #1968
Conversation
|
Welcome @FlorianJDF! |
persist_config=persist_config, | ||
temp_file_path=temp_file_path) | ||
return ApiClient(configuration=client_config) | ||
return ApiClient(configuration=client_configuration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with this PR, how would you set the proxy to resolve #1967?
my_client.configuration.proxy = "MY_HTTP_PROXY"
client.CoreV1Api(api_client=my_client).list_namespace()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allowed me to have my client working perfectly behind a proxy:
my_client_configuration = client.Configuration
my_client_configuration.proxy = os.getenv("HTTP_PROXY", None)
k8s_cluster_client = config.new_client_from_config(config_file=my_config_file, client_configuration=my_client_configuration)
With this solution, you need to find the env vars yourself.
But in a second time I could improve this to find those env vars automatically.
/assign |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
Very useful pull request. I fork it to use it in my day to day job |
/remove-lifecycle stale |
Any update on this? |
gentle ping |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FlorianJDF, yliaog 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:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Makes possible to provide a client.configuration object to the function that creates new client api.
This allow to provide the same configuration when calling
config.load_kube_config()
andconfig.new_client_from_config_dict(kubeconfig)
Right now, the function new_client_from_config_dict automatically creates a new Configuration object
Which issue(s) this PR fixes:
Fixes #1967
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: