@@ -2272,14 +2272,14 @@ func TestNeedsClientSideApplyMigration(t *testing.T) {
2272
2272
}
2273
2273
}
2274
2274
2275
- func templateWithStorage (name , storage string ) map [string ]interface {} {
2276
- return map [string ]interface {} {
2277
- "metadata" : map [string ]interface {} {
2275
+ func templateWithStorage (name , storage string ) map [string ]any {
2276
+ return map [string ]any {
2277
+ "metadata" : map [string ]any {
2278
2278
"name" : name ,
2279
2279
},
2280
- "spec" : map [string ]interface {} {
2281
- "resources" : map [string ]interface {} {
2282
- "requests" : map [string ]interface {} {
2280
+ "spec" : map [string ]any {
2281
+ "resources" : map [string ]any {
2282
+ "requests" : map [string ]any {
2283
2283
"storage" : storage ,
2284
2284
},
2285
2285
},
@@ -2290,16 +2290,16 @@ func templateWithStorage(name, storage string) map[string]interface{} {
2290
2290
func TestStatefulSetImmutableFieldErrors (t * testing.T ) {
2291
2291
tests := []struct {
2292
2292
name string
2293
- currentSpec map [string ]interface {}
2294
- desiredSpec map [string ]interface {}
2293
+ currentSpec map [string ]any
2294
+ desiredSpec map [string ]any
2295
2295
expectedMessage string
2296
2296
}{
2297
2297
{
2298
2298
name : "single field change - serviceName" ,
2299
- currentSpec : map [string ]interface {} {
2299
+ currentSpec : map [string ]any {
2300
2300
"serviceName" : "old-svc" ,
2301
2301
},
2302
- desiredSpec : map [string ]interface {} {
2302
+ desiredSpec : map [string ]any {
2303
2303
"serviceName" : "new-svc" ,
2304
2304
},
2305
2305
expectedMessage : `attempting to change immutable fields:
@@ -2311,31 +2311,31 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
2311
2311
},
2312
2312
{
2313
2313
name : "volumeClaimTemplates change with storage size" ,
2314
- currentSpec : map [string ]interface {} {
2315
- "volumeClaimTemplates" : []interface {} {
2316
- map [string ]interface {} {
2317
- "metadata" : map [string ]interface {} {
2314
+ currentSpec : map [string ]any {
2315
+ "volumeClaimTemplates" : []any {
2316
+ map [string ]any {
2317
+ "metadata" : map [string ]any {
2318
2318
"name" : "data" ,
2319
2319
},
2320
- "spec" : map [string ]interface {} {
2321
- "resources" : map [string ]interface {} {
2322
- "requests" : map [string ]interface {} {
2320
+ "spec" : map [string ]any {
2321
+ "resources" : map [string ]any {
2322
+ "requests" : map [string ]any {
2323
2323
"storage" : "1Gi" ,
2324
2324
},
2325
2325
},
2326
2326
},
2327
2327
},
2328
2328
},
2329
2329
},
2330
- desiredSpec : map [string ]interface {} {
2331
- "volumeClaimTemplates" : []interface {} {
2332
- map [string ]interface {} {
2333
- "metadata" : map [string ]interface {} {
2330
+ desiredSpec : map [string ]any {
2331
+ "volumeClaimTemplates" : []any {
2332
+ map [string ]any {
2333
+ "metadata" : map [string ]any {
2334
2334
"name" : "data" ,
2335
2335
},
2336
- "spec" : map [string ]interface {} {
2337
- "resources" : map [string ]interface {} {
2338
- "requests" : map [string ]interface {} {
2336
+ "spec" : map [string ]any {
2337
+ "resources" : map [string ]any {
2338
+ "requests" : map [string ]any {
2339
2339
"storage" : "2Gi" ,
2340
2340
},
2341
2341
},
@@ -2352,16 +2352,16 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
2352
2352
},
2353
2353
{
2354
2354
name : "selector change" ,
2355
- currentSpec : map [string ]interface {} {
2356
- "selector" : map [string ]interface {} {
2357
- "matchLabels" : map [string ]interface {} {
2355
+ currentSpec : map [string ]any {
2356
+ "selector" : map [string ]any {
2357
+ "matchLabels" : map [string ]any {
2358
2358
"app" : "old-app" ,
2359
2359
},
2360
2360
},
2361
2361
},
2362
- desiredSpec : map [string ]interface {} {
2363
- "selector" : map [string ]interface {} {
2364
- "matchLabels" : map [string ]interface {} {
2362
+ desiredSpec : map [string ]any {
2363
+ "selector" : map [string ]any {
2364
+ "matchLabels" : map [string ]any {
2365
2365
"app" : "new-app" ,
2366
2366
},
2367
2367
},
@@ -2375,14 +2375,14 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
2375
2375
},
2376
2376
{
2377
2377
name : "volumeClaimTemplates change from nil" ,
2378
- currentSpec : map [string ]interface {} {
2378
+ currentSpec : map [string ]any {
2379
2379
"serviceName" : "test-svc" ,
2380
2380
},
2381
- desiredSpec : map [string ]interface {} {
2381
+ desiredSpec : map [string ]any {
2382
2382
"serviceName" : "test-svc" ,
2383
- "volumeClaimTemplates" : []interface {} {
2384
- map [string ]interface {} {
2385
- "metadata" : map [string ]interface {} {
2383
+ "volumeClaimTemplates" : []any {
2384
+ map [string ]any {
2385
+ "metadata" : map [string ]any {
2386
2386
"name" : "data" ,
2387
2387
},
2388
2388
},
@@ -2397,24 +2397,24 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
2397
2397
},
2398
2398
{
2399
2399
name : "complex volumeClaimTemplates change" ,
2400
- currentSpec : map [string ]interface {} {
2401
- "volumeClaimTemplates" : []interface {} {
2402
- map [string ]interface {} {
2403
- "metadata" : map [string ]interface {} {
2400
+ currentSpec : map [string ]any {
2401
+ "volumeClaimTemplates" : []any {
2402
+ map [string ]any {
2403
+ "metadata" : map [string ]any {
2404
2404
"name" : "data1" ,
2405
2405
},
2406
2406
},
2407
2407
},
2408
2408
},
2409
- desiredSpec : map [string ]interface {} {
2410
- "volumeClaimTemplates" : []interface {} {
2411
- map [string ]interface {} {
2412
- "metadata" : map [string ]interface {} {
2409
+ desiredSpec : map [string ]any {
2410
+ "volumeClaimTemplates" : []any {
2411
+ map [string ]any {
2412
+ "metadata" : map [string ]any {
2413
2413
"name" : "data1" ,
2414
2414
},
2415
2415
},
2416
- map [string ]interface {} {
2417
- "metadata" : map [string ]interface {} {
2416
+ map [string ]any {
2417
+ "metadata" : map [string ]any {
2418
2418
"name" : "data2" ,
2419
2419
},
2420
2420
},
@@ -2429,27 +2429,27 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
2429
2429
},
2430
2430
{
2431
2431
name : "multiple volumeClaimTemplate change" ,
2432
- currentSpec : map [string ]interface {} {
2432
+ currentSpec : map [string ]any {
2433
2433
"serviceName" : postgresqlSvc ,
2434
- "selector" : map [string ]interface {} {
2435
- "matchLabels" : map [string ]interface {} {
2434
+ "selector" : map [string ]any {
2435
+ "matchLabels" : map [string ]any {
2436
2436
"app" : "postgresql" ,
2437
2437
},
2438
2438
},
2439
- "volumeClaimTemplates" : []interface {} {
2439
+ "volumeClaimTemplates" : []any {
2440
2440
templateWithStorage (staticFiles , "1Gi" ),
2441
2441
templateWithStorage (dexconfig , "1Gi" ),
2442
2442
templateWithStorage (argocdDexServerTLS , "1Gi" ),
2443
2443
},
2444
2444
},
2445
- desiredSpec : map [string ]interface {} {
2445
+ desiredSpec : map [string ]any {
2446
2446
"serviceName" : postgresqlSvc ,
2447
- "selector" : map [string ]interface {} {
2448
- "matchLabels" : map [string ]interface {} {
2447
+ "selector" : map [string ]any {
2448
+ "matchLabels" : map [string ]any {
2449
2449
"app" : "postgresql" ,
2450
2450
},
2451
2451
},
2452
- "volumeClaimTemplates" : []interface {} {
2452
+ "volumeClaimTemplates" : []any {
2453
2453
templateWithStorage (staticFiles , "2Gi" ),
2454
2454
templateWithStorage (dexconfig , "3Gi" ),
2455
2455
templateWithStorage (argocdDexServerTLS , "4Gi" ),
@@ -2470,27 +2470,27 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
2470
2470
},
2471
2471
{
2472
2472
name : "multiple field changes" ,
2473
- currentSpec : map [string ]interface {} {
2473
+ currentSpec : map [string ]any {
2474
2474
"serviceName" : postgresqlSvc ,
2475
- "selector" : map [string ]interface {} {
2476
- "matchLabels" : map [string ]interface {} {
2475
+ "selector" : map [string ]any {
2476
+ "matchLabels" : map [string ]any {
2477
2477
"app" : "postgresql" ,
2478
2478
},
2479
2479
},
2480
- "volumeClaimTemplates" : []interface {} {
2480
+ "volumeClaimTemplates" : []any {
2481
2481
templateWithStorage (staticFiles , "1Gi" ),
2482
2482
templateWithStorage (dexconfig , "1Gi" ),
2483
2483
templateWithStorage (argocdDexServerTLS , "1Gi" ),
2484
2484
},
2485
2485
},
2486
- desiredSpec : map [string ]interface {} {
2486
+ desiredSpec : map [string ]any {
2487
2487
"serviceName" : "postgresql-svc-new" ,
2488
- "selector" : map [string ]interface {} {
2489
- "matchLabels" : map [string ]interface {} {
2488
+ "selector" : map [string ]any {
2489
+ "matchLabels" : map [string ]any {
2490
2490
"app" : "postgresql-new" ,
2491
2491
},
2492
2492
},
2493
- "volumeClaimTemplates" : []interface {} {
2493
+ "volumeClaimTemplates" : []any {
2494
2494
templateWithStorage (staticFiles , "2Gi" ),
2495
2495
templateWithStorage (dexconfig , "1Gi" ),
2496
2496
templateWithStorage (argocdDexServerTLS , "1Gi" ),
@@ -2514,10 +2514,10 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
2514
2514
for _ , tt := range tests {
2515
2515
t .Run (tt .name , func (t * testing.T ) {
2516
2516
current := & unstructured.Unstructured {
2517
- Object : map [string ]interface {} {
2517
+ Object : map [string ]any {
2518
2518
"apiVersion" : testAPIVersion ,
2519
2519
"kind" : "StatefulSet" ,
2520
- "metadata" : map [string ]interface {} {
2520
+ "metadata" : map [string ]any {
2521
2521
"name" : testStatefulSet ,
2522
2522
"namespace" : testNamespace ,
2523
2523
},
@@ -2526,10 +2526,10 @@ Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordina
2526
2526
}
2527
2527
2528
2528
desired := & unstructured.Unstructured {
2529
- Object : map [string ]interface {} {
2529
+ Object : map [string ]any {
2530
2530
"apiVersion" : testAPIVersion ,
2531
2531
"kind" : "StatefulSet" ,
2532
- "metadata" : map [string ]interface {} {
2532
+ "metadata" : map [string ]any {
2533
2533
"name" : testStatefulSet ,
2534
2534
"namespace" : testNamespace ,
2535
2535
},
0 commit comments