-
Notifications
You must be signed in to change notification settings - Fork 69
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
Controller is stuck on invalid regex pattern #138
Comments
I had experienced the same error, thanks for raising this one. Finally, did you fix regexp for your policy? What was the problem? |
The CLI does validation: $ flux create image policy test --image-ref=test --select-numeric=asc \
--filter-regex='^develop-continuous-(?<buildnumber>\d+)$' \
--export
✗ --filter-regex is an invalid regex pattern |
flux get image policy
output
Admission validation would prevent invalid spec resources to be applied. We have an issue for that but never had the time to work on it myself: #69 |
@kadzielawa I missed the |
Ah, I didn't know that! I thought the CLI was just an easy way to template a Flux yaml. Good to know that it would perform validation on the inputs as well. |
The errors generated by ImagePolicy resources having invalid tag filter regex patterns were not being reported to the user correctly, no event was recorded and the ReadyCondition message did not reflect the encoutered error. Fixes #138 Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
The errors generated by ImagePolicy resources having invalid tag filter regex patterns were not being reported to the user correctly, no event was recorded and the ReadyCondition message did not reflect the encountered error. Fixes #138 Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
The errors generated by ImagePolicy resources having invalid tag filter regex patterns were not being reported to the user correctly, no event was recorded and the ReadyCondition message did not reflect the encountered error. Fixes #138 Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
Describe the bug
I had inadvertently created an ImagePolicy with an invalid pattern
pattern: '^develop-continuous-(?<buildnumber>\d+)$'
(omitting thep
between the?
and the<
) . When trying to reconcile the policy, it was stuck in the following state:Given the message, I tried
flux reconcile image repository
andflux reconcile kustomization
several times to no avail. I looked in the image-reflector-controller logs and sure enough there was an error informing me that my regex was invalid.It would be nice to bubble that information upwards as an explicit error message in
flux get image policy
or an event on theImagePolicy
API object so that users would have a better idea of what went wrong.As an aside, perhaps it's possible to validate the
spec.filterTags.pattern
field at creation time with aValidatingAdmissionWebhook
instead of at runtime?To Reproduce
flux get image policy
Expected behavior
I would have liked a more precise message in
flux get image policy
forImagePolicies
with invalid regexes. While it's technically true that theImagePolicy
was waiting to be reconciled, the message makes it seem like runningflux reconcile
is be obvious (but incorrect) action to take.Additional context
N/A
The text was updated successfully, but these errors were encountered: