Skip to content

Commit

Permalink
remove code to reassign new cluster id
Browse files Browse the repository at this point in the history
this is done by a systemd service in the bundle
so the code on crc can be removed
  • Loading branch information
anjannath committed Jan 16, 2025
1 parent ea59159 commit 386aa3a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
27 changes: 0 additions & 27 deletions pkg/crc/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
crctls "github.com/crc-org/crc/v2/pkg/crc/tls"
"github.com/crc-org/crc/v2/pkg/crc/validation"
crcstrings "github.com/crc-org/crc/v2/pkg/strings"
"github.com/pborman/uuid"
)

// #nosec G101
Expand Down Expand Up @@ -320,32 +319,6 @@ func RemoveOldRenderedMachineConfig(ocConfig oc.Config) error {
return nil
}

func EnsureClusterIDIsNotEmpty(ctx context.Context, ocConfig oc.Config) error {
if err := WaitForOpenshiftResource(ctx, ocConfig, "clusterversion"); err != nil {
return err
}

stdout, stderr, err := ocConfig.RunOcCommand("get", "clusterversion", "version", "-o", `jsonpath="{['spec']['clusterID']}"`)
if err != nil {
return fmt.Errorf("Failed to get clusterversion %v: %s", err, stderr)
}
if strings.TrimSpace(stdout) != "" {
return nil
}

logging.Info("Updating cluster ID...")
clusterID := uuid.New()
cmdArgs := []string{"patch", "clusterversion", "version", "-p",
fmt.Sprintf(`'{"spec":{"clusterID":"%s"}}'`, clusterID), "--type", "merge"}

_, stderr, err = ocConfig.RunOcCommand(cmdArgs...)
if err != nil {
return fmt.Errorf("Failed to update cluster ID %v: %s", err, stderr)
}

return nil
}

func AddProxyConfigToCluster(ctx context.Context, sshRunner *ssh.Runner, ocConfig oc.Config, proxy *httpproxy.ProxyConfig) error {
type trustedCA struct {
Name string `json:"name"`
Expand Down
4 changes: 0 additions & 4 deletions pkg/crc/machine/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,10 +557,6 @@ func (client *client) Start(ctx context.Context, startConfig types.StartConfig)
return nil, errors.Wrap(err, "Failed to update kubeadmin user password")
}

if err := cluster.EnsureClusterIDIsNotEmpty(ctx, ocConfig); err != nil {
return nil, errors.Wrap(err, "Failed to update cluster ID")
}

if client.monitoringEnabled() {
logging.Info("Enabling cluster monitoring operator...")
if err := cluster.StartMonitoring(ocConfig); err != nil {
Expand Down

0 comments on commit 386aa3a

Please sign in to comment.