Open ultram4rine opened 9 months ago
This is excellent contribution, thanks. I learned this was possible after I implemented the initial Go version but never went back to incorporate, so thanks for doing the hard work there. I'll make sure to review soon.
Issue from CI: https://github.com/kubernetes/client-go/issues/1269
Seems like client-go should be updated.
Also maybe UpdateFile
can be used.
Closes #327.
Some notes:
Because without context we're expecting err, it hard to use
Pipe(yaml.Lookup("contexts", "[name={ctxName}]", "context", "namespace"))
. If context doesn't exists,nil
will be returned, just like if context doesn't have namespace, or kubeconfig doesn't have contexts.yaml.GetValue(node)
is used instead ofnode.String()
because last method doesn't work well with primitives like strings (e.g. "" instead of empty string).