-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
[Rest Api Compatibility] Licence accept_enterprise and response changes #75479
Conversation
in elastic#50067 the accept_enterprise = false was no longer supported. This commit allows it under rest compatibility and ignores. in elastic#5073 there were changes when max_nodes and max_resource_units can exist. This does not require compatible changes as it feels to be behaviour change. Requires some testing transformation though relates elastic#51816
Pinging @elastic/es-core-infra (Team:Core/Infra) |
Pinging @elastic/es-security (Team:Security) |
we also no longer parse |
I find this compatibility change to be a bit weird. We're going out of our way to accept a parameter value so that we can ignore it and not do the thing that the client asked for. On this one I really think we should go all the way and hide enterprise licenses from 7.x clients, or reject the parameter. Accepting it but refusing to honor it doesn't make sense to me.
We never supported |
I might have prematurely hit ready for review when this was meant to be a draft helping me to ask a question offline. |
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.
The existing (7.x) behaviours of accept_enterprise
seem inconsistent to me between GetLicense and GetXPackInfo APIs. For this review, I assume we are not trying to fix the inconsistency and just to ensure 8.x behaves the same as 7.x when rest compat is requested. Happy to chat if you need clarification for any of the comments.
x-pack/plugin/core/src/main/java/org/elasticsearch/license/License.java
Outdated
Show resolved
Hide resolved
if (version >= VERSION_ENTERPRISE) { | ||
if (hideEnterprise && builder.getRestApiVersion().matches(onOrAfter(RestApiVersion.V_7))) { | ||
builder.field(Fields.MAX_NODES,maxNodes == -1 ? maxResourceUnits : maxNodes); | ||
}else if (version >= VERSION_ENTERPRISE ) { |
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.
Maybe I don't fully understand the intended behaviour for hideEnterprise
. In GetLicense 7.x, it seems that it is only honored if version < VERSION_ENTERPRISE
. But this is already inconsistent with RestXPackInfo 7.x which always hide enterprise if requested.
Anyway, if we just want to keep whatever 7.x have as is and be compatible, I think we can just copy the code from 7.x, i.e.:
if (version >= VERSION_ENTERPRISE) {
builder.field(Fields.MAX_NODES, maxNodes == -1 ? null : maxNodes);
builder.field(Fields.MAX_RESOURCE_UNITS, maxResourceUnits == -1 ? null : maxResourceUnits);
} else if (hideEnterprise && maxNodes == -1) {
builder.field(Fields.MAX_NODES, maxResourceUnits);
} else {
builder.field(Fields.MAX_NODES, maxNodes);
}
The value of hideEnterprise
is already a result of checking rest compat, so I don't think we need check it again here.
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.
We discussed lively and realised that 7.x sets the license version is set to before enterprise when accept_enterprise=false
. So it does always hide it similar to RestGetXPackInfo.
We also decided that the V7 compat should just behave the same way as 7.x (by mostly adding relevant code from 7.x).
x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/XPackInfoResponse.java
Outdated
Show resolved
Hide resolved
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
x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/XPackInfoResponse.java
Outdated
Show resolved
Hide resolved
…ack/XPackInfoResponse.java Co-authored-by: Yang Wang <[email protected]>
@elasticmachine update branch |
…es (elastic#75479) in elastic#50067 for _license the accept_enterprise = false was no longer supported. This commit allows it under rest compatibility and is showing enterprise licenses as platinum The same change had to be applied to _xpack endpoint elastic#58217 in elastic#50735 max_resource_units was introduced to be more accurate. For v7 requests, which do not know about enterprise license we will return max_node which will be set from max_resource_units (it assumes that one resource unit is 32GB - which corresponds to 1 node) relates elastic#51816
in #50067 for _license the accept_enterprise = false was no longer supported. This
commit allows it under rest compatibility and is showing enterprise licenses as platinum
The same change had to be applied to _xpack endpoint #58217
in #50735 max_resource_units was introduced to be more accurate. For v7 requests, which do not know about enterprise license we will return max_node which will be set from max_resource_units (it assumes that one resource unit is 32GB - which corresponds to 1 node)
relates #51816
gradle check
?