Skip to content

Secrets will be populated to Pod in VK #162

Not planned

Description

@kerthcet

What happened:

createOrUpdatePod skips PopulateEnvironmentVariables, so CreatePod receives the Pod with secretKeyRef, configMapKeyRef and envFrom intact.

To solve it:

The option

From v1.13.0, virtual-kubelet's PodControllerConfig has SkipDownwardAPIResolution:

// SkipDownwardAPIResolution can be used to skip any attempts at resolving downward API references
// in pods before calling CreatePod on the provider.
// Providers need this if they need to do their own custom resolving
SkipDownwardAPIResolution bool

When it's set, createOrUpdatePod skips PopulateEnvironmentVariables, so CreatePod receives the Pod with secretKeyRef, configMapKeyRef and envFrom intact. Nebula would set it in pkg/vnode/node.go. Then:
- The Kubernetes provider keeps the references (bringing remoteEnv back). No Secret value is written into a Pod spec, and the target's kubelet reads the reflected copies. That closes the review comment properly.
- resolveEnv becomes the real resolver for Modal and AWS, with the rules it already documents. The Config/Secrets split becomes real, and the empty Service lister trick for service links is no longer needed.

What it costs

- A dependency upgrade. Nebula is on virtual-kubelet v1.11.0, client-go v0.33.4 and controller-runtime v0.21.0. Virtual-kubelet v1.13.0 requires client-go v0.35.4 and controller-runtime v0.23.3, and v1.14.1 requires v0.37.1 and v0.25.2. That's a repo-wide bump, which belongs in its own PR.
- Behaviour changes for Modal and AWS, since resolveEnv's rules would apply instead of virtual-kubelet's:
  - $(VAR) in env values would no longer be expanded.
  - status.* field references, such as status.podIP, would be refused with a ConfigError.
  - A missing required reference would fail in Nebula's CreatePod instead of in virtual-kubelet.

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

Activity

  1. added
    bug
    on Nov 26, 2026
  2. added
    needs-triage
    needs-priority
    on Nov 26, 2026
  3. kerthcet commented on Nov 26, 2026

    @kerthcet
    MemberAuthor

    /help

  4. added
    help wanted
    on Nov 26, 2026
  5. kerthcet commented on Nov 28, 2026

    @kerthcet
    MemberAuthor

    Closing as won't fix for now. #165 implemented this (skip virtual-kubelet's resolution for the Kubernetes provider only, pass env/envFrom through to the target kubelet), but it regresses metadata fieldRefs: they resolve against the real pod, not the placeholder, and the real pod differs by design:

    • metadata.annotations['…'] → "" (only Nebula's annotations are set). This breaks Indexed Jobs: JOB_COMPLETION_INDEX is empty.
    • metadata.labels['k'] → "" for keys outside --kubernetes-propagate-labels / --cost-labels.
    • metadata.name → the claim name (<namespace>-<pod>), metadata.uid → the real pod's, spec.serviceAccountName → "".

    Fixing it would mean inlining those metadata references from the placeholder in buildPod, on top of the pass-through. We keep virtual-kubelet's resolution instead: every reference resolves against the placeholder, and the trade-off, Secret values inline in the target pod spec, is accepted while target clusters are Nebula-only. Resolving in the target also let a host workload read a target-owned Secret of a matching name; that goes away too.

    virtual-kubelet v1.13 (#164) stays, so SkipDownwardAPIResolution and #165's approach are available if this is revisited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wantedneeds-priorityneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions