stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject stratos git commit: Fixing compilation issues caused by the merge conflict
Date Sun, 21 Dec 2014 16:19:03 GMT
Repository: stratos
Updated Branches:
  refs/heads/master 405ff36de -> 105bbf926


Fixing compilation issues caused by the merge conflict


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/105bbf92
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/105bbf92
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/105bbf92

Branch: refs/heads/master
Commit: 105bbf9267a0dc1a72948b4df1b0c77608e00195
Parents: 405ff36
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Sun Dec 21 21:48:54 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Sun Dec 21 21:48:54 2014 +0530

----------------------------------------------------------------------
 ...tainerClusterContextToKubernetesService.java |  52 -------
 .../functions/PodToMemberContext.java           |  44 ------
 .../cloud/controller/iaases/KubernetesIaas.java | 149 ++++++++++---------
 3 files changed, 77 insertions(+), 168 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/105bbf92/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/ContainerClusterContextToKubernetesService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/ContainerClusterContextToKubernetesService.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/ContainerClusterContextToKubernetesService.java
deleted file mode 100644
index 4adba07..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/ContainerClusterContextToKubernetesService.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.stratos.cloud.controller.functions;
-//
-//import org.apache.stratos.cloud.controller.context.CloudControllerContext;
-//import org.apache.stratos.cloud.controller.domain.ClusterContext;
-//import org.apache.stratos.cloud.controller.domain.ContainerClusterContext;
-//import org.apache.stratos.cloud.controller.domain.KubernetesClusterContext;
-//import org.apache.stratos.cloud.controller.domain.MemberContext;
-//import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
-//import org.apache.stratos.common.constants.StratosConstants;
-//import org.apache.stratos.kubernetes.client.model.Selector;
-//import org.apache.stratos.kubernetes.client.model.Service;
-//
-//import com.google.common.base.Function;
-//
-///**
-// * Is responsible for converting a {@link ContainerClusterContext} object to a Kubernetes
-// * {@link Service} Object.
-// */
-//public class ContainerClusterContextToKubernetesService implements Function<ClusterContext,
Service> {
-//
-//    @Override
-//    public Service apply(ClusterContext clusterContext) {
-//
-//        String clusterId = clusterContext.getClusterId();
-//        String kubernetesClusterId = CloudControllerUtil.getProperty(
-//                clusterContext.getProperties(), StratosConstants.KUBERNETES_CLUSTER_ID);
-//        KubernetesClusterContext kubClusterContext = CloudControllerContext.getInstance()
-//                .getKubernetesClusterContext(kubernetesClusterId);
-//
-//
-//
-//        return service;
-//    }
-//}

http://git-wip-us.apache.org/repos/asf/stratos/blob/105bbf92/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/PodToMemberContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/PodToMemberContext.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/PodToMemberContext.java
deleted file mode 100644
index c8d05d2..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/functions/PodToMemberContext.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.stratos.cloud.controller.functions;
-
-import org.apache.stratos.cloud.controller.domain.MemberContext;
-import org.apache.stratos.kubernetes.client.model.Pod;
-import com.google.common.base.Function;
-
-/**
- * Is responsible for converting a {@link Pod} object to a
- * {@link MemberContext} Object.
- */
-//public class PodToMemberContext implements Function<Pod, MemberContext> {
-//
-//    @Override
-//    public MemberContext apply(Pod pod) {
-//        if (pod == null) {
-//            return null;
-//        }
-//        MemberContext memberContext = new MemberContext();
-//        memberContext.setInstanceId(pod.getId());
-//        memberContext.setPrivateIpAddress(pod.getCurrentState().getHostIP());
-//        memberContext.setPublicIpAddress(pod.getCurrentState().getHostIP());
-//        memberContext.setInitTime(System.currentTimeMillis());
-//
-//        return memberContext;
-//    }
-//}

http://git-wip-us.apache.org/repos/asf/stratos/blob/105bbf92/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/KubernetesIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/KubernetesIaas.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/KubernetesIaas.java
index bdb36cc..5ac0954 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/KubernetesIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/KubernetesIaas.java
@@ -61,7 +61,6 @@ public class KubernetesIaas extends Iaas {
 
     @Override
     public void initialize() {
-
     }
 
     @Override
@@ -70,69 +69,11 @@ public class KubernetesIaas extends Iaas {
     }
 
     @Override
-    public void releaseAddress(String ip) {
-
-    }
-
-    @Override
-    public boolean isValidRegion(String region) throws InvalidRegionException {
-        // No regions in kubernetes cluster
-        return true;
-    }
-
-    @Override
-    public boolean isValidZone(String region, String zone) throws InvalidZoneException, InvalidRegionException
{
-        // No zones in kubernetes cluster
-        return true;
-    }
-
-    @Override
-    public boolean isValidHost(String zone, String host) throws InvalidHostException {
-        // No zones in kubernetes cluster
-        return true;
-    }
-
-    @Override
     public PartitionValidator getPartitionValidator() {
         return partitionValidator;
     }
 
     @Override
-    public String createVolume(int sizeGB, String snapshotId) {
-        throw new NotImplementedException();
-    }
-
-    @Override
-    public String attachVolume(String instanceId, String volumeId, String deviceName) {
-        throw new NotImplementedException();
-    }
-
-    @Override
-    public void detachVolume(String instanceId, String volumeId) {
-        throw new NotImplementedException();
-    }
-
-    @Override
-    public void deleteVolume(String volumeId) {
-        throw new NotImplementedException();
-    }
-
-    @Override
-    public String getIaasDevice(String device) {
-        throw new NotImplementedException();
-    }
-
-    @Override
-    public void allocateIpAddress(String clusterId, MemberContext memberContext, Partition
partition) {
-
-    }
-
-    @Override
-    public void setDynamicPayload(byte[] payload) {
-          // Payload is passed via environment
-    }
-
-    @Override
     public void terminateInstance(MemberContext memberContext) throws InvalidCartridgeTypeException,
             InvalidMemberException, MemberTerminationFailedException {
         terminateContainer(memberContext.getMemberId());
@@ -221,19 +162,7 @@ public class KubernetesIaas extends Iaas {
                 }
 
                 // Create member context
-                MemberContext newMemberContext = new MemberContext();
-                newMemberContext.setCartridgeType(cartridgeType);
-                newMemberContext.setClusterId(clusterId);
-                newMemberContext.setMemberId(memberContext.getMemberId());
-                newMemberContext.setClusterInstanceId(memberContext.getClusterInstanceId());
-                newMemberContext.setInitTime(memberContext.getInitTime());
-                newMemberContext.setNetworkPartitionId(memberContext.getNetworkPartitionId());
-                newMemberContext.setPartition(memberContext.getPartition());
-                newMemberContext.setInitTime(System.currentTimeMillis());
-                newMemberContext.setInstanceId(pod.getId());
-                newMemberContext.setPrivateIpAddress(pod.getCurrentState().getHostIP());
-                newMemberContext.setPublicIpAddress(pod.getCurrentState().getHostIP());
-                newMemberContext.setProperties(memberContext.getProperties());
+                MemberContext newMemberContext = createNewMemberContext(memberContext, pod);
 
                 Property servicesProperty = new Property();
                 servicesProperty.setName(StratosConstants.KUBERNETES_SERVICES);
@@ -268,6 +197,24 @@ public class KubernetesIaas extends Iaas {
         }
     }
 
+    private MemberContext createNewMemberContext(MemberContext memberContext, Pod pod) {
+        MemberContext newMemberContext = new MemberContext();
+        newMemberContext.setCartridgeType(memberContext.getCartridgeType());
+        newMemberContext.setClusterId(memberContext.getClusterId());
+        newMemberContext.setClusterInstanceId(memberContext.getClusterInstanceId());
+        newMemberContext.setMemberId(memberContext.getMemberId());
+        newMemberContext.setNetworkPartitionId(memberContext.getNetworkPartitionId());
+        newMemberContext.setPartition(memberContext.getPartition());
+        newMemberContext.setInstanceId(pod.getId());
+        newMemberContext.setDefaultPrivateIP(pod.getCurrentState().getHostIP());
+        newMemberContext.setPrivateIPs(new String[]{pod.getCurrentState().getHostIP()});
+        newMemberContext.setDefaultPublicIP(pod.getCurrentState().getHostIP());
+        newMemberContext.setPublicIPs(new String[]{pod.getCurrentState().getHostIP()});
+        newMemberContext.setInitTime(System.currentTimeMillis());
+        newMemberContext.setProperties(memberContext.getProperties());
+        return newMemberContext;
+    }
+
     private Pod[] waitForPodToBeCreated(MemberContext memberContext, KubernetesApiClient
kubernetesApi) throws KubernetesClientException, InterruptedException {
         Labels labels = new Labels();
         labels.setName(memberContext.getMemberId());
@@ -525,4 +472,62 @@ public class KubernetesIaas extends Iaas {
             throw new IllegalArgumentException(errorMsg);
         }
     }
+
+    @Override
+    public void releaseAddress(String ip) {
+
+    }
+
+    @Override
+    public boolean isValidRegion(String region) throws InvalidRegionException {
+        // No regions in kubernetes cluster
+        return true;
+    }
+
+    @Override
+    public boolean isValidZone(String region, String zone) throws InvalidZoneException, InvalidRegionException
{
+        // No zones in kubernetes cluster
+        return true;
+    }
+
+    @Override
+    public boolean isValidHost(String zone, String host) throws InvalidHostException {
+        // No zones in kubernetes cluster
+        return true;
+    }
+
+    @Override
+    public String createVolume(int sizeGB, String snapshotId) {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public String attachVolume(String instanceId, String volumeId, String deviceName) {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void detachVolume(String instanceId, String volumeId) {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void deleteVolume(String volumeId) {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public String getIaasDevice(String device) {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void allocateIpAddress(String clusterId, MemberContext memberContext, Partition
partition) {
+
+    }
+
+    @Override
+    public void setDynamicPayload(byte[] payload) {
+        // Payload is passed via environment
+    }
 }


Mime
View raw message