kubernetes-sigs / kubernetes-sigs/controller-runtime

Shutdown manager if webhook & metrics server cert-watchers fail

Open
#3,413 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
3k
Forks
1.3k
Avg merge
2d 5h
Merged PRs (30d)
14

Description

Just recently noticed that the webhook & metrics server are starting certWatchers like this

		go func() {
			if err := certWatcher.Start(ctx); err != nil {
				log.Error(err, "certificate watcher error")
			}
		}()

If the cert-watcher is failing we only log this error and that's it. As soon as the certs are rotated again the servers will use outdated certificates.
If this is somehow covered by a livenessProbe the manager will restart otherwise it won't.

I think we should look into how we can shutdown the manager / restart the binary if one of these cert-watchers fail.

One option might be to ensure the Start func of the servers return an error when the cert-watcher fails.

Contributor guide

Open the contributing guide

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 with the certWatcher.Start(ctx) calls in the webhook and metrics server, then trace how those server Start functions are connected to the manager. Determine how a watcher failure should propagate so the manager shuts down or the binary restarts, and verify that failures are no longer only logged.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.