This is an automated email from the ASF dual-hosted git repository. saadurrahman pushed a commit to branch saadurrahman/3846-Refactoring-K8s-Shim-dev in repository https://gitbox.apache.org/repos/asf/incubator-heron.git
commit a0d8b5fa39f8503b82733c05ef78741de7cfd000 Author: Saad Ur Rahman <[email protected]> AuthorDate: Wed Jul 20 19:57:16 2022 -0400 [StatefulSet] changes to support testing. --- .../apache/heron/scheduler/kubernetes/StatefulSet.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/StatefulSet.java b/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/StatefulSet.java index c8abd842057..154f816867d 100644 --- a/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/StatefulSet.java +++ b/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/StatefulSet.java @@ -118,12 +118,21 @@ final class StatefulSet { } } + @VisibleForTesting + protected void setClusterConfigs(Configs configs) { + this.clusterConfigs = configs; + } - private StatefulSet() { + @VisibleForTesting + protected StatefulSet() { statefulsets.put(Type.Executor, new ExecutorFactory()); statefulsets.put(Type.Manager, new ManagerFactory()); } + static StatefulSet get() { + return new StatefulSet(); + } + interface IStatefulSetFactory { V1StatefulSet create(Configs configs, Resource containerResources, int numberOfInstances); } @@ -149,7 +158,7 @@ final class StatefulSet { @Override public V1StatefulSet create(Configs configs, Resource containerResources, int numberOfInstances) { - clusterConfigs = configs; + setClusterConfigs(configs); return createStatefulSet(containerResources, numberOfInstances, true); } } @@ -159,7 +168,7 @@ final class StatefulSet { @Override public V1StatefulSet create(Configs configs, Resource containerResources, int numberOfInstances) { - clusterConfigs = configs; + setClusterConfigs(configs); return createStatefulSet(containerResources, numberOfInstances, false); } }
