Update VirtualService yaml automatically when a microservice is added into service mesh

I have a use case, where if a microservice is added to the cluster, virtualservice.yaml file must be updated with the routing rule to route the incoming traffic to the appropriate micro-service. This process needs to be automated. Does anyone have any idea how to do this?