open-policy-agent / open-policy-agent/cert-controller

rotator.AddRotator doesn't exit when the process is terminated

Open
#42 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
109
Forks
48
Avg merge
19h 20m
Merged PRs (30d)
6

Description

If you use rotator.AddRotator to build a rotator.ReconcileWH and add it to the controller manager, it uses a context.Background() which is never cancelled. This means the Watch added to the controller manager is never terminated, causing the controller manager to wait its entire Options.GracefulShutdownTimeout (default: 30s) before exiting after SIGTERM/SIGINT.

https://github.com/open-policy-agent/cert-controller/blob/master/pkg/rotator/rotator.go#L110

Can rotator.AddRotator be made to accept a context and pass it through so the controller can exit quickly & gracefully?

Or am I using it wrong?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at pkg/rotator/rotator.go around line 110 and inspect how rotator.AddRotator creates the rotator.ReconcileWH and supplies its context. Confirm how the controller manager uses that watch during shutdown. Done means a controller using AddRotator exits promptly and gracefully after SIGTERM or SIGINT instead of waiting for the 30-second graceful shutdown timeout.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
backend, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.