-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
License plugin #18356
Comments
Original comment by @archanid: Absolutely ++. I've been thinking we needed something like this, as well. Thanks for opening the discussion. Thanks for sharing the License Checking UX spreadsheet, too. I didn't know it existed. Maybe implementation needs to be something like const isReportingOffered = licenseService.isFeatureOffered(license, 'reporting'); |
Original comment by @archanid: I would be happy to take this on as soon as I have bandwidth. @kjbekkelund what do you think? We know we need a license service soon. (in the new platform) |
Original comment by @kjbekkelund: ++ it's definitely something we need to explore. I created this super-enlightening issue for this a while ago (LINK REDACTED 🙈). I'll close that in favor of this issue. Licenses can also change over time, so observables are super-relevant here. @archanid ++ let's discuss this issue when you're done with all the Elasticon stuff 👍 |
Saw a link to this issue from this week's Kibana updates, happy to hear we are starting to revamp this! FWIW @elastic/es-ui team has done some work on a re-usable license checker: https://github.com/elastic/kibana/blob/master/x-pack/legacy/server/lib/check_license/check_license.js This is currently used by a number of our apps now and is instantiated on a per-plugin basis. For example in Snapshot and Restore. I'm not arguing for a specific implementation from the Platform team, but rather just raising awareness of what is currently in place 😄 This common license checker does not return properties like
The license checker uses a ranked array to compare the plugin's minimum license requirement with the current license. The UI uses the returned |
Thanks Jen. @eliperelman can you take a look to see
whether we can incorporate some of the existing works to NP license
service?
|
For use-cases where quantity is involved, would the recommendation be to have (as an example) |
In the legacy platform
NP plugin initially introduced
hasAtLeast(license: LicenseType) => boolean In comparison to If(!license.isAvailable) { //disable something}
If(!license.isActive) { //disable something}
if(!license.hasAtLeast('gold'){ //disable something As a downside: all the plugins implement the similar logic and generate similar error messages. // checkLisense API
const {status, message} = license.check('pluginName', 'gold');
if(status === 'Invalid'){ //disable something
licenseMock.mockReturnValue({status: 'Valid'}) I'm leaning towards removing |
So just to be clear, you're proposing that we replace One question: do plugins really need to have different behaviors based on The only use-case I know of is where we may want to disable a NavLink when a user has a lower license level. This was used to hint to users to upgrade for more features. However, when I just tried loading up a cluster with Basic, I don't see this behavior for any applications (even ML). |
We used to also do conditional rendering based on whether or not the license had expired. For example, when a Platinum license is expired all of the features granted with the Platinum license were greyed out. As opposed to when a license doesn't grant a feature, it's hidden. |
NP Licensing already provides the
Yes. What confused me about the current From @kobelb examples:
A license can be in a tier enough to use a feature but expired. The current I see several options here:
From the practical point of view adding |
Actions
/api/xpack/v1/info
.xpack_main/hacks/check_xpack_info_change
to the NP service.onPreResponse
interceptor in Http service to injectsignature
header under the different name.refresh
should be blocking operation to make sure that server error wasn't a result of license change https://github.com/elastic/x-pack-kibana/pull/2876/files#diff-0fa2a179c15c5afc59d4e7beb9fadcc9R2-R4deprecate
xpack.xpack_main.xpack_api_polling_frequency_millis
in favour ofxpack.licensing.polling_frequency
. config should work for both xpack.main and licensing plugins. blocked by New Platform Config service should support deprecations #40255sync license for NP & LP Sync licenses in NP licensing plugin and XPackMain #52502
document migration path.
should support
enterprise
license type for parity with the LP PR: Support 'enterprise' license type #52273reduce API surface. PR: Reduce license plugin api #53489
[ ] switch license fetching from deprecated/_xpack
to/_license
endpoint./_license
returns license status only. we need to investigate what is a substitution for a set of features.Won't be done. From Slack conversation with elasticsearch team:
[ ] normalize feature name keys. Licensing plugin #49345 (comment) server sends them in snake_case, client work with them in camelCase. can we simplify this ?the full context
Won't be done. In #52284 we decided that we won't transform elastic data to avoid a mismatch between js runtime & REST endpoint data shape.
We have only 2 features in snake_case: frozen_indices & voting_only (as of 18.12.2019). I haven't found any occurrences in the codebase, shouldn't affect plugins. Also, Licensing REST API is not considered as a public and can be changed at any time. Plugins should use API provided by API explicitly.
The main changes
state
LP: The plugin allows consumers to calculate state on
license change
event and store thisThe signature calculation is based on this state + license content
NP: We decided that license service doesn't keep plugins state #49345 (comment). Plugins have to react on license change and calculate license state on every license change. If another plugin needs that information, it should be exposed via a plugin contract.
This change makes NP & LP licensing service not compatible. We have to keep both until all plugins migrate to the new platform service. The legacy plugin consume license data from the LP plugin.
Network request failures
LP: The licensing plugin didn’t emit a license in case of network errors.
NP: Emits the license even if the request failed.
clusterSource
LP: Allows specifying cluster source to perform polling. Monitoring uses this functionality plugin
NP: The plugin always uses
data
client. Provides API to create a license poller with custom ES cluster.Initial value on the client
LP: Passed on the page via inlined
xpackInitialInfo
NP: Should be fetched
Config
LP:
xpack.xpack_main.xpack_api_polling_frequency_millis
NP:
xpack.licensing.api_polling_frequency
License
NP:
mode
field is provided, but deprecated.sessionStorage
LP: License and signature were stored under different keys in session storage
NP: License and signature were stored under one key
xpack.licensing
isOneOf
isOneOf
removed, usecheck
orhasAtLeast
insteadEndpoint
/api/xpack/v1/info
is going to be removed. switch to/api/licensing/info
Original description
*Original comment by @cjcenizal:*While chatting with @kobelb about LINK REDACTED we decided it would be helpful to have a single source of truth regarding our license state.
The problem
Currently, each app implements its own license-checking logic in a variety of ways, typically (ab)using the
showLinks
property. TheshowLinks
property couples our application state with our UI state. We need these to be uncoupled, so that we have the ability to change the UI and UX without how we represent application state.For example, currently
showLinks
is used to disable the "Reporting" link in Management. What if we wanted to allow the user to navigate to Reporting and surface a message there stating, "Your license has expired so Reporting is disabled. Please renew or upgrade your License." In this scenario, usingshowLinks
as the condition upon which to show this message makes little sense.The solution
I think our solution needs to fulfill the following criteria:
Just off the top of my head, I imagine the interface looking something like this:
Implementation wise, we should define our rules in a way which reflects the X-Pack licensing matrix LINK REDACTED. This way our code acts as our single source of truth regarding our business rules.
The text was updated successfully, but these errors were encountered: