diff --git a/pkg/k8sutils/templates/service/spec.go b/pkg/k8sutils/templates/service/spec.go index eb423801..77ac8271 100644 --- a/pkg/k8sutils/templates/service/spec.go +++ b/pkg/k8sutils/templates/service/spec.go @@ -15,13 +15,17 @@ package service import ( - "github.com/StarRocks/starrocks-kubernetes-operator/pkg/apis/starrocks/v1" corev1 "k8s.io/api/core/v1" + + "github.com/StarRocks/starrocks-kubernetes-operator/pkg/apis/starrocks/v1" ) func MakeSearchService(serviceName string, externalService *corev1.Service, ports []corev1.ServicePort) *corev1.Service { searchSvc := &corev1.Service{} externalService.ObjectMeta.DeepCopyInto(&searchSvc.ObjectMeta) + // some service annotations can only be used when `type` is 'LoadBalancer', e.g. service.beta.kubernetes.io/load-balancer-source-ranges + // we do not need to annotations for search service + searchSvc.Annotations = nil searchSvc.Name = serviceName searchSvc.Spec = corev1.ServiceSpec{ ClusterIP: "None",