From 6db88b5a00aeccc434baf3a2103f98d717ec2dc6 Mon Sep 17 00:00:00 2001 From: Hussein Galal Date: Mon, 18 Aug 2025 14:28:19 +0300 Subject: [PATCH] Revert "Fix pod fieldpath annotation translation (#434)" (#435) This reverts commit 883d401ae36328a5ba425b48e12493499e1a1b48. --- k3k-kubelet/provider/provider.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/k3k-kubelet/provider/provider.go b/k3k-kubelet/provider/provider.go index 6229bf37..86d74985 100644 --- a/k3k-kubelet/provider/provider.go +++ b/k3k-kubelet/provider/provider.go @@ -340,14 +340,7 @@ func (p *Provider) CreatePod(ctx context.Context, pod *corev1.Pod) error { // createPod takes a Kubernetes Pod and deploys it within the provider. func (p *Provider) createPod(ctx context.Context, pod *corev1.Pod) error { - // fieldPath envs are not being translated correctly using the virtual kubelet pod controller - // as a workaround we will try to fetch the pod from the virtual cluster and copy over the envSource - var sourcePod corev1.Pod - if err := p.VirtualClient.Get(ctx, types.NamespacedName{Name: pod.Name, Namespace: pod.Namespace}, &sourcePod); err != nil { - return err - } - - tPod := sourcePod.DeepCopy() + tPod := pod.DeepCopy() p.Translator.TranslateTo(tPod) // get Cluster definition @@ -392,7 +385,7 @@ func (p *Provider) createPod(ctx context.Context, pod *corev1.Pod) error { } // fieldpath annotations - if err := p.configureFieldPathEnv(&sourcePod, tPod); err != nil { + if err := p.configureFieldPathEnv(pod, tPod); err != nil { return fmt.Errorf("unable to fetch fieldpath annotations for pod %s/%s: %w", pod.Namespace, pod.Name, err) } // volumes will often refer to resources in the virtual cluster, but instead need to refer to the sync'd @@ -618,11 +611,6 @@ func (p *Provider) updatePod(ctx context.Context, pod *corev1.Pod) error { return nil } - // fieldpath annotations - if err := p.configureFieldPathEnv(¤tVirtualPod, ¤tHostPod); err != nil { - return fmt.Errorf("unable to fetch fieldpath annotations for pod %s/%s: %w", pod.Namespace, pod.Name, err) - } - currentVirtualPod.Spec.Containers = updateContainerImages(currentVirtualPod.Spec.Containers, pod.Spec.Containers) currentVirtualPod.Spec.InitContainers = updateContainerImages(currentVirtualPod.Spec.InitContainers, pod.Spec.InitContainers)