Downward API vs. metadata.labels
Issue
- According to https://access.redhat.com/documentation/en/openshift-enterprise/version-3.2/developer-guide/#selecting-fields metadata.labels should be a valid selector. Trying to use this fieldPath leads to an error:
$ oc create -f pod.yaml
The Pod "test-pod" is invalid.
spec.containers[0].env[0].valueFrom.fieldRef.fieldPath: Unsupported value: "metadata.labels": supported values: metadata.name, metadata.namespace, status.podIP
#cat pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: test-pod
spec:
containers:
- name: test-container
image: reverse-proxy/reverse-proxy
command: [ "/bin/sh", "-c", "env" ]
env:
- name: POD_LABELS
valueFrom:
fieldRef:
fieldPath: metadata.labels
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
restartPolicy: Never
Environment
- Openshift Enterprise 3.2
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
