Add support for kubeconfig context. #121
Merged
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.
The kubeconfig cluster provider enables hubploy to use a kubeconfig file to talk to a cluster. However if there are multiple contexts defined in the file, hubploy can only use the default context. This PR lets you specify the context in cluster.kubeconfig.context, either as the literal value of what you provide, or it can template in the value of
namespace
.This is to support the deploying of hubs to NRP Nautilus where, if you're using service accounts to connect, they will have (or should have) different credentials between namespaces. The idea would be we can define two contexts in a single kubeconfig: one for a service account that connects to the staging namespace and one for a different service account that connects to the prod namespace.
One might theoretically add support for hubploy to read multiple kubeconfig files from cluster.provider.kubconfig.filename, however this would still require the ability to choose a context.
I've tested this manually with kubeconfig and gcloud providers.