Skip to content

Commit aedf6d4

Browse files
committed
remove code to reassign new cluster id
this is done by a systemd service in the bundle so the code on crc can be removed
1 parent 885cec8 commit aedf6d4

File tree

2 files changed

+0
-31
lines changed

2 files changed

+0
-31
lines changed

Diff for: pkg/crc/cluster/cluster.go

-27
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
crctls "github.com/crc-org/crc/v2/pkg/crc/tls"
2727
"github.com/crc-org/crc/v2/pkg/crc/validation"
2828
crcstrings "github.com/crc-org/crc/v2/pkg/strings"
29-
"github.com/pborman/uuid"
3029
)
3130

3231
// #nosec G101
@@ -324,32 +323,6 @@ func RemoveOldRenderedMachineConfig(ocConfig oc.Config) error {
324323
return nil
325324
}
326325

327-
func EnsureClusterIDIsNotEmpty(ctx context.Context, ocConfig oc.Config) error {
328-
if err := WaitForOpenshiftResource(ctx, ocConfig, "clusterversion"); err != nil {
329-
return err
330-
}
331-
332-
stdout, stderr, err := ocConfig.RunOcCommand("get", "clusterversion", "version", "-o", `jsonpath="{['spec']['clusterID']}"`)
333-
if err != nil {
334-
return fmt.Errorf("Failed to get clusterversion %v: %s", err, stderr)
335-
}
336-
if strings.TrimSpace(stdout) != "" {
337-
return nil
338-
}
339-
340-
logging.Info("Updating cluster ID...")
341-
clusterID := uuid.New()
342-
cmdArgs := []string{"patch", "clusterversion", "version", "-p",
343-
fmt.Sprintf(`'{"spec":{"clusterID":"%s"}}'`, clusterID), "--type", "merge"}
344-
345-
_, stderr, err = ocConfig.RunOcCommand(cmdArgs...)
346-
if err != nil {
347-
return fmt.Errorf("Failed to update cluster ID %v: %s", err, stderr)
348-
}
349-
350-
return nil
351-
}
352-
353326
func AddProxyConfigToCluster(ctx context.Context, sshRunner *ssh.Runner, ocConfig oc.Config, proxy *httpproxy.ProxyConfig) error {
354327
type trustedCA struct {
355328
Name string `json:"name"`

Diff for: pkg/crc/machine/start.go

-4
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,6 @@ func (client *client) Start(ctx context.Context, startConfig types.StartConfig)
559559
return nil, errors.Wrap(err, "Failed to update kubeadmin user password")
560560
}
561561

562-
if err := cluster.EnsureClusterIDIsNotEmpty(ctx, ocConfig); err != nil {
563-
return nil, errors.Wrap(err, "Failed to update cluster ID")
564-
}
565-
566562
if client.monitoringEnabled() {
567563
logging.Info("Enabling cluster monitoring operator...")
568564
if err := cluster.StartMonitoring(ocConfig); err != nil {

0 commit comments

Comments
 (0)