-
Notifications
You must be signed in to change notification settings - Fork 218
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
feat(authentication): per method cleanup process #1161
Conversation
…res_before predicate
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.
this all looks great!
one question I have is around the configuration, does it make sense to nest cleanup
under the already existing method? ie:
authentication:
methods:
token:
enabled: true // cleanup is only started if the method is also enabled
cleanup:
interval: 1h
grace_period: 1h
@markphelps yeah, this had also crossed my mind shortly after opening the PR. Ill take a stab at that real quick. |
@markphelps yep, much better 👍 |
Codecov Report
@@ Coverage Diff @@
## main #1161 +/- ##
==========================================
+ Coverage 78.83% 79.89% +1.06%
==========================================
Files 35 38 +3
Lines 2528 2761 +233
==========================================
+ Hits 1993 2206 +213
- Misses 435 451 +16
- Partials 100 104 +4
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Setting authentication:
required: true
methods:
token:
enabled: true
cleanup:
interval: -2h
grace_period: 48h 2022-11-29T09:42:38-05:00 INFO cleanup process deleting authentications {"server": "grpc", "expired_before": "2022-11-27T14:42:38Z"}
2022-11-29T09:42:38-05:00 INFO cleanup process deleting authentications {"server": "grpc", "expired_before": "2022-11-27T14:42:38Z"}
2022-11-29T09:42:38-05:00 INFO cleanup process deleting authentications {"server": "grpc", "expired_before": "2022-11-27T14:42:38Z"}
2022-11-29T09:42:38-05:00 INFO cleanup process deleting authentications {"server": "grpc", "expired_before": "2022-11-27T14:42:38Z"}
2022-11-29T09:42:38-05:00 INFO cleanup process deleting authentications {"server": "grpc", "expired_before": "2022-11-27T14:42:38Z"} We should prob have some validation there that its a positive number greater than 0 |
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.
see above about ♾️
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.
noice!
This adds a new per authentication method cleanup process.
The process creates 1 background goroutine per enabled authentication method.
This goroutine will attempt to acquire a lock via the storage layer and then deleted expired authentications from the backing store.
The process is repeated on a configurable periodic basis.
The delete process includes a configurable grace period for what is deemed "expired".
Allowing for expired authentications to be left untouched until some elapsed duration.
The new configuration levers can be seen in the following patch:
Each key beneath
cleanup
configures the associated authentication method.The clean-up process is only initiated if the method is also
enabled
.By default, for an
enabled
auth method, cleanup is also configured.It will be configured with
1h
interval and30m
grace period.These defaults are debatable.