use of org.bf2.cos.fleetshard.api.Version in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class KafkaManager method currentKafkaVersion.
/**
* Returns the current Kafka version for the Kafka instance
* It comes directly from the Kafka custom resource or from the ManagedKafka in case of creation
*
* @param managedKafka ManagedKafka instance
* @return current Kafka version for the Kafka instance
*/
public String currentKafkaVersion(ManagedKafka managedKafka) {
Kafka kafka = cachedKafka(managedKafka);
// on first time Kafka resource creation, we take the Kafka version from the ManagedKafka resource spec
String kafkaVersion = kafka != null ? kafka.getSpec().getKafka().getVersion() : managedKafka.getSpec().getVersions().getKafka();
log.debugf("[%s/%s] currentKafkaVersion = %s", managedKafka.getMetadata().getNamespace(), managedKafka.getMetadata().getName(), kafkaVersion);
return kafkaVersion;
}
use of org.bf2.cos.fleetshard.api.Version in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class KafkaManager method currentKafkaLogMessageFormatVersion.
/**
* Returns the current Kafka log message format version for the Kafka instance
* It comes directly from the Kafka custom resource or from the ManagedKafka in case of creation
*
* @param managedKafka ManagedKafka instance
* @return current Kafka log message format version for the Kafka instance
*/
public String currentKafkaLogMessageFormatVersion(ManagedKafka managedKafka) {
Kafka kafka = cachedKafka(managedKafka);
String kafkaLogMessageFormatVersion;
String current;
// on first time Kafka resource creation, we take the Kafka log message format version from the ManagedKafka resource spec
if (kafka != null) {
Object logMessageFormat = kafka.getSpec().getKafka().getConfig().get("log.message.format.version");
current = logMessageFormat != null ? logMessageFormat.toString() : kafka.getSpec().getKafka().getVersion();
} else {
current = managedKafka.getSpec().getVersions().getKafka();
}
kafkaLogMessageFormatVersion = AbstractKafkaCluster.getKafkaLogMessageFormatVersion(current);
log.debugf("[%s/%s] currentKafkaLogMessageFormatVersion = %s", managedKafka.getMetadata().getNamespace(), managedKafka.getMetadata().getName(), kafkaLogMessageFormatVersion);
return kafkaLogMessageFormatVersion;
}
use of org.bf2.cos.fleetshard.api.Version in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class KafkaManager method currentKafkaIbpVersion.
/**
* Returns the current Kafka inter broker protocol version for the Kafka instance
* It comes directly from the Kafka custom resource or from the ManagedKafka in case of creation
*
* @param managedKafka ManagedKafka instance
* @return current Kafka inter broker protocol version for the Kafka instance
*/
public String currentKafkaIbpVersion(ManagedKafka managedKafka) {
Kafka kafka = cachedKafka(managedKafka);
String kafkaIbpVersion;
// on first time Kafka resource creation, we take the Kafka inter broker protocol version from the ManagedKafka resource spec
if (kafka != null) {
Object interBrokerProtocol = kafka.getSpec().getKafka().getConfig().get("inter.broker.protocol.version");
kafkaIbpVersion = interBrokerProtocol != null ? AbstractKafkaCluster.getKafkaIbpVersion(interBrokerProtocol.toString()) : AbstractKafkaCluster.getKafkaIbpVersion(kafka.getSpec().getKafka().getVersion());
} else {
kafkaIbpVersion = managedKafka.getSpec().getVersions().getKafkaIbp();
// dealing with ManagedKafka instances not having the IBP field specified
if (kafkaIbpVersion == null) {
kafkaIbpVersion = AbstractKafkaCluster.getKafkaIbpVersion(managedKafka.getSpec().getVersions().getKafka());
}
}
log.debugf("[%s/%s] currentKafkaIbpVersion = %s", managedKafka.getMetadata().getNamespace(), managedKafka.getMetadata().getName(), kafkaIbpVersion);
return kafkaIbpVersion;
}
use of org.bf2.cos.fleetshard.api.Version in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class ManagedKafkaAgentController method buildStatus.
/**
* TODO: this needs to be replaced with actual metrics
* @return
*/
private ManagedKafkaAgentStatus buildStatus(ManagedKafkaAgent resource) {
ManagedKafkaAgentStatus status = resource.getStatus();
ManagedKafkaCondition readyCondition = null;
if (status != null) {
readyCondition = ConditionUtils.findManagedKafkaCondition(status.getConditions(), Type.Ready).orElse(null);
}
List<StrimziVersionStatus> strimziVersions = this.strimziManager.getStrimziVersions();
log.debugf("Strimzi versions %s", strimziVersions);
// consider the fleetshard operator ready when observability is running and a Strimzi bundle is installed (aka at least one available version)
Status statusValue = this.observabilityManager.isObservabilityRunning() && !strimziVersions.isEmpty() ? ManagedKafkaCondition.Status.True : ManagedKafkaCondition.Status.False;
if (readyCondition == null) {
readyCondition = ConditionUtils.buildCondition(ManagedKafkaCondition.Type.Ready, statusValue);
} else {
ConditionUtils.updateConditionStatus(readyCondition, statusValue, null, null);
}
ClusterCapacity total = new ClusterCapacityBuilder().withConnections(10000).withDataRetentionSize(Quantity.parse("40Gi")).withIngressEgressThroughputPerSec(Quantity.parse("40Gi")).withPartitions(10000).build();
ClusterCapacity remaining = new ClusterCapacityBuilder().withConnections(10000).withDataRetentionSize(Quantity.parse("40Gi")).withIngressEgressThroughputPerSec(Quantity.parse("40Gi")).withPartitions(10000).build();
ClusterCapacity delta = new ClusterCapacityBuilder().withConnections(10000).withDataRetentionSize(Quantity.parse("40Gi")).withIngressEgressThroughputPerSec(Quantity.parse("40Gi")).withPartitions(10000).build();
NodeCounts nodeInfo = new NodeCountsBuilder().withCeiling(0).withCurrent(0).withCurrentWorkLoadMinimum(0).withFloor(0).build();
ClusterResizeInfo resize = new ClusterResizeInfoBuilder().withDelta(delta).withNodeDelta(3).build();
return new ManagedKafkaAgentStatusBuilder().withConditions(status == null ? Arrays.asList(readyCondition) : status.getConditions()).withTotal(total).withRemaining(remaining).withNodeInfo(nodeInfo).withResizeInfo(resize).withUpdatedTimestamp(ConditionUtils.iso8601Now()).withStrimzi(strimziVersions).build();
}
use of org.bf2.cos.fleetshard.api.Version in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class OlmBasedStrimziOperatorManager method isSubscriptionInstalled.
private boolean isSubscriptionInstalled() {
OpenShiftClient client = kubeClient.client().adapt(OpenShiftClient.class);
Subscription s = client.operatorHub().subscriptions().inNamespace(namespace).withName(OLM_SUBSCRIPTION_NAME).get();
if (s != null && s.getStatus() != null && !s.getStatus().getCatalogHealth().isEmpty()) {
List<SubscriptionCatalogHealth> healths = s.getStatus().getCatalogHealth();
boolean result = !healths.stream().filter(h -> h.getHealthy()).map(ref -> ref.getCatalogSourceRef()).filter(h -> h.getName().equals(CATALOG_SOURCE_NAME)).collect(Collectors.toList()).isEmpty();
if (result) {
String currentCsv = s.getStatus().getCurrentCSV();
if (currentCsv == null) {
return false;
}
ClusterServiceVersion csv = client.operatorHub().clusterServiceVersions().inNamespace(namespace).withName(currentCsv).get();
if (csv == null) {
return false;
}
versions = csv.getSpec().getInstall().getSpec().getDeployments().stream().map(sds -> sds.getName()).filter(version -> version.startsWith("strimzi-cluster-operator.")).collect(Collectors.toList());
}
return result;
}
return false;
}
Aggregations