blob: 8cd8a20167a166072891a0be49d1262094a0aa6f [file] [log] [blame]
Zack Williams41513bf2018-07-07 20:08:35 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Richard Jankowski54f7a862017-12-20 13:31:10 -050014apiVersion: v1
15kind: Service
16metadata:
17 name: consul
Richard Jankowskid4454382018-02-08 16:21:43 -050018 namespace: voltha
Richard Jankowski54f7a862017-12-20 13:31:10 -050019 labels:
20 name: consul
21spec:
Richard Jankowskic3c291c2018-02-02 13:57:33 -050022 type: ClusterIP
Richard Jankowski54f7a862017-12-20 13:31:10 -050023 clusterIP: None
24 ports:
25 - name: http
26 port: 8500
27 targetPort: 8500
28 - name: https
29 port: 8443
30 targetPort: 8443
31 - name: rpc
32 port: 8400
33 targetPort: 8400
34 - name: serflan-tcp
35 protocol: "TCP"
36 port: 8301
37 targetPort: 8301
38 - name: serflan-udp
39 protocol: "UDP"
40 port: 8301
41 targetPort: 8301
42 - name: serfwan-tcp
43 protocol: "TCP"
44 port: 8302
45 targetPort: 8302
46 - name: serfwan-udp
47 protocol: "UDP"
48 port: 8302
49 targetPort: 8302
50 - name: server
51 port: 8300
52 targetPort: 8300
53 - name: consuldns
54 port: 8600
55 targetPort: 8600
56 selector:
57 app: consul
58---
59apiVersion: apps/v1beta1
60kind: StatefulSet
61metadata:
62 name: consul
Richard Jankowskid4454382018-02-08 16:21:43 -050063 namespace: voltha
Richard Jankowski54f7a862017-12-20 13:31:10 -050064spec:
65 serviceName: consul
66 replicas: 3
Stephane Barbariebcea2f42018-03-02 18:46:32 -050067 updateStrategy:
68 type: RollingUpdate
Richard Jankowski54f7a862017-12-20 13:31:10 -050069 template:
70 metadata:
71 labels:
72 app: consul
Stephane Barbarie5e8d9e42018-02-07 16:15:05 -050073 annotations:
Stephane Barbarie2d4e07f2018-03-26 16:46:45 -040074 cni: "calico"
Richard Jankowski54f7a862017-12-20 13:31:10 -050075 spec:
76 affinity:
77 podAntiAffinity:
78 requiredDuringSchedulingIgnoredDuringExecution:
79 - labelSelector:
80 matchExpressions:
81 - key: app
82 operator: In
83 values:
84 - consul
85 topologyKey: kubernetes.io/hostname
86 terminationGracePeriodSeconds: 10
87 containers:
88 - name: consul
89 image: "consul:0.9.2"
Richard Jankowskid4454382018-02-08 16:21:43 -050090 volumeMounts:
91 - name: consul-config
92 mountPath: /consul/config
93 - name: consul-data
94 mountPath: /consul/data
Richard Jankowski54f7a862017-12-20 13:31:10 -050095 env:
Richard Jankowski54f7a862017-12-20 13:31:10 -050096 - name: NAMESPACE
97 valueFrom:
98 fieldRef:
99 fieldPath: metadata.namespace
100 args:
101 - "agent"
Richard Jankowskid4454382018-02-08 16:21:43 -0500102 - "-server"
Richard Jankowski54f7a862017-12-20 13:31:10 -0500103 - "-bootstrap-expect=3"
Richard Jankowskid4454382018-02-08 16:21:43 -0500104 - "-config-dir=/consul/config"
105 - "-data-dir=/consul/data"
106 - "-bind=0.0.0.0"
107 - "-client=0.0.0.0"
108 - "-ui"
109 - "-raft-protocol=3"
110 - "-rejoin"
Richard Jankowski54f7a862017-12-20 13:31:10 -0500111 - "-retry-join=consul-0.consul.$(NAMESPACE).svc.cluster.local"
112 - "-retry-join=consul-1.consul.$(NAMESPACE).svc.cluster.local"
113 - "-retry-join=consul-2.consul.$(NAMESPACE).svc.cluster.local"
Richard Jankowski54f7a862017-12-20 13:31:10 -0500114 lifecycle:
115 preStop:
116 exec:
117 command:
118 - /bin/sh
119 - -c
120 - consul leave
121 ports:
122 - containerPort: 8500
123 name: ui-port
124 - containerPort: 8400
125 name: alt-port
126 - containerPort: 53
127 name: udp-port
128 - containerPort: 8443
129 name: https-port
130 - containerPort: 8080
131 name: http-port
132 - containerPort: 8301
133 name: serflan
134 - containerPort: 8302
135 name: serfwan
136 - containerPort: 8600
137 name: consuldns
138 - containerPort: 8300
139 name: server
Richard Jankowskid4454382018-02-08 16:21:43 -0500140 volumes:
141 - name: consul-config
142 hostPath:
143 path: /cord/incubator/voltha/consul/config
144 type: Directory
145 - name: consul-data
146 hostPath:
147 path: /cord/incubator/voltha/consul/data
148 type: Directory