feat: add leader election and tracing options #111
Open
oliverbaehler wants to merge 2 commits into
Open
Conversation
Signed-off-by: Oliver Baehler <oliver@sudo-i.net>
Signed-off-by: Oliver Baehler <oliver@sudo-i.net>
✅ Deploy Preview for docs-projectcapsule ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Capsule documentation to describe new operational tuning knobs: leader-election timeout configuration for the manager and OpenTelemetry tracing options for admission webhook requests.
Changes:
- Add a new “Leader Election Timeout” section with guidance and example values for
manager.options.leaderElection.*. - Add an “OTEL Tracing” section describing how to enable OTLP gRPC trace export and configure sampling/auth.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| content/en/docs/operating/setup/installation.md | Adds leader-election tuning guidance and a YAML example for leader election timeouts. |
| content/en/docs/operating/monitoring.md | Documents OpenTelemetry tracing configuration options for admission webhook requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| I0707 08:38:18.442700 1 leaderelection.go:299] "Failed to renew lease" | ||
| ``` | ||
|
|
||
| Tune leader election with `manager.options.leaderElection.leaseDuration`, `manager.options.leaderElection.renewDeadline`, and `manager.options.leaderElection.retryPeriod`. Increasing these values makes Capsule more tolerant of slow or overloaded Kubernetes API servers; for example, raising `leaderElectionRenewDeadline` also raises the leader-election client request timeout because controller-runtime uses roughly half of that value. The tradeoff is slower failover: if the active controller really dies, standby replicas will wait longer before taking leadership. Keep the ordering valid: `leaseDuration` should be greater than `renewDeadline`, and `renewDeadline` should be greater than `retryPeriod`. |
|
|
||
| #### Leader Election Timeout | ||
|
|
||
| In high pressure environments leader election may fail due to the default timeout values. You can adjust the leader election timeout values to avoid this issue: |
Comment on lines
+10
to
+12
| ## OTEL Tracing | ||
|
|
||
| Capsule can export OpenTelemetry traces for admission webhook requests through the OTLP gRPC exporter. Enable tracing with `manager.options.tracing.enabled=true` and set `manager.options.tracing.endpoint` to your collector or tracing backend, for example `tempo.monitoring-system.svc:4317`. The exporter supports insecure transport for local clusters, TLS server name overrides, gzip compression, export timeouts, custom OTLP headers, and basic authentication. For production, prefer `manager.options.tracing.basicAuth.existingSecret` so credentials are loaded from a Kubernetes Secret instead of being rendered into controller arguments. Use `manager.options.tracing.sampleRatio` to control trace volume. |
Comment on lines
+100
to
+108
| ```yaml | ||
| ```shell | ||
| E0707 08:38:18.319041 1 leaderelection.go:452] "Error retrieving lease lock" | ||
| err="Get \"https://10.96.0.1:443/apis/coordination.k8s.io/v1/namespaces/capsule- | ||
| system/leases/42c733ea.clastix.capsule.io?timeout=5s\": net/http: request canceled | ||
| (Client.Timeout exceeded while awaiting headers)" lock="capsule- | ||
| system/42c733ea.clastix.capsule.io" | ||
| I0707 08:38:18.442700 1 leaderelection.go:299] "Failed to renew lease" | ||
| ``` |
sandert-k8s
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.