Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Alternative way to specify auth for the mesos scheduler api #1946

Merged
merged 1 commit into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public class MesosConfiguration {
private double recheckMetricsLoad1Threshold = 0.75;
private double recheckMetricsLoad5Threshold = 0.8;

private Optional<String> mesosUsername;
private Optional<String> mesosPassword;

public int getMaxNumInstancesPerRequest() {
return maxNumInstancesPerRequest;
}
Expand Down Expand Up @@ -372,4 +375,20 @@ public double getRecheckMetricsLoad5Threshold() {
public void setRecheckMetricsLoad5Threshold(double recheckMetricsLoad5Threshold) {
this.recheckMetricsLoad5Threshold = recheckMetricsLoad5Threshold;
}

public Optional<String> getMesosUsername() {
return mesosUsername;
}

public void setMesosUsername(Optional<String> mesosUsername) {
this.mesosUsername = mesosUsername;
}

public Optional<String> getMesosPassword() {
return mesosPassword;
}

public void setMesosPassword(Optional<String> mesosPassword) {
this.mesosPassword = mesosPassword;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,14 @@ public void start() throws Exception {
}
URI masterUri = URI.create(nextMaster);

String userInfo = masterUri.getUserInfo();
if (userInfo == null && mesosConfiguration.getMesosUsername().isPresent() && mesosConfiguration.getMesosPassword().isPresent()) {
userInfo = String.format("%s:%s", mesosConfiguration.getMesosUsername().get(), mesosConfiguration.getMesosPassword().get());
}

mesosSchedulerClient.subscribe(new URI(
masterUri.getScheme() == null ? "http" : masterUri.getScheme(),
masterUri.getUserInfo(),
userInfo,
masterUri.getHost(),
masterUri.getPort(),
Strings.isNullOrEmpty(masterUri.getPath()) ? "/api/v1/scheduler" : masterUri.getPath(),
Expand Down