Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #120 from csrwng/fix_etcd_apply
Browse files Browse the repository at this point in the history
Wait before applying etcd cluster
  • Loading branch information
openshift-merge-robot committed Feb 21, 2020
2 parents e8c43cc + f50f99e commit 560c677
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions contrib/pkg/aws/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,18 @@ func InstallCluster(name, releaseImage, dhParamsFile string, waitForReady bool)
return fmt.Errorf("failed to create oauth branding secret: %v", err)
}

if err = applyManifests(cfg, name, manifestsDir, excludeManifests); err != nil {
excludedDir, err := ioutil.TempDir("", "")
if err != nil {
return fmt.Errorf("failed to create a temporary directory for excluded manifests")
}
initialExclude := append(excludeManifests, "etcd-cluster.yaml")
if err = applyManifests(cfg, name, manifestsDir, initialExclude, excludedDir); err != nil {
return fmt.Errorf("failed to apply manifests: %v", err)
}
time.Sleep(30 * time.Second)
if err = applyManifests(cfg, name, excludedDir, excludeManifests, manifestsDir); err != nil {
return fmt.Errorf("failed to apply etcd cluster manifest")
}
log.Infof("Cluster resources applied")

if waitForReady {
Expand Down Expand Up @@ -515,11 +524,12 @@ func InstallCluster(name, releaseImage, dhParamsFile string, waitForReady bool)
return nil
}

func applyManifests(cfg *rest.Config, namespace, directory string, exclude []string) error {
func applyManifests(cfg *rest.Config, namespace, directory string, exclude []string, excludedDir string) error {
for _, f := range exclude {
name := filepath.Join(directory, f)
if err := os.Remove(name); err != nil {
return fmt.Errorf("cannot delete %s: %v", name, err)
targetName := filepath.Join(excludedDir, f)
if err := os.Rename(name, targetName); err != nil {
return fmt.Errorf("cannot move %s: %v", name, err)
}
}
backoff := wait.Backoff{
Expand Down

0 comments on commit 560c677

Please sign in to comment.