Ranieri Mazili
Ranieri Mazili

Reputation: 833

One service account to pull images to multiple projects

I'm working on a CI solution with Redhat Openshift and Microsoft Azure. To pull images to a project I'm creating a service account with the commands below:

oc project first-project
oc create sa azure-pipeline-svcact
oc policy add-role-to-user admin system:serviceaccount:first-project:azure-pipeline-svcact

To get the this service account token, I'm using the following command

oc sa get-token azure-pipeline-svcact

It's working well, but I've to create one user per project and each user will have different tokens.

Is there a way to create only one service account with the same token that has permissions to build and pull images to multiple projects?

Thanks

Upvotes: 0

Views: 1294

Answers (1)

Will Gordon
Will Gordon

Reputation: 3573

You can absolutely use a service account to access multiple projects. You just have to give permissions.

oc policy add-role-to-user admin system:serviceaccount:first-project:azure-pipeline-svcact -n second-project
oc policy add-role-to-user admin system:serviceaccount:first-project:azure-pipeline-svcact -n third-project
...
etc

Upvotes: 1

Related Questions