Open EricBuist opened 9 months ago
This issue is currently awaiting triage.
SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted
label.
The triage/accepted
label can be added by org members by writing /triage accepted
in a comment.
Does it work if you escape the .
in the field name?
kubectl get configmap config-map -o jsonpath="{.data['application-config\.yaml']}"
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
What happened:
I have a config map containing a field with a dot in the name. The field is a YAML file encoded as a string. I wanted to extract the field using a JSONPath so it shows up as a YAML file instead of a single line with \n all over the place.
What you expected to happen:
I expected to get the information associated with field "application-config.yaml" from the config map config-map, without me having to think in advance not to put dots in field names.
How to reproduce it (as minimally and precisely as possible):
I verified that the issue happens with kubectl 1.29.0. Any config map with a field containing a dot, forcing use of [] in the JSONPath expression, will cause the problem.
kubectl get configmap config-map -o jsonpath="{.data['application-config.yaml']}"
. The command returns no output while it should return the contents or an error.Anything else we need to know?:
Only workaround is to output the full JSON and use a tool such as jq to extract the information. JSONPath becomes in practice less and less useful, requiring a lot of trial and error to come up with an expression to then figure out it won't work and I'd have to use an external tool.
Environment:
kubectl version
): Client Version: v1.29.0 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.27.3cat /etc/os-release
): PRETTY_NAME="Ubuntu 22.04.3 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.3 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms- and-policies/privacy-policy" UBUNTU_CODENAME=jammy