blob: 650890a922053fd994b2317bd200f85005fc4bd1 [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
Stephane Barbariebcea2f42018-03-02 18:46:32 -050054 updateStrategy:
55 type: RollingUpdate
Richard Jankowski54f7a862017-12-20 13:31:10 -050056 template:
57 metadata:
58 labels:
59 app: consul
Stephane Barbarie5e8d9e42018-02-07 16:15:05 -050060 annotations:
Stephane Barbarie2d4e07f2018-03-26 16:46:45 -040061 cni: "calico"
Richard Jankowski54f7a862017-12-20 13:31:10 -050062 spec:
63 affinity:
64 podAntiAffinity:
65 requiredDuringSchedulingIgnoredDuringExecution:
66 - labelSelector:
67 matchExpressions:
68 - key: app
69 operator: In
70 values:
71 - consul
72 topologyKey: kubernetes.io/hostname
73 terminationGracePeriodSeconds: 10
74 containers:
75 - name: consul
76 image: "consul:0.9.2"
Richard Jankowskid4454382018-02-08 16:21:43 -050077 volumeMounts:
78 - name: consul-config
79 mountPath: /consul/config
80 - name: consul-data
81 mountPath: /consul/data
Richard Jankowski54f7a862017-12-20 13:31:10 -050082 env:
Richard Jankowski54f7a862017-12-20 13:31:10 -050083 - name: NAMESPACE
84 valueFrom:
85 fieldRef:
86 fieldPath: metadata.namespace
87 args:
88 - "agent"
Richard Jankowskid4454382018-02-08 16:21:43 -050089 - "-server"
Richard Jankowski54f7a862017-12-20 13:31:10 -050090 - "-bootstrap-expect=3"
Richard Jankowskid4454382018-02-08 16:21:43 -050091 - "-config-dir=/consul/config"
92 - "-data-dir=/consul/data"
93 - "-bind=0.0.0.0"
94 - "-client=0.0.0.0"
95 - "-ui"
96 - "-raft-protocol=3"
97 - "-rejoin"
Richard Jankowski54f7a862017-12-20 13:31:10 -050098 - "-retry-join=consul-0.consul.$(NAMESPACE).svc.cluster.local"
99 - "-retry-join=consul-1.consul.$(NAMESPACE).svc.cluster.local"
100 - "-retry-join=consul-2.consul.$(NAMESPACE).svc.cluster.local"
Richard Jankowski54f7a862017-12-20 13:31:10 -0500101 lifecycle:
102 preStop:
103 exec:
104 command:
105 - /bin/sh
106 - -c
107 - consul leave
108 ports:
109 - containerPort: 8500
110 name: ui-port
111 - containerPort: 8400
112 name: alt-port
113 - containerPort: 53
114 name: udp-port
115 - containerPort: 8443
116 name: https-port
117 - containerPort: 8080
118 name: http-port
119 - containerPort: 8301
120 name: serflan
121 - containerPort: 8302
122 name: serfwan
123 - containerPort: 8600
124 name: consuldns
125 - containerPort: 8300
126 name: server
Richard Jankowskid4454382018-02-08 16:21:43 -0500127 volumes:
128 - name: consul-config
129 hostPath:
130 path: /cord/incubator/voltha/consul/config
131 type: Directory
132 - name: consul-data
133 hostPath:
134 path: /cord/incubator/voltha/consul/data
135 type: Directory