brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drigod...@apache.org
Subject [26/50] [abbrv] brooklyn-server git commit: no_entry: Move openshift classes to new location
Date Thu, 29 Jun 2017 15:36:08 GMT
no_entry: Move openshift classes to new location

Signed-off-by: Andrew Donald Kennedy <andrew.kennedy@cloudsoftcorp.com>


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

Branch: refs/heads/master
Commit: 350d1fb7a162d1327ffe9ed20fa66f54a22a983c
Parents: 445884b
Author: CloudsoftOps <ops@cloudsoft.io>
Authored: Thu May 18 18:01:09 2017 +0100
Committer: Andrew Donald Kennedy <andrew.kennedy@cloudsoftcorp.com>
Committed: Fri May 19 14:03:37 2017 +0100

----------------------------------------------------------------------
 .../entity/openshift/OpenShiftPod.java          |  10 +
 .../entity/openshift/OpenShiftPodImpl.java      |   7 +
 .../entity/openshift/OpenShiftResource.java     |  15 ++
 .../entity/openshift/OpenShiftResourceImpl.java |   6 +
 .../openshift/OpenShiftClientRegistryImpl.java  |  27 +++
 .../location/openshift/OpenShiftLocation.java   | 243 +++++++++++++++++++
 .../openshift/OpenShiftLocationConfig.java      |  15 ++
 .../openshift/OpenShiftLocationResolver.java    |  47 ++++
 .../openshift/OpenShiftLocationLiveTest.java    |  50 ++++
 .../OpenShiftLocationResolverTest.java          |  85 +++++++
 .../OpenShiftLocationYamlLiveTest.java          | 165 +++++++++++++
 .../openshift/entity/OpenShiftPod.java          |  10 -
 .../openshift/entity/OpenShiftPodImpl.java      |   7 -
 .../openshift/entity/OpenShiftResource.java     |  15 --
 .../openshift/entity/OpenShiftResourceImpl.java |   6 -
 .../location/OpenShiftClientRegistryImpl.java   |  27 ---
 .../openshift/location/OpenShiftLocation.java   | 243 -------------------
 .../location/OpenShiftLocationConfig.java       |  15 --
 .../location/OpenShiftLocationResolver.java     |  47 ----
 .../location/OpenShiftLocationLiveTest.java     |  50 ----
 .../location/OpenShiftLocationResolverTest.java |  85 -------
 .../location/OpenShiftLocationYamlLiveTest.java | 165 -------------
 22 files changed, 670 insertions(+), 670 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPod.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPod.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPod.java
new file mode 100644
index 0000000..0073904
--- /dev/null
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPod.java
@@ -0,0 +1,10 @@
+package io.cloudsoft.amp.containerservice.openshift.entity;
+
+import org.apache.brooklyn.api.entity.ImplementedBy;
+
+import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesPod;
+
+@ImplementedBy(OpenShiftPodImpl.class)
+public interface OpenShiftPod extends KubernetesPod {
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPodImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPodImpl.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPodImpl.java
new file mode 100644
index 0000000..49ffa4d
--- /dev/null
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftPodImpl.java
@@ -0,0 +1,7 @@
+package io.cloudsoft.amp.containerservice.openshift.entity;
+
+import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesPodImpl;
+
+public class OpenShiftPodImpl extends KubernetesPodImpl implements OpenShiftPod {
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResource.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResource.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResource.java
new file mode 100644
index 0000000..d4c8d95
--- /dev/null
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResource.java
@@ -0,0 +1,15 @@
+package io.cloudsoft.amp.containerservice.openshift.entity;
+
+import org.apache.brooklyn.api.entity.ImplementedBy;
+
+import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesResource;
+
+@ImplementedBy(OpenShiftResourceImpl.class)
+public interface OpenShiftResource extends KubernetesResource {
+
+    String DEPLOYMENT_CONFIG = "DeploymentConfig";
+    String PROJECT = "Project";
+    String TEMPLATE = "Template";
+    String BUILD_CONFIG = "BuildConfig";
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResourceImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResourceImpl.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResourceImpl.java
new file mode 100644
index 0000000..53badcc
--- /dev/null
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/entity/openshift/OpenShiftResourceImpl.java
@@ -0,0 +1,6 @@
+package io.cloudsoft.amp.containerservice.openshift.entity;
+
+import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesResourceImpl;
+
+public class OpenShiftResourceImpl extends KubernetesResourceImpl implements OpenShiftResource {
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftClientRegistryImpl.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftClientRegistryImpl.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftClientRegistryImpl.java
new file mode 100644
index 0000000..157fef5
--- /dev/null
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftClientRegistryImpl.java
@@ -0,0 +1,27 @@
+package io.cloudsoft.amp.containerservice.openshift.location;
+
+import org.apache.brooklyn.util.core.config.ConfigBag;
+
+import io.cloudsoft.amp.containerservice.kubernetes.location.KubernetesClientRegistryImpl;
+import io.fabric8.kubernetes.client.KubernetesClient;
+import io.fabric8.openshift.client.OpenShiftClient;
+
+public class OpenShiftClientRegistryImpl extends KubernetesClientRegistryImpl {
+
+    public static final OpenShiftClientRegistryImpl INSTANCE = new OpenShiftClientRegistryImpl();
+
+    /**
+     * The default OpenShift URL is set using the Kubernetes
+     * {@code KubernetesLocationConfig#MASTER_URL master URL} as follows:
+     * <pre>
+     * openShiftUrl = URLUtils.join(getMasterUrl(), "oapi", oapiVersion);
+     * </pre>
+     */
+    @Override
+    public KubernetesClient getKubernetesClient(ConfigBag conf) {
+        KubernetesClient client = super.getKubernetesClient(conf);
+        OpenShiftClient oClient = client.adapt(OpenShiftClient.class);
+        return oClient;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocation.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocation.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocation.java
new file mode 100644
index 0000000..af79dfd
--- /dev/null
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocation.java
@@ -0,0 +1,243 @@
+package io.cloudsoft.amp.containerservice.openshift.location;
+
+import java.net.InetAddress;
+import java.util.Map;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.location.LocationSpec;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ImmutableSet;
+
+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;
+import io.fabric8.kubernetes.api.model.HasMetadata;
+import io.fabric8.kubernetes.api.model.Namespace;
+import io.fabric8.kubernetes.api.model.Pod;
+import io.fabric8.kubernetes.api.model.PodTemplateSpec;
+import io.fabric8.kubernetes.api.model.PodTemplateSpecBuilder;
+import io.fabric8.kubernetes.client.KubernetesClient;
+import io.fabric8.kubernetes.client.KubernetesClientException;
+import io.fabric8.openshift.api.model.DeploymentConfig;
+import io.fabric8.openshift.api.model.DeploymentConfigBuilder;
+import io.fabric8.openshift.api.model.DeploymentConfigStatus;
+import io.fabric8.openshift.api.model.Project;
+import io.fabric8.openshift.api.model.ProjectBuilder;
+import io.fabric8.openshift.client.OpenShiftClient;
+
+public class OpenShiftLocation extends KubernetesLocation implements OpenShiftLocationConfig {
+
+    private static final Logger LOG = LoggerFactory.getLogger(OpenShiftLocation.class);
+
+    public static final String OPENSHIFT_GENERATED_BY = "openshift.io/generated-by";
+
+    private OpenShiftClient client;
+
+    public OpenShiftLocation() {
+        super();
+    }
+
+    public OpenShiftLocation(Map<?, ?> properties) {
+        super(properties);
+    }
+
+    @Override
+    protected KubernetesClient getClient(ConfigBag config) {
+        if (client == null) {
+            KubernetesClientRegistry registry = getConfig(OPENSHIFT_CLIENT_REGISTRY);
+            client = (OpenShiftClient) registry.getKubernetesClient(ResolvingConfigBag.newInstanceExtending(getManagementContext(), config));
+        }
+        return client;
+    }
+
+    @Override
+    protected boolean handleResourceDelete(String resourceType, String resourceName, String namespace) {
+        if (super.handleResourceDelete(resourceType, resourceName, namespace)) {
+            return true;
+        }
+
+        try {
+            switch (resourceType) {
+                case OpenShiftResource.DEPLOYMENT_CONFIG:
+                    return client.deploymentConfigs().inNamespace(namespace).withName(resourceName).delete();
+                case OpenShiftResource.PROJECT:
+                    return client.projects().withName(resourceName).delete();
+                case OpenShiftResource.TEMPLATE:
+                    return client.templates().inNamespace(namespace).withName(resourceName).delete();
+                case OpenShiftResource.BUILD_CONFIG:
+                    return client.buildConfigs().inNamespace(namespace).withName(resourceName).delete();
+            }
+        } catch (KubernetesClientException kce) {
+            LOG.warn("Error deleting resource {}: {}", resourceName, kce);
+        }
+        return false;
+    }
+
+    @Override
+    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;
+        }
+
+        if (resourceType.equals(OpenShiftResource.DEPLOYMENT_CONFIG)) {
+            DeploymentConfig deploymentConfig = (DeploymentConfig) metadata;
+            Map<String, String> labels = deploymentConfig.getSpec().getTemplate().getMetadata().getLabels();
+            Pod pod = getPod(namespace, labels);
+            entity.sensors().set(OpenShiftPod.KUBERNETES_POD, pod.getMetadata().getName());
+
+            InetAddress node = Networking.getInetAddressWithFixedName(pod.getSpec().getNodeName());
+            String podAddress = pod.getStatus().getPodIP();
+
+            locationSpec.configure("address", node);
+            locationSpec.configure(SshMachineLocation.PRIVATE_ADDRESSES, ImmutableSet.of(podAddress));
+
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    protected synchronized Namespace createOrGetNamespace(final String name, Boolean create) {
+        Project project = client.projects().withName(name).get();
+        ExitCondition projectReady = new ExitCondition() {
+            @Override
+            public Boolean call() {
+                Project actualProject = client.projects().withName(name).get();
+                return actualProject != null && actualProject.getStatus().getPhase().equals(PHASE_ACTIVE);
+            }
+            @Override
+            public String getFailureMessage() {
+                Project actualProject = client.projects().withName(name).get();
+                return "Project for " + name+ " " + (actualProject == null ? "absent" : " status " + actualProject.getStatus());
+            }
+        };
+        if (project != null) {
+            LOG.debug("Found project {}, returning it.", project);
+        } else if (create) {
+            project = client.projects().create(new ProjectBuilder().withNewMetadata().withName(name).endMetadata().build());
+            LOG.debug("Created project {}.", project);
+        } else {
+            throw new IllegalStateException("Project " + name + " does not exist and namespace.create is not set");
+        }
+        waitForExitCondition(projectReady);
+        return client.namespaces().withName(name).get();
+    }
+
+    @Override
+    protected synchronized void deleteEmptyNamespace(final String name) {
+        if (!name.equals("default") && isNamespaceEmpty(name)) {
+            if (client.projects().withName(name).get() != null &&
+                    !client.projects().withName(name).get().getStatus().getPhase().equals(PHASE_TERMINATING)) {
+                client.projects().withName(name).delete();
+                ExitCondition exitCondition = new ExitCondition() {
+                    @Override
+                    public Boolean call() {
+                        return client.projects().withName(name).get() == null;
+                    }
+                    @Override
+                    public String getFailureMessage() {
+                        return "Project " + name+ " still present";
+                    }
+                };
+                waitForExitCondition(exitCondition);
+            }
+        }
+    }
+
+    @Override
+    protected boolean isNamespaceEmpty(String namespace) {
+        return client.deploymentConfigs().inNamespace(namespace).list().getItems().isEmpty() &&
+               client.services().inNamespace(namespace).list().getItems().isEmpty() &&
+               client.secrets().inNamespace(namespace).list().getItems().isEmpty();
+    }
+
+    @Override
+    protected void deploy(final String namespace, Entity entity, Map<String, String> metadata, final String deploymentName, Container container, final Integer replicas, Map<String, String> secrets) {
+        PodTemplateSpecBuilder podTemplateSpecBuilder = new PodTemplateSpecBuilder()
+                .withNewMetadata()
+                    .addToLabels("name", deploymentName)
+                    .addToLabels(metadata)
+                .endMetadata()
+                .withNewSpec()
+                    .addToContainers(container)
+                .endSpec();
+        if (secrets != null) {
+            for (String secretName : secrets.keySet()) {
+                podTemplateSpecBuilder.withNewSpec()
+                            .addToContainers(container)
+                            .addNewImagePullSecret(secretName)
+                        .endSpec();
+            }
+        }
+        PodTemplateSpec template = podTemplateSpecBuilder.build();
+        DeploymentConfig deployment = new DeploymentConfigBuilder()
+                .withNewMetadata()
+                    .withName(deploymentName)
+                    .addToAnnotations(OPENSHIFT_GENERATED_BY, "AMP")
+                    .addToAnnotations(CLOUDSOFT_ENTITY_ID, entity.getId())
+                    .addToAnnotations(CLOUDSOFT_APPLICATION_ID, entity.getApplicationId())
+                .endMetadata()
+                .withNewSpec()
+                    .withNewStrategy()
+                        .withType("Recreate")
+                    .endStrategy()
+                    .addNewTrigger()
+                        .withType("ConfigChange")
+                    .endTrigger()
+                    .withReplicas(replicas)
+                    .addToSelector("name", deploymentName)
+                    .withTemplate(template)
+                .endSpec()
+                .build();
+        client.deploymentConfigs().inNamespace(namespace).create(deployment);
+        ExitCondition exitCondition = new ExitCondition() {
+            @Override
+            public Boolean call() {
+                DeploymentConfig dc = client.deploymentConfigs().inNamespace(namespace).withName(deploymentName).get();
+                DeploymentConfigStatus status = (dc == null) ? null : dc.getStatus();
+                Integer replicas = (status == null) ? null : status.getAvailableReplicas();
+                return replicas != null && replicas.intValue() == replicas;
+            }
+            @Override
+            public String getFailureMessage() {
+                DeploymentConfig dc = client.deploymentConfigs().inNamespace(namespace).withName(deploymentName).get();
+                DeploymentConfigStatus status = (dc == null) ? null : dc.getStatus();
+                return "Namespace=" + namespace + "; deploymentName= " + deploymentName + "; Deployment=" + dc + "; status=" + status;
+            }
+        };
+        waitForExitCondition(exitCondition);
+        LOG.debug("Deployed {} to namespace {}.", deployment, namespace);
+    }
+
+    @Override
+    protected String getContainerResourceType() {
+        return OpenShiftResource.DEPLOYMENT_CONFIG;
+    }
+
+    @Override
+    protected void undeploy(final String namespace, final String deployment, final String pod) {
+        client.deploymentConfigs().inNamespace(namespace).withName(deployment).delete();
+        ExitCondition exitCondition = new ExitCondition() {
+            @Override
+            public Boolean call() {
+                return client.deploymentConfigs().inNamespace(namespace).withName(deployment).get() == null;
+            }
+            @Override
+            public String getFailureMessage() {
+                return "No deployment with namespace=" + namespace + ", deployment=" + deployment;
+            }
+        };
+        waitForExitCondition(exitCondition);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationConfig.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationConfig.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationConfig.java
new file mode 100644
index 0000000..6dbf7b9
--- /dev/null
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationConfig.java
@@ -0,0 +1,15 @@
+package io.cloudsoft.amp.containerservice.openshift.location;
+
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+
+import io.cloudsoft.amp.containerservice.kubernetes.location.KubernetesClientRegistry;
+
+public interface OpenShiftLocationConfig {
+
+    ConfigKey<KubernetesClientRegistry> OPENSHIFT_CLIENT_REGISTRY = ConfigKeys.newConfigKey(
+            KubernetesClientRegistry.class, "openShiftClientRegistry",
+            "Registry/Factory for creating OpenShift client; default is almost always fine, " +
+                    "except where tests want to customize behaviour", OpenShiftClientRegistryImpl.INSTANCE);
+}
+

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationResolver.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationResolver.java b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationResolver.java
new file mode 100644
index 0000000..50300e1
--- /dev/null
+++ b/brooklyn-server/locations/container/src/main/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationResolver.java
@@ -0,0 +1,47 @@
+package io.cloudsoft.amp.containerservice.openshift.location;
+
+import org.apache.brooklyn.api.location.Location;
+import org.apache.brooklyn.api.location.LocationResolver;
+import org.apache.brooklyn.core.location.AbstractLocationResolver;
+import org.apache.brooklyn.core.location.LocationConfigUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Locations starting with the given prefix (@code "openshift") will use this resolver, to instantiate
+ * a {@link OpenShiftLocation}.
+ * 
+ * We ensure that config will be picked up from brooklyn.properties using the appropriate precedence:
+ * <ol>
+ *   <li>named location config
+ *   <li>Prefix {@code brooklyn.location.openshift.}
+ *   <li>Prefix {@code brooklyn.openshift.}
+ * </ol>
+ */
+public class OpenShiftLocationResolver extends AbstractLocationResolver implements LocationResolver {
+
+    public static final Logger log = LoggerFactory.getLogger(OpenShiftLocationResolver.class);
+
+    public static final String PREFIX = "openshift";
+
+    @Override
+    public boolean isEnabled() {
+        return LocationConfigUtils.isResolverPrefixEnabled(managementContext, getPrefix());
+    }
+
+    @Override
+    public String getPrefix() {
+        return PREFIX;
+    }
+
+    @Override
+    protected Class<? extends Location> getLocationType() {
+        return OpenShiftLocation.class;
+    }
+
+    @Override
+    protected SpecParser getSpecParser() {
+        return new SpecParser(getPrefix()).setExampleUsage("\"openshift\"");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/brooklyn-server/locations/container/src/test/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationLiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/test/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationLiveTest.java b/brooklyn-server/locations/container/src/test/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationLiveTest.java
new file mode 100644
index 0000000..2aa20c4
--- /dev/null
+++ b/brooklyn-server/locations/container/src/test/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationLiveTest.java
@@ -0,0 +1,50 @@
+package io.cloudsoft.amp.containerservice.openshift.location;
+
+import java.util.Map;
+
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.apache.brooklyn.util.os.Os;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.cloudsoft.amp.containerservice.kubernetes.location.KubernetesLocationLiveTest;
+
+/**
+ * Tests deploying containers via the {@code openshift"} location, to an OpenShift endpoint. 
+ * By extending {@link KubernetesLocationLiveTest}, we get all the k8s tests.
+ * 
+ * It needs configured with something like:
+ * 
+ * <pre>
+ * {@code
+ * -Dtest.amp.openshift.endpoint=https://192.168.99.100:8443/
+ * -Dtest.amp.openshift.certsBaseDir=~/repos/grkvlt/40bdf09b09d5896e19a9d287f41d39bb
+ * }
+ * </pre>
+ */
+public class OpenShiftLocationLiveTest extends KubernetesLocationLiveTest {
+
+    @SuppressWarnings("unused")
+    private static final Logger LOG = LoggerFactory.getLogger(OpenShiftLocationLiveTest.class);
+
+    public static final String OPENSHIFT_ENDPOINT = System.getProperty("test.amp.openshift.endpoint", "");
+    public static final String CERTS_BASE_DIR = System.getProperty("test.amp.openshift.certsBaseDir", Os.mergePaths(System.getProperty("user.home"), "openshift-certs"));
+    public static final String CA_CERT_FILE = System.getProperty("test.amp.openshift.caCert", Os.mergePaths(CERTS_BASE_DIR, "ca.crt"));
+    public static final String CLIENT_CERT_FILE = System.getProperty("test.amp.openshift.clientCert", Os.mergePaths(CERTS_BASE_DIR, "admin.crt"));
+    public static final String CLIENT_KEY_FILE = System.getProperty("test.amp.openshift.clientKey", Os.mergePaths(CERTS_BASE_DIR, "admin.key"));
+    public static final String NAMESPACE = System.getProperty("test.amp.openshift.namespace", "");
+
+    @Override
+    protected OpenShiftLocation newKubernetesLocation(Map<String, ?> flags) throws Exception {
+        Map<String,?> allFlags = MutableMap.<String,Object>builder()
+                .put("endpoint", OPENSHIFT_ENDPOINT)
+                .put("caCert", CA_CERT_FILE)
+                .put("clientCert", CLIENT_CERT_FILE)
+                .put("clientKey", CLIENT_KEY_FILE)
+                .put("namespace", NAMESPACE)
+                .put("privileged", true)
+                .putAll(flags)
+                .build();
+        return (OpenShiftLocation) mgmt.getLocationRegistry().getLocationManaged("openshift", allFlags);
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/brooklyn-server/locations/container/src/test/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationResolverTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/test/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationResolverTest.java b/brooklyn-server/locations/container/src/test/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationResolverTest.java
new file mode 100644
index 0000000..7d06460
--- /dev/null
+++ b/brooklyn-server/locations/container/src/test/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationResolverTest.java
@@ -0,0 +1,85 @@
+package io.cloudsoft.amp.containerservice.openshift.location;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Map;
+
+import org.apache.brooklyn.api.location.LocationSpec;
+import org.apache.brooklyn.core.internal.BrooklynProperties;
+import org.apache.brooklyn.core.test.BrooklynMgmtUnitTestSupport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class OpenShiftLocationResolverTest extends BrooklynMgmtUnitTestSupport {
+
+    private static final Logger LOG = LoggerFactory.getLogger(OpenShiftLocationResolverTest.class);
+
+    private BrooklynProperties brooklynProperties;
+
+    @BeforeMethod(alwaysRun = true)
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        brooklynProperties = mgmt.getBrooklynProperties();
+
+        brooklynProperties.put("brooklyn.location.openshift.identity", "openshift-id");
+        brooklynProperties.put("brooklyn.location.openshift.credential", "openshift-cred");
+    }
+
+    @Test
+    public void testGivesCorrectLocationType() {
+        LocationSpec<?> spec = getLocationSpec("openshift");
+        assertEquals(spec.getType(), OpenShiftLocation.class);
+
+        OpenShiftLocation loc = resolve("openshift");
+        assertTrue(loc instanceof OpenShiftLocation, "loc="+loc);
+    }
+
+    @Test
+    public void testParametersInSpecString() {
+        OpenShiftLocation loc = resolve("openshift(endpoint=myMasterUrl)");
+        assertEquals(loc.getConfig(OpenShiftLocation.MASTER_URL), "myMasterUrl");
+    }
+
+    @Test
+    public void testTakesDotSeparateProperty() {
+        brooklynProperties.put("brooklyn.location.openshift.endpoint", "myMasterUrl");
+        OpenShiftLocation loc = resolve("openshift");
+        assertEquals(loc.getConfig(OpenShiftLocation.MASTER_URL), "myMasterUrl");
+    }
+
+    @Test
+    public void testPropertiesPrecedence() {
+        // prefer those in "spec" over everything else
+        brooklynProperties.put("brooklyn.location.named.myopenshift", "openshift:(loginUser=\"loginUser-inSpec\")");
+
+        brooklynProperties.put("brooklyn.location.named.myopenshift.loginUser", "loginUser-inNamed");
+        brooklynProperties.put("brooklyn.location.openshift.loginUser", "loginUser-inDocker");
+
+        // prefer those in "named" over everything else
+        brooklynProperties.put("brooklyn.location.named.myopenshift.privateKeyFile", "privateKeyFile-inNamed");
+        brooklynProperties.put("brooklyn.location.openshift.privateKeyFile", "privateKeyFile-inDocker");
+
+        // prefer those in openshift-specific
+        brooklynProperties.put("brooklyn.location.openshift.publicKeyFile", "publicKeyFile-inDocker");
+
+        Map<String, Object> conf = resolve("named:myopenshift").config().getBag().getAllConfig();
+
+        assertEquals(conf.get("loginUser"), "loginUser-inSpec");
+        assertEquals(conf.get("privateKeyFile"), "privateKeyFile-inNamed");
+        assertEquals(conf.get("publicKeyFile"), "publicKeyFile-inDocker");
+    }
+
+    private LocationSpec<?> getLocationSpec(String spec) {
+        LOG.debug("Obtaining location spec '{}'", spec);
+        return mgmt.getLocationRegistry().getLocationSpec(spec).get();
+    }
+
+    private OpenShiftLocation resolve(String spec) {
+        LOG.debug("Resolving location spec '{}'", spec);
+        return (OpenShiftLocation) mgmt.getLocationRegistry().getLocationManaged(spec);
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/brooklyn-server/locations/container/src/test/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationYamlLiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/locations/container/src/test/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationYamlLiveTest.java b/brooklyn-server/locations/container/src/test/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationYamlLiveTest.java
new file mode 100644
index 0000000..08d8ec4
--- /dev/null
+++ b/brooklyn-server/locations/container/src/test/java/org/apache/brooklyn/container/location/openshift/OpenShiftLocationYamlLiveTest.java
@@ -0,0 +1,165 @@
+package io.cloudsoft.amp.containerservice.openshift.location;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.equalTo;
+import static com.google.common.base.Predicates.not;
+import static com.google.common.base.Predicates.notNull;
+import static io.cloudsoft.amp.containerservice.openshift.location.OpenShiftLocationLiveTest.CA_CERT_FILE;
+import static io.cloudsoft.amp.containerservice.openshift.location.OpenShiftLocationLiveTest.CLIENT_CERT_FILE;
+import static io.cloudsoft.amp.containerservice.openshift.location.OpenShiftLocationLiveTest.CLIENT_KEY_FILE;
+import static io.cloudsoft.amp.containerservice.openshift.location.OpenShiftLocationLiveTest.NAMESPACE;
+import static io.cloudsoft.amp.containerservice.openshift.location.OpenShiftLocationLiveTest.OPENSHIFT_ENDPOINT;
+import static org.apache.brooklyn.core.entity.EntityAsserts.assertAttribute;
+import static org.apache.brooklyn.core.entity.EntityAsserts.assertAttributeEquals;
+import static org.apache.brooklyn.core.entity.EntityAsserts.assertEntityHealthy;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.core.entity.Entities;
+import org.apache.brooklyn.entity.software.base.SoftwareProcess;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Iterables;
+
+import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesPod;
+import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesResource;
+import io.cloudsoft.amp.containerservice.kubernetes.location.KubernetesLocationYamlLiveTest;
+import io.cloudsoft.amp.containerservice.openshift.entity.OpenShiftPod;
+import io.cloudsoft.amp.containerservice.openshift.entity.OpenShiftResource;
+
+/**
+ * Tests YAML apps via the {@code openshift"} location, to an OpenShift endpoint.
+ * By extending {@link KubernetesLocationYamlLiveTest}, we get all the k8s tests.
+ * 
+ * It needs configured with something like:
+ * 
+ * <pre>
+ * {@code
+ * -Dtest.amp.openshift.endpoint=https://master.example.com:8443/
+ * -Dtest.amp.openshift.certsBaseDir=/Users/aled/repos/grkvlt/40bdf09b09d5896e19a9d287f41d39bb
+ * -Dtest.amp.openshift.namespace=test
+ * }
+ * </pre>
+ */
+public class OpenShiftLocationYamlLiveTest extends KubernetesLocationYamlLiveTest {
+
+    // TODO testTomcatContainer seems flaky on the OpenShift deployed at 10.101.1.139, 
+    // when using node2.
+    //
+    // The container's log shows it takes 355 seconds to deploy the default web application 
+    // directory /usr/local/tomcat/webapps/ROOT:
+    //    24-Nov-2016 22:04:11.906 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.39
+    //    24-Nov-2016 22:04:11.940 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/ROOT
+    //    24-Nov-2016 22:10:07.093 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [354,156] milliseconds.
+    //    24-Nov-2016 22:10:07.123 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/ROOT has finished in 355,183 ms
+    //    24-Nov-2016 22:10:07.133 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/docs
+    //    24-Nov-2016 22:10:07.172 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/docs has finished in 40 ms
+    //    24-Nov-2016 22:10:07.173 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/examples
+    //    24-Nov-2016 22:10:08.051 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/examples has finished in 878 ms
+    //    24-Nov-2016 22:10:08.052 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/host-manager
+    //    24-Nov-2016 22:10:08.104 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/host-manager has finished in 52 ms
+    //    24-Nov-2016 22:10:08.104 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/manager
+    //    24-Nov-2016 22:10:08.159 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/manager has finished in 55 ms
+    //
+    // With node1, it takes only 6 seconds to deploy the we app.
+
+    @BeforeMethod(alwaysRun=true)
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+
+        locationYaml = Joiner.on("\n").join(
+                "location:",
+                "  openshift:",
+                "    " + OpenShiftLocation.CLOUD_ENDPOINT.getName() + ": \"" + OPENSHIFT_ENDPOINT + "\"",
+                "    " + OpenShiftLocation.CA_CERT_FILE.getName() + ": \"" + CA_CERT_FILE + "\"",
+                "    " + OpenShiftLocation.CLIENT_CERT_FILE.getName() + ": \"" + CLIENT_CERT_FILE + "\"",
+                "    " + OpenShiftLocation.CLIENT_KEY_FILE.getName() + ": \"" + CLIENT_KEY_FILE + "\"",
+                "    " + OpenShiftLocation.NAMESPACE.getName() + ": \"" + NAMESPACE + "\"",
+                "    " + OpenShiftLocation.PRIVILEGED.getName() + ": true",
+                "    " + OpenShiftLocation.LOGIN_USER_PASSWORD.getName() + ": p4ssw0rd");
+    }
+
+    @Test(groups={"Live"})
+    public void testTomcatOpenShiftPod() throws Exception {
+        String yaml = Joiner.on("\n").join(
+                locationYaml,
+                "services:",
+                "  - type: " + OpenShiftPod.class.getName(),
+                "    brooklyn.config:",
+                "      docker.container.imageName: tomcat",
+                "      docker.container.inboundPorts: [ \"8080\" ]");
+
+        runTomcat(yaml, OpenShiftPod.class);
+    }
+
+    @Test(groups={"Live"})
+    public void testOpenShiftPod() throws Exception {
+        String yaml = Joiner.on("\n").join(
+                locationYaml,
+                "services:",
+                "  - type: " + OpenShiftPod.class.getName(),
+                "    brooklyn.config:",
+                "      docker.container.imageName: tomcat",
+                "      docker.container.inboundPorts:",
+                "        - \"8080\"",
+                "      shell.env:",
+                "        CLUSTER_ID: \"id\"",
+                "        CLUSTER_TOKEN: \"token\"");
+
+        Entity app = createStartWaitAndLogApplication(yaml);
+        checkPod(app, OpenShiftPod.class);
+    }
+
+    /* Test disabled as QA framework AMP does not have catalog entries deployed yet */
+    @Test(groups={"Live"}, enabled=false)
+    public void testOpenShiftPodCatalogEntry() throws Exception {
+        String yaml = Joiner.on("\n").join(
+                locationYaml,
+                "services:",
+                "  - type: openshift-pod-entity",
+                "    brooklyn.config:",
+                "      docker.container.imageName: tomcat",
+                "      docker.container.inboundPorts:",
+                "        - \"8080\"",
+                "      shell.env:",
+                "        CLUSTER_ID: \"id\"",
+                "        CLUSTER_TOKEN: \"token\"");
+
+        Entity app = createStartWaitAndLogApplication(yaml);
+        checkPod(app, OpenShiftPod.class);
+    }
+
+    @Test(groups={"Live"})
+    public void testNginxOpenShiftResource() throws Exception {
+        String yaml = Joiner.on("\n").join(
+                locationYaml,
+                "services:",
+                "  - type: " + OpenShiftResource.class.getName(),
+                "    id: nginx",
+                "    name: \"nginx\"",
+                "    brooklyn.config:",
+                "      resource: classpath://nginx.yaml");
+
+        Entity app = createStartWaitAndLogApplication(yaml);
+        checkNginxResource(app, OpenShiftResource.class);
+    }
+
+    /* Test disabled as QA framework AMP does not have catalog entries deployed yet */
+    @Test(groups={"Live"}, enabled=false)
+    public void testNginxOpenShiftResourceCatalogEntry() throws Exception {
+        String yaml = Joiner.on("\n").join(
+                locationYaml,
+                "services:",
+                "  - type: openshift-resource-entity",
+                "    id: nginx",
+                "    name: \"nginx\"",
+                "    brooklyn.config:",
+                "      resource: classpath://nginx.yaml");
+
+        Entity app = createStartWaitAndLogApplication(yaml);
+        checkNginxResource(app, OpenShiftResource.class);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftPod.java
----------------------------------------------------------------------
diff --git a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftPod.java b/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftPod.java
deleted file mode 100644
index 0073904..0000000
--- a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftPod.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package io.cloudsoft.amp.containerservice.openshift.entity;
-
-import org.apache.brooklyn.api.entity.ImplementedBy;
-
-import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesPod;
-
-@ImplementedBy(OpenShiftPodImpl.class)
-public interface OpenShiftPod extends KubernetesPod {
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftPodImpl.java
----------------------------------------------------------------------
diff --git a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftPodImpl.java b/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftPodImpl.java
deleted file mode 100644
index 49ffa4d..0000000
--- a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftPodImpl.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package io.cloudsoft.amp.containerservice.openshift.entity;
-
-import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesPodImpl;
-
-public class OpenShiftPodImpl extends KubernetesPodImpl implements OpenShiftPod {
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftResource.java
----------------------------------------------------------------------
diff --git a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftResource.java b/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftResource.java
deleted file mode 100644
index d4c8d95..0000000
--- a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftResource.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package io.cloudsoft.amp.containerservice.openshift.entity;
-
-import org.apache.brooklyn.api.entity.ImplementedBy;
-
-import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesResource;
-
-@ImplementedBy(OpenShiftResourceImpl.class)
-public interface OpenShiftResource extends KubernetesResource {
-
-    String DEPLOYMENT_CONFIG = "DeploymentConfig";
-    String PROJECT = "Project";
-    String TEMPLATE = "Template";
-    String BUILD_CONFIG = "BuildConfig";
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftResourceImpl.java
----------------------------------------------------------------------
diff --git a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftResourceImpl.java b/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftResourceImpl.java
deleted file mode 100644
index 53badcc..0000000
--- a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/entity/OpenShiftResourceImpl.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package io.cloudsoft.amp.containerservice.openshift.entity;
-
-import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesResourceImpl;
-
-public class OpenShiftResourceImpl extends KubernetesResourceImpl implements OpenShiftResource {
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftClientRegistryImpl.java
----------------------------------------------------------------------
diff --git a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftClientRegistryImpl.java b/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftClientRegistryImpl.java
deleted file mode 100644
index 157fef5..0000000
--- a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftClientRegistryImpl.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package io.cloudsoft.amp.containerservice.openshift.location;
-
-import org.apache.brooklyn.util.core.config.ConfigBag;
-
-import io.cloudsoft.amp.containerservice.kubernetes.location.KubernetesClientRegistryImpl;
-import io.fabric8.kubernetes.client.KubernetesClient;
-import io.fabric8.openshift.client.OpenShiftClient;
-
-public class OpenShiftClientRegistryImpl extends KubernetesClientRegistryImpl {
-
-    public static final OpenShiftClientRegistryImpl INSTANCE = new OpenShiftClientRegistryImpl();
-
-    /**
-     * The default OpenShift URL is set using the Kubernetes
-     * {@code KubernetesLocationConfig#MASTER_URL master URL} as follows:
-     * <pre>
-     * openShiftUrl = URLUtils.join(getMasterUrl(), "oapi", oapiVersion);
-     * </pre>
-     */
-    @Override
-    public KubernetesClient getKubernetesClient(ConfigBag conf) {
-        KubernetesClient client = super.getKubernetesClient(conf);
-        OpenShiftClient oClient = client.adapt(OpenShiftClient.class);
-        return oClient;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/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
deleted file mode 100644
index af79dfd..0000000
--- a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocation.java
+++ /dev/null
@@ -1,243 +0,0 @@
-package io.cloudsoft.amp.containerservice.openshift.location;
-
-import java.net.InetAddress;
-import java.util.Map;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.LocationSpec;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.ImmutableSet;
-
-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;
-import io.fabric8.kubernetes.api.model.HasMetadata;
-import io.fabric8.kubernetes.api.model.Namespace;
-import io.fabric8.kubernetes.api.model.Pod;
-import io.fabric8.kubernetes.api.model.PodTemplateSpec;
-import io.fabric8.kubernetes.api.model.PodTemplateSpecBuilder;
-import io.fabric8.kubernetes.client.KubernetesClient;
-import io.fabric8.kubernetes.client.KubernetesClientException;
-import io.fabric8.openshift.api.model.DeploymentConfig;
-import io.fabric8.openshift.api.model.DeploymentConfigBuilder;
-import io.fabric8.openshift.api.model.DeploymentConfigStatus;
-import io.fabric8.openshift.api.model.Project;
-import io.fabric8.openshift.api.model.ProjectBuilder;
-import io.fabric8.openshift.client.OpenShiftClient;
-
-public class OpenShiftLocation extends KubernetesLocation implements OpenShiftLocationConfig {
-
-    private static final Logger LOG = LoggerFactory.getLogger(OpenShiftLocation.class);
-
-    public static final String OPENSHIFT_GENERATED_BY = "openshift.io/generated-by";
-
-    private OpenShiftClient client;
-
-    public OpenShiftLocation() {
-        super();
-    }
-
-    public OpenShiftLocation(Map<?, ?> properties) {
-        super(properties);
-    }
-
-    @Override
-    protected KubernetesClient getClient(ConfigBag config) {
-        if (client == null) {
-            KubernetesClientRegistry registry = getConfig(OPENSHIFT_CLIENT_REGISTRY);
-            client = (OpenShiftClient) registry.getKubernetesClient(ResolvingConfigBag.newInstanceExtending(getManagementContext(), config));
-        }
-        return client;
-    }
-
-    @Override
-    protected boolean handleResourceDelete(String resourceType, String resourceName, String namespace) {
-        if (super.handleResourceDelete(resourceType, resourceName, namespace)) {
-            return true;
-        }
-
-        try {
-            switch (resourceType) {
-                case OpenShiftResource.DEPLOYMENT_CONFIG:
-                    return client.deploymentConfigs().inNamespace(namespace).withName(resourceName).delete();
-                case OpenShiftResource.PROJECT:
-                    return client.projects().withName(resourceName).delete();
-                case OpenShiftResource.TEMPLATE:
-                    return client.templates().inNamespace(namespace).withName(resourceName).delete();
-                case OpenShiftResource.BUILD_CONFIG:
-                    return client.buildConfigs().inNamespace(namespace).withName(resourceName).delete();
-            }
-        } catch (KubernetesClientException kce) {
-            LOG.warn("Error deleting resource {}: {}", resourceName, kce);
-        }
-        return false;
-    }
-
-    @Override
-    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;
-        }
-
-        if (resourceType.equals(OpenShiftResource.DEPLOYMENT_CONFIG)) {
-            DeploymentConfig deploymentConfig = (DeploymentConfig) metadata;
-            Map<String, String> labels = deploymentConfig.getSpec().getTemplate().getMetadata().getLabels();
-            Pod pod = getPod(namespace, labels);
-            entity.sensors().set(OpenShiftPod.KUBERNETES_POD, pod.getMetadata().getName());
-
-            InetAddress node = Networking.getInetAddressWithFixedName(pod.getSpec().getNodeName());
-            String podAddress = pod.getStatus().getPodIP();
-
-            locationSpec.configure("address", node);
-            locationSpec.configure(SshMachineLocation.PRIVATE_ADDRESSES, ImmutableSet.of(podAddress));
-
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    @Override
-    protected synchronized Namespace createOrGetNamespace(final String name, Boolean create) {
-        Project project = client.projects().withName(name).get();
-        ExitCondition projectReady = new ExitCondition() {
-            @Override
-            public Boolean call() {
-                Project actualProject = client.projects().withName(name).get();
-                return actualProject != null && actualProject.getStatus().getPhase().equals(PHASE_ACTIVE);
-            }
-            @Override
-            public String getFailureMessage() {
-                Project actualProject = client.projects().withName(name).get();
-                return "Project for " + name+ " " + (actualProject == null ? "absent" : " status " + actualProject.getStatus());
-            }
-        };
-        if (project != null) {
-            LOG.debug("Found project {}, returning it.", project);
-        } else if (create) {
-            project = client.projects().create(new ProjectBuilder().withNewMetadata().withName(name).endMetadata().build());
-            LOG.debug("Created project {}.", project);
-        } else {
-            throw new IllegalStateException("Project " + name + " does not exist and namespace.create is not set");
-        }
-        waitForExitCondition(projectReady);
-        return client.namespaces().withName(name).get();
-    }
-
-    @Override
-    protected synchronized void deleteEmptyNamespace(final String name) {
-        if (!name.equals("default") && isNamespaceEmpty(name)) {
-            if (client.projects().withName(name).get() != null &&
-                    !client.projects().withName(name).get().getStatus().getPhase().equals(PHASE_TERMINATING)) {
-                client.projects().withName(name).delete();
-                ExitCondition exitCondition = new ExitCondition() {
-                    @Override
-                    public Boolean call() {
-                        return client.projects().withName(name).get() == null;
-                    }
-                    @Override
-                    public String getFailureMessage() {
-                        return "Project " + name+ " still present";
-                    }
-                };
-                waitForExitCondition(exitCondition);
-            }
-        }
-    }
-
-    @Override
-    protected boolean isNamespaceEmpty(String namespace) {
-        return client.deploymentConfigs().inNamespace(namespace).list().getItems().isEmpty() &&
-               client.services().inNamespace(namespace).list().getItems().isEmpty() &&
-               client.secrets().inNamespace(namespace).list().getItems().isEmpty();
-    }
-
-    @Override
-    protected void deploy(final String namespace, Entity entity, Map<String, String> metadata, final String deploymentName, Container container, final Integer replicas, Map<String, String> secrets) {
-        PodTemplateSpecBuilder podTemplateSpecBuilder = new PodTemplateSpecBuilder()
-                .withNewMetadata()
-                    .addToLabels("name", deploymentName)
-                    .addToLabels(metadata)
-                .endMetadata()
-                .withNewSpec()
-                    .addToContainers(container)
-                .endSpec();
-        if (secrets != null) {
-            for (String secretName : secrets.keySet()) {
-                podTemplateSpecBuilder.withNewSpec()
-                            .addToContainers(container)
-                            .addNewImagePullSecret(secretName)
-                        .endSpec();
-            }
-        }
-        PodTemplateSpec template = podTemplateSpecBuilder.build();
-        DeploymentConfig deployment = new DeploymentConfigBuilder()
-                .withNewMetadata()
-                    .withName(deploymentName)
-                    .addToAnnotations(OPENSHIFT_GENERATED_BY, "AMP")
-                    .addToAnnotations(CLOUDSOFT_ENTITY_ID, entity.getId())
-                    .addToAnnotations(CLOUDSOFT_APPLICATION_ID, entity.getApplicationId())
-                .endMetadata()
-                .withNewSpec()
-                    .withNewStrategy()
-                        .withType("Recreate")
-                    .endStrategy()
-                    .addNewTrigger()
-                        .withType("ConfigChange")
-                    .endTrigger()
-                    .withReplicas(replicas)
-                    .addToSelector("name", deploymentName)
-                    .withTemplate(template)
-                .endSpec()
-                .build();
-        client.deploymentConfigs().inNamespace(namespace).create(deployment);
-        ExitCondition exitCondition = new ExitCondition() {
-            @Override
-            public Boolean call() {
-                DeploymentConfig dc = client.deploymentConfigs().inNamespace(namespace).withName(deploymentName).get();
-                DeploymentConfigStatus status = (dc == null) ? null : dc.getStatus();
-                Integer replicas = (status == null) ? null : status.getAvailableReplicas();
-                return replicas != null && replicas.intValue() == replicas;
-            }
-            @Override
-            public String getFailureMessage() {
-                DeploymentConfig dc = client.deploymentConfigs().inNamespace(namespace).withName(deploymentName).get();
-                DeploymentConfigStatus status = (dc == null) ? null : dc.getStatus();
-                return "Namespace=" + namespace + "; deploymentName= " + deploymentName + "; Deployment=" + dc + "; status=" + status;
-            }
-        };
-        waitForExitCondition(exitCondition);
-        LOG.debug("Deployed {} to namespace {}.", deployment, namespace);
-    }
-
-    @Override
-    protected String getContainerResourceType() {
-        return OpenShiftResource.DEPLOYMENT_CONFIG;
-    }
-
-    @Override
-    protected void undeploy(final String namespace, final String deployment, final String pod) {
-        client.deploymentConfigs().inNamespace(namespace).withName(deployment).delete();
-        ExitCondition exitCondition = new ExitCondition() {
-            @Override
-            public Boolean call() {
-                return client.deploymentConfigs().inNamespace(namespace).withName(deployment).get() == null;
-            }
-            @Override
-            public String getFailureMessage() {
-                return "No deployment with namespace=" + namespace + ", deployment=" + deployment;
-            }
-        };
-        waitForExitCondition(exitCondition);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationConfig.java
----------------------------------------------------------------------
diff --git a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationConfig.java b/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationConfig.java
deleted file mode 100644
index 6dbf7b9..0000000
--- a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationConfig.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package io.cloudsoft.amp.containerservice.openshift.location;
-
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-
-import io.cloudsoft.amp.containerservice.kubernetes.location.KubernetesClientRegistry;
-
-public interface OpenShiftLocationConfig {
-
-    ConfigKey<KubernetesClientRegistry> OPENSHIFT_CLIENT_REGISTRY = ConfigKeys.newConfigKey(
-            KubernetesClientRegistry.class, "openShiftClientRegistry",
-            "Registry/Factory for creating OpenShift client; default is almost always fine, " +
-                    "except where tests want to customize behaviour", OpenShiftClientRegistryImpl.INSTANCE);
-}
-

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationResolver.java
----------------------------------------------------------------------
diff --git a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationResolver.java b/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationResolver.java
deleted file mode 100644
index 50300e1..0000000
--- a/openshift-location/src/main/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationResolver.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package io.cloudsoft.amp.containerservice.openshift.location;
-
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationResolver;
-import org.apache.brooklyn.core.location.AbstractLocationResolver;
-import org.apache.brooklyn.core.location.LocationConfigUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Locations starting with the given prefix (@code "openshift") will use this resolver, to instantiate
- * a {@link OpenShiftLocation}.
- * 
- * We ensure that config will be picked up from brooklyn.properties using the appropriate precedence:
- * <ol>
- *   <li>named location config
- *   <li>Prefix {@code brooklyn.location.openshift.}
- *   <li>Prefix {@code brooklyn.openshift.}
- * </ol>
- */
-public class OpenShiftLocationResolver extends AbstractLocationResolver implements LocationResolver {
-
-    public static final Logger log = LoggerFactory.getLogger(OpenShiftLocationResolver.class);
-
-    public static final String PREFIX = "openshift";
-
-    @Override
-    public boolean isEnabled() {
-        return LocationConfigUtils.isResolverPrefixEnabled(managementContext, getPrefix());
-    }
-
-    @Override
-    public String getPrefix() {
-        return PREFIX;
-    }
-
-    @Override
-    protected Class<? extends Location> getLocationType() {
-        return OpenShiftLocation.class;
-    }
-
-    @Override
-    protected SpecParser getSpecParser() {
-        return new SpecParser(getPrefix()).setExampleUsage("\"openshift\"");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/openshift-location/src/test/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationLiveTest.java
----------------------------------------------------------------------
diff --git a/openshift-location/src/test/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationLiveTest.java b/openshift-location/src/test/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationLiveTest.java
deleted file mode 100644
index 2aa20c4..0000000
--- a/openshift-location/src/test/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationLiveTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package io.cloudsoft.amp.containerservice.openshift.location;
-
-import java.util.Map;
-
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.os.Os;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import io.cloudsoft.amp.containerservice.kubernetes.location.KubernetesLocationLiveTest;
-
-/**
- * Tests deploying containers via the {@code openshift"} location, to an OpenShift endpoint. 
- * By extending {@link KubernetesLocationLiveTest}, we get all the k8s tests.
- * 
- * It needs configured with something like:
- * 
- * <pre>
- * {@code
- * -Dtest.amp.openshift.endpoint=https://192.168.99.100:8443/
- * -Dtest.amp.openshift.certsBaseDir=~/repos/grkvlt/40bdf09b09d5896e19a9d287f41d39bb
- * }
- * </pre>
- */
-public class OpenShiftLocationLiveTest extends KubernetesLocationLiveTest {
-
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(OpenShiftLocationLiveTest.class);
-
-    public static final String OPENSHIFT_ENDPOINT = System.getProperty("test.amp.openshift.endpoint", "");
-    public static final String CERTS_BASE_DIR = System.getProperty("test.amp.openshift.certsBaseDir", Os.mergePaths(System.getProperty("user.home"), "openshift-certs"));
-    public static final String CA_CERT_FILE = System.getProperty("test.amp.openshift.caCert", Os.mergePaths(CERTS_BASE_DIR, "ca.crt"));
-    public static final String CLIENT_CERT_FILE = System.getProperty("test.amp.openshift.clientCert", Os.mergePaths(CERTS_BASE_DIR, "admin.crt"));
-    public static final String CLIENT_KEY_FILE = System.getProperty("test.amp.openshift.clientKey", Os.mergePaths(CERTS_BASE_DIR, "admin.key"));
-    public static final String NAMESPACE = System.getProperty("test.amp.openshift.namespace", "");
-
-    @Override
-    protected OpenShiftLocation newKubernetesLocation(Map<String, ?> flags) throws Exception {
-        Map<String,?> allFlags = MutableMap.<String,Object>builder()
-                .put("endpoint", OPENSHIFT_ENDPOINT)
-                .put("caCert", CA_CERT_FILE)
-                .put("clientCert", CLIENT_CERT_FILE)
-                .put("clientKey", CLIENT_KEY_FILE)
-                .put("namespace", NAMESPACE)
-                .put("privileged", true)
-                .putAll(flags)
-                .build();
-        return (OpenShiftLocation) mgmt.getLocationRegistry().getLocationManaged("openshift", allFlags);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/openshift-location/src/test/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationResolverTest.java
----------------------------------------------------------------------
diff --git a/openshift-location/src/test/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationResolverTest.java b/openshift-location/src/test/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationResolverTest.java
deleted file mode 100644
index 7d06460..0000000
--- a/openshift-location/src/test/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationResolverTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package io.cloudsoft.amp.containerservice.openshift.location;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Map;
-
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.test.BrooklynMgmtUnitTestSupport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-public class OpenShiftLocationResolverTest extends BrooklynMgmtUnitTestSupport {
-
-    private static final Logger LOG = LoggerFactory.getLogger(OpenShiftLocationResolverTest.class);
-
-    private BrooklynProperties brooklynProperties;
-
-    @BeforeMethod(alwaysRun = true)
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        brooklynProperties = mgmt.getBrooklynProperties();
-
-        brooklynProperties.put("brooklyn.location.openshift.identity", "openshift-id");
-        brooklynProperties.put("brooklyn.location.openshift.credential", "openshift-cred");
-    }
-
-    @Test
-    public void testGivesCorrectLocationType() {
-        LocationSpec<?> spec = getLocationSpec("openshift");
-        assertEquals(spec.getType(), OpenShiftLocation.class);
-
-        OpenShiftLocation loc = resolve("openshift");
-        assertTrue(loc instanceof OpenShiftLocation, "loc="+loc);
-    }
-
-    @Test
-    public void testParametersInSpecString() {
-        OpenShiftLocation loc = resolve("openshift(endpoint=myMasterUrl)");
-        assertEquals(loc.getConfig(OpenShiftLocation.MASTER_URL), "myMasterUrl");
-    }
-
-    @Test
-    public void testTakesDotSeparateProperty() {
-        brooklynProperties.put("brooklyn.location.openshift.endpoint", "myMasterUrl");
-        OpenShiftLocation loc = resolve("openshift");
-        assertEquals(loc.getConfig(OpenShiftLocation.MASTER_URL), "myMasterUrl");
-    }
-
-    @Test
-    public void testPropertiesPrecedence() {
-        // prefer those in "spec" over everything else
-        brooklynProperties.put("brooklyn.location.named.myopenshift", "openshift:(loginUser=\"loginUser-inSpec\")");
-
-        brooklynProperties.put("brooklyn.location.named.myopenshift.loginUser", "loginUser-inNamed");
-        brooklynProperties.put("brooklyn.location.openshift.loginUser", "loginUser-inDocker");
-
-        // prefer those in "named" over everything else
-        brooklynProperties.put("brooklyn.location.named.myopenshift.privateKeyFile", "privateKeyFile-inNamed");
-        brooklynProperties.put("brooklyn.location.openshift.privateKeyFile", "privateKeyFile-inDocker");
-
-        // prefer those in openshift-specific
-        brooklynProperties.put("brooklyn.location.openshift.publicKeyFile", "publicKeyFile-inDocker");
-
-        Map<String, Object> conf = resolve("named:myopenshift").config().getBag().getAllConfig();
-
-        assertEquals(conf.get("loginUser"), "loginUser-inSpec");
-        assertEquals(conf.get("privateKeyFile"), "privateKeyFile-inNamed");
-        assertEquals(conf.get("publicKeyFile"), "publicKeyFile-inDocker");
-    }
-
-    private LocationSpec<?> getLocationSpec(String spec) {
-        LOG.debug("Obtaining location spec '{}'", spec);
-        return mgmt.getLocationRegistry().getLocationSpec(spec).get();
-    }
-
-    private OpenShiftLocation resolve(String spec) {
-        LOG.debug("Resolving location spec '{}'", spec);
-        return (OpenShiftLocation) mgmt.getLocationRegistry().getLocationManaged(spec);
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/350d1fb7/openshift-location/src/test/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationYamlLiveTest.java
----------------------------------------------------------------------
diff --git a/openshift-location/src/test/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationYamlLiveTest.java b/openshift-location/src/test/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationYamlLiveTest.java
deleted file mode 100644
index 08d8ec4..0000000
--- a/openshift-location/src/test/java/io/cloudsoft/amp/containerservice/openshift/location/OpenShiftLocationYamlLiveTest.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package io.cloudsoft.amp.containerservice.openshift.location;
-
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.equalTo;
-import static com.google.common.base.Predicates.not;
-import static com.google.common.base.Predicates.notNull;
-import static io.cloudsoft.amp.containerservice.openshift.location.OpenShiftLocationLiveTest.CA_CERT_FILE;
-import static io.cloudsoft.amp.containerservice.openshift.location.OpenShiftLocationLiveTest.CLIENT_CERT_FILE;
-import static io.cloudsoft.amp.containerservice.openshift.location.OpenShiftLocationLiveTest.CLIENT_KEY_FILE;
-import static io.cloudsoft.amp.containerservice.openshift.location.OpenShiftLocationLiveTest.NAMESPACE;
-import static io.cloudsoft.amp.containerservice.openshift.location.OpenShiftLocationLiveTest.OPENSHIFT_ENDPOINT;
-import static org.apache.brooklyn.core.entity.EntityAsserts.assertAttribute;
-import static org.apache.brooklyn.core.entity.EntityAsserts.assertAttributeEquals;
-import static org.apache.brooklyn.core.entity.EntityAsserts.assertEntityHealthy;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.entity.software.base.SoftwareProcess;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.Iterables;
-
-import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesPod;
-import io.cloudsoft.amp.containerservice.kubernetes.entity.KubernetesResource;
-import io.cloudsoft.amp.containerservice.kubernetes.location.KubernetesLocationYamlLiveTest;
-import io.cloudsoft.amp.containerservice.openshift.entity.OpenShiftPod;
-import io.cloudsoft.amp.containerservice.openshift.entity.OpenShiftResource;
-
-/**
- * Tests YAML apps via the {@code openshift"} location, to an OpenShift endpoint.
- * By extending {@link KubernetesLocationYamlLiveTest}, we get all the k8s tests.
- * 
- * It needs configured with something like:
- * 
- * <pre>
- * {@code
- * -Dtest.amp.openshift.endpoint=https://master.example.com:8443/
- * -Dtest.amp.openshift.certsBaseDir=/Users/aled/repos/grkvlt/40bdf09b09d5896e19a9d287f41d39bb
- * -Dtest.amp.openshift.namespace=test
- * }
- * </pre>
- */
-public class OpenShiftLocationYamlLiveTest extends KubernetesLocationYamlLiveTest {
-
-    // TODO testTomcatContainer seems flaky on the OpenShift deployed at 10.101.1.139, 
-    // when using node2.
-    //
-    // The container's log shows it takes 355 seconds to deploy the default web application 
-    // directory /usr/local/tomcat/webapps/ROOT:
-    //    24-Nov-2016 22:04:11.906 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.39
-    //    24-Nov-2016 22:04:11.940 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/ROOT
-    //    24-Nov-2016 22:10:07.093 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [354,156] milliseconds.
-    //    24-Nov-2016 22:10:07.123 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/ROOT has finished in 355,183 ms
-    //    24-Nov-2016 22:10:07.133 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/docs
-    //    24-Nov-2016 22:10:07.172 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/docs has finished in 40 ms
-    //    24-Nov-2016 22:10:07.173 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/examples
-    //    24-Nov-2016 22:10:08.051 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/examples has finished in 878 ms
-    //    24-Nov-2016 22:10:08.052 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/host-manager
-    //    24-Nov-2016 22:10:08.104 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/host-manager has finished in 52 ms
-    //    24-Nov-2016 22:10:08.104 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/local/tomcat/webapps/manager
-    //    24-Nov-2016 22:10:08.159 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/local/tomcat/webapps/manager has finished in 55 ms
-    //
-    // With node1, it takes only 6 seconds to deploy the we app.
-
-    @BeforeMethod(alwaysRun=true)
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-
-        locationYaml = Joiner.on("\n").join(
-                "location:",
-                "  openshift:",
-                "    " + OpenShiftLocation.CLOUD_ENDPOINT.getName() + ": \"" + OPENSHIFT_ENDPOINT + "\"",
-                "    " + OpenShiftLocation.CA_CERT_FILE.getName() + ": \"" + CA_CERT_FILE + "\"",
-                "    " + OpenShiftLocation.CLIENT_CERT_FILE.getName() + ": \"" + CLIENT_CERT_FILE + "\"",
-                "    " + OpenShiftLocation.CLIENT_KEY_FILE.getName() + ": \"" + CLIENT_KEY_FILE + "\"",
-                "    " + OpenShiftLocation.NAMESPACE.getName() + ": \"" + NAMESPACE + "\"",
-                "    " + OpenShiftLocation.PRIVILEGED.getName() + ": true",
-                "    " + OpenShiftLocation.LOGIN_USER_PASSWORD.getName() + ": p4ssw0rd");
-    }
-
-    @Test(groups={"Live"})
-    public void testTomcatOpenShiftPod() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                locationYaml,
-                "services:",
-                "  - type: " + OpenShiftPod.class.getName(),
-                "    brooklyn.config:",
-                "      docker.container.imageName: tomcat",
-                "      docker.container.inboundPorts: [ \"8080\" ]");
-
-        runTomcat(yaml, OpenShiftPod.class);
-    }
-
-    @Test(groups={"Live"})
-    public void testOpenShiftPod() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                locationYaml,
-                "services:",
-                "  - type: " + OpenShiftPod.class.getName(),
-                "    brooklyn.config:",
-                "      docker.container.imageName: tomcat",
-                "      docker.container.inboundPorts:",
-                "        - \"8080\"",
-                "      shell.env:",
-                "        CLUSTER_ID: \"id\"",
-                "        CLUSTER_TOKEN: \"token\"");
-
-        Entity app = createStartWaitAndLogApplication(yaml);
-        checkPod(app, OpenShiftPod.class);
-    }
-
-    /* Test disabled as QA framework AMP does not have catalog entries deployed yet */
-    @Test(groups={"Live"}, enabled=false)
-    public void testOpenShiftPodCatalogEntry() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                locationYaml,
-                "services:",
-                "  - type: openshift-pod-entity",
-                "    brooklyn.config:",
-                "      docker.container.imageName: tomcat",
-                "      docker.container.inboundPorts:",
-                "        - \"8080\"",
-                "      shell.env:",
-                "        CLUSTER_ID: \"id\"",
-                "        CLUSTER_TOKEN: \"token\"");
-
-        Entity app = createStartWaitAndLogApplication(yaml);
-        checkPod(app, OpenShiftPod.class);
-    }
-
-    @Test(groups={"Live"})
-    public void testNginxOpenShiftResource() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                locationYaml,
-                "services:",
-                "  - type: " + OpenShiftResource.class.getName(),
-                "    id: nginx",
-                "    name: \"nginx\"",
-                "    brooklyn.config:",
-                "      resource: classpath://nginx.yaml");
-
-        Entity app = createStartWaitAndLogApplication(yaml);
-        checkNginxResource(app, OpenShiftResource.class);
-    }
-
-    /* Test disabled as QA framework AMP does not have catalog entries deployed yet */
-    @Test(groups={"Live"}, enabled=false)
-    public void testNginxOpenShiftResourceCatalogEntry() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                locationYaml,
-                "services:",
-                "  - type: openshift-resource-entity",
-                "    id: nginx",
-                "    name: \"nginx\"",
-                "    brooklyn.config:",
-                "      resource: classpath://nginx.yaml");
-
-        Entity app = createStartWaitAndLogApplication(yaml);
-        checkNginxResource(app, OpenShiftResource.class);
-    }
-
-}


Mime
View raw message