-
-
Notifications
You must be signed in to change notification settings - Fork 351
Description
While we now support stacked kubeconfigs (see #132), and have all the merging logic for it, we crash on multi-document kubeconfigs.
Create two k3d
clusters, and save their outputs in a single file:
k3d cluster start promstack
k3d cluster start kube
k3d kubeconfig get --all > ~/.kube/k3d
export KUBECONFIG="$HOME/.kube/k3d"
You'll have a file with two ---\n
delimited yaml objects, which could be merged.
kubectl
handles it, kube
crashes:
Error: Error loading kubeconfig: Failed to infer config.. cluster env: (Error loading kubeconfig: Unable to load in cluster config, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined), kubeconfig: (Error loading kubeconfig: Failed to parse Kubeconfig YAML: deserializing from YAML containing more than one document is not supported)
Caused by:
0: Failed to infer config.. cluster env: (Error loading kubeconfig: Unable to load in cluster config, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined), kubeconfig: (Error loading kubeconfig: Failed to parse Kubeconfig YAML: deserializing from YAML containing more than one document is not supported)
1: Error loading kubeconfig: Failed to parse Kubeconfig YAML: deserializing from YAML containing more than one document is not supported
2: Failed to parse Kubeconfig YAML: deserializing from YAML containing more than one document is not supported
3: deserializing from YAML containing more than one document is not supported
We could probably the yaml objects together and flatten the reads to get the same result in file_config.rs
.
AFAIKT: It might be enough to change: Kubeconfig::read_from
to:
- have
serde_yaml::from_reader
call returnVec<Kubeconfig>
- lift remapping path inside a loop over configs
- fold the kubeconfigs together using
Kubeconfig::merge
- return an already merged
Kubeconfig
Fold might be awkward, since you need to fold over an existing Kubeconfig, but fold_first is almost stable!
Last point; this isn't a bad lack. You can tell k3d to give you delimited path output with multiple config files (k3d config merge
- just don't use it with --output
) and fallback to stacked kubeconfigs. It would just be nice to not crash on what kubectl
handles.