Skip to content
Open
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
2 changes: 1 addition & 1 deletion cmd/osde2e/cleanup/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func collectActiveClusters() (map[string]bool, error) {
// Create a map with cluster names from active osde2e clusters
for _, cluster := range clusters {
activeClusters[cluster.Name()] = true
log.Printf("Found active cluster: %s (state: %s)\n", cluster.Name(), cluster.State())
log.Printf("Found active cluster: %s (state: %s, environment: %s)\n", cluster.ID(), cluster.State(), env)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Printf("Found active cluster: %s (state: %s, environment: %s)\n", cluster.ID(), cluster.State(), env)
log.Printf("Found active cluster: %s (%s, %s)\n", cluster.ID(), env, cluster.State())

}
}
return activeClusters, nil
Expand Down
32 changes: 2 additions & 30 deletions pkg/common/providers/ocmprovider/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
viper "github.com/openshift/osde2e/pkg/common/concurrentviper"
"github.com/openshift/osde2e/pkg/common/config"
"github.com/openshift/osde2e/pkg/common/spi"
"k8s.io/apimachinery/pkg/util/wait"
)

// IsValidClusterName validates the clustername prior to proceeding with it
Expand Down Expand Up @@ -588,35 +587,8 @@ func (o *OCMProvider) DeleteCluster(clusterID string) error {
return fmt.Errorf("cluster already uninstalling, skipped")
}

err = wait.PollUntilContextTimeout(context.Background(), 1*time.Minute, 15*time.Minute, false, func(ctx context.Context) (bool, error) {
// If the cluster state is anything but Hibernating or Ready, poll the state again
if cluster.State() == spi.ClusterStateReady {
cluster, err = o.GetCluster(clusterID)
if err != nil {
log.Printf("error retrieving cluster for deletion: %v", err)
return false, nil
}
}
// A cluster errored in OCM is unlikely to recover so we should fail fast
if cluster.State() == spi.ClusterStateError {
return false, fmt.Errorf("cluster %s is in an errored state", cluster.ID())
}

// We have a ready cluster, hooray
if cluster.State() == spi.ClusterStateReady {
return true, nil
}

// The cluster isn't ready so we should loop again
return false, nil
})
if err != nil {
return err
}

err = o.AddProperty(cluster, clusterproperties.Status, clusterproperties.StatusUninstalling)
if err != nil {
return fmt.Errorf("error adding uninstalling status to cluster: %v", err)
if cluster.State() == spi.ClusterStatePending {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about clusters that are in the Installing state?

return fmt.Errorf("cluster pending, skipped")
}

err = retryer().Do(func() error {
Expand Down