Skip to content

Commit e2f47f4

Browse files
committed
Replacing mysql:5.7 with mariadb:11.8
1 parent f537616 commit e2f47f4

16 files changed

+270
-269
lines changed

tests/DaemonSetTest.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ class DaemonSetTest extends TestCase
1111
{
1212
public function test_daemon_set_build()
1313
{
14-
$pod = $this->createMysqlPod();
14+
$pod = $this->createMariadbPod();
1515

1616
$ds = $this->cluster->daemonSet()
17-
->setName('mysql')
17+
->setName('mariadb')
1818
->setLabels(['tier' => 'backend'])
1919
->setUpdateStrategy('RollingUpdate')
2020
->setMinReadySeconds(0)
2121
->setTemplate($pod);
2222

2323
$this->assertEquals('apps/v1', $ds->getApiVersion());
24-
$this->assertEquals('mysql', $ds->getName());
24+
$this->assertEquals('mariadb', $ds->getName());
2525
$this->assertEquals(['tier' => 'backend'], $ds->getLabels());
2626
$this->assertEquals(0, $ds->getMinReadySeconds());
2727
$this->assertEquals($pod->getName(), $ds->getTemplate()->getName());
@@ -31,12 +31,12 @@ public function test_daemon_set_build()
3131

3232
public function test_daemon_set_from_yaml()
3333
{
34-
$pod = $this->createMysqlPod();
34+
$pod = $this->createMariadbPod();
3535

3636
$ds = $this->cluster->fromYamlFile(__DIR__.'/yaml/daemonset.yaml');
3737

3838
$this->assertEquals('apps/v1', $ds->getApiVersion());
39-
$this->assertEquals('mysql', $ds->getName());
39+
$this->assertEquals('mariadb', $ds->getName());
4040
$this->assertEquals(['tier' => 'backend'], $ds->getLabels());
4141
$this->assertEquals($pod->getName(), $ds->getTemplate()->getName());
4242

@@ -56,16 +56,16 @@ public function test_daemon_set_api_interaction()
5656

5757
public function runCreationTests()
5858
{
59-
$pod = $this->createMysqlPod([
60-
'labels' => ['tier' => 'backend', 'daemonset-name' => 'mysql'],
59+
$pod = $this->createMariadbPod([
60+
'labels' => ['tier' => 'backend', 'daemonset-name' => 'mariadb'],
6161
'container' => [
6262
'additionalPort' => 3307,
6363
'includeEnv' => true,
6464
],
6565
]);
6666

6767
$ds = $this->cluster->daemonSet()
68-
->setName('mysql')
68+
->setName('mariadb')
6969
->setLabels(['tier' => 'backend'])
7070
->setSelectors(['matchLabels' => ['tier' => 'backend']])
7171
->setUpdateStrategy('RollingUpdate')
@@ -83,7 +83,7 @@ public function runCreationTests()
8383
$this->assertInstanceOf(K8sDaemonSet::class, $ds);
8484

8585
$this->assertEquals('apps/v1', $ds->getApiVersion());
86-
$this->assertEquals('mysql', $ds->getName());
86+
$this->assertEquals('mariadb', $ds->getName());
8787
$this->assertEquals(['tier' => 'backend'], $ds->getLabels());
8888
$this->assertEquals(0, $ds->getMinReadySeconds());
8989
$this->assertEquals($pod->getName(), $ds->getTemplate()->getName());
@@ -152,22 +152,22 @@ public function runGetAllTests()
152152

153153
public function runGetTests()
154154
{
155-
$ds = $this->cluster->getDaemonSetByName('mysql');
155+
$ds = $this->cluster->getDaemonSetByName('mariadb');
156156

157157
$this->assertInstanceOf(K8sDaemonSet::class, $ds);
158158

159159
$this->assertTrue($ds->isSynced());
160160

161161
$this->assertEquals('apps/v1', $ds->getApiVersion());
162-
$this->assertEquals('mysql', $ds->getName());
162+
$this->assertEquals('mariadb', $ds->getName());
163163
$this->assertEquals(['tier' => 'backend'], $ds->getLabels());
164164

165165
$this->assertInstanceOf(K8sPod::class, $ds->getTemplate());
166166
}
167167

168168
public function runUpdateTests()
169169
{
170-
$ds = $this->cluster->getDaemonSetByName('mysql');
170+
$ds = $this->cluster->getDaemonSetByName('mariadb');
171171

172172
$this->assertTrue($ds->isSynced());
173173

@@ -176,15 +176,15 @@ public function runUpdateTests()
176176
$this->assertTrue($ds->isSynced());
177177

178178
$this->assertEquals('apps/v1', $ds->getApiVersion());
179-
$this->assertEquals('mysql', $ds->getName());
179+
$this->assertEquals('mariadb', $ds->getName());
180180
$this->assertEquals(['tier' => 'backend'], $ds->getLabels());
181181

182182
$this->assertInstanceOf(K8sPod::class, $ds->getTemplate());
183183
}
184184

185185
public function runDeletionTests()
186186
{
187-
$ds = $this->cluster->getDaemonSetByName('mysql');
187+
$ds = $this->cluster->getDaemonSetByName('mariadb');
188188

189189
$this->assertTrue($ds->delete());
190190

@@ -200,13 +200,13 @@ public function runDeletionTests()
200200

201201
$this->expectException(KubernetesAPIException::class);
202202

203-
$this->cluster->getDaemonSetByName('mysql');
203+
$this->cluster->getDaemonSetByName('mariadb');
204204
}
205205

206206
public function runWatchAllTests()
207207
{
208208
$watch = $this->cluster->daemonSet()->watchAll(function ($type, $ds) {
209-
if ($ds->getName() === 'mysql') {
209+
if ($ds->getName() === 'mariadb') {
210210
return true;
211211
}
212212
}, ['timeoutSeconds' => 10]);
@@ -216,8 +216,8 @@ public function runWatchAllTests()
216216

217217
public function runWatchTests()
218218
{
219-
$watch = $this->cluster->daemonSet()->watchByName('mysql', function ($type, $ds) {
220-
return $ds->getName() === 'mysql';
219+
$watch = $this->cluster->daemonSet()->watchByName('mariadb', function ($type, $ds) {
220+
return $ds->getName() === 'mariadb';
221221
}, ['timeoutSeconds' => 10]);
222222

223223
$this->assertTrue($watch);

tests/DeploymentTest.php

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ class DeploymentTest extends TestCase
1212
{
1313
public function test_deployment_build()
1414
{
15-
$mysql = $this->createMysqlContainer();
15+
$mariadb = $this->createMariadbContainer();
1616

1717
$pod = $this->cluster->pod()
18-
->setName('mysql')
19-
->setContainers([$mysql]);
18+
->setName('mariadb')
19+
->setContainers([$mariadb]);
2020

2121
$dep = $this->cluster->deployment()
22-
->setName('mysql')
22+
->setName('mariadb')
2323
->setLabels(['tier' => 'backend'])
24-
->setAnnotations(['mysql/annotation' => 'yes'])
24+
->setAnnotations(['mariadb/annotation' => 'yes'])
2525
->setReplicas(3)
2626
->setTemplate($pod);
2727

2828
$this->assertEquals('apps/v1', $dep->getApiVersion());
29-
$this->assertEquals('mysql', $dep->getName());
29+
$this->assertEquals('mariadb', $dep->getName());
3030
$this->assertEquals(['tier' => 'backend'], $dep->getLabels());
31-
$this->assertEquals(['mysql/annotation' => 'yes'], $dep->getAnnotations());
31+
$this->assertEquals(['mariadb/annotation' => 'yes'], $dep->getAnnotations());
3232
$this->assertEquals(3, $dep->getReplicas());
3333
$this->assertEquals($pod->getName(), $dep->getTemplate()->getName());
3434

@@ -37,18 +37,18 @@ public function test_deployment_build()
3737

3838
public function test_deployment_from_yaml()
3939
{
40-
$mysql = $this->createMysqlContainer();
40+
$mariadb = $this->createMariadbContainer();
4141

4242
$pod = $this->cluster->pod()
43-
->setName('mysql')
44-
->setContainers([$mysql]);
43+
->setName('mariadb')
44+
->setContainers([$mariadb]);
4545

4646
$dep = $this->cluster->fromYamlFile(__DIR__.'/yaml/deployment.yaml');
4747

4848
$this->assertEquals('apps/v1', $dep->getApiVersion());
49-
$this->assertEquals('mysql', $dep->getName());
49+
$this->assertEquals('mariadb', $dep->getName());
5050
$this->assertEquals(['tier' => 'backend'], $dep->getLabels());
51-
$this->assertEquals(['mysql/annotation' => 'yes'], $dep->getAnnotations());
51+
$this->assertEquals(['mariadb/annotation' => 'yes'], $dep->getAnnotations());
5252
$this->assertEquals(3, $dep->getReplicas());
5353
$this->assertEquals($pod->getName(), $dep->getTemplate()->getName());
5454

@@ -70,24 +70,24 @@ public function test_deployment_api_interaction()
7070

7171
public function runCreationTests()
7272
{
73-
$mysql = $this->createMysqlContainer([
73+
$mariadb = $this->createMariadbContainer([
7474
'includeEnv' => true,
7575
'additionalPort' => 3307
7676
]);
7777

78-
$pod = $this->createMysqlPod([
79-
'labels' => ['tier' => 'backend', 'deployment-name' => 'mysql'],
78+
$pod = $this->createMariadbPod([
79+
'labels' => ['tier' => 'backend', 'deployment-name' => 'mariadb'],
8080
'container' => [
8181
'includeEnv' => true,
8282
'additionalPort' => 3307
8383
]
8484
])
85-
->setAnnotations(['mysql/annotation' => 'yes']);
85+
->setAnnotations(['mariadb/annotation' => 'yes']);
8686

8787
$dep = $this->cluster->deployment()
88-
->setName('mysql')
88+
->setName('mariadb')
8989
->setLabels(['tier' => 'backend'])
90-
->setAnnotations(['mysql/annotation' => 'yes'])
90+
->setAnnotations(['mariadb/annotation' => 'yes'])
9191
->setSelectors(['matchLabels' => ['tier' => 'backend']])
9292
->setReplicas(1)
9393
->setUpdateStrategy('RollingUpdate')
@@ -105,9 +105,9 @@ public function runCreationTests()
105105
$this->assertInstanceOf(K8sDeployment::class, $dep);
106106

107107
$this->assertEquals('apps/v1', $dep->getApiVersion());
108-
$this->assertEquals('mysql', $dep->getName());
108+
$this->assertEquals('mariadb', $dep->getName());
109109
$this->assertEquals(['tier' => 'backend'], $dep->getLabels());
110-
$this->assertEquals(['mysql/annotation' => 'yes'], $dep->getAnnotations());
110+
$this->assertEquals(['mariadb/annotation' => 'yes'], $dep->getAnnotations());
111111
$this->assertEquals(1, $dep->getReplicas());
112112
$this->assertEquals(0, $dep->getMinReadySeconds());
113113
$this->assertEquals($pod->getName(), $dep->getTemplate()->getName());
@@ -168,29 +168,29 @@ public function runGetAllTests()
168168

169169
public function runGetTests()
170170
{
171-
$dep = $this->cluster->getDeploymentByName('mysql');
171+
$dep = $this->cluster->getDeploymentByName('mariadb');
172172

173173
$this->assertInstanceOf(K8sDeployment::class, $dep);
174174

175175
$this->assertTrue($dep->isSynced());
176176

177177
$this->assertEquals('apps/v1', $dep->getApiVersion());
178-
$this->assertEquals('mysql', $dep->getName());
178+
$this->assertEquals('mariadb', $dep->getName());
179179
$this->assertEquals(['tier' => 'backend'], $dep->getLabels());
180-
$this->assertEquals(['mysql/annotation' => 'yes', 'deployment.kubernetes.io/revision' => '1'], $dep->getAnnotations());
180+
$this->assertEquals(['mariadb/annotation' => 'yes', 'deployment.kubernetes.io/revision' => '1'], $dep->getAnnotations());
181181
$this->assertEquals(1, $dep->getReplicas());
182182

183183
$this->assertInstanceOf(K8sPod::class, $dep->getTemplate());
184184
}
185185

186186
public function attachPodAutoscaler()
187187
{
188-
$dep = $this->cluster->getDeploymentByName('mysql');
188+
$dep = $this->cluster->getDeploymentByName('mariadb');
189189

190190
$cpuMetric = K8s::metric()->cpu()->averageUtilization(70);
191191

192192
$hpa = $this->cluster->horizontalPodAutoscaler()
193-
->setName('deploy-mysql')
193+
->setName('deploy-mariadb')
194194
->setResource($dep)
195195
->addMetrics([$cpuMetric])
196196
->setMetrics([$cpuMetric])
@@ -209,7 +209,7 @@ public function attachPodAutoscaler()
209209

210210
public function runUpdateTests()
211211
{
212-
$dep = $this->cluster->getDeploymentByName('mysql');
212+
$dep = $this->cluster->getDeploymentByName('mariadb');
213213

214214
$this->assertTrue($dep->isSynced());
215215

@@ -220,7 +220,7 @@ public function runUpdateTests()
220220
$this->assertTrue($dep->isSynced());
221221

222222
$this->assertEquals('apps/v1', $dep->getApiVersion());
223-
$this->assertEquals('mysql', $dep->getName());
223+
$this->assertEquals('mariadb', $dep->getName());
224224
$this->assertEquals(['tier' => 'backend'], $dep->getLabels());
225225
$this->assertEquals([], $dep->getAnnotations());
226226
$this->assertEquals(2, $dep->getReplicas());
@@ -230,8 +230,8 @@ public function runUpdateTests()
230230

231231
public function runDeletionTests()
232232
{
233-
$dep = $this->cluster->getDeploymentByName('mysql');
234-
$hpa = $this->cluster->getHorizontalPodAutoscalerByName('deploy-mysql');
233+
$dep = $this->cluster->getDeploymentByName('mariadb');
234+
$hpa = $this->cluster->getHorizontalPodAutoscalerByName('deploy-mariadb');
235235

236236
$this->assertTrue($dep->delete());
237237
$this->assertTrue($hpa->delete());
@@ -253,14 +253,14 @@ public function runDeletionTests()
253253

254254
$this->expectException(KubernetesAPIException::class);
255255

256-
$this->cluster->getDeploymentByName('mysql');
257-
$this->cluster->getHorizontalPodAutoscalerByName('deploy-mysql');
256+
$this->cluster->getDeploymentByName('mariadb');
257+
$this->cluster->getHorizontalPodAutoscalerByName('deploy-mariadb');
258258
}
259259

260260
public function runWatchAllTests()
261261
{
262262
$watch = $this->cluster->deployment()->watchAll(function ($type, $dep) {
263-
if ($dep->getName() === 'mysql') {
263+
if ($dep->getName() === 'mariadb') {
264264
return true;
265265
}
266266
}, ['timeoutSeconds' => 10]);
@@ -270,16 +270,16 @@ public function runWatchAllTests()
270270

271271
public function runWatchTests()
272272
{
273-
$watch = $this->cluster->deployment()->watchByName('mysql', function ($type, $dep) {
274-
return $dep->getName() === 'mysql';
273+
$watch = $this->cluster->deployment()->watchByName('mariadb', function ($type, $dep) {
274+
return $dep->getName() === 'mariadb';
275275
}, ['timeoutSeconds' => 10]);
276276

277277
$this->assertTrue($watch);
278278
}
279279

280280
public function runScalingTests()
281281
{
282-
$dep = $this->cluster->getDeploymentByName('mysql');
282+
$dep = $this->cluster->getDeploymentByName('mariadb');
283283

284284
$scaler = $dep->scale(2);
285285

0 commit comments

Comments
 (0)