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

[Upgrade Assistant] Migrate server to new es-js client #89207

Merged

Conversation

alisonelizabeth
Copy link
Contributor

@alisonelizabeth alisonelizabeth commented Jan 25, 2021

Part of #73973

This PR migrates Upgrade Assistant to use the new ES JS client.

How to test:

These changes are pretty widespread. I think UA has good test coverage to catch regressions, but it would also be good to run through the UI and do a quick smoke test.

  1. Hack x-pack/plugins/upgrade_assistant/server/lib/es_migration_apis.ts and seed data:
      indices: indices.concat([
      {
        level: 'none',
        message: 'none level test',
        url: 'test/url',
        details: 'test details',
        index: 'test1',
        reindex: true,
        needsDefaultFields: false,
        blockerForReindexing: 'index-closed',
      },
      {
        level: 'info',
        message: 'info level test',
        url: 'test/url',
        details: 'test details',
        index: 'test2',
        reindex: true,
        needsDefaultFields: false,
      },
      {
        level: 'warning',
        message: 'warning level test2',
        url: 'test/url',
        details: 'test details',
        index: 'test3',
        reindex: true,
        needsDefaultFields: false,
      },
      {
        level: 'critical',
        message: 'metricbeat-1 successful fix',
        url: 'test/url',
        details: 'test details',
        index: 'metricbeat-1',
        reindex: false,
        needsDefaultFields: true,
      },
      {
        level: 'critical',
        message: 'metricbeat-2 failed fix',
        url: 'test/url',
        details: 'test details',
        index: 'metricbeat-2',
        reindex: false,
        needsDefaultFields: true,
      },
    ]),

Then, via Console, create indices:

PUT test1/_doc/1
{"foo":"bar"}
PUT test2/_doc/1
{"foo":"bar"}
PUT test3/_doc/1
{"foo":"bar"}
PUT metricbeat-1/_doc/1
{"foo":"bar"}
  1. Navigate to Upgrade Assistant in Stack Management.
  2. Verify enable/disable deprecation logging on the Overview tab
  3. Go to the Indices tab and run reindex against test2 index

@alisonelizabeth alisonelizabeth added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Upgrade Assistant v7.12.0 Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more labels Jan 25, 2021
@@ -13,7 +13,7 @@ import { getIndexState } from '../../../plugins/upgrade_assistant/common/get_ind
export default function ({ getService }) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't realize these tests existed until today 😄 . We also have UA tests in x-pack/test/api_integration. In a future PR, it might be worth seeing if we can consolidate.

@alisonelizabeth alisonelizabeth marked this pull request as ready for review January 27, 2021 01:59
@alisonelizabeth alisonelizabeth requested a review from a team as a code owner January 27, 2021 01:59
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Great work @alisonelizabeth ! I tested locally and was able to re-index indices as before.

I did notice one issue unrelated to these changes that might be worth following up on:

Screenshot 2021-01-27 at 11 51 08

Clicking this documentation link just sent me back to the stack management home screen. I'm not sure how this URL is generated and whether it is different in a prod environment, but just wanted to raise this for visibility.

@@ -5,8 +5,6 @@
*/

import { SavedObject, SavedObjectAttributes } from 'src/core/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import type { DeprecationInfo } from '../../../../src/core/server/elasticsearch/legacy/api_types';
Copy link
Contributor

Choose a reason for hiding this comment

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

I am guessing these values are no longer being maintained on the core server side since it is in a "legacy" directory so they are safe to duplicate here without risk of something changing and TS not catching it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct. I think it's safe to duplicate for now. I did not see any support for it with the new client. I also think UA was the only app consuming the legacy type.

@jloleysens
Copy link
Contributor

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@alisonelizabeth
Copy link
Contributor Author

Thanks for the review @jloleysens!

Clicking this documentation link just sent me back to the stack management home screen. I'm not sure how this URL is generated and whether it is different in a prod environment, but just wanted to raise this for visibility.

👍 The documentation URL is generated from the response from the deprecation info API. You can see in the mocked data above it appears as url: 'test/url', which is likely why it's redirecting you back.

@alisonelizabeth alisonelizabeth merged commit 007e7e4 into elastic:master Jan 27, 2021
@alisonelizabeth alisonelizabeth deleted the es_client_migration/ua branch January 27, 2021 15:22
jloleysens added a commit to jloleysens/kibana that referenced this pull request Jan 27, 2021
…y-tests

* 'master' of github.com:elastic/kibana: (276 commits)
  [Telemetry] Settings Collector: redact sensitive reported values (elastic#88675)
  [CI] Combines Jest test jobs (elastic#85850)
  [Upgrade Assistant] Migrate server to new es-js client (elastic#89207)
  Migrate maps_legacy, maps_oss, region_map, and tile_map plugions to TS projects (elastic#89351)
  [Vega Docs] Add experimental flag on the vega maps title (elastic#89402)
  Increase the time needed to locate the save viz toast (elastic#89301)
  [Enterprise Search] Add links to doc links service (elastic#89260)
  Fixed regex bug in Safari (elastic#89399)
  [Lens] Fix indexpattern checks for missing references (elastic#88840)
  [Lens] Clean up usage collector (elastic#89109)
  update apm index pattern (elastic#89395)
  [APM] Upgrade ES client (elastic#86594)
  Enable v2 so migrations, disable in FTR tests (elastic#89297)
  [Search Sessions] Make search session indicator UI opt-in, refactor per-app capabilities (elastic#88699)
  Cleanup OSS code from visualizations wizard (elastic#89092)
  [APM] Optimize API test order (elastic#88654)
  Rename conversion function, extract to module scope and add tests. (elastic#89018)
  [core.logging] Add ops logs to the KP logging system (elastic#88070)
  chore(NA): improve ts build refs performance on kbn bootstrap (elastic#89333)
  skip flaky suite (elastic#89379)
  ...

# Conflicts:
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.tsx
#	x-pack/test/accessibility/config.ts
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 27, 2021
…ana into task-manager/shift-on-trend

* 'task-manager/shift-on-trend' of github.com:gmmorris/kibana: (74 commits)
  [Metrics UI] Fix Host Overview boxes in Host Detail page (elastic#89299)
  [Telemetry] Settings Collector: redact sensitive reported values (elastic#88675)
  [CI] Combines Jest test jobs (elastic#85850)
  [Upgrade Assistant] Migrate server to new es-js client (elastic#89207)
  Migrate maps_legacy, maps_oss, region_map, and tile_map plugions to TS projects (elastic#89351)
  [Vega Docs] Add experimental flag on the vega maps title (elastic#89402)
  Increase the time needed to locate the save viz toast (elastic#89301)
  [Enterprise Search] Add links to doc links service (elastic#89260)
  Fixed regex bug in Safari (elastic#89399)
  [Lens] Fix indexpattern checks for missing references (elastic#88840)
  [Lens] Clean up usage collector (elastic#89109)
  update apm index pattern (elastic#89395)
  [APM] Upgrade ES client (elastic#86594)
  Enable v2 so migrations, disable in FTR tests (elastic#89297)
  [Search Sessions] Make search session indicator UI opt-in, refactor per-app capabilities (elastic#88699)
  Cleanup OSS code from visualizations wizard (elastic#89092)
  [APM] Optimize API test order (elastic#88654)
  Rename conversion function, extract to module scope and add tests. (elastic#89018)
  [core.logging] Add ops logs to the KP logging system (elastic#88070)
  chore(NA): improve ts build refs performance on kbn bootstrap (elastic#89333)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Feature:Upgrade Assistant release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants