-
-
Notifications
You must be signed in to change notification settings - Fork 325
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
Config
: New incluster
and incluster_dns
constructors
#1001
Conversation
The `Config::from_cluster_env` constructor is misleadingly named: it doesn't use the environment, it uses the default cluster configurations. This change deprecates the `Config::from_cluster_env` constructor in favor of `Config::load_in_cluster`. An additional constructor, `Config::load_in_cluster_from_legacy_env`, uses the `KUBERNETES_SERVICE_HOST` and `KUBERNETES_SERVICE_PORT` environment variables to match client-go's behavior. This changes does NOT alter the default inferred configuration in any way. It simply allows users to opt-in to using the old behavior. Related to kubernetes/kubernetes#112263 Closes kube-rs#1000 Signed-off-by: Oliver Gould <[email protected]>
25ae3f6
to
4e3743e
Compare
Signed-off-by: Oliver Gould <[email protected]>
Given kubernetes/kubernetes#112263 (comment), it looks like the env-based configuration isn't legacy at all. It's the only officially supported means to connect to the Kubernetes API server from within the cluster. The documentation is a lie! With this in mind, I think we should update this PR to:
Yes, this means that rustls won't be usable within the cluster. That will need to be clearly documented. We should followup in rustls/webpki to address the deficiencies. |
Oh, dear. That's unfortunate. But I agree with this assessment in light of of this :( |
Add `Config::from_cluster_dns` to support the current behavior. Signed-off-by: Oliver Gould <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #1001 +/- ##
==========================================
+ Coverage 72.17% 72.21% +0.03%
==========================================
Files 64 64
Lines 4532 4574 +42
==========================================
+ Hits 3271 3303 +32
- Misses 1261 1271 +10
|
Signed-off-by: Oliver Gould <[email protected]>
Signed-off-by: Oliver Gould <[email protected]>
When `rustls-tls` is enabled, the `kubernetes.default.svc` DNS name is used. Otherwise, the `KUBERNETES_SERVICE_{HOST,PORT}` environment variables are used. Signed-off-by: Oliver Gould <[email protected]>
I took it a step further and made the behavior dependent on the TLS feature that's enabled. This allows |
@clux I updated this to expose a single |
Thanks a lot. The name change looks justified to me - and this is already a breaking change so might as well make it right now. Just left a few minor nits on docs and tests. |
* Make `Config::incluster_env` and `Config::incluster_dns` public regardless of what features are enabled. * Restrict visibility for `pub` helpers that are not actually publicly exported. Signed-off-by: Oliver Gould <[email protected]>
Signed-off-by: Oliver Gould <[email protected]>
Signed-off-by: Oliver Gould <[email protected]>
This looks all good to me, happy to merge if you are happy with it! |
@clux Thanks. Looks good to merge! |
Config
: New incluster
and incluster_dns
constructors
The kube `Config` constructors have been renamed in version 0.75.0: kube-rs/kube#1001.
This change restores the default behavior of reading the
KUBERNETES_SERVICE_HOST
andKUBERNETES_SERVICE_PORT
environmentvariables, matching the official Kubernetes client libraries' behavior.
This behavior only applies when the
rustls-tls
feature is not enabled.When the
rustls-tls
feature is enabled, incluster configurationsreference the DNS name
kubernetes.default.svc
.Related to #1003 kubernetes/kubernetes#112263
Closes #1000
Signed-off-by: Oliver Gould [email protected]