helmify icon indicating copy to clipboard operation
helmify copied to clipboard

Add crd spec to values.yaml

Open zalsader opened this issue 2 years ago • 0 comments

If my yaml file contains an object that is created by a CRD in the same file, it would be nice to add the spec to that object in values.yaml. Alternatively, #67 could be used and the user would have to do it manually.

Here's an example input:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
spec:
  names:
    kind: FooBar
  scope: Namespaced
  versions:
  - name: v1
    schema:
      openAPIV3Schema:
          spec:
            properties:
              baz:
                type: boolean
...
---
...
kind: FooBar
metadata:
  name: my-foo-bar
spec:
  baz: true

Desired <chart>/templates/my-foo-bar.yaml:

...
kind: FooBar
metadata:
  name: my-foo-bar
spec:
{{ toYaml .Values.myFooBarSpec | indent 2 }}

Desired <chart>/values.yaml:

...
myFooBarSpec:
  baz: true

zalsader avatar Jan 14 '23 04:01 zalsader