Skip to content

Generate template files from kctrl package init #1182

Open
@liangyuanpeng

Description

@liangyuanpeng

Describe the problem/challenge you have

I want to generate a template carvel package from command of kctrl package init for quickly to know carvel package.

Describe the solution you'd like

Auto generate files (from https://github.com/carvel-dev/ytt/tree/develop/examples/playground/basics/example-demo) :

defaults.yml

#@data/values
---
echos:
- name: first
- name: second
  port: 8081
  text: "Hello #ytt World on 8081!"

demo.yml

#@ load("@ytt:data", "data")

#@ def labels():
app: echo
org: test
#@ end

#@ def name(echo):
#@   return "echo-"+echo.name
#@ end

kind: Pod
apiVersion: v1
metadata:
  name: echo-app
  labels: #@ labels()
spec:
  containers:
  #@ for/end echo in data.values.echos:
  - name: #@ name(echo)
    image: hashicorp/http-echo
    args:
    - #@ "-listen=:" + str(echo.port)
    - #@ "-text=" + echo.text

#@ if/end data.values.service.enabled:
---
kind: Service
apiVersion: v1
metadata:
  name: echo-service
spec:
  selector: #@ labels()
  ports:
  #@ for/end echo in data.values.echos:
  - name: #@ name(echo)
    port: #@ echo.port

schema.yml

#@data/values-schema
---
echos:
- name: ""
  port: 8080
  text: "Hello #ytt World on 8080!"
service:
  enabled: true

Anything else you would like to add:


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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionThis issue is not a bug or feature and a conversation is needed to find an appropriate resolutionenhancementThis issue is a feature request

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions