From ae15bc78e2d2f52efcc6989e75e95b23a230157a Mon Sep 17 00:00:00 2001 From: Jordan Rodgers Date: Fri, 2 Aug 2024 11:58:27 -0700 Subject: [PATCH] headless PublishNotReadyAddresses Signed-off-by: Jordan Rodgers --- k8sutils/services.go | 1 + k8sutils/services_test.go | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/k8sutils/services.go b/k8sutils/services.go index 627117277..24b7f74e6 100644 --- a/k8sutils/services.go +++ b/k8sutils/services.go @@ -55,6 +55,7 @@ func generateServiceDef(serviceMeta metav1.ObjectMeta, epp exporterPortProvider, } if headless { service.Spec.ClusterIP = "None" + service.Spec.PublishNotReadyAddresses = true } if exporterPort, ok := epp(); ok { redisExporterService := enableMetricsPort(exporterPort) diff --git a/k8sutils/services_test.go b/k8sutils/services_test.go index 5906d61db..e7503f691 100644 --- a/k8sutils/services_test.go +++ b/k8sutils/services_test.go @@ -102,9 +102,10 @@ func TestGenerateServiceDef(t *testing.T) { Protocol: corev1.ProtocolTCP, }, }, - Selector: map[string]string{"role": "sentinel"}, - ClusterIP: "None", - Type: corev1.ServiceTypeClusterIP, + Selector: map[string]string{"role": "sentinel"}, + ClusterIP: "None", + Type: corev1.ServiceTypeClusterIP, + PublishNotReadyAddresses: true, }, }, }, @@ -184,9 +185,10 @@ func TestGenerateServiceDef(t *testing.T) { Protocol: corev1.ProtocolTCP, }, }, - Selector: map[string]string{"role": "redis"}, - ClusterIP: "None", - Type: corev1.ServiceTypeClusterIP, + Selector: map[string]string{"role": "redis"}, + ClusterIP: "None", + Type: corev1.ServiceTypeClusterIP, + PublishNotReadyAddresses: true, }, }, },