use of org.bf2.cos.fleet.manager.model.ConnectorOperator in project cos-fleetshard by bf2fc6cc711aee1a0c2a.
the class ConnectorClusterStatusSync method update.
private void update() {
ConnectorClusterStatus status = new ConnectorClusterStatus();
status.setPhase(ConnectorClusterState.READY);
fleetShardClient.getOperators().stream().map(o -> new ConnectorClusterStatusOperators().namespace(o.getMetadata().getNamespace()).operator(new ConnectorOperator().id(o.getMetadata().getName()).type(o.getSpec().getType()).version(o.getSpec().getVersion())).status(Operators.PHASE_READY)).forEach(status::addOperatorsItem);
fleetShardClient.getNamespaces().stream().map(n -> {
ConnectorNamespaceState phase = ConnectorNamespaceState.DISCONNECTED;
if (n.getStatus() != null) {
if (Objects.equals(Namespaces.STATUS_ACTIVE, n.getStatus().getPhase())) {
phase = ConnectorNamespaceState.READY;
} else if (Objects.equals(Namespaces.STATUS_TERMINATING, n.getStatus().getPhase())) {
phase = ConnectorNamespaceState.DELETING;
}
}
return new ConnectorNamespaceStatus().id(n.getMetadata().getLabels().get(Resources.LABEL_NAMESPACE_ID)).version(Resources.getLabel(n, Resources.LABEL_KUBERNETES_VERSION)).connectorsDeployed(fleetShardClient.getConnectors(n).size()).phase(phase);
}).forEach(status::addNamespacesItem);
controlPlane.updateClusterStatus(status);
}
Aggregations