Preserve translator identity metadata on host pod updates - #3
Merged
Conversation
updatePod copies the virtual pod's labels and annotations verbatim onto the host pod. The virtual pod never carries the translator-added k3k.io/clusterName label or the k3k.io/name and k3k.io/namespace annotations, so any pod update (image bump, label/annotation change, kubelet restart re-sync) strips them from the host pod. That breaks every label-selector consumer on the host side: synced services such as k3k-<cluster>-kube-dns lose all endpoints (virtual-cluster DNS goes dark), and network policies selecting on the cluster label silently stop matching the pod. Re-assert the translator-owned keys after the copy so updates propagate virtual label changes without destroying host-side identity. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
updatePodcopies the virtual pod's labels and annotations verbatim onto the host pod. The virtual pod never carries the translator-addedk3k.io/clusterNamelabel or thek3k.io/name/k3k.io/namespaceannotations, so any pod update (image bump, label/annotation change, kubelet restart re-sync) strips them from the host pod.Observed impact on a live shared-mode cluster: after a k3k-kubelet restart, every synced workload pod lost
k3k.io/clusterName. The syncedk3k-<cluster>-kube-dnsservice (selector includes that label) lost all endpoints — DNS inside the virtual cluster went completely dark (operation not permittedon every lookup, external-dns and anything else needing DNS dead). Any NetworkPolicy/CiliumNetworkPolicy selecting on the label silently stops matching, too.Fix
After the label/annotation copy in the host-pod update path, re-assert the translator-owned identity keys. Virtual label changes still propagate; host-side identity survives.
Testing
go test ./k3k-kubelet/provider/passesk3k.io/clusterName; kube-dns endpoints stay populated across kubelet restarts🤖 Generated with Claude Code