Update kubernetes service on start for port changes

This commit is contained in:
Erik Wilson 2019-06-21 17:04:40 -07:00 committed by Rafael Breno
parent 820493d82a
commit c774e60758

View File

@ -89,6 +89,11 @@ func (c *Controller) Start(stopCh <-chan struct{}) {
runtime.HandleError(fmt.Errorf("timed out waiting for caches to sync"))
return
}
// Service definition is reconciled during first run to correct port and type per expectations.
if err := c.UpdateKubernetesService(true); err != nil {
klog.Errorf("Unable to perform initial Kubernetes service initialization: %v", err)
}
// Reconcile during first run removing itself until server is ready.
endpointPorts := createEndpointPortSpec(c.PublicServicePort, "https")
if err := c.EndpointReconciler.RemoveEndpoints(kubernetesServiceName, c.PublicIP, endpointPorts); err == nil {