Skip to content

Commit

Permalink
bump timeout for waiting on final deployments (#237)
Browse files Browse the repository at this point in the history
* bump timout

* wait for crossplane deployment

* fix log message

* wait for kubefirst api after export
  • Loading branch information
jarededwards authored Nov 15, 2023
1 parent ce123fd commit 0de9097
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 40 deletions.
43 changes: 33 additions & 10 deletions providers/aws/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,29 +213,29 @@ func CreateAWSCluster(definition *pkgtypes.ClusterDefinition) error {
return err
}

// Wait for console Deployment Pods to transition to Running
log.Info("deploying kubefirst console and verifying cluster installation is complete")
consoleDeployment, err := k8s.ReturnDeploymentObject(
// Wait for last sync wave app transition to Running
log.Info("waiting for final sync wave Deployment to transition to Running")
crossplaneDeployment, err := k8s.ReturnDeploymentObject(
kcfg.Clientset,
"app.kubernetes.io/name",
"console",
"kubefirst",
"app.kubernetes.io/instance",
"crossplane",
"crossplane-system",
1200,
)
if err != nil {
log.Errorf("Error finding console Deployment: %s", err)

log.Errorf("Error finding kubefirst api Deployment: %s", err)
ctrl.HandleError(err.Error())
return err
}
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, consoleDeployment, 120)
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, crossplaneDeployment, 300)
if err != nil {
log.Errorf("Error waiting for console Deployment ready state: %s", err)
log.Errorf("Error waiting for all Apps to sync ready state: %s", err)

ctrl.HandleError(err.Error())
return err
}


log.Info("cluster creation complete")

//* export and import cluster
Expand Down Expand Up @@ -266,5 +266,28 @@ func CreateAWSCluster(definition *pkgtypes.ClusterDefinition) error {
}
}

log.Info("waiting for kubefirst-api Deployment to transition to Running")
kubefirstAPI, err := k8s.ReturnDeploymentObject(
kcfg.Clientset,
"app.kubernetes.io/name",
"kubefirst-api",
"kubefirst",
1200,
)
if err != nil {
log.Errorf("Error finding kubefirst api Deployment: %s", err)
ctrl.HandleError(err.Error())
return err
}
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, kubefirstAPI, 300)
if err != nil {
log.Errorf("Error waiting for kubefirst-api to transition to Running: %s", err)

ctrl.HandleError(err.Error())
return err
}

log.Info("cluster creation complete")

return nil
}
29 changes: 26 additions & 3 deletions providers/civo/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ func CreateCivoCluster(definition *pkgtypes.ClusterDefinition) error {
return err
}

// Wait for console Deployment Pods to transition to Running
log.Info("deploying kubefirst console and verifying cluster installation is complete")
// Wait for last sync wave app transition to Running
log.Info("waiting for final sync wave Deployment to transition to Running")
crossplaneDeployment, err := k8s.ReturnDeploymentObject(
kcfg.Clientset,
"app.kubernetes.io/instance",
Expand All @@ -203,7 +203,7 @@ func CreateCivoCluster(definition *pkgtypes.ClusterDefinition) error {
ctrl.HandleError(err.Error())
return err
}
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, crossplaneDeployment, 120)
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, crossplaneDeployment, 300)
if err != nil {
log.Errorf("Error waiting for all Apps to sync ready state: %s", err)

Expand Down Expand Up @@ -246,5 +246,28 @@ func CreateCivoCluster(definition *pkgtypes.ClusterDefinition) error {
}
}

log.Info("waiting for kubefirst-api Deployment to transition to Running")
kubefirstAPI, err := k8s.ReturnDeploymentObject(
kcfg.Clientset,
"app.kubernetes.io/name",
"kubefirst-api",
"kubefirst",
1200,
)
if err != nil {
log.Errorf("Error finding kubefirst api Deployment: %s", err)
ctrl.HandleError(err.Error())
return err
}
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, kubefirstAPI, 300)
if err != nil {
log.Errorf("Error waiting for kubefirst-api to transition to Running: %s", err)

ctrl.HandleError(err.Error())
return err
}

log.Info("cluster creation complete")

return nil
}
42 changes: 32 additions & 10 deletions providers/digitalocean/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,24 +186,23 @@ func CreateDigitaloceanCluster(definition *pkgtypes.ClusterDefinition) error {
return err
}

// Wait for console Deployment Pods to transition to Running
log.Info("deploying kubefirst console and verifying cluster installation is complete")
consoleDeployment, err := k8s.ReturnDeploymentObject(
// Wait for last sync wave app transition to Running
log.Info("waiting for final sync wave Deployment to transition to Running")
crossplaneDeployment, err := k8s.ReturnDeploymentObject(
kcfg.Clientset,
"app.kubernetes.io/name",
"console",
"kubefirst",
"app.kubernetes.io/instance",
"crossplane",
"crossplane-system",
1200,
)
if err != nil {
log.Errorf("Error finding console Deployment: %s", err)

log.Errorf("Error finding kubefirst api Deployment: %s", err)
ctrl.HandleError(err.Error())
return err
}
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, consoleDeployment, 120)
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, crossplaneDeployment, 300)
if err != nil {
log.Errorf("Error waiting for console Deployment ready state: %s", err)
log.Errorf("Error waiting for all Apps to sync ready state: %s", err)

ctrl.HandleError(err.Error())
return err
Expand Down Expand Up @@ -241,5 +240,28 @@ func CreateDigitaloceanCluster(definition *pkgtypes.ClusterDefinition) error {
}
}

log.Info("waiting for kubefirst-api Deployment to transition to Running")
kubefirstAPI, err := k8s.ReturnDeploymentObject(
kcfg.Clientset,
"app.kubernetes.io/name",
"kubefirst-api",
"kubefirst",
1200,
)
if err != nil {
log.Errorf("Error finding kubefirst api Deployment: %s", err)
ctrl.HandleError(err.Error())
return err
}
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, kubefirstAPI, 300)
if err != nil {
log.Errorf("Error waiting for kubefirst-api to transition to Running: %s", err)

ctrl.HandleError(err.Error())
return err
}

log.Info("cluster creation complete")

return nil
}
41 changes: 33 additions & 8 deletions providers/google/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,28 +208,30 @@ func CreateGoogleCluster(definition *pkgtypes.ClusterDefinition) error {
return err
}

// Wait for console Deployment Pods to transition to Running
log.Info("deploying kubefirst console and verifying cluster installation is complete")
consoleDeployment, err := k8s.ReturnDeploymentObject(
// Wait for last sync wave app transition to Running
log.Info("waiting for final sync wave Deployment to transition to Running")
crossplaneDeployment, err := k8s.ReturnDeploymentObject(
kcfg.Clientset,
"app.kubernetes.io/name",
"console",
"kubefirst",
"app.kubernetes.io/instance",
"crossplane",
"crossplane-system",
1200,
)
if err != nil {
log.Errorf("Error finding kubefirst api Deployment: %s", err)
ctrl.HandleError(err.Error())
return err
}
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, consoleDeployment, 120)
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, crossplaneDeployment, 300)
if err != nil {
log.Errorf("Error waiting for kubefirst api Deployment ready state: %s", err)
log.Errorf("Error waiting for all Apps to sync ready state: %s", err)

ctrl.HandleError(err.Error())
return err
}

log.Info("cluster creation complete")

cluster1KubefirstApiStopChannel := make(chan struct{}, 1)
defer func() {
close(cluster1KubefirstApiStopChannel)
Expand Down Expand Up @@ -262,6 +264,29 @@ func CreateGoogleCluster(definition *pkgtypes.ClusterDefinition) error {
log.Errorf("error adding default service entries for cluster %s: %s", cl.ClusterName, err)
}
}

log.Info("waiting for kubefirst-api Deployment to transition to Running")
kubefirstAPI, err := k8s.ReturnDeploymentObject(
kcfg.Clientset,
"app.kubernetes.io/name",
"kubefirst-api",
"kubefirst",
1200,
)
if err != nil {
log.Errorf("Error finding kubefirst api Deployment: %s", err)
ctrl.HandleError(err.Error())
return err
}
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, kubefirstAPI, 300)
if err != nil {
log.Errorf("Error waiting for kubefirst-api to transition to Running: %s", err)

ctrl.HandleError(err.Error())
return err
}

log.Info("cluster creation complete")

return nil
}
40 changes: 31 additions & 9 deletions providers/vultr/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,29 +185,28 @@ func CreateVultrCluster(definition *pkgtypes.ClusterDefinition) error {
return err
}

// Wait for console Deployment Pods to transition to Running
log.Info("deploying kubefirst console and verifying cluster installation is complete")
consoleDeployment, err := k8s.ReturnDeploymentObject(
// Wait for last sync wave app transition to Running
log.Info("waiting for final sync wave Deployment to transition to Running")
crossplaneDeployment, err := k8s.ReturnDeploymentObject(
kcfg.Clientset,
"app.kubernetes.io/name",
"console",
"kubefirst",
"app.kubernetes.io/instance",
"crossplane",
"crossplane-system",
1200,
)
if err != nil {
log.Errorf("Error finding kubefirst api Deployment: %s", err)
ctrl.HandleError(err.Error())
return err
}
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, consoleDeployment, 120)
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, crossplaneDeployment, 300)
if err != nil {
log.Errorf("Error waiting for kubefirst api Deployment ready state: %s", err)
log.Errorf("Error waiting for all Apps to sync ready state: %s", err)

ctrl.HandleError(err.Error())
return err
}

log.Info("cluster creation complete")

//* export and import cluster
err = ctrl.ExportClusterRecord()
Expand Down Expand Up @@ -237,5 +236,28 @@ func CreateVultrCluster(definition *pkgtypes.ClusterDefinition) error {
}
}

log.Info("waiting for kubefirst-api Deployment to transition to Running")
kubefirstAPI, err := k8s.ReturnDeploymentObject(
kcfg.Clientset,
"app.kubernetes.io/name",
"kubefirst-api",
"kubefirst",
1200,
)
if err != nil {
log.Errorf("Error finding kubefirst api Deployment: %s", err)
ctrl.HandleError(err.Error())
return err
}
_, err = k8s.WaitForDeploymentReady(kcfg.Clientset, kubefirstAPI, 300)
if err != nil {
log.Errorf("Error waiting for kubefirst-api to transition to Running: %s", err)

ctrl.HandleError(err.Error())
return err
}

log.Info("cluster creation complete")

return nil
}

0 comments on commit 0de9097

Please sign in to comment.