@@ -85,118 +85,52 @@ func TestDefaultingWebhook(t *testing.T) {
8585 resourceName : "cluster1" ,
8686 resourceNS : "default" ,
8787 expectHash : false ,
88- expectSpec : AWSManagedControlPlaneSpec {
89- EKSClusterName : "default_cluster1" ,
90- IdentityRef : defaultIdentityRef ,
91- Bastion : defaultTestBastion ,
92- NetworkSpec : defaultNetworkSpec ,
93- TokenMethod : & EKSTokenMethodIAMAuthenticator ,
94- BootstrapSelfManagedAddons : true ,
95- },
88+ expectSpec : AWSManagedControlPlaneSpec {EKSClusterName : "default_cluster1" , IdentityRef : defaultIdentityRef , Bastion : defaultTestBastion , NetworkSpec : defaultNetworkSpec , TokenMethod : & EKSTokenMethodIAMAuthenticator , BootstrapSelfManagedAddons : true , PreserveAddons : false },
9689 },
9790 {
9891 name : "less than 100 chars, dot in name" ,
9992 resourceName : "team1.cluster1" ,
10093 resourceNS : "default" ,
10194 expectHash : false ,
102- expectSpec : AWSManagedControlPlaneSpec {
103- EKSClusterName : "default_team1_cluster1" ,
104- IdentityRef : defaultIdentityRef ,
105- Bastion : defaultTestBastion ,
106- NetworkSpec : defaultNetworkSpec ,
107- TokenMethod : & EKSTokenMethodIAMAuthenticator ,
108- BootstrapSelfManagedAddons : true ,
109- },
95+ expectSpec : AWSManagedControlPlaneSpec {EKSClusterName : "default_team1_cluster1" , IdentityRef : defaultIdentityRef , Bastion : defaultTestBastion , NetworkSpec : defaultNetworkSpec , TokenMethod : & EKSTokenMethodIAMAuthenticator , BootstrapSelfManagedAddons : true , PreserveAddons : false },
11096 },
11197 {
11298 name : "more than 100 chars" ,
11399 resourceName : "abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde" ,
114100 resourceNS : "default" ,
115101 expectHash : true ,
116- expectSpec : AWSManagedControlPlaneSpec {
117- EKSClusterName : "capi_" ,
118- IdentityRef : defaultIdentityRef ,
119- Bastion : defaultTestBastion ,
120- NetworkSpec : defaultNetworkSpec ,
121- TokenMethod : & EKSTokenMethodIAMAuthenticator ,
122- BootstrapSelfManagedAddons : true ,
123- },
102+ expectSpec : AWSManagedControlPlaneSpec {EKSClusterName : "capi_" , IdentityRef : defaultIdentityRef , Bastion : defaultTestBastion , NetworkSpec : defaultNetworkSpec , TokenMethod : & EKSTokenMethodIAMAuthenticator , BootstrapSelfManagedAddons : true , PreserveAddons : false },
124103 },
125104 {
126105 name : "with patch" ,
127106 resourceName : "cluster1" ,
128107 resourceNS : "default" ,
129108 expectHash : false ,
130- spec : AWSManagedControlPlaneSpec {
131- Version : & vV1_17_1 ,
132- },
133- expectSpec : AWSManagedControlPlaneSpec {
134- EKSClusterName : "default_cluster1" ,
135- Version : & vV1_17_1 ,
136- IdentityRef : defaultIdentityRef ,
137- Bastion : defaultTestBastion ,
138- NetworkSpec : defaultNetworkSpec ,
139- TokenMethod : & EKSTokenMethodIAMAuthenticator ,
140- BootstrapSelfManagedAddons : true ,
141- },
109+ spec : AWSManagedControlPlaneSpec {Version : & vV1_17_1 },
110+ expectSpec : AWSManagedControlPlaneSpec {EKSClusterName : "default_cluster1" , Version : & vV1_17_1 , IdentityRef : defaultIdentityRef , Bastion : defaultTestBastion , NetworkSpec : defaultNetworkSpec , TokenMethod : & EKSTokenMethodIAMAuthenticator , BootstrapSelfManagedAddons : true , PreserveAddons : false },
142111 },
143112 {
144113 name : "with allowed ip on bastion" ,
145114 resourceName : "cluster1" ,
146115 resourceNS : "default" ,
147116 expectHash : false ,
148- spec : AWSManagedControlPlaneSpec {
149- Bastion : infrav1.Bastion {
150- AllowedCIDRBlocks : []string {"100.100.100.100/0" },
151- },
152- },
153- expectSpec : AWSManagedControlPlaneSpec {
154- EKSClusterName : "default_cluster1" ,
155- IdentityRef : defaultIdentityRef ,
156- Bastion : infrav1.Bastion {
157- AllowedCIDRBlocks : []string {"100.100.100.100/0" },
158- },
159- NetworkSpec : defaultNetworkSpec ,
160- TokenMethod : & EKSTokenMethodIAMAuthenticator ,
161- BootstrapSelfManagedAddons : true ,
162- },
117+ spec : AWSManagedControlPlaneSpec {Bastion : infrav1.Bastion {AllowedCIDRBlocks : []string {"100.100.100.100/0" }}},
118+ expectSpec : AWSManagedControlPlaneSpec {EKSClusterName : "default_cluster1" , IdentityRef : defaultIdentityRef , Bastion : infrav1.Bastion {AllowedCIDRBlocks : []string {"100.100.100.100/0" }}, NetworkSpec : defaultNetworkSpec , TokenMethod : & EKSTokenMethodIAMAuthenticator , BootstrapSelfManagedAddons : true , PreserveAddons : false },
163119 },
164120 {
165121 name : "with CNI on network" ,
166122 resourceName : "cluster1" ,
167123 resourceNS : "default" ,
168124 expectHash : false ,
169- spec : AWSManagedControlPlaneSpec {
170- NetworkSpec : infrav1.NetworkSpec {
171- CNI : & infrav1.CNISpec {},
172- },
173- },
174- expectSpec : AWSManagedControlPlaneSpec {
175- EKSClusterName : "default_cluster1" ,
176- IdentityRef : defaultIdentityRef ,
177- Bastion : defaultTestBastion ,
178- NetworkSpec : infrav1.NetworkSpec {
179- CNI : & infrav1.CNISpec {},
180- VPC : defaultVPCSpec ,
181- },
182- TokenMethod : & EKSTokenMethodIAMAuthenticator ,
183- BootstrapSelfManagedAddons : true ,
184- },
125+ spec : AWSManagedControlPlaneSpec {NetworkSpec : infrav1.NetworkSpec {CNI : & infrav1.CNISpec {}}},
126+ expectSpec : AWSManagedControlPlaneSpec {EKSClusterName : "default_cluster1" , IdentityRef : defaultIdentityRef , Bastion : defaultTestBastion , NetworkSpec : infrav1.NetworkSpec {CNI : & infrav1.CNISpec {}, VPC : defaultVPCSpec }, TokenMethod : & EKSTokenMethodIAMAuthenticator , BootstrapSelfManagedAddons : true , PreserveAddons : false },
185127 },
186128 {
187129 name : "secondary CIDR" ,
188130 resourceName : "cluster1" ,
189131 resourceNS : "default" ,
190132 expectHash : false ,
191- expectSpec : AWSManagedControlPlaneSpec {
192- EKSClusterName : "default_cluster1" ,
193- IdentityRef : defaultIdentityRef ,
194- Bastion : defaultTestBastion ,
195- NetworkSpec : defaultNetworkSpec ,
196- SecondaryCidrBlock : nil ,
197- TokenMethod : & EKSTokenMethodIAMAuthenticator ,
198- BootstrapSelfManagedAddons : true ,
199- },
133+ expectSpec : AWSManagedControlPlaneSpec {EKSClusterName : "default_cluster1" , IdentityRef : defaultIdentityRef , Bastion : defaultTestBastion , NetworkSpec : defaultNetworkSpec , SecondaryCidrBlock : nil , TokenMethod : & EKSTokenMethodIAMAuthenticator , BootstrapSelfManagedAddons : true , PreserveAddons : false },
200134 },
201135 }
202136
0 commit comments