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
The following commit(s) were added to
refs/heads/saadurrahman/3846-Refactoring-K8s-Shim-dev by this push:
new 6c50e98092d [StatefulSet] added stubs for the Executor and Manager
factory entry points.
6c50e98092d is described below
commit 6c50e98092d864c9046f4f0f7bb50480186ebcb0
Author: Saad Ur Rahman <[email protected]>
AuthorDate: Tue Jul 19 13:52:40 2022 -0400
[StatefulSet] added stubs for the Executor and Manager factory entry points.
---
.../heron/scheduler/kubernetes/StatefulSet.java | 39 ++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 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 ee763e97aea..e358c09eff0 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
@@ -27,14 +27,49 @@ import org.apache.heron.spi.packing.Resource;
import io.kubernetes.client.openapi.models.V1StatefulSet;
final class StatefulSet {
- private final Map<String, StatefulSetFactory> statefulsets = new HashMap<>();
+ private final Map<Type, IStatefulSetFactory> statefulsets = new HashMap<>();
public enum Type {
Executor,
Manager
}
- interface StatefulSetFactory {
+ private StatefulSet() {
+ statefulsets.put(Type.Executor, new ExecutorFactory());
+ statefulsets.put(Type.Manager, new ManagerFactory());
+ }
+
+ interface IStatefulSetFactory {
V1StatefulSet create(Type type, Resource containerResources, int
numberOfInstances);
}
+
+ /**
+ * Creates configured <code>Executor</code> or <code>Manager</code>
<code>Stateful Set</code>.
+ * @param type One of <code>Executor</code> or <code>Manager</code>
+ * @param containerResources The container system resource configurations.
+ * @param numberOfInstances The container count.
+ * @return Fully configured <code>Stateful Set</code> or <code>null</code>
on invalid <code>type</code>.
+ */
+ V1StatefulSet create(Type type, Resource containerResources, int
numberOfInstances) {
+ if (statefulsets.containsKey(type)) {
+ return statefulsets.get(type).create(type, containerResources,
numberOfInstances);
+ }
+ return null;
+ }
+
+ static class ExecutorFactory implements IStatefulSetFactory {
+
+ @Override
+ public V1StatefulSet create(Type type, Resource containerResources, int
numberOfInstances) {
+ return null;
+ }
+ }
+
+ static class ManagerFactory implements IStatefulSetFactory {
+
+ @Override
+ public V1StatefulSet create(Type type, Resource containerResources, int
numberOfInstances) {
+ return null;
+ }
+ }
}