Skip to content

Expose pod index as a pod label and source env var from it via fieldRef #506

@julienmancuso

Description

@julienmancuso

What you would like to be added?

Expose the pod index within a PodClique as a pod label (grove.io/podclique-pod-index) and source the GROVE_PCLQ_POD_INDEX environment variable from that label via Kubernetes Downward API (fieldRef).

Why is this needed?

As a PCS user, I need to define custom environment variables that are derived from the pod index (e.g. ENGINE_ID used by Dynamo applications). Today, GROVE_PCLQ_POD_INDEX is injected by the operator as a direct value at pod creation time, which means there is no way for users to reference it in their own env var definitions via the Downward API.

By exposing the pod index as a label, users can define their own env vars that reference it:

env:
  - name: ENGINE_ID
    valueFrom:
      fieldRef:
        fieldPath: metadata.labels['grove.io/podclique-pod-index']

This is consistent with how GROVE_PCSG_INDEX and GROVE_PCSG_NAME are already exposed via labels and fieldRef.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No fields configured for Task.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions