terraform-provider-kubernetes icon indicating copy to clipboard operation
terraform-provider-kubernetes copied to clipboard

How to express field_path to complex label name?

Open worldspawn opened this issue 3 years ago • 4 comments

Hello,

I would like to know how this should be written.

env {
            name = "ORLEANS_CLUSTER_ID"
            value_from {
              field_ref {
                field_path = "metadata.labels['orleans/clusterId']"
              }
            }
          }

This results in a literal value of metadata.labels['orleans/clusterId']. I can't find any examples for such a scenario. Is it supported?

Have also tried "metadata.labels.'orleans/clusterId'" "metadata.labels.orleans/clusterId" but they fail on run.

If this can/cannot be done could you also add a note in the relevant section deployment and/or pod documentation.

Terraform version, Kubernetes provider version and Kubernetes version

Terraform version: 0.14.6
Kubernetes Provider version: 2.0.2
Kubernetes version: 1.19.7

worldspawn avatar Mar 19 '21 00:03 worldspawn

Are you able to get this to work outside of Terraform using YAML? I can't find any documented example of a fieldPath with a slash in it which leads me to suspect that this might not be possible.

The docs do have an example of using a volume to get the pod labels – that might be a possible workaround: https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#store-pod-fields

jrhouston avatar Apr 07 '21 07:04 jrhouston

@worldspawn did you ever find a solution to this? I'm coming up against the same issue.

bobbymartinez avatar Aug 28 '21 01:08 bobbymartinez

No I gave up 🤷‍♂️

worldspawn avatar Aug 28 '21 02:08 worldspawn

@jrhouston in answer to your question -> https://dotnet.github.io/orleans/docs/deployment/kubernetes.html

worldspawn avatar Jun 23 '22 00:06 worldspawn

Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you!

github-actions[bot] avatar Jun 24 '23 00:06 github-actions[bot]