Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pkg/controllers/openshift-apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,9 @@ func (s *OCPAPIServer) Run(ctx context.Context, ready chan<- struct{}, stopped c
return err
}

stopCh := make(chan struct{})
if err := s.options.RunAPIServer(stopCh); err != nil {
if err := s.options.RunAPIServer(ctx.Done()); err != nil {
klog.Fatalf("Failed to start ocp-apiserver %v", err)
}

return ctx.Err()
}

Expand Down
16 changes: 10 additions & 6 deletions pkg/controllers/openshift-controller-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package controllers

import (
"context"
"fmt"
"io"
"io/ioutil"
"os"
Expand Down Expand Up @@ -107,7 +106,7 @@ func (s *OCPControllerManager) Run(ctx context.Context, ready chan<- struct{}, s
go func() {
healthcheckStatus := util.RetryTCPConnection("127.0.0.1", "8445")
if !healthcheckStatus {
klog.Fatalf(s.Name(), fmt.Errorf("healthcheck status"), "%s failed to start")
klog.Fatalf("initial healthcheck on %s failed", s.Name())
}
klog.Infof("%s is ready", s.Name())
close(ready)
Expand All @@ -116,13 +115,18 @@ func (s *OCPControllerManager) Run(ctx context.Context, ready chan<- struct{}, s
if err := assets.ApplyNamespaces([]string{
"assets/core/0000_50_cluster-openshift-controller-manager_00_namespace.yaml",
}, s.kubeconfig); err != nil {
klog.Warningf("failed to apply openshift namespaces %v", err)
klog.Fatalf("failed to apply openshift namespaces %v", err)
}

options := openshift_controller_manager.OpenShiftControllerManager{Output: os.Stdout}
options.ConfigFilePath = s.ConfigFilePath
if err := options.StartControllerManager(); err != nil {
klog.Fatalf("Failed to start openshift-controller-manager %v", err)
}

go func() {
if err := options.StartControllerManager(); err != nil {
klog.Fatalf("Failed to start openshift-controller-manager %v", err)
}
}()

<-ctx.Done()
return ctx.Err()
}
5 changes: 2 additions & 3 deletions pkg/controllers/openshift-oauth-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ func (s *OpenShiftOAuth) configure(cfg *config.MicroshiftConfig) {

func (s *OpenShiftOAuth) Run(ctx context.Context, ready chan<- struct{}, stopped chan<- struct{}) error {
defer close(stopped)
stopCh := make(chan struct{})

// run readiness check
go func() {
Expand All @@ -114,8 +113,8 @@ func (s *OpenShiftOAuth) Run(ctx context.Context, ready chan<- struct{}, stopped
close(ready)
}()

if err := oauth_apiserver.RunOAuthAPIServer(s.options, stopCh); err != nil {
return err
if err := oauth_apiserver.RunOAuthAPIServer(s.options, ctx.Done()); err != nil {
klog.Fatalf("Error starting oauth API server: %s", err)
}

return ctx.Err()
Expand Down
2 changes: 1 addition & 1 deletion pkg/kustomize/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (s *Kustomizer) Run(ctx context.Context, ready chan<- struct{}, stopped cha
if _, err := os.Stat(kustomization); !errors.Is(err, os.ErrNotExist) {
klog.Infof("Applying kustomization at %v ", kustomization)
if err := ApplyKustomizationWithRetries(s.path, s.kubeconfig); err != nil {
klog.Warningf("Applying kustomization failed: %s. Giving up.", err)
klog.Fatalf("Applying kustomization failed: %s. Giving up.", err)
} else {
klog.Warningf("Kustomization applied successfully.")
}
Expand Down
10 changes: 7 additions & 3 deletions pkg/node/kube-proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,13 @@ func (s *ProxyOptions) Run(ctx context.Context, ready chan<- struct{}, stopped c
klog.Infof("%s is ready", s.Name())
close(ready)
}()
if err := s.options.Run(); err != nil {
klog.Fatalf("%s failed to start", s.Name(), err)
}

go func() {
if err := s.options.Run(); err != nil {
klog.Fatalf("%s failed to start %v", s.Name(), err)
}
}()

<-ctx.Done()
return ctx.Err()
}