Search in sources :

Example 1 with DefaultVolcanoClient

use of io.fabric8.volcano.client.DefaultVolcanoClient in project kubernetes-client by fabric8io.

the class PodGroupCreate method main.

public static void main(String[] args) {
    try (NamespacedVolcanoClient volcanoClient = new DefaultVolcanoClient()) {
        String namespace = "default";
        String groupName = "group1";
        PodGroup podGroup = Utils.buildDefaultPodGroups(namespace, groupName);
        // Create PodGroup
        volcanoClient.podGroups().inNamespace(namespace).createOrReplace(podGroup);
        System.out.println("Created: " + podGroup.getMetadata().getName());
        // Wait for status or 5s timeout
        volcanoClient.podGroups().inNamespace(namespace).withName(groupName).waitUntilCondition(group -> Objects.nonNull(group.getStatus()) && group.getStatus().getPhase().equals("Running"), 5, TimeUnit.SECONDS);
        System.out.println("Created: " + podGroup.getMetadata().getName());
        // List PodGroup
        PodGroupList podGroupList = volcanoClient.podGroups().inNamespace(namespace).list();
        System.out.println("There are " + podGroupList.getItems().size() + " PodGroup objects in " + namespace);
        // Delete PodGroup
        volcanoClient.podGroups().inNamespace(namespace).withName(groupName).delete();
    }
}
Also used : NamespacedVolcanoClient(io.fabric8.volcano.client.NamespacedVolcanoClient) DefaultVolcanoClient(io.fabric8.volcano.client.DefaultVolcanoClient) PodGroup(io.fabric8.volcano.scheduling.v1beta1.PodGroup) PodGroupList(io.fabric8.volcano.scheduling.v1beta1.PodGroupList)

Example 2 with DefaultVolcanoClient

use of io.fabric8.volcano.client.DefaultVolcanoClient in project kubernetes-client by fabric8io.

the class PodGroupCreate method main.

public static void main(String[] args) {
    try (NamespacedVolcanoClient volcanoClient = new DefaultVolcanoClient()) {
        String namespace = "default";
        String groupName = "group1";
        PodGroup podGroup = Utils.buildDefaultPodGroups(namespace, groupName);
        // Create PodGroup
        volcanoClient.v1beta1().podGroups().inNamespace(namespace).createOrReplace(podGroup);
        System.out.println("Created: " + podGroup.getMetadata().getName());
        // Wait for status or 5s timeout
        volcanoClient.v1beta1().podGroups().inNamespace(namespace).withName(groupName).waitUntilCondition(group -> Objects.nonNull(group.getStatus()) && group.getStatus().getPhase().equals("Running"), 5, TimeUnit.SECONDS);
        System.out.println("Created: " + podGroup.getMetadata().getName());
        // List PodGroup
        PodGroupList podGroupList = volcanoClient.v1beta1().podGroups().inNamespace(namespace).list();
        System.out.println("There are " + podGroupList.getItems().size() + " PodGroup objects in " + namespace);
        // Delete PodGroup
        volcanoClient.v1beta1().podGroups().inNamespace(namespace).withName(groupName).delete();
    }
}
Also used : NamespacedVolcanoClient(io.fabric8.volcano.client.NamespacedVolcanoClient) DefaultVolcanoClient(io.fabric8.volcano.client.DefaultVolcanoClient) PodGroup(io.fabric8.volcano.scheduling.v1beta1.PodGroup) PodGroupList(io.fabric8.volcano.scheduling.v1beta1.PodGroupList)

Example 3 with DefaultVolcanoClient

use of io.fabric8.volcano.client.DefaultVolcanoClient in project kubernetes-client by fabric8io.

the class QueueCreate method main.

public static void main(String[] args) {
    try (NamespacedVolcanoClient volcanoClient = new DefaultVolcanoClient()) {
        String queueName = "queue1";
        Queue queue = Utils.buildDefaultQueues(queueName);
        volcanoClient.queues().createOrReplace(queue);
        // Wait for status or 5s timeout
        volcanoClient.queues().withName(queueName).waitUntilCondition(q -> Objects.nonNull(q.getStatus()) && q.getStatus().getState().equals("Open"), 5, TimeUnit.SECONDS);
        System.out.println("Created: " + queue.getMetadata().getName());
        // List queue
        QueueList queueList = volcanoClient.queues().list();
        System.out.println("There are " + queueList.getItems().size() + " queue objects");
        // Delete queue
        volcanoClient.queues().withName(queueName).delete();
    }
}
Also used : NamespacedVolcanoClient(io.fabric8.volcano.client.NamespacedVolcanoClient) DefaultVolcanoClient(io.fabric8.volcano.client.DefaultVolcanoClient) Queue(io.fabric8.volcano.scheduling.v1beta1.Queue) QueueList(io.fabric8.volcano.scheduling.v1beta1.QueueList)

Example 4 with DefaultVolcanoClient

use of io.fabric8.volcano.client.DefaultVolcanoClient in project kubernetes-client by fabric8io.

the class QueueCreate method main.

public static void main(String[] args) {
    try (NamespacedVolcanoClient volcanoClient = new DefaultVolcanoClient()) {
        String queueName = "queue1";
        Queue queue = Utils.buildDefaultQueues(queueName);
        volcanoClient.v1beta1().queues().createOrReplace(queue);
        // Wait for status or 5s timeout
        volcanoClient.v1beta1().queues().withName(queueName).waitUntilCondition(q -> Objects.nonNull(q.getStatus()) && q.getStatus().getState().equals("Open"), 5, TimeUnit.SECONDS);
        System.out.println("Created: " + queue.getMetadata().getName());
        // List queue
        QueueList queueList = volcanoClient.v1beta1().queues().list();
        System.out.println("There are " + queueList.getItems().size() + " queue objects");
        // Delete queue
        volcanoClient.v1beta1().queues().withName(queueName).delete();
    }
}
Also used : NamespacedVolcanoClient(io.fabric8.volcano.client.NamespacedVolcanoClient) DefaultVolcanoClient(io.fabric8.volcano.client.DefaultVolcanoClient) Queue(io.fabric8.volcano.scheduling.v1beta1.Queue) QueueList(io.fabric8.volcano.scheduling.v1beta1.QueueList)

Aggregations

DefaultVolcanoClient (io.fabric8.volcano.client.DefaultVolcanoClient)4 NamespacedVolcanoClient (io.fabric8.volcano.client.NamespacedVolcanoClient)4 PodGroup (io.fabric8.volcano.scheduling.v1beta1.PodGroup)2 PodGroupList (io.fabric8.volcano.scheduling.v1beta1.PodGroupList)2 Queue (io.fabric8.volcano.scheduling.v1beta1.Queue)2 QueueList (io.fabric8.volcano.scheduling.v1beta1.QueueList)2