loft-sh / vcluster

vCluster - Create fully functional virtual Kubernetes clusters - Each vcluster runs inside a namespace of the underlying k8s cluster. It's cheaper than creating separate full-blown clusters and it offers better multi-tenancy and isolation than regular namespaces.
https://www.vcluster.com
Apache License 2.0
6.92k stars 426 forks source link

After changing a service from Loadbalancer to ClusterIP, Syncer cannot sync this service to the host cluster #2248

Open Lanyujiex opened 3 weeks ago

Lanyujiex commented 3 weeks ago

What happened?

Syncer cannot sync this service to the host cluster

What did you expect to happen?

host cluster service can be updated to ClusterIP

How can we reproduce it (as minimally and precisely as possible)?

set a service with LoadBalancer, and then the service given a ingressIP. change service.Type to ClusterIP. You will see that the service in host cluster can't be sync to ClusterIP.

Anything else we need to know?

logs: 2024-10-30 02:47:11 DEBUG service.abc-c-1730193780615-9a045 services/syncer.go:90 Updating object with: {"status":{"loadBalancer":{"ingress":[{"ip":"1.1.1.1","ipMode":"VIP"}]}}} {"component": "vcluster"} 2024-10-30 02:47:11 ERROR controller/controller.go:324 Reconciler error {"component": "vcluster", "controller": "service", "namespace": "default", "name": "abc-c-1730193780615-9a045", "reconcileID": "d7c600e5-7e05-421b-a55f-c5dfe51ea974", "error": "Service \"abc-c-1730193780615-9a045\" is invalid: status.loadBalancer.ingress: Forbidden: may only be used when spec.type is 'LoadBalancer'"}

Host cluster Kubernetes version

v1.30.3

vcluster version

I have tried 0.20.1 0.20.2 and the latest-20241029

VCluster Config

just helm install with k8s default.

Lanyujiex commented 3 weeks ago

Has anyone encountered this problem?