carvel-dev / ytt

YAML templating tool that works on YAML structure instead of text
https://carvel.dev/ytt
Apache License 2.0
1.68k stars 137 forks source link

Support composite settings file like kustomization.yaml or include just other yaml #813

Closed wreulicke closed 1 year ago

wreulicke commented 1 year ago

Describe the problem/challenge you have [A description of the current challenge that you are experiencing.] Now, we have the following structure.

├── base
│   └── api.yaml
└── envs
    └── dev
        ├── api.yaml
        └── values.yaml

Then, we need to execute the following command to generate yaml.

ytt -f base/api.yaml -f envs/dev/api.yaml -f envs/dev/values.yaml

We have to add wrapper script with ytt because of this.

Describe the solution you'd like [A clear and concise description of what you want to happen. If applicable a visual representation of the UX (ex: new CLI argument name, or resulting yaml).]

I would like to generate yaml by the following command.

ytt -f envs/dev/api.yaml
# or like kustomize
ytt -f envs/dev/

To achieve this, we need to composition settings file like kustomization.yaml or include just other yaml

approach 1. composition settings file

This approach is similar to kustomization.yaml

#! envs/dev/api.yaml
resources:
- ../../base/
- api.yaml
- values.yaml

approach 2. include just other yaml

#! envs/dev/api.yaml
#@ include("../../base/api.yaml")

---
#@ load("@ytt:overlay", "overlay")

#@overlay/match by=overlay.all
---
spec:
  template:
    spec:
      containers:
      #@overlay/match by=overlay.index(0)
      - env:
        - name: SOME_ENV
          value: overlay

Anything else you would like to add: [Additional information that will assist in solving the issue.]


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible" 👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

github-actions[bot] commented 1 year ago

This issue is being marked as stale due to a long period of inactivity and will be closed in 5 days if there is no response.

liangyuanpeng commented 1 year ago

I think it's useful, do not stale.

github-actions[bot] commented 1 year ago

This issue is being marked as stale due to a long period of inactivity and will be closed in 5 days if there is no response.

github-actions[bot] commented 1 year ago

This issue is being marked as stale due to a long period of inactivity and will be closed in 5 days if there is no response.