From dfb963ca2c67f43ce701d45369f79fc81b85dc26 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Mon, 25 Jul 2022 13:58:48 +0200 Subject: [PATCH] cli/sync: create service account secret in advance to trigger token creation --- pkg/cliplugins/workload/plugin/sync_test.go | 9 +++++++++ pkg/cliplugins/workload/plugin/syncer.yaml | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/pkg/cliplugins/workload/plugin/sync_test.go b/pkg/cliplugins/workload/plugin/sync_test.go index 590d35d62c9..803d3eaee63 100644 --- a/pkg/cliplugins/workload/plugin/sync_test.go +++ b/pkg/cliplugins/workload/plugin/sync_test.go @@ -39,6 +39,15 @@ metadata: name: kcp-syncer-sync-target-name-34b23c4k namespace: kcp-syncer-sync-target-name-34b23c4k --- +apiVersion: v1 +kind: Secret +metadata: + name: kcp-syncer-sync-target-name-34b23c4k-token + namespace: kcp-syncer-sync-target-name-34b23c4k + annotations: + kubernetes.io/service-account.name: kcp-syncer-sync-target-name-34b23c4k +type: kubernetes.io/service-account-token +--- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/pkg/cliplugins/workload/plugin/syncer.yaml b/pkg/cliplugins/workload/plugin/syncer.yaml index 9368299ac45..b85dab2355d 100644 --- a/pkg/cliplugins/workload/plugin/syncer.yaml +++ b/pkg/cliplugins/workload/plugin/syncer.yaml @@ -13,6 +13,15 @@ metadata: name: {{.ServiceAccount}} namespace: {{.Namespace}} --- +apiVersion: v1 +kind: Secret +metadata: + name: {{.ServiceAccount}}-token + namespace: {{.Namespace}} + annotations: + kubernetes.io/service-account.name: {{.ServiceAccount}} +type: kubernetes.io/service-account-token +--- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: