blob: b398b7ae4f1f9ff7344333a232f4f7f904f3e87a [file] [log] [blame]
Richard Jankowski54f7a862017-12-20 13:31:10 -05001apiVersion: v1
2kind: Service
3metadata:
4 name: consul
Richard Jankowskid4454382018-02-08 16:21:43 -05005 namespace: voltha
Richard Jankowski54f7a862017-12-20 13:31:10 -05006 labels:
7 name: consul
8spec:
Richard Jankowskic3c291c2018-02-02 13:57:33 -05009 type: ClusterIP
Richard Jankowski54f7a862017-12-20 13:31:10 -050010 clusterIP: None
11 ports:
12 - name: http
13 port: 8500
14 targetPort: 8500
15 - name: https
16 port: 8443
17 targetPort: 8443
18 - name: rpc
19 port: 8400
20 targetPort: 8400
21 - name: serflan-tcp
22 protocol: "TCP"
23 port: 8301
24 targetPort: 8301
25 - name: serflan-udp
26 protocol: "UDP"
27 port: 8301
28 targetPort: 8301
29 - name: serfwan-tcp
30 protocol: "TCP"
31 port: 8302
32 targetPort: 8302
33 - name: serfwan-udp
34 protocol: "UDP"
35 port: 8302
36 targetPort: 8302
37 - name: server
38 port: 8300
39 targetPort: 8300
40 - name: consuldns
41 port: 8600
42 targetPort: 8600
43 selector:
44 app: consul
45---
46apiVersion: apps/v1beta1
47kind: StatefulSet
48metadata:
49 name: consul
Richard Jankowskid4454382018-02-08 16:21:43 -050050 namespace: voltha
Richard Jankowski54f7a862017-12-20 13:31:10 -050051spec:
52 serviceName: consul
53 replicas: 3
54 template:
55 metadata:
56 labels:
57 app: consul
Stephane Barbarie5e8d9e42018-02-07 16:15:05 -050058 annotations:
59 cni: "weave"
Richard Jankowski54f7a862017-12-20 13:31:10 -050060 spec:
61 affinity:
62 podAntiAffinity:
63 requiredDuringSchedulingIgnoredDuringExecution:
64 - labelSelector:
65 matchExpressions:
66 - key: app
67 operator: In
68 values:
69 - consul
70 topologyKey: kubernetes.io/hostname
71 terminationGracePeriodSeconds: 10
72 containers:
73 - name: consul
74 image: "consul:0.9.2"
Richard Jankowskid4454382018-02-08 16:21:43 -050075 volumeMounts:
76 - name: consul-config
77 mountPath: /consul/config
78 - name: consul-data
79 mountPath: /consul/data
Richard Jankowski54f7a862017-12-20 13:31:10 -050080 env:
Richard Jankowski54f7a862017-12-20 13:31:10 -050081 - name: NAMESPACE
82 valueFrom:
83 fieldRef:
84 fieldPath: metadata.namespace
85 args:
86 - "agent"
Richard Jankowskid4454382018-02-08 16:21:43 -050087 - "-server"
Richard Jankowski54f7a862017-12-20 13:31:10 -050088 - "-bootstrap-expect=3"
Richard Jankowskid4454382018-02-08 16:21:43 -050089 - "-config-dir=/consul/config"
90 - "-data-dir=/consul/data"
91 - "-bind=0.0.0.0"
92 - "-client=0.0.0.0"
93 - "-ui"
94 - "-raft-protocol=3"
95 - "-rejoin"
Richard Jankowski54f7a862017-12-20 13:31:10 -050096 - "-retry-join=consul-0.consul.$(NAMESPACE).svc.cluster.local"
97 - "-retry-join=consul-1.consul.$(NAMESPACE).svc.cluster.local"
98 - "-retry-join=consul-2.consul.$(NAMESPACE).svc.cluster.local"
Richard Jankowski54f7a862017-12-20 13:31:10 -050099 lifecycle:
100 preStop:
101 exec:
102 command:
103 - /bin/sh
104 - -c
105 - consul leave
106 ports:
107 - containerPort: 8500
108 name: ui-port
109 - containerPort: 8400
110 name: alt-port
111 - containerPort: 53
112 name: udp-port
113 - containerPort: 8443
114 name: https-port
115 - containerPort: 8080
116 name: http-port
117 - containerPort: 8301
118 name: serflan
119 - containerPort: 8302
120 name: serfwan
121 - containerPort: 8600
122 name: consuldns
123 - containerPort: 8300
124 name: server
Richard Jankowskid4454382018-02-08 16:21:43 -0500125 volumes:
126 - name: consul-config
127 hostPath:
128 path: /cord/incubator/voltha/consul/config
129 type: Directory
130 - name: consul-data
131 hostPath:
132 path: /cord/incubator/voltha/consul/data
133 type: Directory