Reputation: 833
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
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