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 23:40:08 UTC

[incubator-heron] branch saadurrahman/3846-Refactoring-K8s-Shim-dev updated (713f83faa6f -> bc18ba8c325)

This is an automated email from the ASF dual-hosted git repository.

saadurrahman pushed a change to branch saadurrahman/3846-Refactoring-K8s-Shim-dev
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git


    from 713f83faa6f [StatefulSet] added stubs for the Executor and Manager factory entry points.
     new 5adfee2db4d [Tests] empty test stub added.
     new bc18ba8c325 [StatefulSet] cluster configuration container added.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../heron/scheduler/kubernetes/StatefulSet.java    | 50 +++++++++++++++++++---
 .../scheduler/kubernetes/StatefulSetTest.java      |  7 +++
 2 files changed, 52 insertions(+), 5 deletions(-)


[incubator-heron] 01/02: [Tests] empty test stub added.

Posted by sa...@apache.org.
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 5adfee2db4d3e0c289730b845c98dcf296cd60ff
Author: Saad Ur Rahman <sa...@apache.org>
AuthorDate: Tue Jul 19 19:34:34 2022 -0400

    [Tests] empty test stub added.
---
 .../org/apache/heron/scheduler/kubernetes/StatefulSetTest.java     | 7 +++++++
 1 file changed, 7 insertions(+)

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
index 5dedaa97178..746823f21ea 100644
--- a/heron/schedulers/tests/java/org/apache/heron/scheduler/kubernetes/StatefulSetTest.java
+++ b/heron/schedulers/tests/java/org/apache/heron/scheduler/kubernetes/StatefulSetTest.java
@@ -19,5 +19,12 @@
 
 package org.apache.heron.scheduler.kubernetes;
 
+import org.junit.Assert;
+import org.junit.Test;
+
 public class StatefulSetTest {
+  @Test
+  public void testEmpty() {
+    Assert.assertTrue(true);
+  }
 }


[incubator-heron] 02/02: [StatefulSet] cluster configuration container added.

Posted by sa...@apache.org.
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 bc18ba8c3255d093ec4f03ee65c3816114f51f01
Author: Saad Ur Rahman <sa...@apache.org>
AuthorDate: Tue Jul 19 19:35:14 2022 -0400

    [StatefulSet] cluster configuration container added.
---
 .../heron/scheduler/kubernetes/StatefulSet.java    | 50 +++++++++++++++++++---
 1 file changed, 45 insertions(+), 5 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 4a1893918e1..cea3a91fc05 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
@@ -22,6 +22,8 @@ package org.apache.heron.scheduler.kubernetes;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.heron.scheduler.utils.Runtime;
+import org.apache.heron.spi.common.Config;
 import org.apache.heron.spi.packing.Resource;
 
 import io.kubernetes.client.openapi.models.V1StatefulSet;
@@ -34,25 +36,61 @@ final class StatefulSet {
     Manager
   }
 
+  /**
+   * Container class of all the Kubernetes cluster configurations. The methods contained within
+   * <code>KubernetesController</code> cannot be accessed externally since it is an abstract class.
+   */
+  static final class Configs {
+    private final String namespace;
+    private final String topologyName;
+    private final Config configuration;
+    private final Config runtimeConfiguration;
+
+    Configs(String namespace, Config configuration, Config runtimeConfiguration) {
+      this.namespace = namespace;
+      this.topologyName = Runtime.topologyName(runtimeConfiguration);
+      this.configuration = configuration;
+      this.runtimeConfiguration = runtimeConfiguration;
+    }
+
+    Config getConfiguration() {
+      return configuration;
+    }
+
+    Config getRuntimeConfiguration() {
+      return runtimeConfiguration;
+    }
+
+    String getNamespace() {
+      return namespace;
+    }
+
+    String getTopologyName() {
+      return topologyName;
+    }
+  }
+
   private StatefulSet() {
     statefulsets.put(Type.Executor, new ExecutorFactory());
     statefulsets.put(Type.Manager, new ManagerFactory());
   }
 
   interface IStatefulSetFactory {
-    V1StatefulSet create(Resource containerResources, int numberOfInstances);
+    V1StatefulSet create(Configs configs, 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 configs Cluster configuration information container.
    * @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) {
+  V1StatefulSet create(Type type, Configs configs, Resource containerResources,
+                       int numberOfInstances) {
     if (statefulsets.containsKey(type)) {
-      return statefulsets.get(type).create(containerResources, numberOfInstances);
+      return statefulsets.get(type).create(configs, containerResources, numberOfInstances);
     }
     return null;
   }
@@ -60,7 +98,8 @@ final class StatefulSet {
   static class ExecutorFactory implements IStatefulSetFactory {
 
     @Override
-    public V1StatefulSet create(Resource containerResources, int numberOfInstances) {
+    public V1StatefulSet create(Configs configs, Resource containerResources,
+                                int numberOfInstances) {
       return null;
     }
   }
@@ -68,7 +107,8 @@ final class StatefulSet {
   static class ManagerFactory implements IStatefulSetFactory {
 
     @Override
-    public V1StatefulSet create(Resource containerResources, int numberOfInstances) {
+    public V1StatefulSet create(Configs configs, Resource containerResources,
+                                int numberOfInstances) {
       return null;
     }
   }