Skip to content
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 API Key as environment variable #1633

Open
ruflin opened this issue Jan 22, 2024 · 5 comments · May be fixed by #2298
Open

Support API Key as environment variable #1633

ruflin opened this issue Jan 22, 2024 · 5 comments · May be fixed by #2298
Assignees
Labels
Team:Ecosystem Label for the Packages Ecosystem team

Comments

@ruflin
Copy link
Contributor

ruflin commented Jan 22, 2024

Currently if connecting elastic-package to a remote Elastic Stack, only username / password as environment variable are supported. As we are moving more and more to API Keys, also an API key should be supported. See #1627 for more discussions.

Stretch goal: Ideally we would have an easy way to create an API Key either through and API call or in the UI in Kibana with the right permissions ...

Related PRs:

@jsoriano
Copy link
Member

jsoriano commented Feb 6, 2024

There are currently issues installing packages with API keys elastic/kibana#166473

@bhapas
Copy link
Contributor

bhapas commented May 21, 2024

@jsoriano Is this unblocked when elastic/kibana#178120 is merged?

@jsoriano
Copy link
Member

@jsoriano Is this unblocked when elastic/kibana#178120 is merged?

Looks like that, yes.

@andrewkroh
Copy link
Member

andrewkroh commented Oct 18, 2024

We need API key support for interacting with Serverless projects. Unless you create the project through the API you won't have an admin user/pass and you cannot create local users. So API key is the only option.

I hacked on this for a few minutes at andrewkroh@6e7f9c2 and was able to do some operations like install packages on serverless, but hit other issues for system tests.

@jsoriano
Copy link
Member

jsoriano commented Jan 3, 2025

Updated description with related PRs.

Apart from changes similar to Andrew's (thanks!), I am adding an "environment" stack provider that can be used when elastic-package is configured with environment variables, to fill the gaps for system testing.

jsoriano added a commit that referenced this issue Jan 7, 2025
…2307)

Stop using the internal `_reset-internal-credentials` API to obtain the credentials used
for serverless stacks managed by elastic-package. This API is only available to Elastic
employees.

There were two reasons to obtain credentials this way:
- Some APIs were restricted in serverless to credentials obtained this way. From these
  internal APIs, the only one we use now is the one to check the cluster status (`_cluster/health`).
  In this case, if normal credentials are used, it returns HTTP status 410 (Gone) if the
  cluster is alive and the credentials are valid. We can consider this as an OK for this case.
- At some point during development the project creation API didn't return credentials with
  enough permissions, so we needed to request them using the reset credentials APIs.
  Serverless is GA now, and the project creation API returns user and password with admin
  privileges, what is enough for all elastic-package operations.

As these reasons are not strong enough anymore, it would be better to avoid these resets,
what will allow to use elastic-package more openly.

This is also needed for API keys support (#1633), because API keys neither have access to
these internal APIs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Ecosystem Label for the Packages Ecosystem team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants