diff --git a/jsonnet/params.libsonnet b/jsonnet/params.libsonnet new file mode 100644 index 0000000..ad39d95 --- /dev/null +++ b/jsonnet/params.libsonnet @@ -0,0 +1,8 @@ +{ + containerPort: 5000, + image: "quay.io/acend/example-web-go", + name: "argo-jsonnet-example-", + replicas: 1, + servicePort: 5000, + type: "ClusterIP", +} \ No newline at end of file diff --git a/jsonnet/simple-application.jsonnet b/jsonnet/simple-application.jsonnet new file mode 100644 index 0000000..72b1eb5 --- /dev/null +++ b/jsonnet/simple-application.jsonnet @@ -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 + } + ] + } + ] + } + } + } + } +] \ No newline at end of file