-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Drop GCP credentials env if user-gcp-sa secret is not present #2643
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
} | ||
if !someStepsHaveUserGcpSa { | ||
// No steps used user-gcp-sa secret, no need to drop GOOGLE_APPLICATION_CREDENTIALS. | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would that possible: no steps/components mounted secret but set the ADC env?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me explain. We only handle the default case of using use_gcp_secret with all default arguments.
If user doesn't have this secret, but have ADC env, they may have mounted secret as a different name. So we shouldn't break them
@@ -13,6 +13,12 @@ rules: | |||
- get | |||
- list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you help remove the line in one shot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's OK if no test for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so does MINIO.
I think MySQL and MINIO won't hit the createRun to allow you remove it.
https://github.com/kubeflow/pipelines/blob/master/manifests/gcp_marketplace/chart/kubeflow-pipelines/templates/minio.yaml#L46
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing them out. I prefer a separate one because this is complex enough.
Will do that shortly after this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, or feel free to leave it to me if multi-user is busy
manifests/gcp_marketplace/chart/kubeflow-pipelines/templates/pipeline.yaml
Show resolved
Hide resolved
/assign @jingzhang36 |
@@ -281,6 +399,11 @@ func (r *ResourceManager) CreateRun(apiRun *api.Run) (*model.RunDetail, error) { | |||
} | |||
} | |||
|
|||
err = r.dropUserGcpSaIfNotConfigured(workflow) | |||
if err != nil { | |||
return nil, util.NewInternalServerError(err, "Failed to verify whether GCP secret is configured") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ask for review. Call out that this is probably something that would be controversial. I discussed with @jingzhang36 about this. We concluded that because only users whose workflow contains use_gcp_secret
can possibly hit this error. It's clearer if the error is returned to user, instead of silently swallowed (probably with a warning message that no user will ever see).
someStepHasGcpSecretVolume = true | ||
break | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: here also can break
if someStepHasGcpSecretVolume is true, it also can break in outer "for".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, I would prefer writing no breaks here to keep it simple and easy to read. (because this cannot impact performance)
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
*overrideOptional = true | ||
volume.Secret.Optional = overrideOptional | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, only remove the ENV Var is enough, but OK here you also do these clean up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack, got your meaning to have more info for debugging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer leaving the secret optional here to give them a clue what happened, just in case they may hit this unexepectedly.
/lgtm |
/lgtm not sure whether you tested this CL via CLI deployment. We can do the test via creating a full scope cluster with "gcloud". |
Why do we need this change? If you really just want to unblock the marketplace samples from being running, isn't it better just to fork the sample in mkp to not mounting the secret? This change introduce "magical" behavior to the kfp backend. How do you plan to convey this behavior to the end user? |
/hold |
Synced with @IronPan, because I don't have bandwidth on finishing workload identity documentation for samples and standalone deployment. He prefers finding someone else to finish those, so that we don't need this PR. |
/close |
@Bobgy: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This is part of #2589
@IronPan @jingzhang36
Can you help me review?
Behavior summary:
user-gcp-sa
secretuser-gcp-sa
volume as optional for templates that mountuser-gcp-sa
.Verified
TODO: add some unit testsDone
TODO2: apply manifest changes here to Kubeflow too
/cc @rmgogogo
/assign @IronPan
/area backend
This change is