-
Notifications
You must be signed in to change notification settings - Fork 10
/
hello-world.jinja
73 lines (70 loc) · 2.33 KB
/
hello-world.jinja
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{% set NAME_PREFIX = env['deployment'] %}
{% set CLUSTER_TYPE = env['project'] + '/' + properties['cluster'] + '-type' %}
{% set CLUSTER_TYPE_APPS = env['project'] + '/' + properties['cluster'] + '-type-apps' %}
{% set CLUSTER_TYPE_BETA = env['project'] + '/' + properties['cluster'] + '-type-v1beta1-extensions' %}
{% set DEPLOYMENT_COLLECTION = '/apis/apps/v1/namespaces/{namespace}/deployments' %}
{% set INGRESS_COLLECTION = '/apis/extensions/v1beta1/namespaces/{namespace}/ingresses' %}
{% set SERVICE_COLLECTION = '/api/v1/namespaces/{namespace}/services' %}
resources:
- name: {{ NAME_PREFIX }}
type: {{ CLUSTER_TYPE_APPS }}:{{ DEPLOYMENT_COLLECTION }}
properties:
apiVersion: apps/v1
kind: Deployment
namespace: {{ properties['namespace'] | default('default') }}
metadata:
labels:
app: {{ env['name'] }}
deployment: {{ env['deployment'] }}
spec:
replicas: {{ properties['replicas'] | default(2) }}
selector:
matchLabels:
app: {{ env['name'] }}
deployment: {{ env['deployment'] }}
template:
metadata:
labels:
app: {{ env['name'] }}
deployment: {{ env['deployment'] }}
spec:
containers:
- image: gcr.io/google-samples/hello-app:1.0
name: hello-server
ports:
- containerPort: 8080
protocol: TCP
- name: {{ NAME_PREFIX }}-svc
type: {{ CLUSTER_TYPE }}:{{ SERVICE_COLLECTION }}
properties:
apiVersion: v1
kind: Service
namespace: {{ properties['namespace'] | default('default') }}
metadata:
name: {{ NAME_PREFIX }}-svc
labels:
app: {{ env['name'] }}
deployment: {{ env['deployment'] }}
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
selector:
app: {{ env['name'] }}
deployment: {{ env['deployment'] }}
- name: {{ NAME_PREFIX }}-ingress
type: {{ CLUSTER_TYPE_BETA }}:{{ INGRESS_COLLECTION }}
properties:
apiVersion: extensions/v1beta1
kind: Ingress
namespace: {{ properties['namespace'] | default('default') }}
metadata:
name: {{ NAME_PREFIX }}
labels:
app: {{ env['name'] }}
deployment: {{ env['deployment'] }}
spec:
backend:
serviceName: {{ NAME_PREFIX }}-svc
servicePort: 8080