Package io.fabric8.internal.autoscale

Examples of io.fabric8.internal.autoscale.HostProfileCounter


    public static HostProfileCounter assertSshAutoScale(FabricRequirements requirements) {
        return assertSshAutoScale(requirements, new AutoScaleStatus());
    }

    public static HostProfileCounter assertSshAutoScale(FabricRequirements requirements, AutoScaleStatus status) {
        HostProfileCounter hostProfileCounter = new HostProfileCounter();
        String version = requirements.getVersion();
        if (Strings.isEmpty(version)) {
            version = "1.0";
        }
        List<ProfileRequirements> profileRequirements = requirements.getProfileRequirements();
        for (ProfileRequirements profileRequirement : profileRequirements) {
            Integer minimumInstances = profileRequirement.getMinimumInstances();
            if (minimumInstances != null) {
                for (int i = 0; i < minimumInstances; i++) {
                    String profileId = profileRequirement.getProfile();
                    AutoScaleRequest request = new AutoScaleRequest(null, version, profileId, 1, requirements, profileRequirement, status);
                    CreateSshContainerOptions.Builder builder = chooseHostContainerOptions(request, hostProfileCounter);
                    assertNotNull("Should have found a builder for " + profileId, builder);
                    String host = builder.getHost();
                    hostProfileCounter.incrementContainers(host);
                    hostProfileCounter.incrementProfileCount(host, profileId);
                }
            }
        }
        Map<String, CountingMap> hostToProfileCounts = hostProfileCounter.getHostToProfileCounts();
        assertProfilesUseSeparateHost(requirements, hostToProfileCounts);
        assertMaximumContainerCountNotExceeded(requirements, hostToProfileCounts);
        return hostProfileCounter;
    }
View Full Code Here


        if (fabricService != null) {

            Container[] containers = fabricService.getContainers();
            FabricRequirements requirements = request.getFabricRequirements();
            List<? extends HostConfiguration> hostConfigurations = requirements.getDockerHosts();
            HostProfileCounter hostProfileCounter = new HostProfileCounter();
            AutoScalers.createHostToProfileScaleMap(hostProfileCounter, hostConfigurations, containers);


            // TODO this is actually generic to all providers! :)
            for (int i = 0; i < count; i++) {
View Full Code Here

    }

    @Override
    public Result execute(UIExecutionContext context) throws Exception {
        File applyFile = file.getValue();
        Controller controller = new Controller(getKubernetes());
        controller.applyJson(applyFile);
        return null;
    }
View Full Code Here

        builder.add(filterText);
    }

    @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

        builder.add(filterText);
    }

    @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

        builder.add(filterText);
    }

    @Override
    public Result execute(UIExecutionContext uiExecutionContext) throws Exception {
        Kubernetes kubernetes = getKubernetes();
        ServiceListSchema services = kubernetes.getServices();
        printServices(services, System.out);
        return null;
    }
View Full Code Here

        builder.add(replicationControllerId);
    }

    @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

        builder.add(serviceId);
    }

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

        String idText = serviceId.getValue();
        ServiceSchema service = kubernetes.getService(idText);
        if (service == null) {
            System.out.println("No service for id: " + idText);
        } else {
            executeService(service);
        }
View Full Code Here

        builder.add(podId);
    }

    @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 KubernetesClient getKubernetes() {
        if (kubernetes == null) {
            String kubernetesAddress = kubernetesUrl.getValue();
            if (Strings.isNotBlank(kubernetesAddress)) {
                kubernetes = new KubernetesClient(new KubernetesFactory(kubernetesAddress));
            } else {
                kubernetes = new KubernetesClient();
            }
        }
        Objects.notNull(kubernetes, "kubernetes");
        return kubernetes;
    }
View Full Code Here

TOP

Related Classes of io.fabric8.internal.autoscale.HostProfileCounter

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.