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

Add verbose parameter to remove-disks endpoint valid parameter list #2106

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added verbose and skip_hard_goal_check parameter to remove-disks end…
…point

Signed-off-by: ShubhamRwt <[email protected]>
ShubhamRwt committed Apr 30, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 219c572136e5f0a8787504d5860c86646bf57e24
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ public RemoveDisksRunnable(KafkaCruiseControl kafkaCruiseControl,
OperationFuture future,
RemoveDisksParameters parameters,
String uuid) {
super(kafkaCruiseControl, future, parameters, parameters.dryRun(), parameters.stopOngoingExecution(), false,
super(kafkaCruiseControl, future, parameters, false, parameters.stopOngoingExecution(), parameters.skipHardGoalCheck(),
uuid, parameters::reason);
_brokerIdAndLogdirs = parameters.brokerIdAndLogdirs();
}
Original file line number Diff line number Diff line change
@@ -16,8 +16,10 @@
import static com.linkedin.kafka.cruisecontrol.servlet.parameters.ParameterUtils.BROKER_ID_AND_LOGDIRS_PARAM;
import static com.linkedin.kafka.cruisecontrol.servlet.parameters.ParameterUtils.DRY_RUN_PARAM;
import static com.linkedin.kafka.cruisecontrol.servlet.parameters.ParameterUtils.REASON_PARAM;
import static com.linkedin.kafka.cruisecontrol.servlet.parameters.ParameterUtils.SKIP_HARD_GOAL_CHECK_PARAM;
import static com.linkedin.kafka.cruisecontrol.servlet.parameters.ParameterUtils.STOP_ONGOING_EXECUTION_PARAM;
import static com.linkedin.kafka.cruisecontrol.servlet.parameters.ParameterUtils.JSON_PARAM;
import static com.linkedin.kafka.cruisecontrol.servlet.parameters.ParameterUtils.VERBOSE_PARAM;

public class RemoveDisksParameters extends GoalBasedOptimizationParameters {
protected static final SortedSet<String> CASE_INSENSITIVE_PARAMETER_NAMES;
@@ -26,12 +28,16 @@ public class RemoveDisksParameters extends GoalBasedOptimizationParameters {
validParameterNames.add(BROKER_ID_AND_LOGDIRS_PARAM);
validParameterNames.add(DRY_RUN_PARAM);
validParameterNames.add(REASON_PARAM);
validParameterNames.add(VERBOSE_PARAM);
validParameterNames.add(SKIP_HARD_GOAL_CHECK_PARAM);
validParameterNames.add(STOP_ONGOING_EXECUTION_PARAM);
validParameterNames.add(JSON_PARAM);
CASE_INSENSITIVE_PARAMETER_NAMES = Collections.unmodifiableSortedSet(validParameterNames);
}
private boolean _dryRun;
private String _reason;
private boolean _verbose;
private boolean _skipHardGoalCheck;
private boolean _stopOngoingExecution;
private Map<Integer, Set<String>> _logdirByBrokerId;

@@ -44,6 +50,8 @@ protected void initParameters() throws UnsupportedEncodingException {
super.initParameters();
_logdirByBrokerId = ParameterUtils.brokerIdAndLogdirs(_requestContext);
_dryRun = ParameterUtils.getDryRun(_requestContext);
_verbose = ParameterUtils.isVerbose(_requestContext);
_skipHardGoalCheck = ParameterUtils.skipHardGoalCheck(_requestContext);
boolean requestReasonRequired = _config.getBoolean(ExecutorConfig.REQUEST_REASON_REQUIRED_CONFIG);
_reason = ParameterUtils.reason(_requestContext, requestReasonRequired && !_dryRun);
_stopOngoingExecution = ParameterUtils.stopOngoingExecution(_requestContext);
@@ -68,6 +76,12 @@ public SortedSet<String> caseInsensitiveParameterNames() {
public String reason() {
return _reason;
}
public boolean verbose() {
return super.isVerbose();
}
public boolean skipHardGoalCheck() {
return _skipHardGoalCheck;
}
public boolean dryRun() {
return _dryRun;
}
12 changes: 12 additions & 0 deletions cruise-control/src/main/resources/yaml/endpoints/removeDisks.yaml
Original file line number Diff line number Diff line change
@@ -15,6 +15,18 @@ RemoveDisksEndpoint:
schema:
type: boolean
default: false
- name: skip_hard_goal_check
in: query
description: Whether to allow hard goals be skipped in proposal generation.
schema:
type: boolean
default: false
- name: verbose
in: query
description: Return detailed state information.
schema:
type: boolean
default: false
- name: reason
in: query
description: Reason for request.