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

[WIP][skip-ci] Retrieve index pattern from ingest manager app #60063

Closed

Conversation

jonathan-buttner
Copy link
Contributor

This PR connects the endpoint and ingest apps. The endpoint app will rely on the ingest manager to retrieve the index pattern for querying elasticsearch. The index pattern is built using the contents of the endpoint package.

One issue I think I'm going to run into is that the ingest manager's setup doesn't happen until the app is navigated too in the UI. The endpoint package needs to be installed by default and be there before the endpoint app can start making queries to elasticsearch. I think the ingest manager will need to do install the default system packages earlier or the endpoint app will have to call the setup route first.

John Schulz and others added 30 commits November 15, 2019 14:10
* plugin.start now does reactdom.render vs returning react element

export plugin function from public/index

* Move setClient call from plugin.start to plugin.setup

* Use `useUiSetting$` from `useKibana` hooks
Can't use useKibana outside a React component.

Reverting to prior approach since it's still NP. Can revisit context usage in a followup PR
* Support basic "click button -> show spinner -> installed" install flow

* Remove incorrect comments. Add TS return types to data functions.
* Use NP feature_catalogue.register

* Use type from NP plugin
* Update (all remaining?) references from integrations_manager to EPM

* Update path in i18n file
* change min max version to single range value

* add elastic stack icon and change text

* remove badge from version and use code font

* remove euistyled

* add back version component lost in merge

* remove euiStyled

* remove old file
Temporary work around until we know how the stack wants to add the permissions we need. Either adding to the kibana user or creating a new user.
    Temporary work around until we know how the stack wants to add the permissions we need. Either adding to the kibana user or creating a new user.
* Initialize es in test.

* Add it(), no es.init()

* Clean up.
* add confirmation modal, move install state to Header

* update callout to use title

* move components only used in detail view to detail dir

* use better variable names

* update to more descriptive  variable names
…51252)

Discussed this with @skh elastic#51112 (comment) & elastic#51112 (comment) as well as in a video call

Also added some TS type annotations for data fetching functions to make the contracts more explicit
…stic#51414)

* API only shows installable assets. Server types to own file. Restore enums

* Fix type imports

* Only return installable asset types (kibana for now)

* server/types now only has code from hapi which shouldn't go to client

* Add more restricted TS types to DisplayAssets object

* Flip order of arguments to Extract

In these cases it still works the same, but looking at https://www.typescriptlang.org/docs/handbook/advanced-types.html the signature is

`Extract<T, U>` - Extract from `T` those types that are assignable to `U`

so the larger set should be first
jonathan-buttner and others added 12 commits March 11, 2020 17:01
* Disable create/destroy CTAs if no write capability

Use `core.application.capabilities.ingestManager.write` to test user permissions

* Add -all & -read tags for HTTP routes

* Update test .expect() to match description

* Add useCapabilities hook. Fix two issues with hiding/disabling CTA.

Co-authored-by: Elastic Machine <[email protected]>
FTR tests failing to start ES with error

```
ERROR ERROR: setting [xpack.security.authc.api_key.enabled] already set, saw [true] and [true]
```

https://github.com/elastic/kibana/pull/59376/checks?check_run_id=503930031 & https://github.com/elastic/kibana/pull/59376/checks?check_run_id=503975576 etc

It appears the xpack.security.authc.api_key.enabled flag was recently added to master in another part, so remove our instance of the setting to prevent the error
These should have failed when the routes were changed. Will go back and see what happened.
@jonathan-buttner jonathan-buttner changed the title [WIP] Retrieve index pattern from ingest manager app [WIP][skip-ci] Retrieve index pattern from ingest manager app Mar 12, 2020
jonathan-buttner and others added 5 commits March 12, 2020 16:09
* Add revision to agent config and datasource saved objects, add delete datasource service and datasource

* Add revision to full agent config output

* PR feedback
@kibanamachine
Copy link
Contributor

💔 Build Failed


Test Failures

Kibana Pipeline / x-pack-intake-agent / X-Pack Jest Tests.x-pack/plugins/endpoint/server/routes/resolver/queries.related events query generates the correct legacy queries

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches


Stack Trace

Error: expect(received).toStrictEqual(expected) // deep equality

- Expected
+ Received

@@ -1,14 +1,7 @@
  Object {
    "body": Object {
-     "aggs": Object {
-       "total": Object {
-         "value_count": Object {
-           "field": "endgame.serial_event_id",
-         },
-       },
-     },
      "query": Object {
        "bool": Object {
          "filter": Array [
            Object {
              "terms": Object {
@@ -17,36 +10,27 @@
                ],
              },
            },
            Object {
              "term": Object {
-               "agent.id": "awesome-id",
+               "agent.id": Object {
+                 "eventID": "foo",
+                 "size": 1,
+                 "timestamp": 1584047038998,
+               },
              },
            },
            Object {
              "bool": Object {
                "must_not": Object {
                  "term": Object {
                    "event.category": "process",
-                 },
                  },
                },
              },
-         ],
            },
-     },
-     "search_after": Array [
-       1584047038998,
-       "foo",
          ],
-     "size": 1,
-     "sort": Array [
-       Object {
-         "@timestamp": "asc",
        },
-       Object {
-         "endgame.serial_event_id": "asc",
      },
-     ],
    },
    "index": "endgame-*",
  }
    at Object.it (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/x-pack/plugins/endpoint/server/routes/resolver/queries/related_events.test.ts:14:7)
    at Object.asyncJestTest (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:102:37)
    at resolve (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:43:12)
    at new Promise (<anonymous>)
    at mapper (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:26:19)
    at promise.then (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:73:41)

Kibana Pipeline / x-pack-intake-agent / X-Pack Jest Tests.x-pack/plugins/endpoint/server/routes/resolver/queries.related events query generates the correct non-legacy queries

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches


Stack Trace

Error: expect(received).toStrictEqual(expected) // deep equality

- Expected
+ Received

@@ -1,35 +1,24 @@
  Object {
    "body": Object {
-     "aggs": Object {
-       "total": Object {
-         "value_count": Object {
-           "field": "event.id",
-         },
-       },
-     },
      "query": Object {
        "bool": Object {
          "filter": Array [
            Object {
-             "bool": Object {
-               "should": Array [
-                 Object {
              "terms": Object {
-                     "endpoint.process.entity_id": Array [
+               "endgame.unique_pid": Array [
                  "baz",
                ],
              },
            },
            Object {
-                   "terms": Object {
-                     "process.entity_id": Array [
-                       "baz",
-                     ],
-                   },
+             "term": Object {
+               "agent.id": Object {
+                 "eventID": "bar",
+                 "size": 1,
+                 "timestamp": 1584047039007,
                },
-               ],
              },
            },
            Object {
              "bool": Object {
                "must_not": Object {
@@ -37,24 +26,11 @@
                    "event.category": "process",
                  },
                },
              },
            },
-         ],
-       },
-     },
-     "search_after": Array [
-       1584047039007,
-       "bar",
          ],
-     "size": 1,
-     "sort": Array [
-       Object {
-         "@timestamp": "asc",
        },
-       Object {
-         "event.id": "asc",
      },
-     ],
    },
-   "index": undefined,
+   "index": "endgame-*",
  }
    at Object.it (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/x-pack/plugins/endpoint/server/routes/resolver/queries/related_events.test.ts:55:7)
    at Object.asyncJestTest (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:102:37)
    at resolve (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:43:12)
    at new Promise (<anonymous>)
    at mapper (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:26:19)
    at promise.then (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:73:41)

Kibana Pipeline / x-pack-intake-agent / X-Pack Jest Tests.x-pack/plugins/endpoint/server/routes/resolver/queries.children events query generates the correct legacy queries

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches


Stack Trace

Error: expect(received).toStrictEqual(expected) // deep equality

- Expected
+ Received

@@ -1,14 +1,7 @@
  Object {
    "body": Object {
-     "aggs": Object {
-       "total": Object {
-         "value_count": Object {
-           "field": "endgame.serial_event_id",
-         },
-       },
-     },
      "query": Object {
        "bool": Object {
          "filter": Array [
            Object {
              "terms": Object {
@@ -17,37 +10,28 @@
                ],
              },
            },
            Object {
              "term": Object {
-               "agent.id": "awesome-id",
+               "agent.id": Object {
+                 "eventID": "foo",
+                 "size": 1,
+                 "timestamp": 1584047044776,
+               },
              },
            },
            Object {
              "term": Object {
                "event.category": "process",
              },
            },
            Object {
              "term": Object {
                "event.type": "process_start",
-             },
              },
-         ],
            },
-     },
-     "search_after": Array [
-       1584047044776,
-       "foo",
          ],
-     "size": 1,
-     "sort": Array [
-       Object {
-         "@timestamp": "asc",
        },
-       Object {
-         "endgame.serial_event_id": "asc",
      },
-     ],
    },
    "index": "endgame-*",
  }
    at Object.it (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/x-pack/plugins/endpoint/server/routes/resolver/queries/children.test.ts:14:7)
    at Object.asyncJestTest (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:102:37)
    at resolve (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:43:12)
    at new Promise (<anonymous>)
    at mapper (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:26:19)
    at promise.then (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:73:41)

and 6 more failures, only showing the first 3.

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

@jen-huang
Copy link
Contributor

FYI, feature-ingest was merged into master (#59376), so this work can be rebased against master now.

@jonathan-buttner
Copy link
Contributor Author

Thanks @jen-huang I'll switch it over!

@jonathan-buttner jonathan-buttner changed the base branch from feature-ingest to master March 13, 2020 13:06
@jonathan-buttner
Copy link
Contributor Author

Closing because commits from feature-ingest aren't syncing up.

@jonathan-buttner jonathan-buttner deleted the get-ip-from-ingest branch April 1, 2020 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v7.7.0 v8.0.0 WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.