@@ -142,6 +142,124 @@ func TestKonnectExtension(t *testing.T) {
142142 }.
143143 RunWithConfig (t , cfg , scheme )
144144 })
145+ t .Run ("status clusterType" , func (t * testing.T ) {
146+ common.TestCasesGroup [* konnectv1alpha2.KonnectExtension ]{
147+ {
148+ Name : "status clusterType ControlPlane" ,
149+ TestObject : & konnectv1alpha2.KonnectExtension {
150+ ObjectMeta : common .CommonObjectMeta (ns .Name ),
151+ Spec : konnectv1alpha2.KonnectExtensionSpec {
152+ Konnect : konnectv1alpha2.KonnectExtensionKonnectSpec {
153+ ControlPlane : konnectv1alpha2.KonnectExtensionControlPlane {
154+ Ref : commonv1alpha1.KonnectExtensionControlPlaneRef {
155+ Type : configurationv1alpha1 .ControlPlaneRefKonnectNamespacedRef ,
156+ KonnectNamespacedRef : & commonv1alpha1.KonnectNamespacedRef {
157+ Name : "test-konnect-control-plane" ,
158+ },
159+ },
160+ },
161+ },
162+ },
163+ },
164+ StatusUpdate : func (ke * konnectv1alpha2.KonnectExtension ) {
165+ ke .Status .Konnect = & konnectv1alpha2.KonnectExtensionControlPlaneStatus {
166+ ControlPlaneID : "cp-id" ,
167+ ClusterType : konnectv1alpha2 .ClusterTypeControlPlane ,
168+ Endpoints : konnectv1alpha2.KonnectEndpoints {
169+ TelemetryEndpoint : "telemetry.example.com" ,
170+ ControlPlaneEndpoint : "cp.example.com" ,
171+ },
172+ }
173+ },
174+ },
175+ {
176+ Name : "status clusterType K8SIngressController" ,
177+ TestObject : & konnectv1alpha2.KonnectExtension {
178+ ObjectMeta : common .CommonObjectMeta (ns .Name ),
179+ Spec : konnectv1alpha2.KonnectExtensionSpec {
180+ Konnect : konnectv1alpha2.KonnectExtensionKonnectSpec {
181+ ControlPlane : konnectv1alpha2.KonnectExtensionControlPlane {
182+ Ref : commonv1alpha1.KonnectExtensionControlPlaneRef {
183+ Type : configurationv1alpha1 .ControlPlaneRefKonnectNamespacedRef ,
184+ KonnectNamespacedRef : & commonv1alpha1.KonnectNamespacedRef {
185+ Name : "test-konnect-control-plane" ,
186+ },
187+ },
188+ },
189+ },
190+ },
191+ },
192+ StatusUpdate : func (ke * konnectv1alpha2.KonnectExtension ) {
193+ ke .Status .Konnect = & konnectv1alpha2.KonnectExtensionControlPlaneStatus {
194+ ControlPlaneID : "cp-id" ,
195+ ClusterType : konnectv1alpha2 .ClusterTypeK8sIngressController ,
196+ Endpoints : konnectv1alpha2.KonnectEndpoints {
197+ TelemetryEndpoint : "telemetry.example.com" ,
198+ ControlPlaneEndpoint : "cp.example.com" ,
199+ },
200+ }
201+ },
202+ },
203+ {
204+ Name : "status clusterType ControlPlaneGroup" ,
205+ TestObject : & konnectv1alpha2.KonnectExtension {
206+ ObjectMeta : common .CommonObjectMeta (ns .Name ),
207+ Spec : konnectv1alpha2.KonnectExtensionSpec {
208+ Konnect : konnectv1alpha2.KonnectExtensionKonnectSpec {
209+ ControlPlane : konnectv1alpha2.KonnectExtensionControlPlane {
210+ Ref : commonv1alpha1.KonnectExtensionControlPlaneRef {
211+ Type : configurationv1alpha1 .ControlPlaneRefKonnectNamespacedRef ,
212+ KonnectNamespacedRef : & commonv1alpha1.KonnectNamespacedRef {
213+ Name : "test-konnect-control-plane" ,
214+ },
215+ },
216+ },
217+ },
218+ },
219+ },
220+ StatusUpdate : func (ke * konnectv1alpha2.KonnectExtension ) {
221+ ke .Status .Konnect = & konnectv1alpha2.KonnectExtensionControlPlaneStatus {
222+ ControlPlaneID : "cp-id" ,
223+ ClusterType : konnectv1alpha2 .ClusterTypeControlPlaneGroup ,
224+ Endpoints : konnectv1alpha2.KonnectEndpoints {
225+ TelemetryEndpoint : "telemetry.example.com" ,
226+ ControlPlaneEndpoint : "cp.example.com" ,
227+ },
228+ }
229+ },
230+ },
231+ {
232+ Name : "status clusterType invalid" ,
233+ TestObject : & konnectv1alpha2.KonnectExtension {
234+ ObjectMeta : common .CommonObjectMeta (ns .Name ),
235+ Spec : konnectv1alpha2.KonnectExtensionSpec {
236+ Konnect : konnectv1alpha2.KonnectExtensionKonnectSpec {
237+ ControlPlane : konnectv1alpha2.KonnectExtensionControlPlane {
238+ Ref : commonv1alpha1.KonnectExtensionControlPlaneRef {
239+ Type : configurationv1alpha1 .ControlPlaneRefKonnectNamespacedRef ,
240+ KonnectNamespacedRef : & commonv1alpha1.KonnectNamespacedRef {
241+ Name : "test-konnect-control-plane" ,
242+ },
243+ },
244+ },
245+ },
246+ },
247+ },
248+ StatusUpdate : func (ke * konnectv1alpha2.KonnectExtension ) {
249+ ke .Status .Konnect = & konnectv1alpha2.KonnectExtensionControlPlaneStatus {
250+ ControlPlaneID : "cp-id" ,
251+ ClusterType : konnectv1alpha2 .KonnectExtensionClusterType ("InvalidType" ),
252+ Endpoints : konnectv1alpha2.KonnectEndpoints {
253+ TelemetryEndpoint : "telemetry.example.com" ,
254+ ControlPlaneEndpoint : "cp.example.com" ,
255+ },
256+ }
257+ },
258+ ExpectedStatusUpdateErrorMessage : new (`Unsupported value: "InvalidType"` ),
259+ },
260+ }.
261+ RunWithConfig (t , cfg , scheme )
262+ })
145263 t .Run ("dataPlane labels" , func (t * testing.T ) {
146264 common.TestCasesGroup [* konnectv1alpha2.KonnectExtension ]{
147265 {
0 commit comments