You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by sa...@apache.org on 2022/07/19 17:38:37 UTC

[incubator-heron] 02/02: [StatefulSet] groundwork for the Stateful Set factory.

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 73c5223c83b910f87e4e6e5ad6cb07a3f0ea9a3f
Author: Saad Ur Rahman <sa...@apache.org>
AuthorDate: Tue Jul 19 13:38:22 2022 -0400

    [StatefulSet] groundwork for the Stateful Set factory.
---
 .../heron/scheduler/kubernetes/StatefulSet.java    | 40 ++++++++++++++++++++++
 heron/schedulers/tests/java/BUILD                  |  1 +
 .../scheduler/kubernetes/StatefulSetTest.java      | 23 +++++++++++++
 3 files changed, 64 insertions(+)

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
new file mode 100644
index 00000000000..ee763e97aea
--- /dev/null
+++ b/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/StatefulSet.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.heron.scheduler.kubernetes;
+
+import java.util.HashMap;
+import java.util.Map;
+
+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<>();
+
+  public enum Type {
+    Executor,
+    Manager
+  }
+
+  interface StatefulSetFactory {
+    V1StatefulSet create(Type type, Resource containerResources, int numberOfInstances);
+  }
+}
diff --git a/heron/schedulers/tests/java/BUILD b/heron/schedulers/tests/java/BUILD
index 0fb732314b2..c8eac176c74 100644
--- a/heron/schedulers/tests/java/BUILD
+++ b/heron/schedulers/tests/java/BUILD
@@ -206,6 +206,7 @@ java_tests(
         "org.apache.heron.scheduler.kubernetes.VolumesTests",
         "org.apache.heron.scheduler.kubernetes.KubernetesContextTest",
         "org.apache.heron.scheduler.kubernetes.KubernetesShimTest",
+        "org.apache.heron.scheduler.kubernetes.StatefulSetTest",
         "org.apache.heron.scheduler.kubernetes.KubernetesUtilsTest",
     ],
     runtime_deps = [":kubernetes-tests"],
diff --git a/heron/schedulers/tests/java/org/apache/heron/scheduler/kubernetes/StatefulSetTest.java b/heron/schedulers/tests/java/org/apache/heron/scheduler/kubernetes/StatefulSetTest.java
new file mode 100644
index 00000000000..5dedaa97178
--- /dev/null
+++ b/heron/schedulers/tests/java/org/apache/heron/scheduler/kubernetes/StatefulSetTest.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.heron.scheduler.kubernetes;
+
+public class StatefulSetTest {
+}