mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
check readyz before adding endpoint for kube-apiserver
This commit is contained in:
parent
9962577929
commit
3e93197b84
@ -52,7 +52,7 @@ type Controller struct {
|
|||||||
ServiceClient corev1client.ServicesGetter
|
ServiceClient corev1client.ServicesGetter
|
||||||
NamespaceClient corev1client.NamespacesGetter
|
NamespaceClient corev1client.NamespacesGetter
|
||||||
EventClient corev1client.EventsGetter
|
EventClient corev1client.EventsGetter
|
||||||
healthClient rest.Interface
|
readyzClient rest.Interface
|
||||||
|
|
||||||
ServiceClusterIPRegistry rangeallocation.RangeRegistry
|
ServiceClusterIPRegistry rangeallocation.RangeRegistry
|
||||||
ServiceClusterIPRange net.IPNet
|
ServiceClusterIPRange net.IPNet
|
||||||
@ -85,7 +85,7 @@ type Controller struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewBootstrapController returns a controller for watching the core capabilities of the master
|
// NewBootstrapController returns a controller for watching the core capabilities of the master
|
||||||
func (c *completedConfig) NewBootstrapController(legacyRESTStorage corerest.LegacyRESTStorage, serviceClient corev1client.ServicesGetter, nsClient corev1client.NamespacesGetter, eventClient corev1client.EventsGetter, healthClient rest.Interface) *Controller {
|
func (c *completedConfig) NewBootstrapController(legacyRESTStorage corerest.LegacyRESTStorage, serviceClient corev1client.ServicesGetter, nsClient corev1client.NamespacesGetter, eventClient corev1client.EventsGetter, readyzClient rest.Interface) *Controller {
|
||||||
_, publicServicePort, err := c.GenericConfig.SecureServing.HostPort()
|
_, publicServicePort, err := c.GenericConfig.SecureServing.HostPort()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Fatalf("failed to get listener address: %v", err)
|
klog.Fatalf("failed to get listener address: %v", err)
|
||||||
@ -97,7 +97,7 @@ func (c *completedConfig) NewBootstrapController(legacyRESTStorage corerest.Lega
|
|||||||
ServiceClient: serviceClient,
|
ServiceClient: serviceClient,
|
||||||
NamespaceClient: nsClient,
|
NamespaceClient: nsClient,
|
||||||
EventClient: eventClient,
|
EventClient: eventClient,
|
||||||
healthClient: healthClient,
|
readyzClient: readyzClient,
|
||||||
|
|
||||||
EndpointReconciler: c.ExtraConfig.EndpointReconcilerConfig.Reconciler,
|
EndpointReconciler: c.ExtraConfig.EndpointReconcilerConfig.Reconciler,
|
||||||
EndpointInterval: c.ExtraConfig.EndpointReconcilerConfig.Interval,
|
EndpointInterval: c.ExtraConfig.EndpointReconcilerConfig.Interval,
|
||||||
@ -211,7 +211,7 @@ func (c *Controller) RunKubernetesService(ch chan struct{}) {
|
|||||||
// wait until process is ready
|
// wait until process is ready
|
||||||
wait.PollImmediateUntil(100*time.Millisecond, func() (bool, error) {
|
wait.PollImmediateUntil(100*time.Millisecond, func() (bool, error) {
|
||||||
var code int
|
var code int
|
||||||
c.healthClient.Get().AbsPath("/healthz").Do(context.TODO()).StatusCode(&code)
|
c.readyzClient.Get().AbsPath("/readyz").Do(context.TODO()).StatusCode(&code)
|
||||||
return code == http.StatusOK, nil
|
return code == http.StatusOK, nil
|
||||||
}, ch)
|
}, ch)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user