Skip to content

Commit 2a211c0

Browse files
author
Martin Linkhorst
committed
se unique cluster alias as identifier rather than redundant eksID
Signed-off-by: Martin Linkhorst <[email protected]>
1 parent 6695a52 commit 2a211c0

File tree

4 files changed

+3
-18
lines changed

4 files changed

+3
-18
lines changed

provisioner/aws.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ type EKSClusterDetails struct {
777777

778778
func (a *awsAdapter) GetEKSClusterDetails(cluster *api.Cluster) (*EKSClusterDetails, error) {
779779
resp, err := a.eksClient.DescribeCluster(&eks.DescribeClusterInput{
780-
Name: aws.String(eksID(cluster.ID)),
780+
Name: aws.String(cluster.Alias),
781781
})
782782
if err != nil {
783783
return nil, err

provisioner/template.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ func renderTemplate(context *templateContext, file string) (string, error) {
9595
"azID": azID,
9696
"azCount": azCount,
9797
"split": split,
98-
"eksID": eksID,
9998
"mountUnitName": mountUnitName,
10099
"accountID": accountID,
101100
"portRanges": portRanges,
@@ -281,11 +280,6 @@ func list(args ...interface{}) []interface{} {
281280
return args
282281
}
283282

284-
func eksID(id string) string {
285-
parts := strings.Split(id, ":")
286-
return parts[len(parts)-1]
287-
}
288-
289283
// accountID returns just the ID part of an account
290284
func accountID(account string) (string, error) {
291285
items := strings.Split(account, ":")

provisioner/template_test.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,6 @@ func TestAccountIDFailsOnInvalid(t *testing.T) {
278278
require.Error(t, err)
279279
}
280280

281-
func TestEKSID(t *testing.T) {
282-
result, err := renderSingle(
283-
t,
284-
`{{ eksID "aws:000000:eu-north-1:kube-1" }}`,
285-
"")
286-
require.NoError(t, err)
287-
require.EqualValues(t, "kube-1", result)
288-
}
289-
290281
func TestParsePortRanges(t *testing.T) {
291282
testTemplate := `{{- if index .Values.data.portRanges -}}
292283
{{- range $index, $element := portRanges .Values.data.portRanges -}}

provisioner/zalando_eks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (z *ZalandoEKSProvisioner) Provision(
8282
return fmt.Errorf("failed to setup AWS Adapter: %v", err)
8383
}
8484

85-
eksTokenSource := eks.NewTokenSource(awsAdapter.session, eksID(cluster.ID))
85+
eksTokenSource := eks.NewTokenSource(awsAdapter.session, cluster.Alias)
8686

8787
logger.Infof(
8888
"clusterpy: Prepare for provisioning EKS cluster %s (%s)..",
@@ -127,7 +127,7 @@ func (z *ZalandoEKSProvisioner) Decommission(
127127
}
128128

129129
cluster.APIServerURL = cluster.ConfigItems[KeyEKSEndpoint]
130-
tokenSource := eks.NewTokenSource(awsAdapter.session, eksID(cluster.ID))
130+
tokenSource := eks.NewTokenSource(awsAdapter.session, cluster.Alias)
131131

132132
return z.decommission(
133133
ctx,

0 commit comments

Comments
 (0)