Skip to content

Commit

Permalink
fix the current cluster does not exist, but the creationTimestamp of …
Browse files Browse the repository at this point in the history
…the expected cluster is not zero.
  • Loading branch information
bxy4543 committed Jul 20, 2023
1 parent 481f9a7 commit c01fd2a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/apply/applydrivers/apply_drivers_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"fmt"
"os"

"github.com/labring/sealos/pkg/utils/confirm"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/version"

Expand Down Expand Up @@ -90,7 +92,13 @@ func (c *Applier) Apply() error {
}
}()
c.initStatus()
if c.ClusterDesired.CreationTimestamp.IsZero() && (c.ClusterCurrent == nil || c.ClusterCurrent.CreationTimestamp.IsZero()) {
if c.ClusterCurrent == nil || c.ClusterCurrent.CreationTimestamp.IsZero() {
if !c.ClusterDesired.CreationTimestamp.IsZero() {
if yes, _ := confirm.Confirm("Desired cluster CreationTimestamp is not zero, do you want to initialize it again?", "you have canceled to create cluster"); !yes {
clusterErr = processor.NewPreProcessError(fmt.Errorf("canceled to create cluster"))
return clusterErr
}
}
clusterErr = c.initCluster()
c.ClusterDesired.CreationTimestamp = metav1.Now()
} else {
Expand Down

0 comments on commit c01fd2a

Please sign in to comment.