Skip to content

Commit a6e8836

Browse files
authored
docs: update examples to reflect kusion modules (#154)
1 parent e8671c4 commit a6e8836

File tree

15 files changed

+103
-78
lines changed

15 files changed

+103
-78
lines changed

example/nginx/dev/kcl.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name = "nginx"
33
version = "0.1.0"
44

55
[dependencies]
6-
catalog = { git = "https://github.com/KusionStack/catalog.git", tag = "0.1.2" }
6+
kam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }
7+
network = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }
78

89
[profile]
910
entries = ["main.k"]

example/nginx/dev/main.k

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import catalog.models.schema.v1 as ac
2-
import catalog.models.schema.v1.workload as wl
3-
import catalog.models.schema.v1.workload.container as c
4-
import catalog.models.schema.v1.workload.network as n
1+
import kam.v1.app_configuration as ac
2+
import kam.v1.workload as wl
3+
import kam.v1.workload.container as c
4+
import network as n
55

66
nginx: ac.AppConfiguration {
77
workload: wl.Service {
@@ -15,12 +15,16 @@ nginx: ac.AppConfiguration {
1515
}
1616
}
1717
replicas: 1
18-
ports: [
19-
n.Port {
20-
port: 80
21-
protocol: "TCP"
22-
public: True
23-
}
24-
]
18+
}
19+
accessories: {
20+
"network": n.Network {
21+
ports: [
22+
n.Port {
23+
port: 80
24+
protocol: "TCP"
25+
public: True
26+
}
27+
]
28+
}
2529
}
2630
}
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import catalog.models.schema.v1 as ac
2-
import catalog.models.schema.v1.workload as wl
3-
import catalog.models.schema.v1.workload.network as n
4-
import catalog.models.schema.v1.workload.container as c
1+
import kam.v1.app_configuration as ac
2+
import kam.v1.workload as wl
3+
import kam.v1.workload.container as c
4+
import network as n
55

66
echoserver: ac.AppConfiguration {
77
workload: wl.Service {
@@ -15,10 +15,14 @@ echoserver: ac.AppConfiguration {
1515
}
1616
}
1717
replicas: 1
18-
ports: [
19-
n.Port {
20-
port: 80
21-
}
22-
]
18+
}
19+
accessories: {
20+
"network": n.Network {
21+
ports: [
22+
n.Port {
23+
port: 80
24+
}
25+
]
26+
}
2327
}
2428
}

example/service-multi-stack/dev/kcl.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name = "service-multi-stack-dev"
33
version = "0.1.0"
44

55
[dependencies]
6-
catalog = { git = "https://github.com/KusionStack/catalog.git", tag = "0.1.2" }
6+
kam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }
7+
network = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }
78

89
[profile]
910
entries = ["../base/base.k", "main.k"]

example/service-multi-stack/dev/main.k

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import catalog.models.schema.v1 as ac
1+
import kam.v1.app_configuration as ac
22

33
# main.k declares customized configurations for dev stack.
44
echoserver: ac.AppConfiguration {

example/service-multi-stack/prod/kcl.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name = "service-multi-stack-prod"
33
version = "0.1.0"
44

55
[dependencies]
6-
catalog = { git = "https://github.com/KusionStack/catalog.git", tag = "0.1.2" }
6+
kam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }
7+
network = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }
78

89
[profile]
910
entries = ["../base/base.k", "main.k"]
11+

example/service-multi-stack/prod/main.k

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import catalog.models.schema.v1 as ac
1+
import kam.v1.app_configuration as ac
22

33
# main.k declares customized configurations for prod stack.
44
echoserver: ac.AppConfiguration {

example/simple-job/dev/kcl.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name = "simple-job"
33
version = "0.1.0"
44

55
[dependencies]
6-
catalog = { git = "https://github.com/KusionStack/catalog.git", tag = "0.1.2" }
6+
kam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }
77

88
[profile]
99
entries = ["main.k"]
10+

example/simple-job/dev/main.k

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import catalog.models.schema.v1 as ac
2-
import catalog.models.schema.v1.workload as wl
3-
import catalog.models.schema.v1.workload.container as c
1+
import kam.v1.app_configuration as ac
2+
import kam.v1.workload as wl
3+
import kam.v1.workload.container as c
44

55
helloworld: ac.AppConfiguration {
66
workload: wl.Job {

example/simple-service/dev/kcl.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ name = "simple-service"
33
version = "0.1.0"
44

55
[dependencies]
6-
catalog = { git = "https://github.com/KusionStack/catalog.git", tag = "0.1.2" }
6+
kam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }
7+
network = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }
8+
opsrule = { oci = "oci://ghcr.io/kusionstack/opsrule", tag = "0.1.0" }
9+
monitoring = { oci = "oci://ghcr.io/kusionstack/monitoring", tag = "0.1.0" }
710

811
[profile]
912
entries = ["main.k"]

example/simple-service/dev/main.k

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import catalog.models.schema.v1 as ac
2-
import catalog.models.schema.v1.workload as wl
3-
import catalog.models.schema.v1.workload.container as c
4-
import catalog.models.schema.v1.workload.container.probe as p
5-
import catalog.models.schema.v1.workload.network as n
6-
import catalog.models.schema.v1.monitoring as m
7-
import catalog.models.schema.v1.trait as t
1+
import kam.v1.app_configuration as ac
2+
import kam.v1.workload as wl
3+
import kam.v1.workload.container as c
4+
import kam.v1.workload.container.probe as p
5+
import monitoring as m
6+
import opsrule as o
7+
import network as n
88

99
helloworld: ac.AppConfiguration {
1010
workload: wl.Service {
@@ -29,20 +29,21 @@ helloworld: ac.AppConfiguration {
2929
}
3030
}
3131
replicas: 2
32-
# Comment the following block to un-expose service
33-
ports: [
34-
n.Port {
35-
port: 8080
36-
targetPort: 80
37-
}
38-
]
39-
}
40-
# Comment the following block to remove opsRule
41-
opsRule: t.OpsRule {
42-
maxUnavailable: "30%"
4332
}
44-
# Comment the following block to disable monitoring
45-
monitoring: m.Prometheus{
46-
path: "/metrics"
33+
accessories: {
34+
"network": n.Network {
35+
ports: [
36+
n.Port {
37+
port: 8080
38+
targetPort: 80
39+
}
40+
]
41+
}
42+
"monitoring": m.Prometheus {
43+
path: "/metrics"
44+
}
45+
"opsRule": o.OpsRule {
46+
maxUnavailable: "30%"
47+
}
4748
}
4849
}

example/wordpress-cloud-rds/prod/kcl.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name = "wordpress-cloud-rds"
33
version = "0.1.0"
44

55
[dependencies]
6-
catalog = { git = "https://github.com/KusionStack/catalog.git", tag = "0.1.2" }
6+
mysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }
7+
kam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }
8+
network = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }
79

810
[profile]
911
entries = ["main.k"]

example/wordpress-cloud-rds/prod/main.k

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import catalog.models.schema.v1 as ac
2-
import catalog.models.schema.v1.workload as wl
3-
import catalog.models.schema.v1.workload.container as c
4-
import catalog.models.schema.v1.workload.network as n
5-
import catalog.models.schema.v1.accessories.mysql
1+
import kam.v1.app_configuration as ac
2+
import kam.v1.workload as wl
3+
import kam.v1.workload.container as c
4+
import network as n
5+
import mysql as m
66

77
# main.k declares customized configurations for prod stacks.
88
wordpress: ac.AppConfiguration {
@@ -23,14 +23,16 @@ wordpress: ac.AppConfiguration {
2323
}
2424
}
2525
replicas: 1
26-
ports: [
27-
n.Port {
28-
port: 80
29-
}
30-
]
3126
}
32-
database: {
33-
wordpress: mysql.MySQL {
27+
accessories: {
28+
"network": n.Network {
29+
ports: [
30+
n.Port {
31+
port: 80
32+
}
33+
]
34+
}
35+
"mysql": m.MySQL {
3436
type: "cloud"
3537
version: "8.0"
3638
}

example/wordpress-local-db/prod/kcl.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name = "wordpress-local-db"
33
version = "0.1.0"
44

55
[dependencies]
6-
catalog = { git = "https://github.com/KusionStack/catalog.git", tag = "0.1.2" }
6+
kam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }
7+
network = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }
8+
mysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }
79

810
[profile]
911
entries = ["main.k"]

example/wordpress-local-db/prod/main.k

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import catalog.models.schema.v1 as ac
2-
import catalog.models.schema.v1.workload as wl
3-
import catalog.models.schema.v1.workload.container as c
4-
import catalog.models.schema.v1.workload.network as n
5-
import catalog.models.schema.v1.accessories.mysql
1+
import kam.v1.app_configuration as ac
2+
import kam.v1.workload as wl
3+
import kam.v1.workload.container as c
4+
import network as n
5+
import mysql as m
66

77
# main.k declares customized configurations for prod stack.
88
wordpress: ac.AppConfiguration {
@@ -19,15 +19,17 @@ wordpress: ac.AppConfiguration {
1919
}
2020
}
2121
replicas: 1
22-
ports: [
23-
n.Port {
24-
port: 80
25-
}
26-
]
2722
}
28-
database: {
29-
wordpress: mysql.MySQL {
30-
type: "local"
23+
accessories: {
24+
"network": n.Network {
25+
ports: [
26+
n.Port {
27+
port: 80
28+
}
29+
]
30+
}
31+
"mysql": m.MySQL {
32+
type: "local"
3133
version: "8.0"
3234
}
3335
}

0 commit comments

Comments
 (0)