use of io.fabric8.volcano.scheduling.v1beta1.PodGroupList in project kubernetes-client by fabric8io.
the class V1Beta1VolcanoTest method testV1Beta1PodGroup.
@Test
void testV1Beta1PodGroup() {
PodGroup podGroup = new PodGroupBuilder().editOrNewMetadata().withName("Pod").endMetadata().build();
client.v1beta1().podGroups().inNamespace("ns1").create(podGroup);
PodGroupList podGroupList = client.v1beta1().podGroups().inNamespace("ns1").list();
assertNotNull(podGroupList);
assertEquals(1, podGroupList.getItems().size());
}
use of io.fabric8.volcano.scheduling.v1beta1.PodGroupList in project kubernetes-client by fabric8io.
the class VolcanoTest method testPodGroupWithMetaAndSpec.
@Test
void testPodGroupWithMetaAndSpec() {
Quantity cpu = new QuantityBuilder(false).withAmount("1").build();
Quantity memory = new QuantityBuilder(false).withAmount(TEST_MEMORY + "Mi").build();
Map<String, Quantity> resourceMap = new HashMap<>();
resourceMap.put("cpu", cpu);
resourceMap.put("memory", memory);
// Create PodGroup with metadata and spec
PodGroup podGroup = new PodGroupBuilder().editOrNewMetadata().withName(TEST_GROUP_NAME).withNamespace(TEST_NAMESPACE_NAME).endMetadata().editOrNewSpec().withMinResources(resourceMap).endSpec().build();
client.podGroups().inNamespace(TEST_NAMESPACE_NAME).create(podGroup);
// Check podgroup
PodGroupList podGroupList = client.podGroups().inNamespace(TEST_NAMESPACE_NAME).list();
assertNotNull(podGroupList);
assertEquals(1, podGroupList.getItems().size());
PodGroup group1 = podGroupList.getItems().get(0);
// Check name and namespace in metadata
assertEquals(TEST_GROUP_NAME, group1.getMetadata().getName());
assertEquals(TEST_NAMESPACE_NAME, group1.getMetadata().getNamespace());
// Check cpu/memory amount in spec
assertEquals(TEST_CPU_NUM, group1.getSpec().getMinResources().get("cpu").getAmount());
assertEquals(TEST_MEMORY, group1.getSpec().getMinResources().get("memory").getAmount());
}
use of io.fabric8.volcano.scheduling.v1beta1.PodGroupList 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();
}
}
use of io.fabric8.volcano.scheduling.v1beta1.PodGroupList 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();
}
}
Aggregations