You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by dr...@apache.org on 2017/06/29 15:35:44 UTC

[02/50] [abbrv] brooklyn-server git commit: Use KubernetesMachineLocation correctly in location specs

Use KubernetesMachineLocation correctly in location specs


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/9048959f
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/9048959f
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/9048959f

Branch: refs/heads/master
Commit: 9048959f134efc9e1df06d8fc83e3c3050ec3a94
Parents: 326b077
Author: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Authored: Wed Feb 1 21:12:25 2017 +0000
Committer: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Committed: Fri May 19 14:01:20 2017 +0100

----------------------------------------------------------------------
 .../kubernetes/location/KubernetesLocation.java         | 12 ++++++------
 .../openshift/location/OpenShiftLocation.java           |  6 ++----
 2 files changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9048959f/kubernetes-location/src/main/java/io/cloudsoft/amp/containerservice/kubernetes/location/KubernetesLocation.java
----------------------------------------------------------------------
diff --git a/kubernetes-location/src/main/java/io/cloudsoft/amp/containerservice/kubernetes/location/KubernetesLocation.java b/kubernetes-location/src/main/java/io/cloudsoft/amp/containerservice/kubernetes/location/KubernetesLocation.java
index f8ec2e2..fe056af 100644
--- a/kubernetes-location/src/main/java/io/cloudsoft/amp/containerservice/kubernetes/location/KubernetesLocation.java
+++ b/kubernetes-location/src/main/java/io/cloudsoft/amp/containerservice/kubernetes/location/KubernetesLocation.java
@@ -107,7 +107,7 @@ import io.fabric8.kubernetes.api.model.extensions.DeploymentStatus;
 import io.fabric8.kubernetes.client.KubernetesClient;
 import io.fabric8.kubernetes.client.KubernetesClientException;
 
-public class KubernetesLocation extends AbstractLocation implements MachineProvisioningLocation<MachineLocation>, KubernetesLocationConfig {
+public class KubernetesLocation extends AbstractLocation implements MachineProvisioningLocation<KubernetesMachineLocation>, KubernetesLocationConfig {
 
     /*
      * TODO
@@ -182,7 +182,7 @@ public class KubernetesLocation extends AbstractLocation implements MachineProvi
     }
 
     @Override
-    public MachineLocation obtain(Map<?, ?> flags) throws NoMachinesAvailableException {
+    public KubernetesMachineLocation obtain(Map<?, ?> flags) throws NoMachinesAvailableException {
         ConfigBag setupRaw = ConfigBag.newInstanceExtending(config().getBag(), flags);
         ConfigBag setup = ResolvingConfigBag.newInstanceExtending(getManagementContext(), setupRaw);
 
@@ -218,7 +218,7 @@ public class KubernetesLocation extends AbstractLocation implements MachineProvi
     }
 
     @Override
-    public void release(MachineLocation machine) {
+    public void release(KubernetesMachineLocation machine) {
         Entity entity = validateCallerContext(machine);
         if (isKubernetesResource(entity)) {
             if (machine instanceof KubernetesEmptyMachineLocation && KubernetesPod.EMPTY.equals(machine.config().get(KubernetesMachineLocation.KUBERNETES_RESOURCE_TYPE))) {
@@ -340,7 +340,7 @@ public class KubernetesLocation extends AbstractLocation implements MachineProvi
         return null;
     }
 
-    protected MachineLocation createKubernetesResourceLocation(Entity entity, ConfigBag setup) {
+    protected KubernetesMachineLocation createKubernetesResourceLocation(Entity entity, ConfigBag setup) {
         String resourceUri = entity.config().get(KubernetesResource.RESOURCE_FILE);
         InputStream resource = ResourceUtils.create(entity).getResourceFromUrl(resourceUri);
         String templateContents = Streams.readFullyString(resource);
@@ -457,7 +457,7 @@ public class KubernetesLocation extends AbstractLocation implements MachineProvi
         }
     }
 
-    protected MachineLocation createKubernetesContainerLocation(Entity entity, ConfigBag setup) {
+    protected KubernetesMachineLocation createKubernetesContainerLocation(Entity entity, ConfigBag setup) {
         String deploymentName = lookup(KubernetesPod.DEPLOYMENT, entity, setup, entity.getId());
         Integer replicas = lookup(KubernetesPod.REPLICAS, entity, setup);
         List<String> volumes = lookup(KubernetesPod.PERSISTENT_VOLUMES, entity, setup);
@@ -998,7 +998,7 @@ public class KubernetesLocation extends AbstractLocation implements MachineProvi
     }
 
     @Override
-    public MachineProvisioningLocation<MachineLocation> newSubLocation(Map<?, ?> newFlags) {
+    public MachineProvisioningLocation<KubernetesMachineLocation> newSubLocation(Map<?, ?> newFlags) {
         throw new UnsupportedOperationException();
     }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9048959f/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocation.java
----------------------------------------------------------------------
diff --git a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocation.java b/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocation.java
index c724acb..af79dfd 100644
--- a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocation.java
+++ b/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocation.java
@@ -9,16 +9,14 @@ import org.apache.brooklyn.location.ssh.SshMachineLocation;
 import org.apache.brooklyn.util.core.config.ConfigBag;
 import org.apache.brooklyn.util.core.config.ResolvingConfigBag;
 import org.apache.brooklyn.util.net.Networking;
-import org.apache.brooklyn.util.text.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.ImmutableSet;
 
-import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesPod;
-import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesResource;
 import io.cloudsoft.amp.containerservice.kubernetes.location.KubernetesClientRegistry;
 import io.cloudsoft.amp.containerservice.kubernetes.location.KubernetesLocation;
+import io.cloudsoft.amp.containerservice.kubernetes.location.machine.KubernetesMachineLocation;
 import io.cloudsoft.amp.containerservice.openshift.entity.OpenShiftPod;
 import io.cloudsoft.amp.containerservice.openshift.entity.OpenShiftResource;
 import io.fabric8.kubernetes.api.model.Container;
@@ -85,7 +83,7 @@ public class OpenShiftLocation extends KubernetesLocation implements OpenShiftLo
     }
 
     @Override
-    protected boolean findResourceAddress(LocationSpec<SshMachineLocation> locationSpec, Entity entity, HasMetadata metadata, String resourceType, String resourceName, String namespace) {
+    protected boolean findResourceAddress(LocationSpec<? extends KubernetesMachineLocation> locationSpec, Entity entity, HasMetadata metadata, String resourceType, String resourceName, String namespace) {
         if (super.findResourceAddress(locationSpec, entity, metadata, resourceType, resourceName, namespace)) {
             return true;
         }