-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from kcl-lang/extra-resource-example
feat: add extra resource examples
- Loading branch information
Showing
6 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import konfig.models.kube.frontend | ||
import konfig.models.kube.frontend.service | ||
import konfig.models.kube.frontend.container | ||
|
||
# Application Configuration | ||
appConfiguration: frontend.Server { | ||
# Main Container Configuration | ||
mainContainer = container.Main { | ||
ports = [ | ||
{containerPort = 80} | ||
] | ||
env.MY_ENV: { | ||
value = "MY_VALUE" | ||
} | ||
} | ||
image = "nginx:1.7.8" | ||
services = [ | ||
service.Service { | ||
name = "nginx" | ||
type = "NodePort" | ||
ports = [ | ||
{ | ||
nodePort = 30201 | ||
port = 80 | ||
targetPort = 80 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "nginx-example-dev" | ||
version = "0.0.1" | ||
|
||
[dependencies] | ||
konfig = { path = "../../../../../konfig" } | ||
k8s = "1.28" | ||
[profile] | ||
entries = ["../base/base.k", "main.k", "${konfig:KCL_MOD}/models/kube/render/render.k"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[dependencies] | ||
[dependencies.k8s] | ||
name = "k8s" | ||
full_name = "k8s_1.28" | ||
version = "1.28" | ||
sum = "aTxPUVZyr9MdiB3YdiY/8pCh9sC55yURnZdGlJsKG6Q=" | ||
reg = "ghcr.io" | ||
repo = "kcl-lang/k8s" | ||
oci_tag = "1.28" | ||
[dependencies.konfig] | ||
name = "konfig" | ||
full_name = "konfig_0.4.0" | ||
version = "0.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import konfig.models.kube.frontend | ||
import konfig.models.kube.templates.resource as res_tpl | ||
|
||
mw = { | ||
apiVersion = "traefik.containo.us/v1alpha1" | ||
kind = "Middleware" | ||
metadata = { | ||
name = option("app") | ||
namespace = option("app") | ||
labels = {app = option("app")} | ||
} | ||
spec = { | ||
basicAuth = { | ||
secret = option("app") | ||
removeHeader = True | ||
} | ||
} | ||
} | ||
|
||
# The application configuration in stack will overwrite | ||
# the configuration with the same attribute in base. | ||
appConfiguration: frontend.Server { | ||
schedulingStrategy.resource = res_tpl.tiny | ||
extraResources.mw = mw | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters