-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Upgrade Assistant] Create new status endpoint #105998
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
[Upgrade Assistant] Create new status endpoint #105998
Conversation
|
Pinging @elastic/kibana-stack-management (Team:Stack Management) |
sabarasaba
left a comment
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 working this out @alisonelizabeth! Stack management changes lgtm. Tested locally and code looks good. Left a non-blocking suggestion of adding a few more tests for the getKibanaUpgradeStatus function.
| import { DeprecationsServiceStart, IScopedClusterClient } from 'kibana/server'; | ||
| import { DomainDeprecationDetails, SavedObjectsClientContract } from 'src/core/server/types'; | ||
|
|
||
| export const getKibanaUpgradeStatus = async ({ |
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.
Should we add some tests for this the same way we have for es_deprecation_status?
| getAllDeprecations: (dependencies: GetDeprecationsContext) => | ||
| this.deprecationsFactory.getAllDeprecations(dependencies), | ||
| }; |
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.
Instead of requiring the calling plugin to provide these dependencies, I think we should add this to our RequestHandlerContext and automatically wire up the ES client and SO client for the current request. This would be more in line with how we expose other services.
The type for RequestHandlerContext is defined in src/core/server/index.ts and implementation for our context provider is available in src/core/server/core_route_handler_context.ts. I'd expect that we add a new deprecations key under RequestHandlerContext['core'] and use the lazy-instantiation approach we're using for the other clients in the implementation.
If we go with this approach, I don't believe we'll need to expose this 'raw' API to plugins and can keep this API internal (don't include it in plugin_context.ts).
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 @joshdover for the feedback! Can you let me know if this is what you had in mind: 993773e? I will follow up with updating tests and docs in a separate commit if you're happy with the approach.
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.
Yep, this looks perfect! Feel free to ping me again when the tests are in place. Thanks for this!
| // We're not able to easily test different upgrade status scenarios (there are tests with mocked data to handle this) | ||
| // so, for now, we simply verify the response returns the expected format | ||
| expectedResponseKeys.forEach((key) => { | ||
| expect(body[key]).to.not.equal(undefined); |
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; maybe we can test the kibana status at least? we have a core_deprecations functional plugin in test/plugin_functional/plugins/core_plugin_deprecations which we can use to test this endpoint in test/plugin_functional/test_suites/upgrade_assistant
Bamieh
left a comment
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 with 1 nit about testing the endpoint
|
Hi @joshdover! Would you mind taking another look at this PR when you get a chance? Cleaned up a few things and updated the tests and docs. |
joshdover
left a comment
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.
Needs a couple more tests and we should be good!
| } | ||
| } | ||
|
|
||
| class CoreDeprecationsRouteHandlerContext { |
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.
Can we update src/core/server/core_route_handler_context.test.ts to include tests for this?
| public start() {} | ||
| public start(): InternalDeprecationsServiceStart { | ||
| return { | ||
| asScopedToClient: this.createScopedDeprecations(), |
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.
Needs unit test
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.
Added test via da04f4b. Let me know if you think there should be anything more tested here.
|
@elasticmachine merge upstream |
|
@joshdover Added some additional tests via da04f4b. Let me know what you think. Thanks! |
|
@elasticmachine merge upstream |
|
@elasticmachine merge upstream |
|
Waiting to merge until @tobio can take a look and verify this doesn't break anything on the cloud side. |
|
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Async chunks
Unknown metric groupsAPI count
API count missing comments
History
To update your PR or re-run it, just comment with: |
This PR creates a new status API that cloud can use to fetch the upgrade status for Kibana and ES.
Fixes #101282
Example responses:
Note:
GET /api/upgrade_assistant/statuspreviously returned the list of ES deprecations, this route has been renamed toGET /api/upgrade_assistant/es_deprecations.