File tree Expand file tree Collapse file tree 4 files changed +338
-7
lines changed
tests/e2e/sample-applications/mysql-persistent Expand file tree Collapse file tree 4 files changed +338
-7
lines changed Original file line number Diff line number Diff line change 1+ apiVersion : v1
2+ kind : List
3+ items :
4+ - kind : Namespace
5+ apiVersion : v1
6+ metadata :
7+ name : mysql-persistent
8+ labels :
9+ app : mysql
10+ - apiVersion : v1
11+ kind : PersistentVolumeClaim
12+ metadata :
13+ name : mysql
14+ namespace : mysql-persistent
15+ labels :
16+ app : mysql
17+ spec :
18+ accessModes :
19+ - ReadWriteOnce
20+ resources :
21+ requests :
22+ storage : 1Gi
23+ - apiVersion : v1
24+ kind : Service
25+ metadata :
26+ annotations :
27+ template.openshift.io/expose-uri : mariadb://{.spec.clusterIP}:{.spec.ports[?(.name=="mysql")].port}
28+ name : mysql
29+ namespace : mysql-persistent
30+ labels :
31+ app : mysql
32+ service : mysql
33+ spec :
34+ ports :
35+ - protocol : TCP
36+ name : mysql
37+ port : 3306
38+ selector :
39+ app : mysql
40+ - apiVersion : apps/v1
41+ kind : Deployment
42+ metadata :
43+ annotations :
44+ template.alpha.openshift.io/wait-for-ready : ' true'
45+ name : mysql
46+ namespace : mysql-persistent
47+ labels :
48+ e2e-app : " true"
49+ spec :
50+ selector :
51+ matchLabels :
52+ app : mysql
53+ strategy :
54+ type : Recreate
55+ template :
56+ metadata :
57+ labels :
58+ e2e-app : " true"
59+ app : mysql
60+ curl-tool : " true"
61+ spec :
62+ containers :
63+ - image : docker.io/library/mariadb:10.5
64+ name : mysql
65+ env :
66+ - name : MYSQL_USER
67+ value : changeme
68+ - name : MYSQL_PASSWORD
69+ value : changeme
70+ - name : MYSQL_ROOT_PASSWORD
71+ value : root
72+ - name : MYSQL_DATABASE
73+ value : todolist
74+ ports :
75+ - containerPort : 3306
76+ name : mysql
77+ resources :
78+ limits :
79+ memory : 512Mi
80+ volumeMounts :
81+ - name : mysql-data
82+ mountPath : /var/lib/mysql
83+ readinessProbe :
84+ exec :
85+ command :
86+ - /usr/bin/timeout
87+ - 1s
88+ - /usr/bin/mysql
89+ - $(MYSQL_DATABASE)
90+ - -h
91+ - 127.0.0.1
92+ - -u$(MYSQL_USER)
93+ - -p$(MYSQL_PASSWORD)
94+ - -e
95+ - SELECT 1
96+ initialDelaySeconds : 10
97+ periodSeconds : 5
98+ timeoutSeconds : 2
99+ failureThreshold : 3
100+ livenessProbe :
101+ exec :
102+ command :
103+ - /usr/bin/timeout
104+ - 1s
105+ - /usr/bin/mysql
106+ - $(MYSQL_DATABASE)
107+ - -h
108+ - 127.0.0.1
109+ - -u$(MYSQL_USER)
110+ - -p$(MYSQL_PASSWORD)
111+ - -e
112+ - SELECT 1
113+ initialDelaySeconds : 30
114+ periodSeconds : 10
115+ timeoutSeconds : 5
116+ failureThreshold : 3
117+ startupProbe :
118+ exec :
119+ command :
120+ - /usr/bin/timeout
121+ - 1s
122+ - /usr/bin/mysql
123+ - $(MYSQL_DATABASE)
124+ - -h
125+ - 127.0.0.1
126+ - -u$(MYSQL_USER)
127+ - -p$(MYSQL_PASSWORD)
128+ - -e
129+ - EXIT
130+ initialDelaySeconds : 5
131+ periodSeconds : 30
132+ timeoutSeconds : 2
133+ successThreshold : 1
134+ failureThreshold : 40 # 40x30sec = 20min before restart pod
135+ - image : docker.io/curlimages/curl:8.5.0
136+ name : curl-tool
137+ command : ["/bin/sleep", "infinity"]
138+ securityContext :
139+ runAsNonRoot : false
140+ volumes :
141+ - name : mysql-data
142+ persistentVolumeClaim :
143+ claimName : mysql
144+ - apiVersion : v1
145+ kind : Service
146+ metadata :
147+ name : todolist
148+ namespace : mysql-persistent
149+ labels :
150+ app : todolist
151+ service : todolist
152+ e2e-app : " true"
153+ spec :
154+ ports :
155+ - name : web
156+ port : 8000
157+ targetPort : 8000
158+ selector :
159+ app : todolist
160+ service : todolist
161+ - apiVersion : apps/v1
162+ kind : Deployment
163+ metadata :
164+ name : todolist
165+ namespace : mysql-persistent
166+ labels :
167+ app : todolist
168+ service : todolist
169+ e2e-app : " true"
170+ spec :
171+ replicas : 1
172+ selector :
173+ matchLabels :
174+ app : todolist
175+ service : todolist
176+ strategy :
177+ type : Recreate
178+ template :
179+ metadata :
180+ labels :
181+ app : todolist
182+ service : todolist
183+ e2e-app : " true"
184+ spec :
185+ containers :
186+ - name : todolist
187+ image : quay.io/migtools/oadp-ci-todolist-mariadb-go:latest
188+ env :
189+ - name : foo
190+ value : bar
191+ ports :
192+ - containerPort : 8000
193+ protocol : TCP
194+ livenessProbe :
195+ httpGet :
196+ path : /
197+ port : 8000
198+ initialDelaySeconds : 30
199+ periodSeconds : 10
200+ readinessProbe :
201+ httpGet :
202+ path : /
203+ port : 8000
204+ initialDelaySeconds : 10
205+ periodSeconds : 5
206+ initContainers :
207+ - name : init-myservice
208+ image : docker.io/curlimages/curl:8.5.0
209+ command : ['sh', '-c', 'sleep 10; until nc -z -w 1 mysql 3306; do echo Trying to connect to mysql DB port; sleep 5; done; echo mysql DB port reachable']
210+ securityContext :
211+ runAsNonRoot : false
Original file line number Diff line number Diff line change @@ -104,12 +104,40 @@ items:
104104 volumeMounts :
105105 - name : mysql-data
106106 mountPath : /var/lib/mysql
107+ readinessProbe :
108+ exec :
109+ command :
110+ - /usr/bin/timeout
111+ - 1s
112+ - /usr/bin/mysql
113+ - $(MYSQL_DATABASE)
114+ - -h
115+ - 127.0.0.1
116+ - -u$(MYSQL_USER)
117+ - -p$(MYSQL_PASSWORD)
118+ - -e
119+ - SELECT 1
120+ initialDelaySeconds : 10
121+ periodSeconds : 5
122+ timeoutSeconds : 2
123+ failureThreshold : 3
107124 livenessProbe :
108- tcpSocket :
109- port : mysql
125+ exec :
126+ command :
127+ - /usr/bin/timeout
128+ - 1s
129+ - /usr/bin/mysql
130+ - $(MYSQL_DATABASE)
131+ - -h
132+ - 127.0.0.1
133+ - -u$(MYSQL_USER)
134+ - -p$(MYSQL_PASSWORD)
135+ - -e
136+ - SELECT 1
110137 initialDelaySeconds : 30
111138 periodSeconds : 10
112139 timeoutSeconds : 5
140+ failureThreshold : 3
113141 startupProbe :
114142 exec :
115143 command :
@@ -183,6 +211,18 @@ items:
183211 ports :
184212 - containerPort : 8000
185213 protocol : TCP
214+ livenessProbe :
215+ httpGet :
216+ path : /
217+ port : 8000
218+ initialDelaySeconds : 30
219+ periodSeconds : 10
220+ readinessProbe :
221+ httpGet :
222+ path : /
223+ port : 8000
224+ initialDelaySeconds : 10
225+ periodSeconds : 5
186226 initContainers :
187227 - name : init-myservice
188228 image : docker.io/curlimages/curl:8.5.0
Original file line number Diff line number Diff line change @@ -96,12 +96,40 @@ items:
9696 volumeMounts :
9797 - name : mysql-data
9898 mountPath : /var/lib/mysql
99+ readinessProbe :
100+ exec :
101+ command :
102+ - /usr/bin/timeout
103+ - 1s
104+ - /usr/bin/mysql
105+ - $(MYSQL_DATABASE)
106+ - -h
107+ - 127.0.0.1
108+ - -u$(MYSQL_USER)
109+ - -p$(MYSQL_PASSWORD)
110+ - -e
111+ - SELECT 1
112+ initialDelaySeconds : 10
113+ periodSeconds : 5
114+ timeoutSeconds : 2
115+ failureThreshold : 3
99116 livenessProbe :
100- tcpSocket :
101- port : mysql
117+ exec :
118+ command :
119+ - /usr/bin/timeout
120+ - 1s
121+ - /usr/bin/mysql
122+ - $(MYSQL_DATABASE)
123+ - -h
124+ - 127.0.0.1
125+ - -u$(MYSQL_USER)
126+ - -p$(MYSQL_PASSWORD)
127+ - -e
128+ - SELECT 1
102129 initialDelaySeconds : 30
103130 periodSeconds : 10
104131 timeoutSeconds : 5
132+ failureThreshold : 3
105133 startupProbe :
106134 exec :
107135 command :
@@ -174,6 +202,18 @@ items:
174202 ports :
175203 - containerPort : 8000
176204 protocol : TCP
205+ livenessProbe :
206+ httpGet :
207+ path : /
208+ port : 8000
209+ initialDelaySeconds : 30
210+ periodSeconds : 10
211+ readinessProbe :
212+ httpGet :
213+ path : /
214+ port : 8000
215+ initialDelaySeconds : 10
216+ periodSeconds : 5
177217 volumeMounts :
178218 - name : applog
179219 mountPath : /tmp/log/todoapp/
Original file line number Diff line number Diff line change @@ -117,12 +117,40 @@ items:
117117 volumeMounts :
118118 - name : mysql-data
119119 mountPath : /var/lib/mysql
120- livenessProbe :
121- tcpSocket :
122- port : mysql
120+ readinessProbe :
121+ exec :
122+ command :
123+ - /usr/bin/timeout
124+ - 1s
125+ - /usr/bin/mysql
126+ - $(MYSQL_DATABASE)
127+ - -h
128+ - 127.0.0.1
129+ - -u$(MYSQL_USER)
130+ - -p$(MYSQL_PASSWORD)
131+ - -e
132+ - SELECT 1
123133 initialDelaySeconds : 10
134+ periodSeconds : 5
135+ timeoutSeconds : 2
136+ failureThreshold : 3
137+ livenessProbe :
138+ exec :
139+ command :
140+ - /usr/bin/timeout
141+ - 1s
142+ - /usr/bin/mysql
143+ - $(MYSQL_DATABASE)
144+ - -h
145+ - 127.0.0.1
146+ - -u$(MYSQL_USER)
147+ - -p$(MYSQL_PASSWORD)
148+ - -e
149+ - SELECT 1
150+ initialDelaySeconds : 30
124151 periodSeconds : 10
125152 timeoutSeconds : 5
153+ failureThreshold : 3
126154 startupProbe :
127155 exec :
128156 command :
@@ -196,6 +224,18 @@ items:
196224 ports :
197225 - containerPort : 8000
198226 protocol : TCP
227+ livenessProbe :
228+ httpGet :
229+ path : /
230+ port : 8000
231+ initialDelaySeconds : 30
232+ periodSeconds : 10
233+ readinessProbe :
234+ httpGet :
235+ path : /
236+ port : 8000
237+ initialDelaySeconds : 10
238+ periodSeconds : 5
199239 initContainers :
200240 - name : init-myservice
201241 image : docker.io/curlimages/curl:8.5.0
You can’t perform that action at this time.
0 commit comments