Search in sources :

Example 6 with ConnectorNamespace

use of org.bf2.cos.fleet.manager.model.ConnectorNamespace in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class SyncTestSupport method namespace.

public static ConnectorNamespace namespace(String id, String name, Consumer<ConnectorNamespace> consumer) {
    ConnectorNamespace answer = new ConnectorNamespace().id(id).name(name);
    consumer.accept(answer);
    if (answer.getStatus() == null) {
        answer.setStatus(new ConnectorNamespaceStatus1());
    }
    if (answer.getStatus().getConnectorsDeployed() == null) {
        answer.getStatus().setConnectorsDeployed(0);
    }
    return answer;
}
Also used : ConnectorNamespace(org.bf2.cos.fleet.manager.model.ConnectorNamespace) ConnectorNamespaceStatus1(org.bf2.cos.fleet.manager.model.ConnectorNamespaceStatus1)

Example 7 with ConnectorNamespace

use of org.bf2.cos.fleet.manager.model.ConnectorNamespace in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class FleetManagerClient method getNamespaces.

public void getNamespaces(long gv, Consumer<Collection<ConnectorNamespace>> consumer) {
    RestClientHelper.run(() -> {
        LOGGER.debug("polling namespaces with gv: {}", gv);
        final AtomicInteger counter = new AtomicInteger();
        final List<ConnectorNamespace> items = new ArrayList<>();
        for (int i = 1; i < Integer.MAX_VALUE; i++) {
            ConnectorNamespaceList list = controlPlane.getConnectorNamespaces(config.cluster().id(), Integer.toString(i), null, gv);
            if (list == null || list.getItems() == null || list.getItems().isEmpty()) {
                LOGGER.info("No namespace for cluster {}", config.cluster().id());
                break;
            }
            items.addAll(list.getItems());
            consumer.accept(items);
            if (counter.addAndGet(items.size()) >= list.getTotal()) {
                break;
            }
        }
    });
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ConnectorNamespace(org.bf2.cos.fleet.manager.model.ConnectorNamespace) ArrayList(java.util.ArrayList) ConnectorNamespaceList(org.bf2.cos.fleet.manager.model.ConnectorNamespaceList)

Aggregations

ConnectorNamespace (org.bf2.cos.fleet.manager.model.ConnectorNamespace)7 Namespace (io.fabric8.kubernetes.api.model.Namespace)3 ConnectorNamespaceStatus1 (org.bf2.cos.fleet.manager.model.ConnectorNamespaceStatus1)3 Date (java.util.Date)2 ConnectorNamespaceList (org.bf2.cos.fleet.manager.model.ConnectorNamespaceList)2 ConnectorNamespaceTenant (org.bf2.cos.fleet.manager.model.ConnectorNamespaceTenant)2 Secret (io.fabric8.kubernetes.api.model.Secret)1 MeterRegistry (io.micrometer.core.instrument.MeterRegistry)1 ArrayList (java.util.ArrayList)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 ConnectorNamespaceStatus (org.bf2.cos.fleet.manager.model.ConnectorNamespaceStatus)1 MetaV1Condition (org.bf2.cos.fleet.manager.model.MetaV1Condition)1 ManagedConnector (org.bf2.cos.fleetshard.api.ManagedConnector)1 FleetShardSyncConfig (org.bf2.cos.fleetshard.sync.FleetShardSyncConfig)1 FleetManagerClient (org.bf2.cos.fleetshard.sync.client.FleetManagerClient)1 FleetShardClient (org.bf2.cos.fleetshard.sync.client.FleetShardClient)1 ConnectorNamespaceProvisioner (org.bf2.cos.fleetshard.sync.resources.ConnectorNamespaceProvisioner)1 Test (org.junit.jupiter.api.Test)1