-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Support GKE Workload Identity for Searchable Snapshots #82974
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
Support GKE Workload Identity for Searchable Snapshots #82974
Conversation
Searchable snapshots perform naked calls of `GoogleCloudStorageBlobContainer#readBlob` without the Security Manager. The client fails to get Compute Engine credentials because of that. It works for normal snapshot/restore because they do a privileged call of `GoogleCloudStorageBlobStore.writeBlob` during the verification of the repo. The simplest fix is just to make sure `ServiceOptions.getDefaultProjectId` and `GoogleCredentials::getApplicationDefault` are get called under the SecurityManager (which they should because they perform network calls). Unfortunately, we can't write an integration test for the issue, because the test framework does the repo verification automatically, which works around the bug. Writing a unit test also seems not possible, because `ComputeEngineCredentials#getMetadataServerUrl` relies on the `GCE_METADATA_HOST` environment variable. See elastic/cloud-on-k8s#5230 Resolves elastic#82702
Pinging @elastic/es-distributed (Team:Distributed) |
I wonder if we can workaround this and add a QA test for searchable snapshots that would reuse the AbstractSearchableSnapshotsRestTestCase (without verifyng the repository) and the fixture used in I think it is worth to have such a test so that we don't reintroduce such bugs in the future. Note that this can be done in a follow up PR. What do you think? |
…nity-tokens-searchable-snapshots
Hi @arteam, I've created a changelog YAML for you. |
I think it's a good idea! Unfortunately, I've been unsuccessful in trying to come up with a test reproducing the failure. Even i I disable the repository verification, the client still gets called correctly under the SecurityManager via
We probably need some ILM based test for recovery if want to reproduce the issue to trigger the following failing path
|
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.
LGTM, we can merge the fix and work on a more specialized test in a follow up
Thanks, Tanguy! |
* Support GKE Workload Identity for Searchable Snapshots Searchable snapshots perform naked calls of `GoogleCloudStorageBlobContainer#readBlob` without the Security Manager. The client fails to get Compute Engine credentials because of that. It works for normal snapshot/restore because they do a privileged call of `GoogleCloudStorageBlobStore.writeBlob` during the verification of the repo. The simplest fix is just to make sure `ServiceOptions.getDefaultProjectId` and `GoogleCredentials::getApplicationDefault` are get called under the SecurityManager (which they should because they perform network calls). Unfortunately, we can't write an integration test for the issue, because the test framework does the repo verification automatically, which works around the bug. Writing a unit test also seems not possible, because `ComputeEngineCredentials#getMetadataServerUrl` relies on the `GCE_METADATA_HOST` environment variable. See elastic/cloud-on-k8s#5230 Resolves elastic#82702
* Support GKE Workload Identity for Searchable Snapshots Searchable snapshots perform naked calls of `GoogleCloudStorageBlobContainer#readBlob` without the Security Manager. The client fails to get Compute Engine credentials because of that. It works for normal snapshot/restore because they do a privileged call of `GoogleCloudStorageBlobStore.writeBlob` during the verification of the repo. The simplest fix is just to make sure `ServiceOptions.getDefaultProjectId` and `GoogleCredentials::getApplicationDefault` are get called under the SecurityManager (which they should because they perform network calls). Unfortunately, we can't write an integration test for the issue, because the test framework does the repo verification automatically, which works around the bug. Writing a unit test also seems not possible, because `ComputeEngineCredentials#getMetadataServerUrl` relies on the `GCE_METADATA_HOST` environment variable. See elastic/cloud-on-k8s#5230 Resolves elastic#82702
* Support GKE Workload Identity for Searchable Snapshots Searchable snapshots perform naked calls of `GoogleCloudStorageBlobContainer#readBlob` without the Security Manager. The client fails to get Compute Engine credentials because of that. It works for normal snapshot/restore because they do a privileged call of `GoogleCloudStorageBlobStore.writeBlob` during the verification of the repo. The simplest fix is just to make sure `ServiceOptions.getDefaultProjectId` and `GoogleCredentials::getApplicationDefault` are get called under the SecurityManager (which they should because they perform network calls). Unfortunately, we can't write an integration test for the issue, because the test framework does the repo verification automatically, which works around the bug. Writing a unit test also seems not possible, because `ComputeEngineCredentials#getMetadataServerUrl` relies on the `GCE_METADATA_HOST` environment variable. See elastic/cloud-on-k8s#5230 Resolves #82702
… explicetly After we fixed getting application credentials in a GCE environment in elastic#82974, we can actually get credentials set automatically when creating a new GCS client Fixes elastic#83131
… explicetly (elastic#83139) After we fixed getting application credentials in a GCE environment in elastic#82974, we can actually get credentials set automatically when creating a new GCS client Fixes elastic#83131
Searchable snapshots perform naked calls of `GoogleCloudStorageBlobContainer#readBlob` without the Security Manager. The client fails to get Compute Engine credentials because of that. It works for normal snapshot/restore because they do a privileged call of `GoogleCloudStorageBlobStore.writeBlob` during the verification of the repo. The simplest fix is just to make sure `ServiceOptions.getDefaultProjectId` and `GoogleCredentials::getApplicationDefault` are get called under the SecurityManager (which they should because they perform network calls). Unfortunately, we can't write an integration test for the issue, because the test framework does the repo verification automatically, which works around the bug. Writing a unit test also seems not possible, because `ComputeEngineCredentials#getMetadataServerUrl` relies on the `GCE_METADATA_HOST` environment variable. See elastic/cloud-on-k8s#5230 Resolves #82702
Searchable snapshots perform naked calls of
GoogleCloudStorageBlobContainer#readBlob
without the Security Manager. Theclient fails to get Compute Engine credentials because of that. It does work for for normal snapshot/restore we
do a privileged call of
GoogleCloudStorageBlobStore.writeBlob
during the verification of the repository.The simplest fix is just to make sure that both
ServiceOptions.getDefaultProjectId
andGoogleCredentials::getApplicationDefault
get called under the Security Manager (which they should because they perform network calls).Unfortunately, we can't write an integration test for the issue, because the test framework does the repo verification
automatically which kind works around the bug. Writing a unit test also seems not possible, because
ComputeEngineCredentials#getMetadataServerUrl
relies on theGCE_METADATA_HOST
environment variable.See elastic/cloud-on-k8s#5230
Resolves #82702