Skip to content

Commit ef2dbc5

Browse files
Go formatting and Lint
1 parent f84f494 commit ef2dbc5

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

internal/resources/ekscluster/data_source.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import (
1010
"log"
1111
"strconv"
1212
"time"
13-
// "os"
14-
// "strings"
1513

1614
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1715
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -84,19 +82,18 @@ func dataSourceTMCEKSClusterRead(ctx context.Context, d *schema.ResourceData, m
8482
return true, nil
8583
}
8684

87-
// if val := os.Getenv("WAIT_FOR_HEALTHY"); strings.EqualFold(val, "TRUE") || val == "" {
8885
if isWaitForKubeconfig(d) {
89-
clusFullName := &clustermodel.VmwareTanzuManageV1alpha1ClusterFullName { Name: resp.EksCluster.Spec.AgentName, OrgID: clusterFn.OrgID, ManagementClusterName: "eks", ProvisionerName: "eks" }
86+
clusFullName := &clustermodel.VmwareTanzuManageV1alpha1ClusterFullName{Name: resp.EksCluster.Spec.AgentName, OrgID: clusterFn.OrgID, ManagementClusterName: "eks", ProvisionerName: "eks"}
9087
clusterResp, err := config.TMCConnection.ClusterResourceService.ManageV1alpha1ClusterResourceServiceGet(clusFullName)
9188
if err != nil {
9289
log.Printf("Unable to get Tanzu Mission Control cluster entry, name : %s", clusterFn.Name)
9390
}
94-
91+
9592
if !isManagemetClusterHealthy(clusterResp) {
9693
log.Printf("[DEBUG] waiting for cluster(%s) to be in Healthy status", clusterFn.Name)
9794
return true, nil
9895
}
99-
96+
10097
fn := &configModels.VmwareTanzuManageV1alpha1ClusterFullName{
10198
ManagementClusterName: "eks",
10299
ProvisionerName: "eks",
@@ -112,7 +109,7 @@ func dataSourceTMCEKSClusterRead(ctx context.Context, d *schema.ResourceData, m
112109
}
113110
}
114111
}
115-
112+
116113
return false, nil
117114
}
118115

@@ -159,7 +156,7 @@ func dataSourceTMCEKSClusterRead(ctx context.Context, d *schema.ResourceData, m
159156
}
160157

161158
func isManagemetClusterHealthy(cluster *clustermodel.VmwareTanzuManageV1alpha1ClusterGetClusterResponse) bool {
162-
return cluster.Cluster.Status.Health != nil && *cluster.Cluster.Status.Health == clustermodel.VmwareTanzuManageV1alpha1CommonClusterHealthHEALTHY
159+
return cluster.Cluster.Status.Health != nil && *cluster.Cluster.Status.Health == clustermodel.VmwareTanzuManageV1alpha1CommonClusterHealthHEALTHY
163160
}
164161

165162
func kubeConfigReady(err error, resp *configModels.VmwareTanzuManageV1alpha1ClusterKubeconfigGetKubeconfigResponse) bool {

internal/resources/ekscluster/data_source_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010

1111
"github.com/stretchr/testify/require"
1212

13-
eksmodel "github.com/vmware/terraform-provider-tanzu-mission-control/internal/models/ekscluster"
1413
clustermodel "github.com/vmware/terraform-provider-tanzu-mission-control/internal/models/cluster"
14+
eksmodel "github.com/vmware/terraform-provider-tanzu-mission-control/internal/models/ekscluster"
1515
)
1616

1717
func TestNodepoolPosMap(t *testing.T) {
@@ -63,10 +63,10 @@ func TestNodepoolPosMap(t *testing.T) {
6363

6464
func TestIsManagemetClusterHealthy(t *testing.T) {
6565
tests := []struct {
66-
name string
67-
cluster *clustermodel.VmwareTanzuManageV1alpha1ClusterGetClusterResponse
66+
name string
67+
cluster *clustermodel.VmwareTanzuManageV1alpha1ClusterGetClusterResponse
6868
response bool
69-
err error
69+
err error
7070
}{
7171
{
7272
name: "Not healthy",
@@ -78,7 +78,7 @@ func TestIsManagemetClusterHealthy(t *testing.T) {
7878
},
7979
},
8080
response: false,
81-
err: nil,
81+
err: nil,
8282
},
8383
{
8484
name: "Healthy",
@@ -88,9 +88,9 @@ func TestIsManagemetClusterHealthy(t *testing.T) {
8888
Health: clustermodel.NewVmwareTanzuManageV1alpha1CommonClusterHealth(clustermodel.VmwareTanzuManageV1alpha1CommonClusterHealthHEALTHY),
8989
},
9090
},
91-
},
92-
response: true,
93-
err: nil,
91+
},
92+
response: true,
93+
err: nil,
9494
},
9595
}
9696

@@ -101,4 +101,4 @@ func TestIsManagemetClusterHealthy(t *testing.T) {
101101
}
102102
})
103103
}
104-
}
104+
}

internal/resources/ekscluster/resource_ekscluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ var clusterSchema = map[string]*schema.Schema{
9696
Type: schema.TypeString,
9797
Description: "Kubeconfig for connecting to newly created cluster base64 encoded. This will only be returned if you have elected to wait for kubeconfig.",
9898
Computed: true,
99-
},
99+
},
100100
}
101101

102102
var clusterSpecSchema = &schema.Schema{
@@ -977,4 +977,4 @@ func isWaitForKubeconfig(data *schema.ResourceData) bool {
977977
}
978978

979979
return false
980-
}
980+
}

0 commit comments

Comments
 (0)