Skip to content

Commit

Permalink
Remove check function validateInfoForConnect for DisconnectWithHelm f…
Browse files Browse the repository at this point in the history
…unction

Signed-off-by: Joseph Ligier <joseph.ligier@gmail.com>
  • Loading branch information
littlejo committed Dec 19, 2023
1 parent b8251dc commit 7bd5a33
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions clustermesh/clustermesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -1111,35 +1111,6 @@ func (k *K8sClusterMesh) validateInfoForConnect(aiLocal, aiRemote *accessInforma
return nil
}

func (k *K8sClusterMesh) validateInfoForDisconnect(aiLocal, aiRemote *accessInformation) error {
if !aiRemote.validate() {
return fmt.Errorf("remote cluster has non-unique name (%s) and/or ID (%s)",
aiRemote.ClusterName, aiRemote.ClusterID)
}

if !aiLocal.validate() {
return fmt.Errorf(
"local cluster has the default name (cluster name: %s) and/or ID 0 (cluster ID: %s)",
aiLocal.ClusterName, aiLocal.ClusterID)
}

_, err := strconv.Atoi(aiRemote.ClusterID)
if err != nil {
return fmt.Errorf(
"remote cluster has non-numeric cluster ID %s. Only numeric values 1-255 are allowed",
aiRemote.ClusterID)
}
if aiRemote.ClusterName == aiLocal.ClusterName {
return fmt.Errorf("remote and local cluster have the same, non-unique name: %s", aiLocal.ClusterName)
}

if aiRemote.ClusterID == aiLocal.ClusterID {
return fmt.Errorf("remote and local cluster have the same, non-unique ID: %s", aiLocal.ClusterID)
}

return nil
}

func (k *K8sClusterMesh) Connect(ctx context.Context) error {
localClient, remoteClient, err := k.getClientsForConnect()
if err != nil {
Expand Down Expand Up @@ -2272,9 +2243,6 @@ func (k *K8sClusterMesh) DisconnectWithHelm(ctx context.Context) error {
if err != nil {
return err
}
if err = k.validateInfoForDisconnect(aiLocal, aiRemote); err != nil {
return err
}

// Modify the clustermesh config to remove the intended cluster if any
localHelmValues, err := removeFromClustermeshConfig(localRelease.Config, aiRemote.ClusterName)
Expand Down

0 comments on commit 7bd5a33

Please sign in to comment.