Skip to content

Commit

Permalink
Add wait for api server available
Browse files Browse the repository at this point in the history
  • Loading branch information
Jont828 committed Jan 19, 2024
1 parent 569a99c commit 875c7f6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/e2e/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
. "github.com/onsi/ginkgo/v2"
"github.com/onsi/ginkgo/v2/types"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
kubeadmv1 "sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1"
"sigs.k8s.io/cluster-api/test/framework"
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
Expand Down Expand Up @@ -54,14 +55,14 @@ func EnsureControlPlaneInitialized(ctx context.Context, input clusterctl.ApplyCu
g.Expect(kubeadmControlPlane.Status.Initialized).To(BeTrue(), "KubeadmControlPlane is not yet initialized")
}, input.WaitForControlPlaneIntervals...).Should(Succeed(), "KubeadmControlPlane object %s/%s was not initialized in time", cluster.Spec.ControlPlaneRef.Namespace, cluster.Spec.ControlPlaneRef.Name)

// By("Ensuring API Server is reachable before applying Helm charts")
// Eventually(func(g Gomega) {
// ns := &corev1.Namespace{}
// clusterProxy := input.ClusterProxy.GetWorkloadCluster(ctx, input.Namespace, input.ClusterName)
// g.Expect(clusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: kubesystem}, ns)).To(Succeed(), "Failed to get kube-system namespace")
// }, input.WaitForControlPlaneIntervals...).Should(Succeed(), "API Server was not reachable in time")
By("Ensuring API Server is reachable before querying Helm charts")
Eventually(func(g Gomega) {
ns := &corev1.Namespace{}
clusterProxy := input.ClusterProxy.GetWorkloadCluster(ctx, input.Namespace, input.ClusterName)
g.Expect(clusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: kubesystem}, ns)).To(Succeed(), "Failed to get kube-system namespace")
}, input.WaitForControlPlaneIntervals...).Should(Succeed(), "API Server was not reachable in time")

By("Ensure calico is ready after control plane is installed")
By("Ensure calico is ready after control plane is initialized")
EnsureCalicoIsReady(ctx, input, result)

result.ControlPlane = framework.DiscoveryAndWaitForControlPlaneInitialized(ctx, framework.DiscoveryAndWaitForControlPlaneInitializedInput{
Expand Down

0 comments on commit 875c7f6

Please sign in to comment.