carvel-dev / carvel-dev/ytt

ytt should have a functionality to generate value file skeletons

Open
#253 3 comments 1 reaction 0 assignees View on GitHub
carvel accepted enhancement
Dominant language
Go
Stars
1.9k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem/challenge you have**
I was parameterizing a k8s yaml file and added a bunch of data values into it, e.g.:
```
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: #@ data.values.meta.appname if data.values.meta.appname else assert.fail("missing data.values.meta.appname ")
namespace: #@ data.values.meta.appnamespace or "argocd"
```
The needed _values-skeleton.yml looks like this:
```
#@data/values
---
meta:
appname:
appnamespace:
```
Currently this needs to be done by hand/manually. This is especially challenging if you need to merge multiple yaml snippets to compose an application/deployment unit and want to create a data values file for it. It would also be nice to validate/annotate unused data values in a value file when applied to a set of input files.

**Describe the solution you'd like**
Given the first snippet of a prepared yaml file/template, I would like to have a functionality that I can invoke via cli to generate the output as described in the second snippet above: `ytt values generate -f application.yml -o values.yml`
For validation and checking for unused values I would propose something like this:
```
ytt values validate -f application.yml -f values.yml
-----
VALID
[INFO] data.values.projectname is unused
-----
INVALID
[ERR] data.values.meta.appname is not provided but required
[INFO] data.values.meta.namespace is not provided
...
```

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.