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

Value from YAML fragment that is embedded as multiline scalar value #4822

Closed
christian-2 opened this issue Oct 9, 2022 · 7 comments
Closed
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. triage/duplicate Indicates an issue is a duplicate of other open issue.

Comments

@christian-2
Copy link

christian-2 commented Oct 9, 2022

I would like to exact a value from a ConfigMap that contains a YAML fragment that is embedded inside another YAML fragment as multlline scalar value. ConfigMaps like this constitute a fairly common pattern with Kubernetes.

The relevant part of my ConfigMap looks as follows:

apiVersion: v1
kind: ConfigMap
metadata:
  name: config
data:
  config: |
    test:
      url: https://github.com

The relevant part of my kustomization.yaml looks as follows:

vars:
- name: URL
  objref:
    kind: ConfigMap
    name: config
    apiVersion: v1
  fieldref:
    fieldpath: data.config.test.url

This does not work for comprehensible reasons: It assumes that there is a single YAML fragment, not one that embeds another one as multiline string.

I guess what would be needed is support for fieldpaths such as yaml(data.config).test.url, conceptually speaking. Or am I missing something? Is there support for accessing such embedded values for the purpose of setting environment variables in kustomization.yaml and if so, how could this be accomplished in my concrete example.

@k8s-ci-robot k8s-ci-robot added needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 9, 2022
@christian-2
Copy link
Author

I have meanwhile taken note of the recommendation that one should migrate from vars to replacement. But even then the same question remains now with respect to source.fieldPath.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 8, 2023
@koba1t
Copy link
Member

koba1t commented Jan 18, 2023

Hi @christian-2

I think your use case is covered in my enhancement proposal.
#4558

Could you check the above proposal and decide whether that is enough for your want?

@annasong20
Copy link
Contributor

As @koba1t suggests, this feature seems to duplicate #3787 #4517

/kind feature
/triage duplicate

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. triage/duplicate Indicates an issue is a duplicate of other open issue. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 11, 2023
@christian-2
Copy link
Author

@koba1t Sorry for the late response @annasong20 @koba1t Yes, I can see now that the same use case has come up before, and I'd like to support these earlier efforts. Hence I would not insist on my sketched solution (with yaml() in fieldpaths over an ability to specify merge behavior, say.) Please advise if you want me to close this issue.

@annasong20
Copy link
Contributor

Defer to @koba1t

@koba1t
Copy link
Member

koba1t commented Feb 28, 2023

Hi @christian-2
I prefer to close this issue, and please join the discussion for that Proposal if you want.

I want to get a lot of feedback for this function!
I am happy to get your comments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. triage/duplicate Indicates an issue is a duplicate of other open issue.
Projects
None yet
Development

No branches or pull requests

5 participants