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

[ML] Moving to kibana capabilities #64057

Merged

Conversation

jgowdyelastic
Copy link
Member

@jgowdyelastic jgowdyelastic commented Apr 21, 2020

Changes the way the ml_capabilities are populated. Rather than being based on es privileges, they are now based on kibana's capabilities.

A licence level filter is applied using a capabilities switcher. This means for the most part, the standard kibana capabilities are correct and can be used by other plugins.
The only difference between the standard kibana capabilities and our ml_capabilities endpoint is the later also performs an upgrade mode check and will disable all admin capabilities if an upgrade is in progress.

Also renames all uses of "privileges" to "capabilities" in identifiers and file names as they are no longer based on es privileges.

Checklist

Delete any items that are not applicable to this PR.

@botelastic botelastic bot added the Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability label Apr 21, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@jgowdyelastic jgowdyelastic force-pushed the moving-to-kibana-capabilities branch from 0b350cd to 1af4ac8 Compare April 21, 2020 15:09
@jgowdyelastic jgowdyelastic marked this pull request as ready for review April 22, 2020 12:11
@jgowdyelastic jgowdyelastic requested a review from a team as a code owner April 22, 2020 12:11
@jgowdyelastic jgowdyelastic self-assigned this Apr 22, 2020
@jgowdyelastic jgowdyelastic removed the request for review from darnautov April 22, 2020 12:12
@jgowdyelastic jgowdyelastic added :ml non-issue Indicates to automation that a pull request should not appear in the release notes release_note:skip Skip the PR/issue when compiling release notes review v7.8.0 v8.0.0 labels Apr 22, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@legrego legrego self-requested a review April 22, 2020 15:12
x-pack/plugins/ml/server/routes/apidoc.json Outdated Show resolved Hide resolved
},
});
return resp.has_all_requested;
return mlCapabilities.canCreateJob;
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm logged in as a user without machine_learning_admin or machine_learning_user roles I still see the ML link in the sample data links on the Kibana Home page. Can this be hidden?

image

Copy link
Member Author

@jgowdyelastic jgowdyelastic Apr 22, 2020

Choose a reason for hiding this comment

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

This should be fixed in a follow PR as it's not a trivial change.
At the point we initialise the sample datasets, we do not have the complete capabilities from kibana.
so the dataset initialisation will need to move, possibly to the plugin start function

Copy link
Member Author

Choose a reason for hiding this comment

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

Thinking about this some more, i'm not sure this is possible.
This sample dataset links are initialised once per kibana server setup. They are not based on request and so cannot be toggled based on user credentials.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, this doesn't currently seem possible with the way the sample data set links work. I've added it as an extra item to #64172 so we can follow up the extra changes that are required to the home and ml plugins.

// Filters
canGetFilters: false,
// Data Frame Analytics
canGetDataFrameAnalytics: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

If I log in as a user with the machine_learning_user role. the clone item is showing for data frame analytics jobs:

image

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a bug in master. I think it is outside the scope of this PR to fix here.
I've raised #64235 to cover it.

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

Code LGTM

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested latest edits with capabilities and switched and LGTM.

@jgowdyelastic
Copy link
Member Author

retest

@jgowdyelastic jgowdyelastic force-pushed the moving-to-kibana-capabilities branch from 23bbbe3 to fcd830d Compare April 23, 2020 17:42
Copy link
Member

@legrego legrego left a comment

Choose a reason for hiding this comment

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

Reviewed the capabilities switcher, and did some light testing locally. From my perspective, this looks good!


return capabilities;
} catch (e) {
logger.debug('Error updating capabilities for ML based on licensing');
Copy link
Member

Choose a reason for hiding this comment

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

optional nit: you may want to include the exception in the log message so that failures are easier to diagnose:

Suggested change
logger.debug('Error updating capabilities for ML based on licensing');
logger.debug(`Error updating capabilities for ML based on licensing: ${e}`);

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 0eaa2a1

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@jgowdyelastic jgowdyelastic merged commit b3c7002 into elastic:master Apr 24, 2020
@jgowdyelastic jgowdyelastic deleted the moving-to-kibana-capabilities branch April 24, 2020 11:08
jgowdyelastic added a commit to jgowdyelastic/kibana that referenced this pull request Apr 24, 2020
* [ML] Moving to kibana capabilities

* fixing types

* renaming privilges

* renaming privileges to capabilities

* renaming resolvers

* correcting admin capabilities

* fixing includes

* removing any types

* renaming type

* readding spaces

* adding capabilities switcher

* updating comment

* removing unnecessary failing tests

* adding error to log
jgowdyelastic added a commit that referenced this pull request Apr 24, 2020
* [ML] Moving to kibana capabilities

* fixing types

* renaming privilges

* renaming privileges to capabilities

* renaming resolvers

* correcting admin capabilities

* fixing includes

* removing any types

* renaming type

* readding spaces

* adding capabilities switcher

* updating comment

* removing unnecessary failing tests

* adding error to log
jloleysens added a commit to jloleysens/kibana that referenced this pull request Apr 27, 2020
…bana into ingest-node-pipeline/open-flyout-create-edit

* 'feature/ingest-node-pipelines' of github.com:elastic/kibana: (116 commits)
  [Ingest Node Pipelines] More lenient treatment of on-failure value (elastic#64411)
  Report Deletion via UI- functional test (elastic#64031)
  Bump handlebars dependency from 4.5.3 to 4.7.6 (elastic#64402)
  [Uptime] Update TLS settings (elastic#64111)
  [alerting] removes usage of any throughout Alerting Services code (elastic#64161)
  [CANVAS] Moves notify to a canvas service (elastic#63268)
  [Canvas] Misc NP Stuff (elastic#63703)
  update apm index pattern (elastic#64232)
  Task/hostlist pagination (elastic#63722)
  [NP] Vega migration (elastic#63849)
  Move ensureDefaultIndexPattern into data plugin (elastic#63100)
  [Fleet] Fix agent status count to not include unenrolled agents (elastic#64106)
  Migrate graph_workspace saved object registration to Kibana platform (elastic#64157)
  Index pattern management UI -> TypeScript and New Platform Ready (edit_index_pattern) (elastic#64184)
  [ML] EuiDataGrid ml/transform components. (elastic#63447)
  [ML] Moving to kibana capabilities (elastic#64057)
  Move input_control_vis into NP (elastic#63333)
  remove reference to local application service in graph (elastic#64288)
  KQL removes leading zero and breaks query (elastic#62748)
  [FieldFormats] Cleanup: rename IFieldFormatType -> FieldFormatInstanceType (elastic#64193)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:ml non-issue Indicates to automation that a pull request should not appear in the release notes release_note:skip Skip the PR/issue when compiling release notes review Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants