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

dedupe warning messages for deprecated API warnings #1712

Merged
merged 1 commit into from
Oct 13, 2020

Conversation

kensipe
Copy link
Member

@kensipe kensipe commented Oct 12, 2020

It took some research to get here... many things to liggitt as well!

Fixes: #1711

Inspiration for fix from kubectl https://github.com/kubernetes/kubernetes/blob/release-1.19/pkg/kubectl/cmd/cmd.go#L433
Details https://kubernetes.io/blog/2020/09/03/warnings/

This solution will continue to print a Warning message for each interaction that involves a deprecated API for each deprecated API but that's it... any repeated use of that API will not print.

Output for a simple kudo init --dry-run after the fix:

❯ go run cmd/kubectl-kudo/main.go init --dry-run --version 2
$KUDO_HOME has been configured at /Users/kensipe/.kudo
Warning: apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
Errors
failed to detect any valid cert-manager CRDs. Make sure cert-manager is installed.
Error: failed to verify installation requirements
exit status 255

Also hard to see on GH but the word Warning: is colored yellow as well here (which it is not below)

Output for a simple kudo init --dry-run prior to fix:

❯ go run cmd/kubectl-kudo/main.go init --dry-run --version 2
$KUDO_HOME has been configured at /Users/kensipe/.kudo
W1012 16:36:39.397078   28236 warnings.go:67] apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
W1012 16:36:39.400591   28236 warnings.go:67] apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
W1012 16:36:39.404028   28236 warnings.go:67] apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
W1012 16:36:39.412952   28236 warnings.go:67] apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
W1012 16:36:39.416993   28236 warnings.go:67] apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
Errors
failed to detect any valid cert-manager CRDs. Make sure cert-manager is installed.
Error: failed to verify installation requirements
exit status 255

Signed-off-by: Ken Sipe kensipe@gmail.com

Signed-off-by: Ken Sipe <kensipe@gmail.com>
@kensipe
Copy link
Member Author

kensipe commented Oct 12, 2020

also... this nicely fixes all usages

Copy link
Contributor

@alenkacz alenkacz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you 👏

@kensipe kensipe merged commit 7756a5f into main Oct 13, 2020
@kensipe kensipe deleted the ken/deprecation-warnings branch October 13, 2020 13:56
kensipe added a commit that referenced this pull request Nov 16, 2020
Signed-off-by: Ken Sipe <kensipe@gmail.com>
kensipe added a commit that referenced this pull request Nov 16, 2020
Signed-off-by: Ken Sipe <kensipe@gmail.com>
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.

Noisy Install of KUDO on Kube v1.19
4 participants