@@ -1507,7 +1507,7 @@ func Test_BundleValidatingWebhookResourceGenerator_Succeeds(t *testing.T) {
1507
1507
},
1508
1508
opts : render.Options {
1509
1509
InstallNamespace : "install-namespace" ,
1510
- TargetNamespaces : []string {"watch-namespace-one" , "watch-namespace-two " },
1510
+ TargetNamespaces : []string {"" },
1511
1511
},
1512
1512
expectedResources : []client.Object {
1513
1513
& admissionregistrationv1.ValidatingWebhookConfiguration {
@@ -1554,6 +1554,7 @@ func Test_BundleValidatingWebhookResourceGenerator_Succeeds(t *testing.T) {
1554
1554
Port : ptr .To (int32 (443 )),
1555
1555
},
1556
1556
},
1557
+ // No NamespaceSelector is set targetNamespaces = []string{""} (AllNamespaces install mode)
1557
1558
},
1558
1559
},
1559
1560
},
@@ -1647,6 +1648,15 @@ func Test_BundleValidatingWebhookResourceGenerator_Succeeds(t *testing.T) {
1647
1648
Port : ptr .To (int32 (443 )),
1648
1649
},
1649
1650
},
1651
+ NamespaceSelector : & metav1.LabelSelector {
1652
+ MatchExpressions : []metav1.LabelSelectorRequirement {
1653
+ {
1654
+ Key : "kubernetes.io/metadata.name" ,
1655
+ Operator : metav1 .LabelSelectorOpIn ,
1656
+ Values : []string {"watch-namespace-one" , "watch-namespace-two" },
1657
+ },
1658
+ },
1659
+ },
1650
1660
},
1651
1661
},
1652
1662
},
@@ -1694,6 +1704,15 @@ func Test_BundleValidatingWebhookResourceGenerator_Succeeds(t *testing.T) {
1694
1704
Port : ptr .To (int32 (443 )),
1695
1705
},
1696
1706
},
1707
+ NamespaceSelector : & metav1.LabelSelector {
1708
+ MatchExpressions : []metav1.LabelSelectorRequirement {
1709
+ {
1710
+ Key : "kubernetes.io/metadata.name" ,
1711
+ Operator : metav1 .LabelSelectorOpIn ,
1712
+ Values : []string {"watch-namespace-one" , "watch-namespace-two" },
1713
+ },
1714
+ },
1715
+ },
1697
1716
},
1698
1717
},
1699
1718
},
@@ -1772,7 +1791,7 @@ func Test_BundleMutatingWebhookResourceGenerator_Succeeds(t *testing.T) {
1772
1791
},
1773
1792
opts : render.Options {
1774
1793
InstallNamespace : "install-namespace" ,
1775
- TargetNamespaces : []string {"watch-namespace-one" , "watch-namespace-two " },
1794
+ TargetNamespaces : []string {"" },
1776
1795
},
1777
1796
expectedResources : []client.Object {
1778
1797
& admissionregistrationv1.MutatingWebhookConfiguration {
@@ -1820,6 +1839,7 @@ func Test_BundleMutatingWebhookResourceGenerator_Succeeds(t *testing.T) {
1820
1839
Port : ptr .To (int32 (443 )),
1821
1840
},
1822
1841
},
1842
+ // No NamespaceSelector is set targetNamespaces = []string{""} (AllNamespaces install mode)
1823
1843
},
1824
1844
},
1825
1845
},
@@ -1915,6 +1935,15 @@ func Test_BundleMutatingWebhookResourceGenerator_Succeeds(t *testing.T) {
1915
1935
Port : ptr .To (int32 (443 )),
1916
1936
},
1917
1937
},
1938
+ NamespaceSelector : & metav1.LabelSelector {
1939
+ MatchExpressions : []metav1.LabelSelectorRequirement {
1940
+ {
1941
+ Key : "kubernetes.io/metadata.name" ,
1942
+ Operator : metav1 .LabelSelectorOpIn ,
1943
+ Values : []string {"watch-namespace-one" , "watch-namespace-two" },
1944
+ },
1945
+ },
1946
+ },
1918
1947
},
1919
1948
},
1920
1949
},
@@ -1962,6 +1991,15 @@ func Test_BundleMutatingWebhookResourceGenerator_Succeeds(t *testing.T) {
1962
1991
Port : ptr .To (int32 (443 )),
1963
1992
},
1964
1993
},
1994
+ NamespaceSelector : & metav1.LabelSelector {
1995
+ MatchExpressions : []metav1.LabelSelectorRequirement {
1996
+ {
1997
+ Key : "kubernetes.io/metadata.name" ,
1998
+ Operator : metav1 .LabelSelectorOpIn ,
1999
+ Values : []string {"watch-namespace-one" , "watch-namespace-two" },
2000
+ },
2001
+ },
2002
+ },
1965
2003
},
1966
2004
},
1967
2005
},
0 commit comments