Skip to content

Commit 5212ee5

Browse files
committed
refactor: move common code to separate funcs
This commit moves code to get files from a path or a configmap/secret to separate functions or utility functions.
1 parent 6d41ae7 commit 5212ee5

File tree

3 files changed

+284
-229
lines changed

3 files changed

+284
-229
lines changed

pkg/cluster/network.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const (
4545
)
4646

4747
type NetworkConfiguration struct {
48+
PlatformName string
4849
NetworkName string
4950
SubNetworkName string
5051
}
@@ -126,7 +127,11 @@ func GetNetworkFromGKE(ctx context.Context, opts ...gcoption.ClientOption) (*Net
126127
return nil, err
127128
}
128129

129-
return &NetworkConfiguration{cluster.Network, cluster.Subnetwork}, nil
130+
return &NetworkConfiguration{
131+
PlatformName: string(GKECluster),
132+
NetworkName: cluster.Network,
133+
SubNetworkName: cluster.Subnetwork,
134+
}, nil
130135
}
131136

132137
// GetNetworkFromEKS returns the network from EKS.
@@ -167,7 +172,11 @@ func GetNetworkFromEKS(ctx context.Context, cfgs ...*aws.Config) (*NetworkConfig
167172
}
168173

169174
inst := out.Reservations[0].Instances[0]
170-
return &NetworkConfiguration{aws.StringValue(inst.VpcId), aws.StringValue(inst.SubnetId)}, nil
175+
return &NetworkConfiguration{
176+
PlatformName: string(EKSCluster),
177+
NetworkName: aws.StringValue(inst.VpcId),
178+
SubNetworkName: aws.StringValue(inst.SubnetId),
179+
}, nil
171180
}
172181

173182
// GetGCPRegion attempts to get the region where GKE is running in.

0 commit comments

Comments
 (0)