Add Jsonnet example

This commit is contained in:
Thomas Philipona 2022-11-01 11:07:06 +01:00
parent e161343abc
commit 96e7ccac0e
No known key found for this signature in database
GPG Key ID: 48284CEF6E0F9F77
2 changed files with 68 additions and 0 deletions

8
jsonnet/params.libsonnet Normal file
View File

@ -0,0 +1,8 @@
{
containerPort: 5000,
image: "quay.io/acend/example-web-go",
name: "argo-jsonnet-example-<username>",
replicas: 1,
servicePort: 5000,
type: "ClusterIP",
}

View File

@ -0,0 +1,60 @@
local params = import 'params.libsonnet';
[
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"name": params.name
},
"spec": {
"ports": [
{
"port": params.servicePort,
"protocol": "TCP",
"targetPort": params.containerPort
}
],
"selector": {
"app": params.name
},
"type": params.type
}
},
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": params.name
},
"spec": {
"replicas": params.replicas,
"revisionHistoryLimit": 3,
"selector": {
"matchLabels": {
"app": params.name
},
},
"template": {
"metadata": {
"labels": {
"app": params.name
}
},
"spec": {
"containers": [
{
"image": params.image,
"name": params.name,
"ports": [
{
"containerPort": params.containerPort
}
]
}
]
}
}
}
}
]