Commit 3a1eef449b024747dc271b361d8af5a31d89ff3b

Authored by volodymyr-babak
1 parent 08e9e903

TB-58: k8s feature improvements

@@ -34,9 +34,6 @@ done @@ -34,9 +34,6 @@ done
34 # Copying env variables into conf files 34 # Copying env variables into conf files
35 printenv | awk -F "=" '{print "export " $1 "='\''" $2 "'\''"}' >> /usr/share/thingsboard/conf/thingsboard.conf 35 printenv | awk -F "=" '{print "export " $1 "='\''" $2 "'\''"}' >> /usr/share/thingsboard/conf/thingsboard.conf
36 36
37 -# Set env variable for RPC address  
38 -echo "export RPC_HOST='"$(hostname -f)"'" | tee -a /usr/share/thingsboard/conf/thingsboard.conf  
39 -  
40 cat /usr/share/thingsboard/conf/thingsboard.conf 37 cat /usr/share/thingsboard/conf/thingsboard.conf
41 38
42 echo "Starting 'Thingsboard' service..." 39 echo "Starting 'Thingsboard' service..."
@@ -2,9 +2,9 @@ @@ -2,9 +2,9 @@
2 apiVersion: v1 2 apiVersion: v1
3 kind: Service 3 kind: Service
4 metadata: 4 metadata:
5 - name: tb-external-ip 5 + name: tb-service
6 labels: 6 labels:
7 - app: tb-external-ip 7 + app: tb-service
8 spec: 8 spec:
9 ports: 9 ports:
10 - port: 8080 10 - port: 8080
@@ -17,20 +17,6 @@ spec: @@ -17,20 +17,6 @@ spec:
17 app: tb 17 app: tb
18 type: LoadBalancer 18 type: LoadBalancer
19 --- 19 ---
20 -apiVersion: v1  
21 -kind: Service  
22 -metadata:  
23 - name: tb-headless  
24 - labels:  
25 - app: tb-headless  
26 -spec:  
27 - ports:  
28 - - port: 9001  
29 - name: rpc  
30 - selector:  
31 - app: tb  
32 - clusterIP: None  
33 ----  
34 apiVersion: policy/v1beta1 20 apiVersion: policy/v1beta1
35 kind: PodDisruptionBudget 21 kind: PodDisruptionBudget
36 metadata: 22 metadata:
@@ -55,14 +41,13 @@ kind: StatefulSet @@ -55,14 +41,13 @@ kind: StatefulSet
55 metadata: 41 metadata:
56 name: tb 42 name: tb
57 spec: 43 spec:
58 - serviceName: "tb-headless" 44 + serviceName: "tb-service"
59 replicas: 2 45 replicas: 2
60 template: 46 template:
61 metadata: 47 metadata:
62 labels: 48 labels:
63 app: tb 49 app: tb
64 spec: 50 spec:
65 - terminationGracePeriodSeconds: 10  
66 affinity: 51 affinity:
67 podAntiAffinity: 52 podAntiAffinity:
68 requiredDuringSchedulingIgnoredDuringExecution: 53 requiredDuringSchedulingIgnoredDuringExecution:
@@ -71,7 +56,7 @@ spec: @@ -71,7 +56,7 @@ spec:
71 - key: "app" 56 - key: "app"
72 operator: In 57 operator: In
73 values: 58 values:
74 - - tb-headless 59 + - tb-service
75 topologyKey: "kubernetes.io/hostname" 60 topologyKey: "kubernetes.io/hostname"
76 containers: 61 containers:
77 - name: tb 62 - name: tb
@@ -109,19 +94,17 @@ spec: @@ -109,19 +94,17 @@ spec:
109 configMapKeyRef: 94 configMapKeyRef:
110 name: tb-config 95 name: tb-config
111 key: cassandra.url 96 key: cassandra.url
  97 + - name : RPC_HOST
  98 + valueFrom:
  99 + fieldRef:
  100 + fieldPath: status.podIP
112 command: 101 command:
113 - sh 102 - sh
114 - -c 103 - -c
115 - ./run_thingsboard.sh 104 - ./run_thingsboard.sh
116 -# readinessProbe:  
117 -# httpGet:  
118 -# path: /login  
119 -# port: ui-port  
120 -# initialDelaySeconds: 30  
121 -# periodSeconds: 10  
122 livenessProbe: 105 livenessProbe:
123 httpGet: 106 httpGet:
124 path: /login 107 path: /login
125 port: ui-port 108 port: ui-port
126 - initialDelaySeconds: 30  
127 - periodSeconds: 10  
  109 + initialDelaySeconds: 120
  110 + timeoutSeconds: 10