File tree Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Expand file tree Collapse file tree 1 file changed +68
-0
lines changed Original file line number Diff line number Diff line change @@ -546,3 +546,71 @@ metadata:
546
546
name: red-dc6gc5btkc
547
547
` )
548
548
}
549
+
550
+ func TestReplacementTransformerWithSuffixTransformerAndReject (t * testing.T ) {
551
+ th := kusttest_test .MakeEnhancedHarness (t )
552
+ defer th .Reset ()
553
+
554
+ th .WriteF ("base/app.yaml" , `
555
+ apiVersion: apps/v1
556
+ kind: Deployment
557
+ metadata:
558
+ name: original-name
559
+ spec:
560
+ template:
561
+ spec:
562
+ containers:
563
+ - image: app1:1.0
564
+ name: app
565
+ ` )
566
+ th .WriteK ("base" , `
567
+ resources:
568
+ - app.yaml
569
+ ` )
570
+ th .WriteK ("overlay" , `
571
+ apiVersion: kustomize.config.k8s.io/v1beta1
572
+ kind: Kustomization
573
+
574
+ nameSuffix: -dev
575
+ resources:
576
+ - ../base
577
+
578
+ configMapGenerator:
579
+ - name: app-config
580
+ literals:
581
+ - name=something-else
582
+
583
+ replacements:
584
+ - source:
585
+ kind: ConfigMap
586
+ name: app-config
587
+ fieldPath: data.name
588
+ targets:
589
+ - fieldPaths:
590
+ - spec.template.spec.containers.0.name
591
+ select:
592
+ kind: Deployment
593
+ reject:
594
+ - name: original-name
595
+ ` )
596
+ m := th .Run ("overlay" , th .MakeDefaultOptions ())
597
+ th .AssertActualEqualsExpected (m , `
598
+ apiVersion: apps/v1
599
+ kind: Deployment
600
+ metadata:
601
+ name: original-name-dev
602
+ spec:
603
+ template:
604
+ spec:
605
+ containers:
606
+ - image: app1:1.0
607
+ name: something-else
608
+ ---
609
+ apiVersion: v1
610
+ data:
611
+ name: something-else
612
+ kind: ConfigMap
613
+ metadata:
614
+ name: app-config-dev-97544dk6t8
615
+ ` )
616
+ }
You can’t perform that action at this time.
0 commit comments