-
-
Notifications
You must be signed in to change notification settings - Fork 332
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
support kubeconfigs with more than one document #440
Labels
config
Kube config related
Comments
Merging looks ok with a manual let configs: Vec<Kubeconfig> = serde_yaml::from_reader(f).map_err(ConfigError::ParseYaml)?;
// Remap all files we read to absolute paths.
let mut cfg = None;
for mut config in configs {
// OLD REMAP LOGIC HERE INDENTED
if let Some(c) = cfg {
cfg = Some(Kubeconfig::merge(c, config)?);
} else {
cfg = Some(config);
}
}
Ok(cfg.expect("Need at least one yaml document in KUBECONFIG file")) But looks slightly more complicated due to https://www.reddit.com/r/rust/comments/ccpeh4/is_there_a_way_to_deserialize_a_multiple/ might need to split on |
Opportune pr: dtolnay/serde-yaml#189 |
clux
added a commit
that referenced
this issue
Feb 27, 2021
clux
added a commit
that referenced
this issue
Feb 28, 2021
clux
added a commit
that referenced
this issue
Feb 28, 2021
support multi-doc kubeconfigs - fixes #440
Released in 0.51.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:You'll have a file with two
---\n
delimited yaml objects, which could be merged.kubectl
handles it,kube
crashes: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:serde_yaml::from_reader
call returnVec<Kubeconfig>
Kubeconfig::merge
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 whatkubectl
handles.The text was updated successfully, but these errors were encountered: