Skip to content

Commit

Permalink
headless PublishNotReadyAddresses
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Rodgers <[email protected]>
  • Loading branch information
com6056 committed Aug 2, 2024
1 parent e5425a5 commit ae15bc7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions k8sutils/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 8 additions & 6 deletions k8sutils/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
Expand Down Expand Up @@ -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,
},
},
},
Expand Down

0 comments on commit ae15bc7

Please sign in to comment.