Skip to content
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

Migrate to kyaml #412

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

ultram4rine
Copy link

@ultram4rine ultram4rine commented Dec 24, 2023

Closes #327.

Some notes:

  • Seems like it possible to reduce some code, but current tests impose some restrictions. For example:
--- 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.

  • yaml.GetValue(node) is used instead of node.String() because last method doesn't work well with primitives like strings (e.g. "" instead of empty string).

@ahmetb
Copy link
Owner

ahmetb commented Dec 25, 2023

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
Copy link
Author

ultram4rine commented Dec 26, 2023

Issue from CI: kubernetes/client-go#1269

Seems like client-go should be updated.

@ultram4rine
Copy link
Author

Also maybe UpdateFile can be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to kyaml package
2 participants