ahmetb / kubectx

Faster way to switch between clusters and namespaces in kubectl
https://kubectx.dev
Apache License 2.0
17.66k stars 1.26k forks source link

Migrate to kyaml #412

Open ultram4rine opened 9 months ago

ultram4rine commented 9 months ago

Closes #327.

Some notes:

--- FAIL: TestKubeconfig_NamespaceOfContext_ctxNotFound (0.00s)
    namespace_test.go:34: expected err

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.

ahmetb commented 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.

ultram4rine commented 9 months ago

Issue from CI: https://github.com/kubernetes/client-go/issues/1269

Seems like client-go should be updated.

ultram4rine commented 9 months ago

Also maybe UpdateFile can be used.