@@ -1507,7 +1507,7 @@ func Test_BundleValidatingWebhookResourceGenerator_Succeeds(t *testing.T) {
15071507 },
15081508 opts : render.Options {
15091509 InstallNamespace : "install-namespace" ,
1510- TargetNamespaces : []string {"watch-namespace-one" , "watch-namespace-two " },
1510+ TargetNamespaces : []string {"" },
15111511 },
15121512 expectedResources : []client.Object {
15131513 & admissionregistrationv1.ValidatingWebhookConfiguration {
@@ -1554,6 +1554,7 @@ func Test_BundleValidatingWebhookResourceGenerator_Succeeds(t *testing.T) {
15541554 Port : ptr .To (int32 (443 )),
15551555 },
15561556 },
1557+ // No NamespaceSelector is set targetNamespaces = []string{""} (AllNamespaces install mode)
15571558 },
15581559 },
15591560 },
@@ -1647,6 +1648,15 @@ func Test_BundleValidatingWebhookResourceGenerator_Succeeds(t *testing.T) {
16471648 Port : ptr .To (int32 (443 )),
16481649 },
16491650 },
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+ },
16501660 },
16511661 },
16521662 },
@@ -1694,6 +1704,15 @@ func Test_BundleValidatingWebhookResourceGenerator_Succeeds(t *testing.T) {
16941704 Port : ptr .To (int32 (443 )),
16951705 },
16961706 },
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+ },
16971716 },
16981717 },
16991718 },
@@ -1772,7 +1791,7 @@ func Test_BundleMutatingWebhookResourceGenerator_Succeeds(t *testing.T) {
17721791 },
17731792 opts : render.Options {
17741793 InstallNamespace : "install-namespace" ,
1775- TargetNamespaces : []string {"watch-namespace-one" , "watch-namespace-two " },
1794+ TargetNamespaces : []string {"" },
17761795 },
17771796 expectedResources : []client.Object {
17781797 & admissionregistrationv1.MutatingWebhookConfiguration {
@@ -1820,6 +1839,7 @@ func Test_BundleMutatingWebhookResourceGenerator_Succeeds(t *testing.T) {
18201839 Port : ptr .To (int32 (443 )),
18211840 },
18221841 },
1842+ // No NamespaceSelector is set targetNamespaces = []string{""} (AllNamespaces install mode)
18231843 },
18241844 },
18251845 },
@@ -1915,6 +1935,15 @@ func Test_BundleMutatingWebhookResourceGenerator_Succeeds(t *testing.T) {
19151935 Port : ptr .To (int32 (443 )),
19161936 },
19171937 },
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+ },
19181947 },
19191948 },
19201949 },
@@ -1962,6 +1991,15 @@ func Test_BundleMutatingWebhookResourceGenerator_Succeeds(t *testing.T) {
19621991 Port : ptr .To (int32 (443 )),
19631992 },
19641993 },
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+ },
19652003 },
19662004 },
19672005 },
0 commit comments