Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Added support for specifying user as which the task should run, and d…
Browse files Browse the repository at this point in the history
…isabled named vip support temporarily (#278)
  • Loading branch information
mohitsoni authored and gabrielhartmann committed Oct 17, 2016
1 parent 6ad9460 commit 7a9553c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,18 +340,22 @@ private TaskInfo getNewTaskInfo(KafkaSchedulerConfiguration config, String confi
containerPath));
}

if (clusterState.getCapabilities().supportsNamedVips()) {
DiscoveryInfo discoveryInfo = DiscoveryInfo.newBuilder()
.setVisibility(DiscoveryInfo.Visibility.EXTERNAL)
.setName(brokerName)
.setPorts(Ports.newBuilder()
.addPorts(Port.newBuilder()
.setNumber((int) (long)port)
.setProtocol("tcp")
.setLabels(labels("VIP_" + UUID.randomUUID(), "broker:9092")))
.build())
.build();
taskBuilder.setDiscovery(discoveryInfo);
try {
if (clusterState.getCapabilities().supportsNamedVips()) {
DiscoveryInfo discoveryInfo = DiscoveryInfo.newBuilder()
.setVisibility(DiscoveryInfo.Visibility.EXTERNAL)
.setName(brokerName)
.setPorts(Ports.newBuilder()
.addPorts(Port.newBuilder()
.setNumber((int) (long) port)
.setProtocol("tcp")
.setLabels(labels("VIP_" + UUID.randomUUID(), "broker:9092")))
.build())
.build();
taskBuilder.setDiscovery(discoveryInfo);
}
} catch (Exception e) {
log.error("Error querying for named vip support. Named VIP support will be unavailable.", e);
}

KafkaHealthCheckConfiguration healthCheckConfiguration = config.getHealthCheckConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ public Response getConnectionInfo() {
connectionInfo.put(ZOOKEEPER_KEY, zookeeperEndpoint);
connectionInfo.put(ADDRESS_KEY, getBrokerList());
connectionInfo.put(DNS_KEY, getBrokerDNSList());
if (clusterState.getCapabilities().supportsNamedVips()) {
connectionInfo.put(VIP_KEY, String.format("broker.%s.l4lb.thisdcos.directory:9092", frameworkName));
try {
if (clusterState.getCapabilities().supportsNamedVips()) {
connectionInfo.put(VIP_KEY, String.format("broker.%s.l4lb.thisdcos.directory:9092", frameworkName));
}
} catch (Exception e) {
log.info("Unable to query for named VIP support.", e);
}
return Response.ok(connectionInfo.toString(), MediaType.APPLICATION_JSON).build();
} catch (Exception ex) {
Expand Down
5 changes: 5 additions & 0 deletions universe/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"type":"string",
"default":"kafka"
},
"user": {
"type": "string",
"description": "The user that the service will run as.",
"default": "root"
},
"principal": {
"description": "The principal for the Kafka service instance.",
"type": "string",
Expand Down

0 comments on commit 7a9553c

Please sign in to comment.