-
Notifications
You must be signed in to change notification settings - Fork 774
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
chore: adding annotation to generate VAPB right away once the waiting window is over to protect against clock skews #3773
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3773 +/- ##
==========================================
- Coverage 54.49% 47.76% -6.74%
==========================================
Files 134 235 +101
Lines 12329 19865 +7536
==========================================
+ Hits 6719 9488 +2769
- Misses 5116 9488 +4372
- Partials 494 889 +395
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
LGTM with one nit
@@ -65,9 +65,12 @@ import ( | |||
|
|||
const ( | |||
BlockVAPBGenerationUntilAnnotation = "gatekeeper.sh/block-vapb-generation-until" | |||
VAPBGenerationAnnotation = "gatekeeper.sh/vapb-generation" |
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.
nit: vapb-generation-lock
or similar to more clearly specify intent
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.
How about vapb-generation-state
?
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.
LGTM
@@ -745,6 +747,9 @@ func TestReconcile(t *testing.T) { | |||
if vapBindingCreationTime.Before(blockTime) { | |||
return fmt.Errorf("VAPBinding should be created after default wait") | |||
} | |||
if ct.GetAnnotations()[constraint.VAPBGenerationAnnotation] == constraint.VAPBGenerationUnblocked { | |||
return fmt.Errorf("expected %s annotations on CT to be unblocked", constraint.VAPBGenerationAnnotation) |
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.
shouldnt the expected to be the opposite?
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.
Fixed test
@@ -873,6 +881,9 @@ func TestReconcile(t *testing.T) { | |||
if vapBindingCreationTime.Before(blockTime) { | |||
return fmt.Errorf("VAPBinding should not be created before the timestamp") | |||
} | |||
if ct.GetAnnotations()[constraint.VAPBGenerationAnnotation] == constraint.VAPBGenerationUnblocked { | |||
return fmt.Errorf("expected %s annotations on CT to be unblocked", constraint.VAPBGenerationAnnotation) | |||
} |
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.
same here
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.
Updated the test
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.
Did the tests fail before you updated this test logic?
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.
No, but in that case the condition was not evaluating to true (due to CT reconciler being slightly slow to update the annotation than constraint controller in creating vapb once the "time window" is crossed) so the error was not being returned.
… is over to protect against clock skews Signed-off-by: Jaydip Gabani <[email protected]>
Signed-off-by: Jaydip Gabani <[email protected]>
6573d8c
to
6a17e69
Compare
Signed-off-by: Jaydip Gabani <[email protected]>
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, using
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when the PR gets merged):Fixes #3683
Special notes for your reviewer: