log.debug("reconcileAll({}, {}): desired resources with labels {}: {}", RESOURCE_KIND, trigger, selector, desiredNames); Labels resourceSelector = selector.withKind(RESOURCE_KIND); List<? extends HasMetadata> resources = getResources(namespace, resourceSelector); Set<String> resourceNames = resources.stream()
Labels resourceSelector = Labels.EMPTY.withKind(assemblyType.name); List<? extends HasMetadata> resources = getResources(namespace, resourceSelector);
private final Future<CompositeFuture> deleteZk(Reconciliation reconciliation) { String namespace = reconciliation.namespace(); String name = reconciliation.name(); String zkSsName = ZookeeperCluster.zookeeperClusterName(name); Labels pvcSelector = Labels.forCluster(name).withKind(Kafka.RESOURCE_KIND).withName(zkSsName); return deletePersistentVolumeClaim(namespace, pvcSelector); }
private final Future<CompositeFuture> deleteKafka(Reconciliation reconciliation) { String namespace = reconciliation.namespace(); String name = reconciliation.name(); String kafkaSsName = KafkaCluster.kafkaClusterName(name); Labels pvcSelector = Labels.forCluster(name).withKind(Kafka.RESOURCE_KIND).withName(kafkaSsName); return deletePersistentVolumeClaim(namespace, pvcSelector); }
.withKind(ssLabels.get(Labels.STRIMZI_KIND_LABEL)) .withName(name); List<PersistentVolumeClaim> pvcs = pvcOperations.list(namespace, pvcSelector);
public static KafkaConnectCluster fromCrd(KafkaConnect kafkaConnect, KafkaVersion.Lookup versions) { KafkaConnectCluster cluster = fromSpec(kafkaConnect.getSpec(), versions, new KafkaConnectCluster(kafkaConnect.getMetadata().getNamespace(), kafkaConnect.getMetadata().getName(), Labels.fromResource(kafkaConnect).withKind(kafkaConnect.getKind()))); cluster.setOwnerReference(kafkaConnect); return cluster; }
public static KafkaConnectS2ICluster fromCrd(KafkaConnectS2I kafkaConnectS2I, KafkaVersion.Lookup versions) { KafkaConnectS2ISpec spec = kafkaConnectS2I.getSpec(); KafkaConnectS2ICluster cluster = fromSpec(spec, versions, new KafkaConnectS2ICluster(kafkaConnectS2I.getMetadata().getNamespace(), kafkaConnectS2I.getMetadata().getName(), Labels.fromResource(kafkaConnectS2I).withKind(kafkaConnectS2I.getKind()))); cluster.setOwnerReference(kafkaConnectS2I); cluster.setInsecureSourceRepository(spec.isInsecureSourceRepository()); return cluster; }
/** * Creates instance of KafkaUserModel from CRD definition * * @param certManager CertManager instance for work with certificates * @param passwordGenerator A password generator * @param kafkaUser The Custom Resource based on which the model should be created * @param userSecret Kubernetes secret with existing user certificate * @return */ public static KafkaUserModel fromCrd(CertManager certManager, PasswordGenerator passwordGenerator, KafkaUser kafkaUser, Secret clientsCaCert, Secret clientsCaKey, Secret userSecret) { KafkaUserModel result = new KafkaUserModel(kafkaUser.getMetadata().getNamespace(), kafkaUser.getMetadata().getName(), Labels.fromResource(kafkaUser).withKind(kafkaUser.getKind())); result.setAuthentication(kafkaUser.getSpec().getAuthentication()); if (kafkaUser.getSpec().getAuthentication() instanceof KafkaUserTlsClientAuthentication) { result.maybeGenerateCertificates(certManager, clientsCaCert, clientsCaKey, userSecret); } else if (kafkaUser.getSpec().getAuthentication() instanceof KafkaUserScramSha512ClientAuthentication) { result.maybeGeneratePassword(passwordGenerator, userSecret); } if (kafkaUser.getSpec().getAuthorization() != null && kafkaUser.getSpec().getAuthorization().getType().equals(KafkaUserAuthorizationSimple.TYPE_SIMPLE)) { KafkaUserAuthorizationSimple simple = (KafkaUserAuthorizationSimple) kafkaUser.getSpec().getAuthorization(); result.setSimpleAclRules(simple.getAcls()); } return result; }
Future<ReconciliationState> clusterOperatorSecret() { Labels labels = Labels.userLabels(kafkaAssembly.getMetadata().getLabels()).withKind(reconciliation.type().toString()).withCluster(reconciliation.name()); OwnerReference ownerRef = new OwnerReferenceBuilder() .withApiVersion(kafkaAssembly.getApiVersion()) .withKind(kafkaAssembly.getKind()) .withName(kafkaAssembly.getMetadata().getName()) .withUid(kafkaAssembly.getMetadata().getUid()) .withBlockOwnerDeletion(false) .withController(false) .build(); Secret secret = ModelUtils.buildSecret(clusterCa, clusterCa.clusterOperatorSecret(), namespace, ClusterOperator.secretName(name), "cluster-operator", "cluster-operator", labels, ownerRef); return withVoid(secretOperations.reconcile(namespace, ClusterOperator.secretName(name), secret)); }
Labels selectorLabels = Labels.EMPTY.withKind(reconciliation.type().toString()).withCluster(reconciliation.name()); Labels caLabels = Labels.userLabels(kafkaAssembly.getMetadata().getLabels()).withKind(reconciliation.type().toString()).withCluster(reconciliation.name()); Future<ReconciliationState> result = Future.future(); vertx.createSharedWorkerExecutor("kubernetes-ops-pool").<ReconciliationState>executeBlocking(
public static ZookeeperCluster fromCrd(Kafka kafkaAssembly, KafkaVersion.Lookup versions) { ZookeeperCluster zk = new ZookeeperCluster(kafkaAssembly.getMetadata().getNamespace(), kafkaAssembly.getMetadata().getName(), Labels.fromResource(kafkaAssembly).withKind(kafkaAssembly.getKind())); zk.setOwnerReference(kafkaAssembly); ZookeeperClusterSpec zookeeperClusterSpec = kafkaAssembly.getSpec().getZookeeper();
public static KafkaMirrorMakerCluster fromCrd(KafkaMirrorMaker kafkaMirrorMaker, KafkaVersion.Lookup versions) { KafkaMirrorMakerCluster kafkaMirrorMakerCluster = new KafkaMirrorMakerCluster(kafkaMirrorMaker.getMetadata().getNamespace(), kafkaMirrorMaker.getMetadata().getName(), Labels.fromResource(kafkaMirrorMaker).withKind(kafkaMirrorMaker.getKind()));
namespace, kafkaAssembly.getMetadata().getName(), Labels.fromResource(kafkaAssembly).withKind(kafkaAssembly.getKind()));
public static KafkaCluster fromCrd(Kafka kafkaAssembly, KafkaVersion.Lookup versions) { KafkaCluster result = new KafkaCluster(kafkaAssembly.getMetadata().getNamespace(), kafkaAssembly.getMetadata().getName(), Labels.fromResource(kafkaAssembly).withKind(kafkaAssembly.getKind())); result.setOwnerReference(kafkaAssembly); KafkaClusterSpec kafkaClusterSpec = kafkaAssembly.getSpec().getKafka();