-
Notifications
You must be signed in to change notification settings - Fork 116
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
fix: update matching for Kubernetes error message when server-dry-run is not supported #663
fix: update matching for Kubernetes error message when server-dry-run is not supported #663
Conversation
… is not supported current error message contains "does not support dry run" not "doesn't support dry-run" It is not clear if the message was previously "doesn't support dry-run" so I left that in the matching expression. https://github.com/kubernetes/apiserver/blob/7dc4ceb2fd3311166a78bdf6a4eec4c194364dd0/pkg/admission/plugin/webhook/errors/statuserror.go#L61
What specifically did you see that prompted this PR? The link in the description is to a repo containing a "Generic library for building a Kubernetes aggregated API server" and the error is specifically about admission webhooks, which krane doesn't deal with. I believe the error message we're checking for comes from https://github.com/kubernetes/kubernetes/blob/16c2ae4607371f1f948c0a9c884805e699330450/staging/src/k8s.io/kubectl/pkg/cmd/apply/apply.go#L698, which still uses |
I ran into the message We're in the process of updating our webhooks to work with server-dry-run, but in the meantime we can't upgrade to >=0.28.0 because deploying secrets fails. |
Thanks for the explanation. I now see that the code in kubernetes/apiserver (despite that repo's description) is just synced from kubernetes/kubernetes, so the error message in question can also be found here: https://github.com/kubernetes/kubernetes/blob/8b0c36d6204029f6085567706d6e7f689a497346/staging/src/k8s.io/apiserver/pkg/admission/plugin/webhook/errors/statuserror.go#L61. |
lib/krane/kubernetes_resource.rb
Outdated
@@ -16,7 +16,7 @@ class KubernetesResource | |||
TIMEOUT = 5.minutes | |||
LOG_LINE_COUNT = 250 | |||
SERVER_DRY_RUN_DISABLED_ERROR = | |||
/(unknown flag: --server-dry-run)|(doesn't support dry-run)|(dryRun alpha feature is disabled)/ | |||
/(unknown flag: --server-dry-run)|(doesn't support dry-run)|(does not support dry run)|(dryRun alpha feature is disabled)/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sco11morgan for bring it to us.
We can make one regex for doesn't
and does not
, something like:
/(unknown flag: --server-dry-run)|(does[\s]*n[o|']t support dry-run)|(dryRun alpha feature is disabled)/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! Thx
Tests passed, but the diff contains a couple linter errors:
|
Co-Authored-By: Katrina Verey <kn.verey@gmail.com>
Co-Authored-By: Katrina Verey <kn.verey@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good to me. Please fix the lint before merge it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linting passed locally
What are you trying to accomplish with this PR?
Current error message contains 1does not support dry run" not "doesn't support dry-run"
It is not clear if the message previously was "doesn't support dry-run" so I left that in the matching expression.
https://github.com/kubernetes/apiserver/blob/7dc4ceb2fd3311166a78bdf6a4eec4c194364dd0/pkg/admission/plugin/webhook/errors/statuserror.go#L61
...
How is this accomplished?
updated existing regex
Krane::KubernetesResource::SERVER_DRY_RUN_DISABLED_ERROR
...
What could go wrong?
...