Skip to content

feat: add leader election and tracing options #111

Open
oliverbaehler wants to merge 2 commits into
projectcapsule:mainfrom
oliverbaehler:feat/leader-election
Open

feat: add leader election and tracing options #111
oliverbaehler wants to merge 2 commits into
projectcapsule:mainfrom
oliverbaehler:feat/leader-election

Conversation

@oliverbaehler

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>
Signed-off-by: Oliver Baehler <oliver@sudo-i.net>
Copilot AI review requested due to automatic review settings July 14, 2026 03:42
@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for docs-projectcapsule ready!

Name Link
🔨 Latest commit 9393c09
🔍 Latest deploy log https://app.netlify.com/projects/docs-projectcapsule/deploys/6a55b042362f18000823aeca
😎 Deploy Preview https://deploy-preview-111--docs-projectcapsule.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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"
```
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.

3 participants