@@ -2,6 +2,8 @@ apiVersion: v1
22kind : Pod
33metadata :
44 name : masternode
5+ labels :
6+ microstream.one/cluster-component : masternode
57spec :
68 imagePullSecrets : [ name: microstream-ocir-credentials ]
79 securityContext :
@@ -10,59 +12,98 @@ spec:
1012 fsGroup : 10000
1113 runAsUser : 10000
1214 runAsGroup : 10000
15+ resources :
16+ requests :
17+ memory : 2000M
18+ cpu : 1000m
19+ limits :
20+ memory : 2000M
21+ cpu : 1000m
1322 initContainers :
1423 - name : prepare-masternode
1524 image : curlimages/curl:8.11.1
25+ securityContext :
26+ allowPrivilegeEscalation : false
27+ capabilities :
28+ drop : [ all ]
29+ volumeMounts :
30+ - name : storage
31+ mountPath : /storage
32+ - name : app
33+ mountPath : /app
34+ resources :
35+ requests :
36+ memory : 2000M
37+ cpu : 1000m
38+ limits :
39+ memory : 2000M
40+ cpu : 1000m
1641 command :
1742 - sh
1843 - -ce
1944 - |
20- # Wait for the user rest service project to exist
2145 # You can upload the jar like this:
22- # `kubectl cp -c prepare-masternode /path/to/jar masternode:/storage/project/project .jar`
46+ # `kubectl cp -c prepare-masternode /path/to/jar masternode:/app/application .jar`
2347 # If you have a libs folder as well you can copy it with
24- # `kubectl cp -c prepare-masternode /path/to/libs masternode:/storage/project `
48+ # `kubectl cp -c prepare-masternode /path/to/libs masternode:/app `
2549 # When you are done create the ready flag with
26- # `kubectl exec -ti -c prepare-masternode pod/masternode -- touch /storage/project/ready`
27- mkdir -p /storage/project
28- echo "Waiting for user rest service jar (timeout=10min)..."
29- i=0
30- until [ -f /storage/project/ready ]; do
31- sleep 1s
32- # Fail if we time out
33- if [ $i -gt 600 ]; then
34- echo "Timed out waiting for /storage/project/ready to exist" >&2
35- exit 1
36- fi
37- i=$((i+1))
38- done
39- echo "Success!"
50+ # `kubectl exec -ti -c prepare-masternode pod/masternode -- touch /app/ready`
4051
41- # Check for kafka ready flag for 5 minutes
42- echo "Waiting for kafka to be ready (timeout=5min)..."
43- i=0
44- until nc -z -w5 kafka 9092; do
45- sleep 1s
46- # Fail if we time out
47- if [ $i -gt 300 ]; then
48- echo "Timed out waiting for kafka to be ready" >&2
49- exit 1
50- fi
51- i=$((i+1))
52- done
53- echo "Success!"
52+ # Wait for the user application to exist
53+ if [ ! -f /app/ready ]; then
54+ echo "Waiting for /app/ready flag..."
55+ while [ ! -f /app/ready ]; do sleep 1; done
56+ echo "...done!"
57+ fi
58+
59+ # Wait for kafka
60+ if ! nc -z -w5 kafka 9092; then
61+ echo "Waiting for kafka..."
62+ until nc -z -w5 kafka 9092; do sleep 1; done
63+ echo "...done!"
64+ fi
65+ containers :
66+ - name : masternode
67+ image : ocir.microstream.one/onprem/image/microstream-cluster-storage-node:1.14.0
68+ workingDir : /storage
69+ args : [ "/app/application.jar" ]
70+ ports :
71+ - name : http
72+ containerPort : 8080
73+ # Restart the pod if container is not responsive at all
74+ livenessProbe :
75+ periodSeconds : 10
76+ timeoutSeconds : 20
77+ failureThreshold : 2
78+ httpGet :
79+ path : /microstream-cluster-controller/microstream-health
80+ port : http
81+ # Remove the pod from being ready if we fail to check
82+ readinessProbe :
83+ periodSeconds : 10
84+ timeoutSeconds : 20
85+ failureThreshold : 1
86+ httpGet :
87+ path : /microstream-cluster-controller/microstream-health/ready
88+ port : http
5489 securityContext :
5590 allowPrivilegeEscalation : false
5691 capabilities :
5792 drop : [ all ]
5893 volumeMounts :
5994 - name : storage
6095 mountPath : /storage
61- containers :
62- - name : masternode
63- image : ocir.microstream.one/onprem/image/microstream-cluster-storage-node:1.14.0-SNAPSHOT
64- workingDir : /storage
65- args : [ "/storage/project/project.jar" ]
96+ - name : backups
97+ mountPath : /backups
98+ - name : app
99+ mountPath : /app
100+ resources :
101+ requests :
102+ memory : 2000M
103+ cpu : 1000m
104+ limits :
105+ memory : 2000M
106+ cpu : 1000m
66107 env :
67108 - name : MSCNL_PROD_MODE
68109 value : " true"
@@ -81,40 +122,17 @@ spec:
81122 value : " true"
82123 - name : IS_BACKUP_NODE
83124 value : " true"
125+ - name : KEPT_BACKUPS_COUNT
126+ value : " 3"
84127 - name : BACKUP_PROXY_SERVICE_URL
85128 value : external-resource-proxy
86- ports :
87- - name : http
88- containerPort : 8080
89- # Restart the pod if container is not responsive at all
90- livenessProbe :
91- timeoutSeconds : 5
92- failureThreshold : 5
93- httpGet :
94- path : /microstream-cluster-controller/microstream-health
95- port : http
96- # Remove the pod from being ready if we fail to check
97- readinessProbe :
98- timeoutSeconds : 4
99- failureThreshold : 3
100- httpGet :
101- path : /microstream-cluster-controller/microstream-health/ready
102- port : http
103- # Give the container ~50 seconds to fully start up
104- startupProbe :
105- timeoutSeconds : 5
106- failureThreshold : 10
107- httpGet :
108- path : /microstream-cluster-controller/microstream-health
109- port : http
110- securityContext :
111- allowPrivilegeEscalation : false
112- capabilities :
113- drop : [ all ]
114- volumeMounts :
115- - name : storage
116- mountPath : /storage
117129 volumes :
118130 - name : storage
119131 persistentVolumeClaim :
120- claimName : masternode-storage
132+ claimName : masternode-storage
133+ - name : backups
134+ persistentVolumeClaim :
135+ claimName : storage-backups
136+ - name : app
137+ persistentVolumeClaim :
138+ claimName : user-app
0 commit comments