Add Jsonnet example
This commit is contained in:
parent
e161343abc
commit
96e7ccac0e
8
jsonnet/params.libsonnet
Normal file
8
jsonnet/params.libsonnet
Normal 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",
|
||||
}
|
60
jsonnet/simple-application.jsonnet
Normal file
60
jsonnet/simple-application.jsonnet
Normal 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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user