Skip to content

Commit 2924a9b

Browse files
authored
use headless service for upload server (#4052)
apparently there's no k8s API that says "kube-proxy has synced iptables rules for this service on all nodes" so pod readiness/healthz (even endpointslices) could all report success but the client would still face a connection refused. we faced something similar in virtctl #3545 arguably, a headless service was the right fit for us anyway and cuts the above overhead out of the equation. Signed-off-by: Alex Kalenyuk <[email protected]>
1 parent 047a824 commit 2924a9b

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

pkg/controller/upload-controller.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -592,14 +592,12 @@ func (r *UploadReconciler) makeUploadServiceSpec(name string, pvc *corev1.Persis
592592
},
593593
},
594594
Spec: corev1.ServiceSpec{
595+
ClusterIP: corev1.ClusterIPNone,
595596
Ports: []corev1.ServicePort{
596597
{
597-
Protocol: "TCP",
598-
Port: 443,
599-
TargetPort: intstr.IntOrString{
600-
Type: intstr.Int,
601-
IntVal: 8443,
602-
},
598+
Protocol: corev1.ProtocolTCP,
599+
Port: 8443,
600+
TargetPort: intstr.FromInt32(8443),
603601
},
604602
},
605603
Selector: map[string]string{
@@ -765,7 +763,7 @@ func UploadPossibleForPVC(pvc *corev1.PersistentVolumeClaim) error {
765763
// GetUploadServerURL returns the url the proxy should post to for a particular pvc
766764
func GetUploadServerURL(namespace, pvc, uploadPath string) string {
767765
serviceName := createUploadServiceNameFromPvcName(pvc)
768-
return fmt.Sprintf("https://%s.%s.svc%s", serviceName, namespace, uploadPath)
766+
return fmt.Sprintf("https://%s.%s.svc:8443%s", serviceName, namespace, uploadPath)
769767
}
770768

771769
// createUploadServiceName returns the name given to upload service shortened if needed

pkg/controller/upload-controller_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -867,14 +867,12 @@ func createUploadService(pvc *corev1.PersistentVolumeClaim) *corev1.Service {
867867
},
868868
},
869869
Spec: corev1.ServiceSpec{
870+
ClusterIP: corev1.ClusterIPNone,
870871
Ports: []corev1.ServicePort{
871872
{
872-
Protocol: "TCP",
873-
Port: 443,
874-
TargetPort: intstr.IntOrString{
875-
Type: intstr.Int,
876-
IntVal: 8443,
877-
},
873+
Protocol: corev1.ProtocolTCP,
874+
Port: 8443,
875+
TargetPort: intstr.FromInt32(8443),
878876
},
879877
},
880878
Selector: map[string]string{

0 commit comments

Comments
 (0)