Persist generated WireGuard keys as Kubernetes Secrets to prevent key drift on reconcile retries#498
Draft
Persist generated WireGuard keys as Kubernetes Secrets to prevent key drift on reconcile retries#498
Conversation
✅ Deploy Preview for interlink-dev canceled.
|
… drift on retries When full-mesh offloading is enabled, generated WireGuard keypairs are now stored in a Kubernetes Secret (`<name>-wg-keys`) in the wstunnel namespace. Subsequent reconcile runs/retries read back the same keys instead of generating new ones, preventing shadow/client WireGuard config drift. - Add wgKeysSecretName() and ensureWGKeysSecret() in mesh.go - Update createDummyPod() to call ensureWGKeysSecret() after key generation - Update cleanupWstunnelResources() to delete the WG keys Secret on pod deletion Co-authored-by: dciangot <4144326+dciangot@users.noreply.github.com> Agent-Logs-Url: https://github.com/interlink-hq/interLink/sessions/515150a4-c5b6-47e4-b657-b4602bf0cc89
Copilot
AI
changed the title
[WIP] Persist generated WireGuard keys for full-mesh pods to avoid config drift
Persist generated WireGuard keys as Kubernetes Secrets to prevent key drift on reconcile retries
Mar 25, 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.
When full-mesh mode is enabled and WireGuard keypairs are auto-generated (no annotations pre-set), each reconcile retry regenerates a new keypair — causing the already-loaded
wg0interface on the shadow pod to diverge from the client snippet written in the same pass.Changes
pkg/virtualkubelet/mesh.go— newensureWGKeysSecret:<resourceBaseName>-wg-keysSecret in the wstunnel namespace storingserver-private-key,client-private-key, andclient-public-keypkg/virtualkubelet/virtualkubelet.go—createDummyPod:ensureWGKeysSecret; the returned values replace the generated ones so all downstream rendering (shadow pod config, client snippet) uses the same stable keypaircleanupWstunnelResourcesnow also deletes the<name>-wg-keysSecret on pod deletionOriginal prompt
⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.