Search in sources :

Example 1 with DefaultOpenClusterManagementClient

use of io.fabric8.openclustermanagement.client.DefaultOpenClusterManagementClient in project kubernetes-client by fabric8io.

the class ManagedClusterList method main.

public static void main(String[] args) {
    try (OpenClusterManagementClient ocmClient = new DefaultOpenClusterManagementClient()) {
        logger.info("Listing all ManagedClusters: ");
        ocmClient.clusters().managedClusters().list().getItems().stream().map(ManagedCluster::getMetadata).map(ObjectMeta::getName).forEach(logger::info);
    }
}
Also used : ManagedCluster(io.fabric8.openclustermanagement.api.model.cluster.v1.ManagedCluster) DefaultOpenClusterManagementClient(io.fabric8.openclustermanagement.client.DefaultOpenClusterManagementClient) DefaultOpenClusterManagementClient(io.fabric8.openclustermanagement.client.DefaultOpenClusterManagementClient) OpenClusterManagementClient(io.fabric8.openclustermanagement.client.OpenClusterManagementClient)

Example 2 with DefaultOpenClusterManagementClient

use of io.fabric8.openclustermanagement.client.DefaultOpenClusterManagementClient in project kubernetes-client by fabric8io.

the class ManagedClusterSetCreate method main.

public static void main(String[] args) {
    try (OpenClusterManagementClient ocmClient = new DefaultOpenClusterManagementClient()) {
        ManagedClusterSet managedClusterSet = new ManagedClusterSetBuilder().withNewMetadata().withName("managedclusterset1").endMetadata().withNewSpec().endSpec().build();
        logger.info("Creating ManagedClusterSet {}", managedClusterSet.getMetadata().getName());
        ocmClient.clusters().managedClusterSets().create(managedClusterSet);
    }
}
Also used : ManagedClusterSet(io.fabric8.openclustermanagement.api.model.cluster.v1beta1.ManagedClusterSet) DefaultOpenClusterManagementClient(io.fabric8.openclustermanagement.client.DefaultOpenClusterManagementClient) DefaultOpenClusterManagementClient(io.fabric8.openclustermanagement.client.DefaultOpenClusterManagementClient) OpenClusterManagementClient(io.fabric8.openclustermanagement.client.OpenClusterManagementClient) ManagedClusterSetBuilder(io.fabric8.openclustermanagement.api.model.cluster.v1beta1.ManagedClusterSetBuilder)

Example 3 with DefaultOpenClusterManagementClient

use of io.fabric8.openclustermanagement.client.DefaultOpenClusterManagementClient in project kubernetes-client by fabric8io.

the class PlacementRuleCreate method main.

public static void main(String[] args) {
    try (OpenClusterManagementClient ocmClient = new DefaultOpenClusterManagementClient()) {
        PlacementRule placementRule = new PlacementRuleBuilder().withNewMetadata().withName("towhichcluster").endMetadata().withNewSpec().addNewClusterCondition().withType("ManagedClusterConditionAvailable").withStatus("True").endClusterCondition().endSpec().build();
        logger.info("Creating PlacementRule {}", placementRule.getMetadata().getName());
        ocmClient.apps().placementRules().inNamespace("default").create(placementRule);
        logger.info("Success.");
    }
}
Also used : PlacementRule(io.fabric8.openclustermanagement.api.model.multicloudoperatorsplacementrule.apps.v1.PlacementRule) DefaultOpenClusterManagementClient(io.fabric8.openclustermanagement.client.DefaultOpenClusterManagementClient) DefaultOpenClusterManagementClient(io.fabric8.openclustermanagement.client.DefaultOpenClusterManagementClient) OpenClusterManagementClient(io.fabric8.openclustermanagement.client.OpenClusterManagementClient) PlacementRuleBuilder(io.fabric8.openclustermanagement.api.model.multicloudoperatorsplacementrule.apps.v1.PlacementRuleBuilder)

Aggregations

DefaultOpenClusterManagementClient (io.fabric8.openclustermanagement.client.DefaultOpenClusterManagementClient)3 OpenClusterManagementClient (io.fabric8.openclustermanagement.client.OpenClusterManagementClient)3 ManagedCluster (io.fabric8.openclustermanagement.api.model.cluster.v1.ManagedCluster)1 ManagedClusterSet (io.fabric8.openclustermanagement.api.model.cluster.v1beta1.ManagedClusterSet)1 ManagedClusterSetBuilder (io.fabric8.openclustermanagement.api.model.cluster.v1beta1.ManagedClusterSetBuilder)1 PlacementRule (io.fabric8.openclustermanagement.api.model.multicloudoperatorsplacementrule.apps.v1.PlacementRule)1 PlacementRuleBuilder (io.fabric8.openclustermanagement.api.model.multicloudoperatorsplacementrule.apps.v1.PlacementRuleBuilder)1