diff --git a/examples/kubevela/template-oam-app/kcl.mod b/examples/kubevela/template-oam-app/kcl.mod new file mode 100644 index 00000000..d012b457 --- /dev/null +++ b/examples/kubevela/template-oam-app/kcl.mod @@ -0,0 +1,7 @@ +[package] +name = "inherit-oam-app" +edition = "v0.10.0" +version = "0.0.1" + +[dependencies] +oam = "0.2.1" diff --git a/examples/kubevela/template-oam-app/kcl.mod.lock b/examples/kubevela/template-oam-app/kcl.mod.lock new file mode 100644 index 00000000..972bf458 --- /dev/null +++ b/examples/kubevela/template-oam-app/kcl.mod.lock @@ -0,0 +1,10 @@ +[dependencies] + [dependencies.k8s] + name = "k8s" + full_name = "k8s_1.31.2" + version = "1.31.2" + [dependencies.oam] + name = "oam" + full_name = "oam_0.2.1" + version = "0.2.1" + sum = "bz5HT/ggMm6heYVUOaZd5mOLIv/q2jicXupv0ChDlsE=" diff --git a/examples/kubevela/template-oam-app/main.k b/examples/kubevela/template-oam-app/main.k new file mode 100644 index 00000000..4a545ec6 --- /dev/null +++ b/examples/kubevela/template-oam-app/main.k @@ -0,0 +1,27 @@ +import oam + +schema MyTemplate: + name: str + image: str + cmd?: [str] + port: int = 80 + +schema MyApplication[template: MyTemplate](oam.Application): + metadata = {name = "kcl-play-svc"} + spec = { + components = [{ + name = metadata.name + type = "webservice" + properties = { + image = "kcllang/kcl" + ports = [{port = 80, expose = True}] + cmd = ["kcl", "play"] + } + }] + } + +MyApplication({ + name = "kcl-play-svc" + image = "kcllang/kcl" + cmd: ["kcl", "play"] +}) {}