@@ -86,6 +86,7 @@ var _ = Describe(
86
86
"Should update config dynamically" , func () {
87
87
88
88
By ("Modify dynamic config by adding fields" )
89
+
89
90
aeroCluster , err := getCluster (
90
91
k8sClient , ctx , clusterNamespacedName ,
91
92
)
@@ -122,16 +123,21 @@ var _ = Describe(
122
123
err = updateCluster (k8sClient , ctx , aeroCluster )
123
124
Expect (err ).ToNot (HaveOccurred ())
124
125
126
+ By ("Fetch and verify dynamic configs" )
127
+
125
128
pod := aeroCluster .Status .Pods ["dynamic-config-test-0-0" ]
126
129
130
+ // Fetch and verify service section config
127
131
conf , err := getAerospikeConfigFromNode (logger , k8sClient , ctx , clusterNamespacedName ,
128
132
"service" , & pod )
129
133
Expect (err ).ToNot (HaveOccurred ())
134
+
130
135
cv , ok := conf ["proto-fd-max" ]
131
136
Expect (ok ).ToNot (BeFalse ())
132
137
133
138
Expect (cv ).To (Equal (int64 (18000 )))
134
139
140
+ // Fetch and verify security section config
135
141
conf , err = getAerospikeConfigFromNode (logger , k8sClient , ctx , clusterNamespacedName ,
136
142
"security" , & pod )
137
143
Expect (err ).ToNot (HaveOccurred ())
@@ -141,16 +147,19 @@ var _ = Describe(
141
147
142
148
Expect (reportDataOp ).To (Equal ("test" ))
143
149
150
+ // Fetch and verify xdr section config
144
151
conf , err = getAerospikeConfigFromNode (logger , k8sClient , ctx , clusterNamespacedName ,
145
152
"xdr" , & pod )
146
153
Expect (err ).ToNot (HaveOccurred ())
147
154
148
155
Expect (conf ["dcs" ]).To (HaveLen (2 ))
149
156
150
157
By ("Verify no warm/cold restarts in Pods" )
158
+
151
159
validateServerRestart (ctx , aeroCluster , podPIDMap , false )
152
160
153
161
By ("Modify dynamic config by removing fields" )
162
+
154
163
aeroCluster , err = getCluster (
155
164
k8sClient , ctx , clusterNamespacedName ,
156
165
)
@@ -168,8 +177,11 @@ var _ = Describe(
168
177
err = updateCluster (k8sClient , ctx , aeroCluster )
169
178
Expect (err ).ToNot (HaveOccurred ())
170
179
180
+ By ("Fetch and verify dynamic configs" )
181
+
171
182
pod = aeroCluster .Status .Pods ["dynamic-config-test-0-0" ]
172
183
184
+ // Fetch and verify service section config
173
185
conf , err = getAerospikeConfigFromNode (logger , k8sClient , ctx , clusterNamespacedName ,
174
186
"service" , & pod )
175
187
Expect (err ).ToNot (HaveOccurred ())
@@ -178,22 +190,24 @@ var _ = Describe(
178
190
179
191
Expect (cv ).To (Equal (int64 (15000 )))
180
192
193
+ // Fetch and verify security section config
181
194
conf , err = getAerospikeConfigFromNode (logger , k8sClient , ctx , clusterNamespacedName ,
182
195
"security" , & pod )
183
196
Expect (err ).ToNot (HaveOccurred ())
184
197
185
198
_ , ok = conf ["log.report-data-op[0]" ].(string )
186
199
Expect (ok ).ToNot (BeTrue ())
187
200
201
+ // Fetch and verify xdr section config
188
202
conf , err = getAerospikeConfigFromNode (logger , k8sClient , ctx , clusterNamespacedName ,
189
203
"xdr" , & pod )
190
204
Expect (err ).ToNot (HaveOccurred ())
191
205
192
206
Expect (conf ["dcs" ]).To (HaveLen (1 ))
193
207
194
208
By ("Verify no warm/cold restarts in Pods" )
195
- validateServerRestart (ctx , aeroCluster , podPIDMap , false )
196
209
210
+ validateServerRestart (ctx , aeroCluster , podPIDMap , false )
197
211
},
198
212
)
199
213
@@ -215,6 +229,8 @@ var _ = Describe(
215
229
err = updateCluster (k8sClient , ctx , aeroCluster )
216
230
Expect (err ).ToNot (HaveOccurred ())
217
231
232
+ By ("Fetch and verify static configs" )
233
+
218
234
pod := aeroCluster .Status .Pods ["dynamic-config-test-0-0" ]
219
235
220
236
conf , err := getAerospikeConfigFromNode (logger , k8sClient , ctx , clusterNamespacedName ,
@@ -227,14 +243,15 @@ var _ = Describe(
227
243
Expect (enableQuotas ).To (BeTrue ())
228
244
229
245
By ("Verify warm restarts in Pods" )
246
+
230
247
validateServerRestart (ctx , aeroCluster , podPIDMap , true )
231
248
},
232
249
)
233
250
234
251
It (
235
252
"Should update config statically by disabling dynamic update feature" , func () {
236
253
237
- By ("Modify static config" )
254
+ By ("Modify dynamic config statically " )
238
255
239
256
aeroCluster , err := getCluster (
240
257
k8sClient , ctx , clusterNamespacedName ,
@@ -244,12 +261,15 @@ var _ = Describe(
244
261
podPIDMap , err := getPodIDs (ctx , aeroCluster )
245
262
Expect (err ).ToNot (HaveOccurred ())
246
263
264
+ // Disable dynamic config update and set config
247
265
aeroCluster .Spec .EnableDynamicConfigUpdate = ptr .To (false )
248
266
aeroCluster .Spec .AerospikeConfig .Value ["service" ].(map [string ]interface {})["proto-fd-max" ] = 19000
249
267
250
268
err = updateCluster (k8sClient , ctx , aeroCluster )
251
269
Expect (err ).ToNot (HaveOccurred ())
252
270
271
+ By ("Fetch and verify static configs" )
272
+
253
273
pod := aeroCluster .Status .Pods ["dynamic-config-test-0-0" ]
254
274
255
275
conf , err := getAerospikeConfigFromNode (logger , k8sClient , ctx , clusterNamespacedName ,
@@ -320,6 +340,8 @@ var _ = Describe(
320
340
podPIDMap , err := getPodIDs (ctx , aeroCluster )
321
341
Expect (err ).ToNot (HaveOccurred ())
322
342
343
+ // Failure:
344
+ // Update invalid config value
323
345
// This change will lead to dynamic config update failure.
324
346
// In case of full failure, will not fall back to rolling restart
325
347
aeroCluster .Spec .AerospikeConfig .Value ["service" ].(map [string ]interface {})["proto-fd-max" ] = 9999999
@@ -332,16 +354,18 @@ var _ = Describe(
332
354
)
333
355
Expect (err ).ToNot (HaveOccurred ())
334
356
335
- // Recovery
357
+ // Recovery:
358
+ // Update valid config value
359
+ // This change will lead to dynamic config update success.
336
360
aeroCluster .Spec .AerospikeConfig .Value ["service" ].(map [string ]interface {})["proto-fd-max" ] = 15000
337
361
338
362
err = updateCluster (k8sClient , ctx , aeroCluster )
339
363
Expect (err ).ToNot (HaveOccurred ())
340
364
341
- // As pods were failed, expectation is that pods will be cold restarted.
365
+ // As there was no full config update failure,
366
+ // expectation is that pods will not be restarted.
342
367
By ("Verify cold restarts in Pods" )
343
368
validateServerRestart (ctx , aeroCluster , podPIDMap , false )
344
-
345
369
},
346
370
)
347
371
@@ -355,6 +379,8 @@ var _ = Describe(
355
379
podPIDMap , err := getPodIDs (ctx , aeroCluster )
356
380
Expect (err ).ToNot (HaveOccurred ())
357
381
382
+ // Failure:
383
+ // Update multiple invalid config values
358
384
// This change will lead to dynamic config update failure.
359
385
// Assuming it will fall back to rolling restart in case of partial failure.
360
386
// Which leads to pod failures.
@@ -386,7 +412,9 @@ var _ = Describe(
386
412
)
387
413
Expect (err ).ToNot (HaveOccurred ())
388
414
389
- // Recovery
415
+ // Recovery:
416
+ // Update valid config value
417
+ // This change will lead to static config update success.
390
418
aeroCluster .Spec .AerospikeConfig .Value ["service" ].(map [string ]interface {})["proto-fd-max" ] = 15000
391
419
392
420
err = updateCluster (k8sClient , ctx , aeroCluster )
@@ -545,7 +573,12 @@ var _ = Describe(
545
573
By ("Verify XDR Context configs dynamically" )
546
574
err = validateXDRContextDynamically (ctx , flatServer , flatSpec , aeroCluster , dynamic )
547
575
Expect (err ).ToNot (HaveOccurred ())
548
- //
576
+
577
+ aeroCluster , err = getCluster (
578
+ k8sClient , ctx , clusterNamespacedName ,
579
+ )
580
+ Expect (err ).ToNot (HaveOccurred ())
581
+
549
582
By ("Verify no warm/cold restarts in Pods" )
550
583
validateServerRestart (ctx , aeroCluster , podPIDMap , false )
551
584
},
@@ -630,7 +663,7 @@ func updateValue(val interface{}, confKey string) (interface{}, error) {
630
663
return val2 + 1 , nil
631
664
632
665
case lib.Stats :
633
- println ( " stats" , confKey )
666
+ pkgLog . Info ( "got lib. stats type key " , confKey )
634
667
default :
635
668
return nil , fmt .Errorf ("format not supported" )
636
669
}
0 commit comments