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

Remove dependency on cli-runtime #413

Merged
merged 4 commits into from
Aug 10, 2021
Merged

Remove dependency on cli-runtime #413

merged 4 commits into from
Aug 10, 2021

Conversation

imjasonh
Copy link
Member

Fixes #317

This change effectively forks the parts of genericclioptions that we use (i.e., global kubectl flag definitions) into an internal package, where flags are documented as deprecated. It severs our dependency on cli-runtime, and promotes an indirect dep on client-go to a direct one, for now. In a future change, we can remove this package too.

$ go run ./ create -f test --namespace=foo
2021/08/09 21:16:06 NOTICE!
-----------------------------------------------------------------
Passing kubectl global flags to ko directly is deprecated.

Instead of passing:
    ko create ... --namespace=foo

Pass kubectl global flags separated by "--":
    ko create ... -- --namespace=foo

For more information see:
    https://github.com/google/ko/issues/317
-----------------------------------------------------------------

If flags are passed before and after --, the one after the -- is used:

$ go run ./ create -f test --namespace=foo -- --namespace=bar
...
Error from server (NotFound): error when creating "STDIN": namespaces "bar" not found

Flags after -- aren't parsed at all by ko, and are just passed directly to kubectl:

$ go run ./ create -f test -- --unknown=flag
...
Error: unknown flag: --unknown
See 'kubectl apply --help' for usage.

internal/k8sflags.go Outdated Show resolved Hide resolved
@imjasonh imjasonh merged commit 466dbab into ko-build:main Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove k8s deps if possible
2 participants