func NewEtcdHeadlessService(e *v1alpha1.EtcdCluster) (*corev1.Service, error) {
	svc := &corev1.Service{
		ObjectMeta: v1.ObjectMeta{
			Namespace: e.Namespace,
			Name:      helpers.NameForHeadlessService(e),
			Labels: map[string]string{
				constants.LabelEtcdClusterNameSelector: e.Name,
			},
		},
		Spec: corev1.ServiceSpec{
			Type:                     corev1.ServiceTypeClusterIP,
			ClusterIP:                corev1.ClusterIPNone,
			PublishNotReadyAddresses: true,
			Ports: []corev1.ServicePort{
				{
					Name:       constants.EtcdPeerPortName,
					Port:       constants.EtcdDefaultPeerPort,
					Protocol:   corev1.ProtocolTCP,
					TargetPort: intstr.FromInt(constants.EtcdDefaultPeerPort),
				},
			},
			Selector: map[string]string{
				constants.LabelEtcdClusterNameSelector: e.Name,
			},
		},
	}

	controller.SetEtcdOwnerReference(&svc.ObjectMeta, e)

	return svc, nil
}
// NewEtcdHeadlessService will generate a headless service for etcd node internal access and discovery
NewEtcdHeadlessService will generate a headless service for etcd node internal access and discovery
// NewEtcdHeadlessService will generate a headless service for etcd node internal access and discovery
func NewEtcdHeadlessService(e *v1alpha1.EtcdCluster) (*corev1.Service, error) {
	svc := &corev1.Service{
		ObjectMeta: v1.ObjectMeta{
			Namespace: e.Namespace,
			Name:      helpers.NameForHeadlessService(e),
			Labels: map[string]string{
				constants.LabelEtcdClusterNameSelector: e.Name,
			},
		},
		Spec: corev1.ServiceSpec{
			Type:                     corev1.ServiceTypeClusterIP,
			ClusterIP:                corev1.ClusterIPNone,
			PublishNotReadyAddresses: true,
			Ports: []corev1.ServicePort{
				{
					Name:       constants.EtcdPeerPortName,
					Port:       constants.EtcdDefaultPeerPort,
					Protocol:   corev1.ProtocolTCP,
					TargetPort: intstr.FromInt(constants.EtcdDefaultPeerPort),
				},
			},
			Selector: map[string]string{
				constants.LabelEtcdClusterNameSelector: e.Name,
			},
		},
	}
	controller.SetEtcdOwnerReference(&svc.ObjectMeta, e)
	return svc, nil
}
func NewEtcdHeadlessService ( e * v1alpha1 . EtcdCluster ) ( * corev1 . Service , error ) { svc := & corev1 . Service { ObjectMeta : v1 . ObjectMeta { Namespace : e . Namespace , Name : helpers . NameForHeadlessService ( e ) , Labels : map [ string ] string { constants . LabelEtcdClusterNameSelector : e . Name , } , } , Spec : corev1 . ServiceSpec { Type : corev1 . ServiceTypeClusterIP , ClusterIP : corev1 . ClusterIPNone , PublishNotReadyAddresses : true , Ports : [ ] corev1 . ServicePort { { Name : constants . EtcdPeerPortName , Port : constants . EtcdDefaultPeerPort , Protocol : corev1 . ProtocolTCP , TargetPort : intstr . FromInt ( constants . EtcdDefaultPeerPort ) , } , } , Selector : map [ string ] string { constants . LabelEtcdClusterNameSelector : e . Name , } , } , } controller . SetEtcdOwnerReference ( & svc . ObjectMeta , e ) return svc , nil }
NewEtcdHeadlessService will generate a headless service for etcd node internal access and discovery
NewEtcdHeadlessService will generate a headless service for etcd node internal access and discovery