Skip to content

Commit

Permalink
docs: add template oam app example
Browse files Browse the repository at this point in the history
Signed-off-by: Peefy <[email protected]>
  • Loading branch information
Peefy committed Nov 5, 2024
1 parent 81e4062 commit 8754340
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/kubevela/template-oam-app/kcl.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "inherit-oam-app"
edition = "v0.10.0"
version = "0.0.1"

[dependencies]
oam = "0.2.1"
10 changes: 10 additions & 0 deletions examples/kubevela/template-oam-app/kcl.mod.lock
Original file line number Diff line number Diff line change
@@ -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="
27 changes: 27 additions & 0 deletions examples/kubevela/template-oam-app/main.k
Original file line number Diff line number Diff line change
@@ -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"]
}) {}

0 comments on commit 8754340

Please sign in to comment.