Skip to content

fix: runner token expiration renewal#305

Merged
markussiebert merged 9 commits into
crossplane-contrib:masterfrom
BoxBoxJason:fix/runner-expiration-renewal
Jul 7, 2026
Merged

fix: runner token expiration renewal#305
markussiebert merged 9 commits into
crossplane-contrib:masterfrom
BoxBoxJason:fix/runner-expiration-renewal

Conversation

@BoxBoxJason

@BoxBoxJason BoxBoxJason commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

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:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

I have:

  • Successfully built and ran the provider locally against a kubernetes cluster.
  • Successfully created, updated, and deleted resources of the types I changed / created.
  • Ensured reconciliation loops for the changed / created resource complete without error.
    • Creation
    • Update
    • Deletion
  • Deleted the resource on the app side to ensure the provider correctly handles
    unexpected drift. (should result in recreation of the resource if applicable)
  • Updated the resource on the app side to ensure the provider correctly handles
    unexpected drift. (should result in an update of the resource if applicable)

@BoxBoxJason BoxBoxJason marked this pull request as ready for review April 16, 2026 08:06
@BoxBoxJason BoxBoxJason marked this pull request as draft May 21, 2026 23:05
@BoxBoxJason BoxBoxJason force-pushed the fix/runner-expiration-renewal branch from 82874e5 to 91b0933 Compare May 21, 2026 23:05
Comment thread pkg/namespaced/controller/instance/runners/controller.go Outdated
Comment thread pkg/namespaced/controller/instance/runners/controller.go Outdated
Comment thread pkg/namespaced/clients/runners/runner.go
Comment thread pkg/namespaced/controller/instance/runners/controller_test.go
@henrysachs

Copy link
Copy Markdown
Collaborator

@BoxBoxJason left some comments even though it is a draft i would like to have this personally.

@BoxBoxJason

Copy link
Copy Markdown
Contributor Author

Hey there !

Thanks for this pre review with very good insights. I will implement your suggestions and fixes this week end.

@henrysachs

Copy link
Copy Markdown
Collaborator

@BoxBoxJason could you rebase this one too and also remove the draft status? Because i think we're quite close to merging

@BoxBoxJason BoxBoxJason force-pushed the fix/runner-expiration-renewal branch from a1faeb0 to 7eee0d1 Compare June 2, 2026 20:56
@BoxBoxJason

Copy link
Copy Markdown
Contributor Author

Hello !

I just performed the rebase,
I am not that confident to have this merged right now, as I did not have time to test the corrections against my gitlab instance this week end.

I will have more time this thursday to perform all tests and remove the draft status confidently !

@BoxBoxJason

Copy link
Copy Markdown
Contributor Author

Turns out you were right !

Observation did not properly persist renewAt / createdAt fields set in Create
After a bit of digging around, I found out that using annotations works a lot better for that purpose.

Tell me what you think about this revised (and this time properly tested) version

@BoxBoxJason BoxBoxJason marked this pull request as ready for review June 4, 2026 12:55
@BoxBoxJason BoxBoxJason force-pushed the fix/runner-expiration-renewal branch from bd83edb to a9765a4 Compare June 19, 2026 00:38
@BoxBoxJason

Copy link
Copy Markdown
Contributor Author

Hey there @henrysachs

Any news about the review / merge ?

I think there is a missconfig with the codecov, all changes added here are fully covered. (except api type declarations which cannot be)

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>
@BoxBoxJason BoxBoxJason force-pushed the fix/runner-expiration-renewal branch from a9765a4 to 86ffb4f Compare June 30, 2026 20:31

@markussiebert markussiebert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Reviewed the runner token auto-renewal end-to-end:

  • Rotation uses ResetRunnerAuthenticationToken from Update() (keeps the runner ID); Observe() returns ResourceExists: true, ResourceUpToDate: false when due — no recreate/orphaning.
  • Token timestamps bridge Create() -> Observe() via annotations (status is reverted after Create; annotations persist via UpdateCriticalAnnotations) and settle in status on the Update path; I traced the rotation cycle and it settles to a single reset — no storm.
  • renewBeforeDays > lifetime is guarded (!renewAt.After(createdAt)), preventing perpetual resets.
  • All four of @henrysachs's review comments are addressed, and tests encode the intended reset-on-Update semantics.

Verified go build ./..., full go test ./..., and golangci-lint green on current master (Go 1.26.4). The only red check is the soft codecov coverage delta.

@markussiebert markussiebert merged commit 17c7f7f into crossplane-contrib:master Jul 7, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runner Token not renewed on expiration

3 participants