From 91d3e89313e75ab71c56d9aa7d34236b4642e76f Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Mon, 20 Nov 2023 00:34:24 +0900
Subject: [PATCH] Replace * in IAM tags when IRSA namespace has wildcard
---
pkg/model/context.go | 2 +-
tests/integration/update_cluster/irsa/kubernetes.tf | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pkg/model/context.go b/pkg/model/context.go
index e3106d0c45..eb7e156f3d 100644
--- a/pkg/model/context.go
+++ b/pkg/model/context.go
@@ -200,7 +200,7 @@ func (b *KopsModelContext) CloudTagsForInstanceGroup(ig *kops.InstanceGroup) (ma
func (b *KopsModelContext) CloudTagsForServiceAccount(name string, sa types.NamespacedName) map[string]string {
tags := b.CloudTags(name, false)
tags[awstasks.CloudTagServiceAccountName] = sa.Name
- tags[awstasks.CloudTagServiceAccountNamespace] = sa.Namespace
+ tags[awstasks.CloudTagServiceAccountNamespace] = strings.ReplaceAll(sa.Namespace, "*", "wildcard")
return tags
}
diff --git a/tests/integration/update_cluster/irsa/kubernetes.tf b/tests/integration/update_cluster/irsa/kubernetes.tf
index f3e8699dcc..70138e21db 100644
--- a/tests/integration/update_cluster/irsa/kubernetes.tf
+++ b/tests/integration/update_cluster/irsa/kubernetes.tf
@@ -433,7 +433,7 @@ resource "aws_iam_role" "myserviceaccount-test-wildcard-sa-minimal-example-com"
"Name" = "myserviceaccount.test-wildcard.sa.minimal.example.com"
"kubernetes.io/cluster/minimal.example.com" = "owned"
"service-account.kops.k8s.io/name" = "myserviceaccount"
- "service-account.kops.k8s.io/namespace" = "test-*"
+ "service-account.kops.k8s.io/namespace" = "test-wildcard"
}
}