Skip to content

Commit 3e93197

Browse files
committed
check readyz before adding endpoint for kube-apiserver
1 parent 9962577 commit 3e93197

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/controlplane/controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type Controller struct {
5252
ServiceClient corev1client.ServicesGetter
5353
NamespaceClient corev1client.NamespacesGetter
5454
EventClient corev1client.EventsGetter
55-
healthClient rest.Interface
55+
readyzClient rest.Interface
5656

5757
ServiceClusterIPRegistry rangeallocation.RangeRegistry
5858
ServiceClusterIPRange net.IPNet
@@ -85,7 +85,7 @@ type Controller struct {
8585
}
8686

8787
// NewBootstrapController returns a controller for watching the core capabilities of the master
88-
func (c *completedConfig) NewBootstrapController(legacyRESTStorage corerest.LegacyRESTStorage, serviceClient corev1client.ServicesGetter, nsClient corev1client.NamespacesGetter, eventClient corev1client.EventsGetter, healthClient rest.Interface) *Controller {
88+
func (c *completedConfig) NewBootstrapController(legacyRESTStorage corerest.LegacyRESTStorage, serviceClient corev1client.ServicesGetter, nsClient corev1client.NamespacesGetter, eventClient corev1client.EventsGetter, readyzClient rest.Interface) *Controller {
8989
_, publicServicePort, err := c.GenericConfig.SecureServing.HostPort()
9090
if err != nil {
9191
klog.Fatalf("failed to get listener address: %v", err)
@@ -97,7 +97,7 @@ func (c *completedConfig) NewBootstrapController(legacyRESTStorage corerest.Lega
9797
ServiceClient: serviceClient,
9898
NamespaceClient: nsClient,
9999
EventClient: eventClient,
100-
healthClient: healthClient,
100+
readyzClient: readyzClient,
101101

102102
EndpointReconciler: c.ExtraConfig.EndpointReconcilerConfig.Reconciler,
103103
EndpointInterval: c.ExtraConfig.EndpointReconcilerConfig.Interval,
@@ -211,7 +211,7 @@ func (c *Controller) RunKubernetesService(ch chan struct{}) {
211211
// wait until process is ready
212212
wait.PollImmediateUntil(100*time.Millisecond, func() (bool, error) {
213213
var code int
214-
c.healthClient.Get().AbsPath("/healthz").Do(context.TODO()).StatusCode(&code)
214+
c.readyzClient.Get().AbsPath("/readyz").Do(context.TODO()).StatusCode(&code)
215215
return code == http.StatusOK, nil
216216
}, ch)
217217

0 commit comments

Comments
 (0)