linkedin / cruise-control

Cruise-control is the first of its kind to fully automate the dynamic workload rebalance and self-healing of a Kafka cluster. It provides great value to Kafka users by simplifying the operation of Kafka clusters.
https://github.com/linkedin/cruise-control/tags
BSD 2-Clause "Simplified" License
2.74k stars 587 forks source link

`webserver.api.urlprefix` configuration invalid #1336

Closed claudio-benfatto closed 3 years ago

claudio-benfatto commented 4 years ago

Hi,

Problem description

I noticed that even though the webserver.api.urlprefix is documented and configurable, anything different from the default /kafkacruisecontrol/* is as a matter of fact producing an error, eg:

with the configuration:

webserver.api.urlprefix=/mycluster/kafkacruisecontrol/*
curl  http://cruisecontrol.example:9090/mycluster/kafkacruisecontrol/state

will result in:

unrecognized endpoint in request '/state'
* Connection #0 to host 10.231.3.123 left intact
Supported GET endpoints: [BOOTSTRAP, TRAIN, LOAD, PARTITION_LOAD, PROPOSALS, STATE, KAFKA_CLUSTER_STATE, USER_TASKS, REVIEW_BOARD]

I looked a bit into the code and it seems that the culprit for this behaviour is to be found in this code: https://github.com/linkedin/cruise-control/blob/5ed774eb5c64f6e57a6a001c1306c520170416c5/cruise-control/src/main/java/com/linkedin/kafka/cruisecontrol/servlet/KafkaCruiseControlServletUtils.java#L38-L39

and in the following validation attempt: https://github.com/linkedin/cruise-control/blob/fbc1b1dfac27768193d046ce852a7deaad7f7bd9/cruise-control/src/main/java/com/linkedin/kafka/cruisecontrol/servlet/parameters/ParameterUtils.java#L179-L186

Expected behaviour

I would expect this configuration to behave as documented

Thank you!

Lincong commented 3 years ago

Hi @claudio-benfatto, I just merged a PR that resolves this issue. Let me know if it works. Thanks!