Skip to content

Built-in: importstr/yaml #995

Closed
Closed
@steeling

Description

@steeling

Feature Request

Is your feature request related to a problem? Please describe:
I want to declaritively create text files and import them into kcl.

Describe the feature you'd like:
I'd like to create configmaps through kcl, ie:

kind: "ConfigMap"
apiVersion: "v1"
data: {
   "myfile": importstr(myfile.txt)
}

Describe alternatives you've considered:
Create generative rules outside of kcl

Other improvements might be:

importYaml, which would be able to import a yaml file, and convert to a KCL object.
glob to allow creating a list of filenames, that I can then iterate over to create a set of files, ie:

kind: "ConfigMap"
apiVersion: "v1"
data: {
   filename: importstr(filename) for filename in glob('mydata/*.yaml')
}

This feature does exist in jsonnet

Metadata

Metadata

Labels

good first issueGood for newcomershelp wantedExtra attention is neededruntimeIssues or PRs related to kcl runtime including value and value opertionsstdlibIssues or PRs related to kcl standard libraries

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions