fix service

Signed-off-by: Howard Lau <howardlau1999@hotmail.com>
This commit is contained in:
Howard Lau 2020-10-30 07:14:24 +00:00
parent ee1d99b4ab
commit cbd151aa2a
No known key found for this signature in database
GPG Key ID: 5CCC55849E3CF8E2
3 changed files with 38 additions and 4 deletions

View File

@ -77,5 +77,21 @@ func (r *SeaweedReconciler) createMasterService(m *seaweedv1.Seaweed) *corev1.Se
},
}
if m.Spec.Master.Service != nil {
svcSpec := m.Spec.Master.Service
dep.Annotations = copyAnnotations(svcSpec.Annotations)
if svcSpec.Type != "" {
dep.Spec.Type = svcSpec.Type
}
if svcSpec.ClusterIP != nil {
dep.Spec.ClusterIP = *svcSpec.ClusterIP
}
if svcSpec.LoadBalancerIP != nil {
dep.Spec.LoadBalancerIP = *svcSpec.LoadBalancerIP
}
}
return dep
}

View File

@ -20,7 +20,7 @@ func (r *SeaweedReconciler) ensureVolumeServers(seaweedCR *seaweedv1.Seaweed) (d
return
}
if done, result, err = r.ensureVolumeServerStatefulSet(seaweedCR); done {
if done, result, err = r.ensureVolumeServerService(seaweedCR); done {
return
}

View File

@ -25,13 +25,13 @@ func (r *SeaweedReconciler) createVolumeServerPeerService(m *seaweedv1.Seaweed)
PublishNotReadyAddresses: true,
Ports: []corev1.ServicePort{
{
Name: "swfs-volume",
Name: "volume-http",
Protocol: corev1.Protocol("TCP"),
Port: seaweedv1.VolumeHTTPPort,
TargetPort: intstr.FromInt(seaweedv1.VolumeHTTPPort),
},
{
Name: "swfs-volume-grpc",
Name: "volume-grpc",
Protocol: corev1.Protocol("TCP"),
Port: seaweedv1.VolumeGRPCPort,
TargetPort: intstr.FromInt(seaweedv1.VolumeGRPCPort),
@ -58,7 +58,7 @@ func (r *SeaweedReconciler) createVolumeServerService(m *seaweedv1.Seaweed) *cor
PublishNotReadyAddresses: true,
Ports: []corev1.ServicePort{
{
Name: "volume",
Name: "volume-http",
Protocol: corev1.Protocol("TCP"),
Port: seaweedv1.VolumeHTTPPort,
TargetPort: intstr.FromInt(seaweedv1.VolumeHTTPPort),
@ -73,5 +73,23 @@ func (r *SeaweedReconciler) createVolumeServerService(m *seaweedv1.Seaweed) *cor
Selector: labels,
},
}
if m.Spec.Volume.Service != nil {
svcSpec := m.Spec.Volume.Service
dep.Annotations = copyAnnotations(svcSpec.Annotations)
if svcSpec.Type != "" {
dep.Spec.Type = svcSpec.Type
}
if svcSpec.ClusterIP != nil {
dep.Spec.ClusterIP = *svcSpec.ClusterIP
}
if svcSpec.LoadBalancerIP != nil {
dep.Spec.LoadBalancerIP = *svcSpec.LoadBalancerIP
}
}
return dep
}