-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autoprovisioning scopes are wrong with service account #5545
autoprovisioning scopes are wrong with service account #5545
Comments
@mtricolici the oauthScopes was controlled by GCP API. The values are related to serviceAccount. Below is the reference regarding how to use oauthScopes and serviceAccount. I don't know the details about your
https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters |
The issue we've experienced with defaults is that we were unable to access any resources from the cluster using service account, and the error was related to:
We are very confused by the fact that creating a cluster manually or using gcloud is automatically adding https://www.googleapis.com/auth/cloud-platform to OAUTH scopes, while creating the same cluster with same configuration via terraform OAUTH scopes are set to https://www.googleapis.com/auth/logging.write and https://www.googleapis.com/auth/monitoring , but not https://www.googleapis.com/auth/cloud-platform. Why there is this difference? Why other defaults for OAUTH scopes? |
So, let me please be more clear: we have a service account zuzu in project1 (it doesn't have any permissions here) ... we host docker images in GCR in project2 and zuzu has read access to this project. BUT, API (scopes) are disabled. as a result this cluster cannot read docker images from GCR Project 2 (it has permissions, but API is disabled! scopes). error: insufficient oauth scopes When we create the kubernetes cluster manually (via UI or gcloud command line), these APIs are correct (scope is https://www.googleapis.com/auth/cloud-platform) and kubernetes pulls without any issues the images from project2 GCR. google documentation says: when service account is used - scopes are not used (i.e. ALL APIs should be enabled, we control the access via permissions, roles) |
Update, we have a good working cluster when we create it via this command:
Unfortunately we can't set both autoprovisioning service account and scopes via terraform :( BTW. If we don't specify 'autoprovisioning-scopes' then we have the same issue: new pools created by autoprovisioning have limited scopes. |
So, terraform should allow to specify BOTH service account and scopes as google command line! |
@mtricolici @vgirnet If you don't provide the oauth_scopes in terraform config, gcp api (not terraform provider) will give you defaults which you have got. If you want to have a specific oauth_scopes, you may set it in the terraform config like below, and those two will not be showed up
Please let me know if this helps address your issue? |
@edwardmedia that fixes the oauth_scopes for default-pool but not for new pools created automatically via autoprovisioning:
|
The problem is we can't use BOTH service_account and oauth_scopes inside auto_provisioning_defaults block.
Error given by terraform:
|
gcloud console allows using both arguments:
|
We are experiencing the exact same issue. @mtricolici: FWIW I think the only scope that's truly necessary for cross-project GCR usage (in addition to the two being generated) is |
I sent an email over to some GKE folks that have context on this, and I'll update back when I get a response. I think the answer is going to be that we should allow both to be set and that the API docs should be updated to make it clear that it's actually allowed, but I'm going to hold off on any changes until I find out for sure. |
Cool, that is indeed the answer. Assigning over to the current bug onduty for the terraform-side fix. |
thank you @danawillow @edwardmedia for help. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Terraform v0.12.20
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
A cluster like this should be created (this one was created via gcloud commands):
Actual Behavior
oauthScopes defaults are wrong. Via terraform we can't set/adjust them.
Steps to Reproduce
terraform apply
The text was updated successfully, but these errors were encountered: