2019-06-13 03:06:34 +02:00
|
|
|
function (
|
|
|
|
containerPort=80,
|
|
|
|
image="gcr.io/heptio-images/ks-guestbook-demo:0.2",
|
|
|
|
name="jsonnet-guestbook-ui",
|
|
|
|
replicas=1,
|
|
|
|
servicePort=80,
|
|
|
|
type="LoadBalancer"
|
|
|
|
)
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"apiVersion": "v1",
|
|
|
|
"kind": "Service",
|
|
|
|
"metadata": {
|
|
|
|
"name": name
|
|
|
|
},
|
|
|
|
"spec": {
|
|
|
|
"ports": [
|
|
|
|
{
|
|
|
|
"port": servicePort,
|
|
|
|
"targetPort": containerPort
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"selector": {
|
|
|
|
"app": name
|
|
|
|
},
|
|
|
|
"type": type
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2019-09-27 19:58:45 +02:00
|
|
|
"apiVersion": "apps/v1",
|
2019-06-13 03:06:34 +02:00
|
|
|
"kind": "Deployment",
|
|
|
|
"metadata": {
|
|
|
|
"name": name
|
|
|
|
},
|
|
|
|
"spec": {
|
|
|
|
"replicas": replicas,
|
|
|
|
"revisionHistoryLimit": 3,
|
|
|
|
"selector": {
|
|
|
|
"matchLabels": {
|
|
|
|
"app": name
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"template": {
|
|
|
|
"metadata": {
|
|
|
|
"labels": {
|
|
|
|
"app": name
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"spec": {
|
|
|
|
"containers": [
|
|
|
|
{
|
|
|
|
"image": image,
|
|
|
|
"name": name,
|
|
|
|
"ports": [
|
|
|
|
{
|
|
|
|
"containerPort": containerPort
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-27 19:58:45 +02:00
|
|
|
]
|