Improve configuration loading and add ability to merge configurations #69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #68
Would help solve kontena/mortar#86
K8s::Client.autoconfig
which attempts to build or load a configuration using the information available from the environment or local filesystem , see belownamespace:
parameter inK8s::Client.in_cluster_config
K8s::Config
optional and initialize empty objects as default valuesK8s::Config.merge
that follows the rules specified in kube docsK8s::Config.from_kubeconfig_env
that parses config file paths fromKUBECONFIG
and merges the configurations together if it specifies multiple paths (separated by:
as documented in kube docs)K8s::Config.build
that can be used to build a minimal working configuration by passing in at least kubernetes server address, certificate authority data and an access token.Autoconfig look-up order:
KUBE_TOKEN
,KUBE_CA
,KUBE_SERVER
environment variables (UsingK8s::Config.build
)KUBECONFIG
environment variable (UsingK8s::Config.from_kubeconfig_env
)$HOME/.kube/config
file (UsingK8s::Config.load_file
)K8s::Transport.in_cluster_config
)Breaking changes:
in_cluster_config
now raises if the environment variables are not set (it would have raised anyway if the hardcoded paths were not readable)K8s::Config.new
does not raise when initialized without previously required parameters (does not break if it was used in a way that worked previously)