Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Include cluster name in k8s Service Account name for Workload Identity #715

Closed
grac3gao-zz opened this issue Mar 26, 2020 · 3 comments · Fixed by #950
Closed

Include cluster name in k8s Service Account name for Workload Identity #715

grac3gao-zz opened this issue Mar 26, 2020 · 3 comments · Fixed by #950
Assignees
Labels
area/security kind/bug Something isn't working kind/good-first-issue priority/1 Blocks current release defined by release/* label or blocks current milestone release/1
Milestone

Comments

@grac3gao-zz
Copy link
Contributor

Describe the bug
When enable Workload Identity, reconciler will create a k8s Service Account, the k8s SA's name is the same as corresponding Google Cloud Service Account.

func GenerateServiceAccountName(gServiceAccount string) string {

More details about reconciler logic for workload identity: https://github.com/google/knative-gcp/blob/master/docs/install/pubsub-service-account.md

It is better to make k8s SA use name like googleServiceAccount + cluster name.
We can use cluster, _ := metadata.InstanceAttributeValue("cluster-name") to get cluster name, and clusterName is also an optional value in ObjectMeta.

Expected behavior
Include cluster name in k8s Service Account name for Workload Identity

@grantr
Copy link
Contributor

grantr commented Mar 30, 2020

clusterName is also an optional value in ObjectMeta

Thanks for pointing this out @grac3gao! That gave me an idea that we should set this automatically in the webhook for all objects. Opened #735 for that.

@grantr grantr added priority/1 Blocks current release defined by release/* label or blocks current milestone release/1 labels Mar 30, 2020
@grantr
Copy link
Contributor

grantr commented Apr 1, 2020

/kind good-first-issue

@grac3gao-zz
Copy link
Contributor Author

It would be better to fix #735 together with this issue. If #735 is fixed, which means all cloud run resources on GKE would have a default non-empty metadata.clusterName, then we can only use ObjectMeta.getClusterName() to get cluster name.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/security kind/bug Something isn't working kind/good-first-issue priority/1 Blocks current release defined by release/* label or blocks current milestone release/1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants