Describe the bug
After pivoting from a bootstrap cluster to a VCD cluster, the capvcd-controller
attempts to create a second virtual service and pool instead of using the existing resources created by the bootstrap cluster. This causes the controller to error because it cannot add the controlplane endpoint IP as a member to the new pool as it already exists as a member of the original pool.
Reproduction steps
- Create a bootstrap cluster with the CAPVCD controller built from commit
003336f85f44312252553dc1369faf409e18c10b
- Pivot to the VCD cluster
- Watch the controller logs for the following error:
I0725 13:37:38.263497 1 gateway.go:70] Obtained Gateway [vDC 73640 Firewall] for Network Name [capvcd-192.168.52.0] of type [NSXT_FLEXIBLE_SEGMENT]
1.6587562583347037e+09 INFO controller.vcdcluster Creating load balancer for the cluster at user-specified endpoint {"reconciler group": "infrastructure.cluster.x-k8s.io", "reconciler kind": "VCDCluster", "name": "gnu", "namespace": "org-giantswarm", "host": "178.170.32.54", "port": 6443}
I0725 13:37:38.334736 1 gateway.go:1314] Using provided IP [178.170.32.54]
I0725 13:37:38.334742 1 gateway.go:1391] Using VIP [178.170.32.54] for virtual service
I0725 13:37:38.433006 1 gateway.go:181] Using service engine group [&{STD-LB urn:vcloud:serviceEngineGroup:ff547027-ffb4-4107-ab4e-632a4ecc47f3}] on gateway [vDC 73640 Firewall]
I0725 13:37:38.560491 1 gateway.go:676] LoadBalancer Pool [gnu-NO_RDE_0eb6b51f-ca72-4de2-8679-f2ea0ab33817-tcp] already exists
1.658756258738859e+09 ERROR controller.vcdcluster Reconciler error {"reconciler group": "infrastructure.cluster.x-k8s.io", "reconciler kind": "VCDCluster", "name": "gnu", "namespace": "org-giantswarm", "error": "Error creating create load balancer [gnu-NO_RDE_0eb6b51f-ca72-4de2-8679-f2ea0ab33817] for the cluster [gnu]: [unable to create virtual service; expected http response [202], obtained [400]: resp: [&http.Response{Status:\"400 Bad Request\", StatusCode:400, Proto:\"HTTP/1.1\", ProtoMajor:1, ProtoMinor:1, Header:http.Header{\"Cache-Control\":[]string{\"no-store, must-revalidate\"}, \"Content-Type\":[]string{\"application/json\"}, \"Date\":[]string{\"Mon, 25 Jul 2022 13:37:38 GMT\"}, \"X-Vmware-Vcloud-Ceip-Id\":[]string{\"615be85f-ab52-4989-9ba9-170efef7b206\"}, \"X-Vmware-Vcloud-Request-Execution-Time\":[]string{\"106\"}, \"X-Vmware-Vcloud-Request-Id\":[]string{\"ce503ec8-2a00-4c71-a9ae-6117f59a0971\"}}, Body:(*http.bodyEOFSignal)(0xc0003f5080), ContentLength:-1, TransferEncoding:[]string{\"chunked\"}, Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00014fe00), TLS:(*tls.ConnectionState)(0xc0004da630)}]: [400 Bad Request]: [{\"minorErrorCode\":\"BAD_REQUEST\",\"message\":\"[ ce503ec8-2a00-4c71-a9ae-6117f59a0971 ] Overlapping subnets detected for existing virtual service virtual IP address 178.170.32.54 and 178.170.32.54.\",\"stackTrace\":null}]]: unable to create virtual service; expected http response [202], obtained [400]: resp: [&http.Response{Status:\"400 Bad Request\", StatusCode:400, Proto:\"HTTP/1.1\", ProtoMajor:1, ProtoMinor:1, Header:http.Header{\"Cache-Control\":[]string{\"no-store, must-revalidate\"}, \"Content-Type\":[]string{\"application/json\"}, \"Date\":[]string{\"Mon, 25 Jul 2022 13:37:38 GMT\"}, \"X-Vmware-Vcloud-Ceip-Id\":[]string{\"615be85f-ab52-4989-9ba9-170efef7b206\"}, \"X-Vmware-Vcloud-Request-Execution-Time\":[]string{\"106\"}, \"X-Vmware-Vcloud-Request-Id\":[]string{\"ce503ec8-2a00-4c71-a9ae-6117f59a0971\"}}, Body:(*http.bodyEOFSignal)(0xc0003f5080), ContentLength:-1, TransferEncoding:[]string{\"chunked\"}, Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00014fe00), TLS:(*tls.ConnectionState)(0xc0004da630)}]: [400 Bad Request]: [{\"minorErrorCode\":\"BAD_REQUEST\",\"message\":\"[ ce503ec8-2a00-4c71-a9ae-6117f59a0971 ] Overlapping subnets detected for existing virtual service virtual IP address 178.170.32.54 and 178.170.32.54.\",\"stackTrace\":null}]", "errorVerbose": "unable to create virtual service; expected http response [202], obtained [400]: resp: [&http.Response{Status:\"400 Bad Request\", StatusCode:400, Proto:\"HTTP/1.1\", ProtoMajor:1, ProtoMinor:1, Header:http.Header{\"Cache-Control\":[]string{\"no-store, must-revalidate\"}, \"Content-Type\":[]string{\"application/json\"}, \"Date\":[]string{\"Mon, 25 Jul 2022 13:37:38 GMT\"}, \"X-Vmware-Vcloud-Ceip-Id\":[]string{\"615be85f-ab52-4989-9ba9-170efef7b206\"}, \"X-Vmware-Vcloud-Request-Execution-Time\":[]string{\"106\"}, \"X-Vmware-Vcloud-Request-Id\":[]string{\"ce503ec8-2a00-4c71-a9ae-6117f59a0971\"}}, Body:(*http.bodyEOFSignal)(0xc0003f5080), ContentLength:-1, TransferEncoding:[]string{\"chunked\"}, Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00014fe00), TLS:(*tls.ConnectionState)(0xc0004da630)}]: [400 Bad Request]: [{\"minorErrorCode\":\"BAD_REQUEST\",\"message\":\"[ ce503ec8-2a00-4c71-a9ae-6117f59a0971 ] Overlapping subnets detected for existing virtual service virtual IP address 178.170.32.54 and 178.170.32.54.\",\"stackTrace\":null}]\nError creating create load balancer [gnu-NO_RDE_0eb6b51f-ca72-4de2-8679-f2ea0ab33817] for the cluster [gnu]: [unable to create virtual service; expected http response [202], obtained [400]: resp: [&http.Response{Status:\"400 Bad Request\", StatusCode:400, Proto:\"HTTP/1.1\", ProtoMajor:1, ProtoMinor:1, Header:http.Header{\"Cache-Control\":[]string{\"no-store, must-revalidate\"}, \"Content-Type\":[]string{\"application/json\"}, \"Date\":[]string{\"Mon, 25 Jul 2022 13:37:38 GMT\"}, \"X-Vmware-Vcloud-Ceip-Id\":[]string{\"615be85f-ab52-4989-9ba9-170efef7b206\"}, \"X-Vmware-Vcloud-Request-Execution-Time\":[]string{\"106\"}, \"X-Vmware-Vcloud-Request-Id\":[]string{\"ce503ec8-2a00-4c71-a9ae-6117f59a0971\"}}, Body:(*http.bodyEOFSignal)(0xc0003f5080), ContentLength:-1, TransferEncoding:[]string{\"chunked\"}, Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00014fe00), TLS:(*tls.ConnectionState)(0xc0004da630)}]: [400 Bad Request]: [{\"minorErrorCode\":\"BAD_REQUEST\",\"message\":\"[ ce503ec8-2a00-4c71-a9ae-6117f59a0971 ] Overlapping subnets detected for existing virtual service virtual IP address 178.170.32.54 and 178.170.32.54.\",\"stackTrace\":null}]]\ngithub.com/vmware/cluster-api-provider-cloud-director/controllers.(*VCDClusterReconciler).reconcileNormal\n\t/go/src/github.com/vmware/cluster-api-provider-cloud-director/controllers/vcdcluster_controller.go:620\ngithub.com/vmware/cluster-api-provider-cloud-director/controllers.(*VCDClusterReconciler).Reconcile\n\t/go/src/github.com/vmware/cluster-api-provider-cloud-director/controllers/vcdcluster_controller.go:129\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\t/go/src/github.com/vmware/cluster-api-provider-cloud-director/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:114\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/src/github.com/vmware/cluster-api-provider-cloud-director/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:311\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/src/github.com/vmware/cluster-api-provider-cloud-director/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/go/src/github.com/vmware/cluster-api-provider-cloud-director/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581"}
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
/go/src/github.com/vmware/cluster-api-provider-cloud-director/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:266
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
/go/src/github.com/vmware/cluster-api-provider-cloud-director/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227
Expected behavior
The existing virtual service and pool should be reconciled by the controller.
Additional context
No response