Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only some of the Downward API information is available through envvars and downwardAPI volumes #468

Closed
12 of 18 tasks
metral opened this issue Mar 4, 2019 · 4 comments
Closed
12 of 18 tasks
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/no-repro This issue wasn't able to be reproduced

Comments

@metral
Copy link
Contributor

metral commented Mar 4, 2019

On k8s v1.11 we have access to information that is available to containers through environment variables and/or downward API volumes.

However, in using either envvars or downwardAPI volumes, not all of this information is available. I can't tell if it's something on our end, and if so where.

In our nodejs output types, comments aside, we actually only support the following info for each implementation:

  • Env vars using valueFrom.fieldRef:

    • spec.nodeName - the node’s name
    • status.hostIP - the node’s IP
    • metadata.name - the pod’s name
    • metadata.namespace - the pod’s namespace
    • status.podIP - the pod’s IP address
    • spec.serviceAccountName - the pod’s service account name
    • metadata.uid - the pod’s UID
    • metadata.labels[''] - the value of the pod’s label (for example, metadata.labels['mylabel'])
    • metadata.annotations[''] - the value of the pod’s annotation (for example, metadata.annotations['myannotation'])
  • DownwardAPI volumes via items of fieldRef:

    • spec.nodeName - the node’s name
    • status.hostIP - the node’s IP
    • metadata.name - the pod’s name
    • metadata.namespace - the pod’s namespace
    • status.podIP - the pod’s IP address
    • spec.serviceAccountName - the pod’s service account name
    • metadata.uid - the pod’s UID
    • metadata.labels- the value of the pod’s label (for example, metadata.labels['mylabel'])
    • metadata.annotations - the value of the pod’s annotation (for example, metadata.annotations['myannotation'])

Attempts to access any of the missing info from either implementation method, returns an error similar to the following: e.g when using envvars we can't accessmetadata.labels or metadata.annotations:

error: Plan apply failed: Job.batch "cts-auto-metral-job-datadirector-kx9bp16g" is invalid:

[spec.template.spec.containers[0].env[6].valueFrom.fieldRef.fieldPath: Unsupported value: "metadata.labels": supported values: "metadata.name", "metadata.namespace", "metadata.uid", "spec.nodeName", "spec.serviceAccountName", "status.hostIP", "status.podIP",

spec.template.spec.containers[0].env[7].valueFrom.fieldRef.fieldPath: Unsupported value: "metadata.annotations": supported values: "metadata.name", "metadata.namespace", "metadata.uid", "spec.nodeName", "spec.serviceAccountName", "status.hostIP", "status.podIP", 

spec.template.spec.initContainers[0].env[4].valueFrom.fieldRef.fieldPath: Unsupported value: "metadata.labels": supported values: "metadata.name", "metadata.namespace", "metadata.uid", "spec.nodeName", "spec.serviceAccountName", "status.hostIP", "status.podIP", 

spec.template.spec.initContainers[0].env[5].valueFrom.fieldRef.fieldPath: Unsupported value: "metadata.annotations": supported values: "metadata.name", "metadata.namespace", "metadata.uid", "spec.nodeName", "spec.serviceAccountName", "status.hostIP", "status.podIP"]

It's worth noting, that:

  • for envvars we are missing metadata.labels and metadata.annotations, which are both lists/arrays of values, whereas we do support envvars values that are single values e.g. spec.podIP.
  • for downwardAPI volumes we can only access the Pod's metadata object, but not its spec or status

/cc @lblackstone @hausdorff

@hausdorff
Copy link
Contributor

This seems like it would have to be enforced by the API server -- we definitely don't mess with this information directly. The v1.13 docs say the same thing, though. Are we sure this isn't a bug in upstream?

@lblackstone
Copy link
Member

Given that the problem only seems to be present on list items, I wonder if this is another incarnation of the bug I fixed in #461

@metral
Copy link
Contributor Author

metral commented Mar 4, 2019 via email

@lblackstone lblackstone added kind/bug Some behavior is incorrect or out of spec resolution/no-repro This issue wasn't able to be reproduced labels Jul 13, 2023
@lblackstone lblackstone self-assigned this Jul 13, 2023
@lblackstone
Copy link
Member

Unable to repro on this old issue, so closing it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/no-repro This issue wasn't able to be reproduced
Projects
None yet
Development

No branches or pull requests

3 participants