kcl
This module provides KCL (KCL Configuration Language) functionality through Dagger.It includes functions to run KCL code, validate configurations, and test the KCL CLI.
KCL is a constraint-based record and functional language hosted by CNCF that enhances
the writing of complex configurations, including those for cloud-native scenarios.
Installation
dagger install github.com/stuttgart-things/dagger/kcl@v0.36.0Entrypoint
Return Type
Kcl Example
dagger -m github.com/stuttgart-things/dagger/kcl@065862a0d97418baed85591edcb679e50be23e57 call \
func (m *MyModule) Example() *dagger.Kcl {
return dag.
Kcl()
}@function
def example() -> dagger.Kcl:
return (
dag.kcl()
)@func()
example(): Kcl {
return dag
.kcl()
}Types
Kcl 🔗
baseImage() 🔗
Return Type
String ! Example
dagger -m github.com/stuttgart-things/dagger/kcl@065862a0d97418baed85591edcb679e50be23e57 call \
base-imagefunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Kcl().
BaseImage(ctx)
}@function
async def example() -> str:
return await (
dag.kcl()
.base_image()
)@func()
async example(): Promise<string> {
return dag
.kcl()
.baseImage()
}testKcl() 🔗
TestKcl runs a basic KCL test to verify the container and CLI are working
Return Type
String ! Example
dagger -m github.com/stuttgart-things/dagger/kcl@065862a0d97418baed85591edcb679e50be23e57 call \
test-kclfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Kcl().
TestKcl(ctx)
}@function
async def example() -> str:
return await (
dag.kcl()
.test_kcl()
)@func()
async example(): Promise<string> {
return dag
.kcl()
.testKcl()
}runKcl() 🔗
RunKcl executes KCL code from a provided directory
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory ! | - | No description provided |
| entrypoint | String ! | - | No description provided |
Example
dagger -m github.com/stuttgart-things/dagger/kcl@065862a0d97418baed85591edcb679e50be23e57 call \
run-kcl --source DIR_PATH --entrypoint stringfunc (m *MyModule) Example(ctx context.Context, source *dagger.Directory, entrypoint string) string {
return dag.
Kcl().
RunKcl(ctx, source, entrypoint)
}@function
async def example(source: dagger.Directory, entrypoint: str) -> str:
return await (
dag.kcl()
.run_kcl(source, entrypoint)
)@func()
async example(source: Directory, entrypoint: string): Promise<string> {
return dag
.kcl()
.runKcl(source, entrypoint)
}validateKcl() 🔗
ValidateKcl validates KCL configuration files by compiling them
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory ! | - | No description provided |
Example
dagger -m github.com/stuttgart-things/dagger/kcl@065862a0d97418baed85591edcb679e50be23e57 call \
validate-kcl --source DIR_PATHfunc (m *MyModule) Example(ctx context.Context, source *dagger.Directory) string {
return dag.
Kcl().
ValidateKcl(ctx, source)
}@function
async def example(source: dagger.Directory) -> str:
return await (
dag.kcl()
.validate_kcl(source)
)@func()
async example(source: Directory): Promise<string> {
return dag
.kcl()
.validateKcl(source)
}kclVersion() 🔗
KclVersion returns the installed KCL version
Return Type
String ! Example
dagger -m github.com/stuttgart-things/dagger/kcl@065862a0d97418baed85591edcb679e50be23e57 call \
kcl-versionfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Kcl().
KclVersion(ctx)
}@function
async def example() -> str:
return await (
dag.kcl()
.kcl_version()
)@func()
async example(): Promise<string> {
return dag
.kcl()
.kclVersion()
}convertCrd() 🔗
ConvertCrd converts a single CRD file (local or web source) to KCL models Returns a directory containing the generated models/v1beta1/ structure
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| crdSource | String | - | No description provided |
| crdFile | File | - | No description provided |
Example
dagger -m github.com/stuttgart-things/dagger/kcl@065862a0d97418baed85591edcb679e50be23e57 call \
convert-crdfunc (m *MyModule) Example() *dagger.Directory {
return dag.
Kcl().
ConvertCrd()
}@function
def example() -> dagger.Directory:
return (
dag.kcl()
.convert_crd()
)@func()
example(): Directory {
return dag
.kcl()
.convertCrd()
}convertCrdToDirectory() 🔗
ConvertCrdToDirectory converts a CRD and outputs the models to a specified working directory This version gives more control over the output structure and allows custom organization
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| workdir | Directory ! | - | No description provided |
| crdSource | String | - | No description provided |
| crdFile | File | - | No description provided |
| outputPath | String | - | No description provided |
Example
dagger -m github.com/stuttgart-things/dagger/kcl@065862a0d97418baed85591edcb679e50be23e57 call \
convert-crd-to-directory --workdir DIR_PATHfunc (m *MyModule) Example(workdir *dagger.Directory) *dagger.Directory {
return dag.
Kcl().
ConvertCrdToDirectory(workdir)
}@function
def example(workdir: dagger.Directory) -> dagger.Directory:
return (
dag.kcl()
.convert_crd_to_directory(workdir)
)@func()
example(workdir: Directory): Directory {
return dag
.kcl()
.convertCrdToDirectory(workdir)
}