-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into authz-2
- Loading branch information
Showing
32 changed files
with
308 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,4 @@ target/ | |
scratch | ||
|
||
scripts/benchmark/infra/ | ||
nohup.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
core/src/main/java/com/flipkart/varadhi/core/cluster/NodeResources.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...adhi/core/cluster/MembershipListener.java → ...t/varadhi/cluster/MembershipListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../varadhi/core/cluster/NodeConnection.java → ...pkart/varadhi/cluster/NodeConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ipkart/varadhi/core/cluster/NodeInfo.java → ...om/flipkart/varadhi/cluster/NodeInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
server/src/main/java/com/flipkart/varadhi/cluster/NodeResources.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.flipkart.varadhi.cluster; | ||
|
||
public record NodeResources(int cpuCount, int nicMBps) { | ||
} |
51 changes: 51 additions & 0 deletions
51
server/src/main/java/com/flipkart/varadhi/cluster/custom/ZookeeperClusterManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.flipkart.varadhi.cluster.custom; | ||
|
||
import com.flipkart.varadhi.cluster.NodeResources; | ||
import com.flipkart.varadhi.config.ZookeeperConnectConfig; | ||
import com.flipkart.varadhi.utils.CuratorFrameworkCreator; | ||
import io.vertx.core.Promise; | ||
import io.vertx.core.json.JsonObject; | ||
import io.vertx.core.spi.cluster.NodeInfo; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
/** | ||
* Customized zkClusterManager that only works with provided zk configuration. The curatorFramework, needs to be | ||
* configured with namespace for the purpose of cluster nodes. | ||
* | ||
* In the future, we will customize this so that curator is not required to be namespace aware, instead this class will | ||
* handle the namespacing all the paths. This should allow usage of curator client for other purposes other than just cluster | ||
* management. We also need to remove curator.close() from leave method, in case the curator instance is provided. | ||
* | ||
* This class also customizes 1 method: | ||
* 1. setNodeInfo() - to include {@link NodeResources} as part of the nodeInfo | ||
*/ | ||
@Slf4j | ||
public class ZookeeperClusterManager extends io.vertx.spi.cluster.zookeeper.ZookeeperClusterManager { | ||
|
||
/** | ||
* Node specific resource information to be used for load-balancing. This will be persisted as part of nodeInfo | ||
*/ | ||
private final NodeResources nodeResources; | ||
|
||
public ZookeeperClusterManager(ZookeeperConnectConfig zkConnectConfig, String nodeId, NodeResources nodeResources) { | ||
super(CuratorFrameworkCreator.create(zkConnectConfig), nodeId); | ||
this.nodeResources = nodeResources; | ||
} | ||
|
||
@Override | ||
public void setNodeInfo(NodeInfo nodeInfo, Promise<Void> promise) { | ||
NodeInfo copy = new NodeInfo(nodeInfo.host(), nodeInfo.port(), | ||
nodeInfo.metadata() == null ? new JsonObject() : nodeInfo.metadata().copy() | ||
); | ||
copy.metadata().put("cpuCount", nodeResources.cpuCount()); | ||
copy.metadata().put("nicMBps", nodeResources.nicMBps()); | ||
super.setNodeInfo(copy, promise); | ||
} | ||
|
||
public NodeResources toNodeResources(NodeInfo nodeInfo) { | ||
return new NodeResources( | ||
nodeInfo.metadata().getInteger("cpuCount"), | ||
nodeInfo.metadata().getInteger("nicMBps") | ||
); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
server/src/main/java/com/flipkart/varadhi/cluster/impl/ClusterManagerImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.flipkart.varadhi.cluster.impl; | ||
|
||
import com.flipkart.varadhi.cluster.ClusterManager; | ||
import com.flipkart.varadhi.cluster.MembershipListener; | ||
import com.flipkart.varadhi.cluster.NodeConnection; | ||
import com.flipkart.varadhi.cluster.NodeInfo; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@RequiredArgsConstructor | ||
public class ClusterManagerImpl implements ClusterManager { | ||
|
||
// TODO: add instance of zkClusterManager & clusteredVertx and use it to implement the methods of this class | ||
|
||
@Override | ||
public List<NodeInfo> getAllMembers() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void addMembershipListener(MembershipListener listener) { | ||
|
||
} | ||
|
||
@Override | ||
public NodeConnection connect(String nodeId) { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.