Package io.fabric8.kubernetes.api.model

Examples of io.fabric8.kubernetes.api.model.ReplicationControllerSchema


    @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

        }
        String kuberneteMasterUrl = args[0];
        String podID = args[1];
        System.out.println("Looking up ReplicationController for pod ID: " + podID);
        KubernetesClient client = new KubernetesClient(kuberneteMasterUrl);
        ReplicationControllerSchema replicationController = client.getReplicationControllerForPod(podID);
        if (replicationController != null ){
            String id = replicationController.getId();
            System.out.println("Found replication controller: " + id);
        } else {
            System.out.println("Could not find replication controller!");
        }
    }
View Full Code Here

        System.out.println("Generated: " + json);

        Object loadedDTO = KubernetesHelper.loadJson(json);
        System.out.println("Loaded json DTO: " + loadedDTO);
        assertTrue("Loaded DTO should be a ReplicationControllerSchema but was " + loadedDTO, loadedDTO instanceof ReplicationControllerSchema);
        ReplicationControllerSchema rc = (ReplicationControllerSchema) loadedDTO;

        assertThat(rc.getLabels()).isEqualTo(labels);
        ControllerDesiredState desiredState = rc.getDesiredState();
        assertThat(desiredState.getReplicas()).isEqualTo(replicaCount);
        assertThat(desiredState.getReplicaSelector()).isEqualTo(labels);

        // TODO expose labels on pod template
        //assertThat(desiredState.getPodTemplate()).isEqualTo(labels);
View Full Code Here

                        }
                    }
                    if (isProvisionSuccess(status)) {
                        List<String> ids = notNullList(kubernetesContainerMetadata.getReplicationControllerIds());
                        for (String id : ids) {
                            ReplicationControllerSchema replicationController = replicationControllerMap.get(id);
                            status = checkStatus(id, replicationController, errors);
                            if (!isProvisionSuccess(status)) {
                                break;
                            }
                        }
View Full Code Here

                                if (Objects.equal("Pod", kind)) {
                                    PodSchema podSchema = objectMapper.reader(PodSchema.class).readValue(json);
                                    configurePod(podSchema, service, options, metadata);
                                    answer.put(definition, podSchema);
                                } else if (Objects.equal("ReplicationController", kind)) {
                                    ReplicationControllerSchema replicationControllerSchema = objectMapper.reader(ReplicationControllerSchema.class).readValue(json);
                                    configureReplicationController(replicationControllerSchema, service, options, metadata);
                                    answer.put(definition, replicationControllerSchema);
                                } else if (Objects.equal("Service", kind)) {
                                    ServiceSchema serviceSchema = objectMapper.reader(ServiceSchema.class).readValue(json);
                                    configureService(serviceSchema, service, options, metadata);
View Full Code Here

                    } catch (Exception e) {
                        LOG.error("Failed to create pod from " + definition + ". " + e + ". " + podSchema, e);
                    }
                }
            } else if (kubelet instanceof ReplicationControllerSchema) {
                ReplicationControllerSchema replicationControllerSchema = (ReplicationControllerSchema) kubelet;
                if (replicationControllerMap == null) {
                    replicationControllerMap = getReplicationControllerMap(kubernetes);
                }
                String id = replicationControllerSchema.getId();
                ReplicationControllerSchema old = replicationControllerMap.get(id);
                if (isRunning(old)) {
                    LOG.info("Not creating replicationController for " + id + " from definition " + definition + " as its already running");
                } else {
                    LOG.info("Creating a replicationController from " + definition);
                    try {
View Full Code Here

                    } catch (Exception e) {
                        LOG.error("Failed to delete pod " + id + " from " + definition + ": " + e + ". ", e);
                    }
                }
            } else if (kubelet instanceof ReplicationControllerSchema) {
                ReplicationControllerSchema replicationControllerSchema = (ReplicationControllerSchema) kubelet;
                if (replicationControllerMap == null) {
                    replicationControllerMap = getReplicationControllerMap(kubernetes);
                }
                String id = replicationControllerSchema.getId();
                ReplicationControllerSchema old = replicationControllerMap.get(id);
                if (isRunning(old)) {
                    try {
                        deleteReplicationController(id);
                    } catch (Exception e) {
                        LOG.error("Failed to delete replicationController " + id + " from " + definition + ": " + e + ". ", e);
View Full Code Here

        return answer;
    }

    @Override
    public String getReplicationControllerIdForPod(String podId) {
        ReplicationControllerSchema replicationController = kubernetes.getReplicationControllerForPod(podId);
        if (replicationController != null) {
            return replicationController.getId();
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of io.fabric8.kubernetes.api.model.ReplicationControllerSchema

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.