mirror of
https://github.com/labring/sealos.git
synced 2026-09-24 15:46:19 +08:00
fix the current cluster does not exist, but the creationTimestamp of the expected cluster is not zero. (#3549)
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user