add headless service to statefulset
@@ -331,7 +331,7 @@ func (r *ComponentReconcilerTask) ReconcileService() (err error) {
newHeadlessService = true
r.headlessService = &coreV1.Service{
ObjectMeta: metaV1.ObjectMeta{
- Name: r.component.Name,
+ Name: getNameForHeadlessService(r.component.Name),
Namespace: r.component.Namespace,
Labels: labels,
},
@@ -376,7 +376,7 @@ func (r *ComponentReconcilerTask) ReconcileService() (err error) {
}
}
- if r.component.Spec.EnableHeadlessService {
+ if r.component.Spec.EnableHeadlessService || r.component.Spec.WorkloadType == corev1alpha1.WorkloadTypeStatefulSet {
r.headlessService.Spec.Ports = ps
if newHeadlessService {
if err := r.Create(r.ctx, r.headlessService); err != nil {
