Skip to content

Conversation

@ywelsch
Copy link
Contributor

@ywelsch ywelsch commented Apr 2, 2021

Adds support for Default Application Credentials for GCS repositories, making it easier to set up a repository on GCP, as all relevant information to connect to the repository is retrieved from the environment, not necessitating complicated keystore setups.

@ywelsch ywelsch requested a review from dliappis April 2, 2021 15:53
@ywelsch ywelsch added :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement v7.13.0 v8.0.0 labels Apr 2, 2021
Copy link
Contributor

@dliappis dliappis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this on a VM having a custom service account to it and access a GS bucket worked fine via the repository-gcs plugin (successfully restoring a snapshot) without having to explicitly load the credentials_file via the elasticsearch-keystore tool.


@SuppressForbidden(reason = "ok to open connection here")
private static String getDefaultProjectId() throws IOException {
String metaHost = System.getenv("GCE_METADATA_HOST");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if there is ever a case where the metadata server is not metadata.google.internal, but I suppose a) there is no guarantee this will remain for ever the same b) it might be useful esp. under additional layers under k8s etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is purely used for testing. While the Google library uses this environment variable in other places (e.g. to load the credentials from the environment) it does not check it when loading the project id :/

@ywelsch ywelsch marked this pull request as ready for review April 6, 2021 08:47
@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Apr 6, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@tlrx tlrx self-requested a review April 6, 2021 10:22
Copy link
Member

@tlrx tlrx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left some minor comments here and there.

I'm wondering if the integration test is going to fail when executed using a FIPS JVM

@ywelsch ywelsch merged commit 801c509 into elastic:master Apr 6, 2021
ywelsch added a commit that referenced this pull request Apr 6, 2021
Adds support for "Default Application Credentials" for GCS repositories, making it easier to set up a repository on GCP, as all relevant information to connect to the repository is retrieved from the environment, not necessitating complicated keystore setups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v7.13.0 v8.0.0-alpha1

5 participants