-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[X-Pack] Beats centralized management: security role + licensing #30520
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
Changes from 21 commits
573cc62
ffe1ff5
cb874b7
ee45e03
c2618b7
b7254ee
d7af55b
5364b16
61eb9c6
678d8b7
50a4d62
8e517c3
7834c41
9cbd059
a908b97
c1163c6
625b80b
2e29cdb
d0f05d6
154d305
39d08ad
d79e73d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,9 @@ public class XPackLicenseState { | |
messages.put(XPackField.LOGSTASH, new String[] { | ||
"Logstash will continue to poll centrally-managed pipelines" | ||
}); | ||
messages.put(XPackField.BEATS, new String[] { | ||
"Beats will continue to poll centrally-managed configuration" | ||
}); | ||
messages.put(XPackField.DEPRECATION, new String[] { | ||
"Deprecation APIs are disabled" | ||
}); | ||
|
@@ -81,6 +84,7 @@ public class XPackLicenseState { | |
messages.put(XPackField.GRAPH, XPackLicenseState::graphAcknowledgementMessages); | ||
messages.put(XPackField.MACHINE_LEARNING, XPackLicenseState::machineLearningAcknowledgementMessages); | ||
messages.put(XPackField.LOGSTASH, XPackLicenseState::logstashAcknowledgementMessages); | ||
messages.put(XPackField.BEATS, XPackLicenseState::beatsAcknowledgementMessages); | ||
messages.put(XPackField.SQL, XPackLicenseState::sqlAcknowledgementMessages); | ||
ACKNOWLEDGMENT_MESSAGES = Collections.unmodifiableMap(messages); | ||
} | ||
|
@@ -205,12 +209,19 @@ private static String[] machineLearningAcknowledgementMessages(OperationMode cur | |
private static String[] logstashAcknowledgementMessages(OperationMode currentMode, OperationMode newMode) { | ||
switch (newMode) { | ||
case BASIC: | ||
switch (currentMode) { | ||
case TRIAL: | ||
case STANDARD: | ||
case GOLD: | ||
case PLATINUM: | ||
return new String[] { "Logstash will no longer poll for centrally-managed pipelines" }; | ||
if (isBasic(currentMode) == false) { | ||
return new String[] { "Logstash will no longer poll for centrally-managed pipelines" }; | ||
} | ||
break; | ||
} | ||
return Strings.EMPTY_ARRAY; | ||
} | ||
|
||
private static String[] beatsAcknowledgementMessages(OperationMode currentMode, OperationMode newMode) { | ||
switch (newMode) { | ||
case BASIC: | ||
if (isBasic(currentMode) == false) { | ||
return new String[] { "Beats will no longer poll for centrally-managed configuration" }; | ||
} | ||
break; | ||
} | ||
|
@@ -232,6 +243,10 @@ private static String[] sqlAcknowledgementMessages(OperationMode currentMode, Op | |
return Strings.EMPTY_ARRAY; | ||
} | ||
|
||
private static boolean isBasic(OperationMode mode) { | ||
return mode == OperationMode.BASIC; | ||
} | ||
|
||
/** A wrapper for the license mode and state, to allow atomically swapping. */ | ||
private static class Status { | ||
|
||
|
@@ -500,20 +515,17 @@ public boolean isRollupAllowed() { | |
*/ | ||
public boolean isLogstashAllowed() { | ||
Status localStatus = status; | ||
return localStatus.active && (isBasic(localStatus.mode) == false); | ||
} | ||
|
||
if (localStatus.active == false) { | ||
return false; | ||
} | ||
/** | ||
* Beats is allowed as long as there is an active license of type TRIAL, STANDARD, GOLD or PLATINUM | ||
* @return {@code true} as long as there is a valid license | ||
*/ | ||
public boolean isBeatsAllowed() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that the ingest team owns, I wonder if this should instead be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personally I feel like the code should reflect the products/features and not organization structure, as much as possible. So I'd like to keep this as-is. I'd be okay with refactoring the duplicate code in the two methods into a helper method like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be happy with an |
||
Status localStatus = status; | ||
return localStatus.active && (isBasic(localStatus.mode) == false); | ||
|
||
switch (localStatus.mode) { | ||
case TRIAL: | ||
case GOLD: | ||
case PLATINUM: | ||
case STANDARD: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.core.beats; | ||
|
||
import org.elasticsearch.common.io.stream.StreamInput; | ||
import org.elasticsearch.xpack.core.XPackFeatureSet; | ||
import org.elasticsearch.xpack.core.XPackField; | ||
|
||
import java.io.IOException; | ||
|
||
public final class BeatsFeatureSetUsage extends XPackFeatureSet.Usage { | ||
|
||
public BeatsFeatureSetUsage(StreamInput in) throws IOException { | ||
super(in); | ||
} | ||
|
||
public BeatsFeatureSetUsage(boolean available, boolean enabled) { | ||
super(XPackField.BEATS, available, enabled); | ||
} | ||
|
||
} |
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.
This is a little misleading, which is due to how Logstash was already phrased so it may be moot. Technically Beats will continue to poll, right, but they'll see a basic license and not short circuit, then repeat later? Perhaps this should say
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.
TBH I'm not sure what the exact behavior here will be from the beats side. I bet @exekias has given this thought and can weigh in 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.
Technically Beats will continue polling, but won't get new configs until license is back on track. @pickypg's message may be more accurate
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.
Updated in d79e73d.