* Updated CertificateValidationCallBack to build the CaCert bundle with respect to the rootChain certs to verify that they are correct.
* Added a test cases and assets for when all the certs files are in the same file.
* Removed the hardcoded first cert as the chosen root cert
Some tools can generate kubeconfig files which use wildcard IPv4 or IPv6 addresses. For example, using k3d with --api-server=https://0.0.0.0:6433/ would generate a kubeconfig file like this:
```
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: (...)
server: https://0.0.0.0:6433
name: k3d-k3s-default
```
Standard Kubernetes tools (like kubectl or Helm) correctly parse the 0.0.0.0 IP address and transform it 127.0.0.1; 3rd party tools like curl or wget will do the same on Unix systems.
This is default behavior on Unix but not on Windows. As a result, the .NET Kubernetes client will fail to work with kubeconfig files like this and you'll get HTTP exceptions.
Go has explicit workarounds for this (see 1a0b1cca4c), and this PR attemps to replicate these workarounds in the .NET client.
* Allow KUBECONFIG environment variable to point to multiple files
* Add more tests, add API (can make internal if necessary)
* test
* allow passing in env var
* small amount of feedback
* Feedback
* Nits
* Some extra tests and comments
* Use value from ContextDetails to populate Namespace
This is a fix for: #372
This change uses the value from ContextDetails.Namespace to populate
KubernetesClientConfiguration.Namespace.
The issue is there's a Namespace property on both Context and ContextDetails
- The property on Context is used today
- The property on ContextDetails is not
- The property on ContextDetails maps to the actual yaml config
* Obsolete Context.Namespace
This property doesn't map to anything in the YAML and thus will never be
set. Other clients I checked (java, golang) don't look for a property
at this level.
I think this was likely a mistake, and it should be obsoleted because
it will never be populated.
Example:
```yaml
contexts:
- context:
cluster: ...
namespace: ... # this is ContextDetails.Namespace
user: ...
name: foo
```
```yaml
contexts:
- context:
cluster: ...
namespace: ...
user: ...
name: foo
namespace: ... # this is Context.Namespace
```
* Remove requirement for certificate authority data in kubeconfig.
* Update src/KubernetesClient/KubernetesClientConfiguration.ConfigFile.cs
Update casing of `URL` at @itowlson suggestion.
Co-Authored-By: twitchax <twitchax@gmail.com>
* Support relative paths in Kubernetes configuration files
* Filename -> FileName
* Filename -> FileName
* KuberentesClientConfiguration: Allow the user to opt-out of the mechanism which resolves relative paths in the configuration file.
* Update unit tests
* Fix test