Package io.fabric8.process.manager.support

Examples of io.fabric8.process.manager.support.DefaultProcessControllerTest


        labels.put("container", name);

        pod.setLabels(labels);
        DesiredState desiredState = new DesiredState();
        pod.setDesiredState(desiredState);
        Manifest manifest = new Manifest();
        manifest.setVersion(Manifest.Version.V_1_BETA_1);
        desiredState.setManifest(manifest);

        ManifestContainer manifestContainer = new ManifestContainer();
        manifestContainer.setName(name);
        manifestContainer.setImage(image);

        List<ManifestContainer> containers = new ArrayList<>();
        containers.add(manifestContainer);
        manifest.setContainers(containers);

        System.out.println("About to create pod on " + kubernetesFactory.getAddress() + " with " + pod);
        kubernetes.createPod(pod);
        System.out.println("Created pod: " + name);
        System.out.println();
View Full Code Here


        CurrentState currentState = podInfo.getCurrentState();
        if (currentState != null) {
            printValue("Host", currentState.getHost());
            printValue("IP", currentState.getPodIP());
            printValue("Status", currentState.getStatus());
            PodContainerManifest manifest = currentState.getManifest();
        }
        DesiredState desiredState = podInfo.getDesiredState();
        if (desiredState != null) {
            Manifest manifest = desiredState.getManifest();
            if (manifest != null) {
                List<ManifestContainer> containers = manifest.getContainers();
                if (notEmpty(containers)) {
                    System.out.println("Containers:");
                    indentCount++;
                    for (ManifestContainer container : containers) {
                        printValue("Name", container.getName());
                        printValue("Image", container.getImage());
                        printValue("Working Dir", container.getWorkingDir());
                        printValue("Command", container.getCommand());

                        List<Port> ports = container.getPorts();
                        if (notEmpty(ports)) {
                            println("Ports:");
                            indentCount++;
                            for (Port port : ports) {
                                printValue("Name", port.getName());
                                printValue("Protocol", port.getProtocol());
                                printValue("Host Port", port.getHostPort());
                                printValue("Container Port", port.getContainerPort());
                            }
                            indentCount--;
                        }

                        List<Env> envList = container.getEnv();
                        if (notEmpty(envList)) {
                            println("Environment:");
                            indentCount++;
                            for (Env env : envList) {
                                printValue(env.getName(), env.getValue());
                            }
                            indentCount--;
                        }
                        List<VolumeMount> volumeMounts = container.getVolumeMounts();
                        if (notEmpty(volumeMounts)) {
                            println("Volume Mounts:");
                            indentCount++;
                            for (VolumeMount volumeMount : volumeMounts) {
                                printValue("Name", volumeMount.getName());
                                printValue("Mount Path", volumeMount.getMountPath());
                                printValue("Read Only", volumeMount.getReadOnly());
                            }
                            indentCount--;
                        }
                    }
                }

                Set<Volume> volumes = manifest.getVolumes();
                if (volumes != null) {
                    System.out.println("Volumes: ");
                    for (Volume volume : volumes) {
                        System.out.println(indent + volume.getName());
                    }
View Full Code Here

    }

    @Override
    public Result execute(UIExecutionContext uiExecutionContext) throws Exception {
        Kubernetes kubernetes = getKubernetes();
        PodListSchema pods = kubernetes.getPods();
        KubernetesHelper.removeEmptyPods(pods);
        TablePrinter table = podsAsTable(pods);
        return tableResults(table);
    }
View Full Code Here

        // populate autocompletion options
        podId.setCompleter(new UICompleter<String>() {
            @Override
            public Iterable<String> getCompletionProposals(UIContext context, InputComponent<?, String> input, String value) {
                List<String> list = new ArrayList<String>();
                PodListSchema pods = getKubernetes().getPods();
                if (pods != null) {
                    List<PodSchema> items = pods.getItems();
                    if (items != null) {
                        for (PodSchema item : items) {
                            String id = item.getId();
                            list.add(id);
                        }
View Full Code Here

    PodSchema pod1 = new PodSchema();
    pod1.setId("test1");
   
    PodSchema pod2 = new PodSchema();
   
    PodListSchema podSchema = new PodListSchema();
    podSchema.getItems().add(pod1);
    podSchema.getItems().add(pod2);
   
    KubernetesHelper.removeEmptyPods(podSchema);
   
    assertNotNull(podSchema);
    assertEquals(1, podSchema.getItems().size());
  }
View Full Code Here

    @Override
    public Result execute(UIExecutionContext context) throws Exception {
        Kubernetes kubernetes = getKubernetes();

        String podIdText = podId.getValue();
        PodSchema podInfo = kubernetes.getPod(podIdText);
        if (podInfo == null) {
            System.out.println("No pod for id: " + podIdText);
        } else {
            executePod(podInfo, podIdText);
        }
View Full Code Here

public class KubernetesHelperTest {

  @Test
  public void testRemoveEmptyPods() throws Exception {
   
    PodSchema pod1 = new PodSchema();
    pod1.setId("test1");
   
    PodSchema pod2 = new PodSchema();
   
    PodListSchema podSchema = new PodListSchema();
    podSchema.getItems().add(pod1);
    podSchema.getItems().add(pod2);
   
View Full Code Here

    @Override
    public Result execute(UIExecutionContext uiExecutionContext) throws Exception {
        Kubernetes kubernetes = getKubernetes();

        ReplicationControllerListSchema replicationControllers = kubernetes.getReplicationControllers();
        printReplicationControllers(replicationControllers, System.out);
        return null;
    }
View Full Code Here

        // populate autocompletion options
        replicationControllerId.setCompleter(new UICompleter<String>() {
            @Override
            public Iterable<String> getCompletionProposals(UIContext context, InputComponent<?, String> input, String value) {
                List<String> list = new ArrayList<String>();
                ReplicationControllerListSchema replicationControllers = getKubernetes().getReplicationControllers();
                if (replicationControllers != null) {
                    List<ReplicationControllerSchema> items = replicationControllers.getItems();
                    if (items != null) {
                        for (ReplicationControllerSchema item : items) {
                            String id = item.getId();
                            list.add(id);
                        }
View Full Code Here

    @Override
    public Result execute(UIExecutionContext context) throws Exception {
        Kubernetes kubernetes = getKubernetes();

        String idText = replicationControllerId.getValue();
        ReplicationControllerSchema replicationController = kubernetes.getReplicationController(idText);
        if (replicationController == null) {
            System.out.println("No replicationController for id: " + idText);
        } else {
            executeReplicationController(replicationController);
        }
View Full Code Here

TOP

Related Classes of io.fabric8.process.manager.support.DefaultProcessControllerTest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.