Skip to content

Commit

Permalink
Merge pull request #107 from deads2k/wait-for-kube
Browse files Browse the repository at this point in the history
wait for kubeapiserver to be ready
  • Loading branch information
openshift-merge-robot committed Jan 12, 2019
2 parents 8db0838 + 5bf6ab6 commit 782e56a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/operator/workload_controller.go
Expand Up @@ -25,6 +25,7 @@ import (
configinformers "github.com/openshift/client-go/config/informers/externalversions"
operatorconfigclientv1alpha1 "github.com/openshift/cluster-openshift-apiserver-operator/pkg/generated/clientset/versioned/typed/openshiftapiserver/v1alpha1"
operatorconfiginformerv1alpha1 "github.com/openshift/cluster-openshift-apiserver-operator/pkg/generated/informers/externalversions/openshiftapiserver/v1alpha1"
clusteroperatorv1helpers "github.com/openshift/library-go/pkg/config/clusteroperator/v1helpers"
"github.com/openshift/library-go/pkg/operator/events"
)

Expand Down Expand Up @@ -111,6 +112,24 @@ func (c OpenShiftAPIServerOperator) sync() error {
return nil
}

kubeAPIServerOperator, err := c.openshiftConfigClient.ClusterOperators().Get("kube-apiserver", metav1.GetOptions{})
if apierrors.IsNotFound(err) {
kubeAPIServerOperator, err = c.openshiftConfigClient.ClusterOperators().Get("openshift-kube-apiserver-operator", metav1.GetOptions{})
}
if apierrors.IsNotFound(err) {
message := "clusteroperator/kube-apiserver not found"
c.eventRecorder.Warning("PrereqNotReady", message)
return fmt.Errorf(message)
}
if err != nil {
return err
}
if !clusteroperatorv1helpers.IsStatusConditionTrue(kubeAPIServerOperator.Status.Conditions, "Available") {
message := fmt.Sprintf("clusteroperator/%s is not Available", kubeAPIServerOperator.Name)
c.eventRecorder.Warning("PrereqNotReady", message)
return fmt.Errorf(message)
}

// block until config is obvserved
if len(operatorConfig.Spec.ObservedConfig.Raw) == 0 {
glog.Info("Waiting for observed configuration to be available")
Expand Down

0 comments on commit 782e56a

Please sign in to comment.