fix: runner token expiration renewal#305
Conversation
82874e5 to
91b0933
Compare
| ) | ||
|
|
||
| if runners.ShouldRotateRunnerToken(&cr.Status.AtProvider.CommonRunnerObservation, cr.Spec.ForProvider.TokenRenewBeforeDays, time.Now().UTC()) { | ||
| return managed.ExternalObservation{ResourceExists: false}, nil |
There was a problem hiding this comment.
Nice improvement overall. One thing worries me here: when renewal is due, Observe() returns ResourceExists: false even though the runner still exists in GitLab. That pushes Crossplane down the create path, and Create() provisions a brand-new runner instead of rotating the token on the existing one. In practice this looks like it would orphan the old runner, change the external name, and leave cleanup attached only to the newest runner. Since the runner client already exposes ResetRunnerAuthenticationToken, would it be safer to keep ResourceExists: true here and handle token renewal in Update() instead? I think the same issue exists in the group/project + cluster mirrors.
|
@BoxBoxJason left some comments even though it is a draft i would like to have this personally. |
|
Hey there ! Thanks for this pre review with very good insights. I will implement your suggestions and fixes this week end. |
|
@BoxBoxJason could you rebase this one too and also remove the draft status? Because i think we're quite close to merging |
a1faeb0 to
7eee0d1
Compare
|
Hello ! I just performed the rebase, I will have more time this thursday to perform all tests and remove the draft status confidently ! |
|
Turns out you were right ! Observation did not properly persist renewAt / createdAt fields set in Create Tell me what you think about this revised (and this time properly tested) version |
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
bd83edb to
a9765a4
Compare
Description of your changes
This PR adds an automatic renewal mechanism on runner token expiration for the project, group & instance runners.
All of the changes are covered by unit tests
Fixes #304
I have:
make reviewable testto ensure this PR is ready for review.How has this code been tested
I have:
unexpected drift. (should result in recreation of the resource if applicable)
unexpected drift. (should result in an update of the resource if applicable)