Skip to content

Commit df0995f

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 7d63132 commit df0995f

File tree

2 files changed

+0
-31
lines changed

2 files changed

+0
-31
lines changed

pkg/crc/cluster/cluster.go

-27
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
crctls "github.com/crc-org/crc/v2/pkg/crc/tls"
2222
"github.com/crc-org/crc/v2/pkg/crc/validation"
2323
crcstrings "github.com/crc-org/crc/v2/pkg/strings"
24-
"github.com/pborman/uuid"
2524
)
2625

2726
// #nosec G101
@@ -285,32 +284,6 @@ func RemoveOldRenderedMachineConfig(ocConfig oc.Config) error {
285284
return nil
286285
}
287286

288-
func EnsureClusterIDIsNotEmpty(ctx context.Context, ocConfig oc.Config) error {
289-
if err := WaitForOpenshiftResource(ctx, ocConfig, "clusterversion"); err != nil {
290-
return err
291-
}
292-
293-
stdout, stderr, err := ocConfig.RunOcCommand("get", "clusterversion", "version", "-o", `jsonpath="{['spec']['clusterID']}"`)
294-
if err != nil {
295-
return fmt.Errorf("Failed to get clusterversion %v: %s", err, stderr)
296-
}
297-
if strings.TrimSpace(stdout) != "" {
298-
return nil
299-
}
300-
301-
logging.Info("Updating cluster ID...")
302-
clusterID := uuid.New()
303-
cmdArgs := []string{"patch", "clusterversion", "version", "-p",
304-
fmt.Sprintf(`'{"spec":{"clusterID":"%s"}}'`, clusterID), "--type", "merge"}
305-
306-
_, stderr, err = ocConfig.RunOcCommand(cmdArgs...)
307-
if err != nil {
308-
return fmt.Errorf("Failed to update cluster ID %v: %s", err, stderr)
309-
}
310-
311-
return nil
312-
}
313-
314287
func AddProxyConfigToCluster(ctx context.Context, sshRunner *ssh.Runner, ocConfig oc.Config, proxy *httpproxy.ProxyConfig) error {
315288
type trustedCA struct {
316289
Name string `json:"name"`

pkg/crc/machine/start.go

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

565-
if err := cluster.EnsureClusterIDIsNotEmpty(ctx, ocConfig); err != nil {
566-
return nil, errors.Wrap(err, "Failed to update cluster ID")
567-
}
568-
569565
if client.monitoringEnabled() {
570566
logging.Info("Enabling cluster monitoring operator...")
571567
if err := cluster.StartMonitoring(ocConfig); err != nil {

0 commit comments

Comments
 (0)