Skip to content

Commit

Permalink
Add example for jsonnet using functions with top level arguments (arg…
Browse files Browse the repository at this point in the history
  • Loading branch information
lcostea authored and alexmt committed Jun 13, 2019
1 parent 0ad95c5 commit 454cc52
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ to explore ArgoCD and GitOps!
| [ksonnet-guestbook](ksonnet-guestbook/) | The guestbook application as a ksonnet app |
| [helm-guestbook](helm-guestbook/) | The guestbook application as a Helm chart |
| [jsonnet-guestbook](jsonnet-guestbook/) | The guestbook application as a raw jsonnet |
| [jsonnet-guestbook-tla](jsonnet-guestbook-tla/) | The guestbook application as a raw jsonnet with support for top level arguments |
| [kustomize-guestbook](kustomize-guestbook/) | The guestbook application as a Kustomize 2 app |
| [pre-post-sync](pre-post-sync/) | Demonstrates Argo CD PreSync and PostSync hooks |
| [sync-waves](sync-waves/) | Demonstrates Argo CD sync waves with hooks |
Expand Down
65 changes: 65 additions & 0 deletions jsonnet-guestbook-tla/guestbook-ui.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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
}
},
{
"apiVersion": "apps/v1beta2",
"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
}
]
}
]
}
}
}
}
]

0 comments on commit 454cc52

Please sign in to comment.