private int getDeploymentCaCertGeneration(Deployment dep, Ca ca) { int caCertGeneration = 0; if (dep != null) { caCertGeneration = Annotations.intAnnotation( dep.getSpec().getTemplate(), getCaCertAnnotation(ca), 0); } return caCertGeneration; }
this.toDeployment = topicOperator.generateDeployment(isOpenShift); this.toMetricsAndLogsConfigMap = logAndMetricsConfigMap; Annotations.annotations(this.toDeployment.getSpec().getTemplate()).put( ANNO_STRIMZI_IO_LOGGING, this.toMetricsAndLogsConfigMap.getData().get("log4j2.properties"));
Future<ReconciliationState> entityOperatorDeployment(Supplier<Date> dateSupplier) { if (this.entityOperator != null) { Future<Deployment> future = deploymentOperations.getAsync(namespace, this.entityOperator.getName()); if (future != null) { return future.compose(dep -> { // getting the current cluster CA generation from the current deployment, if exists int clusterCaCertGeneration = getDeploymentCaCertGeneration(dep, this.clusterCa); int clientsCaCertGeneration = getDeploymentCaCertGeneration(dep, this.clientsCa); // if maintenance windows are satisfied, the cluster CA generation could be changed // and EO needs a rolling update updating the related annotation boolean isSatisfiedBy = isMaintenanceTimeWindowsSatisfied(dateSupplier); if (isSatisfiedBy) { clusterCaCertGeneration = getCaCertGeneration(this.clusterCa); clientsCaCertGeneration = getCaCertGeneration(this.clientsCa); } Annotations.annotations(eoDeployment.getSpec().getTemplate()).put( Ca.ANNO_STRIMZI_IO_CLUSTER_CA_CERT_GENERATION, String.valueOf(clusterCaCertGeneration)); Annotations.annotations(eoDeployment.getSpec().getTemplate()).put( Ca.ANNO_STRIMZI_IO_CLIENTS_CA_CERT_GENERATION, String.valueOf(clientsCaCertGeneration)); return withVoid(deploymentOperations.reconcile(namespace, EntityOperator.entityOperatorName(name), eoDeployment)); }).map(i -> this); } } return Future.succeededFuture(this); }
Future<ReconciliationState> topicOperatorDeployment(Supplier<Date> dateSupplier) { if (this.topicOperator != null) { Future<Deployment> future = deploymentOperations.getAsync(namespace, this.topicOperator.getName()); if (future != null) { return future.compose(dep -> { // getting the current cluster CA generation from the current deployment, if exists int caCertGeneration = getDeploymentCaCertGeneration(dep, this.clusterCa); // if maintenance windows are satisfied, the cluster CA generation could be changed // and EO needs a rolling update updating the related annotation boolean isSatisfiedBy = isMaintenanceTimeWindowsSatisfied(dateSupplier); if (isSatisfiedBy) { caCertGeneration = getCaCertGeneration(this.clusterCa); } Annotations.annotations(toDeployment.getSpec().getTemplate()).put( Ca.ANNO_STRIMZI_IO_CLUSTER_CA_CERT_GENERATION, String.valueOf(caCertGeneration)); return withVoid(deploymentOperations.reconcile(namespace, TopicOperator.topicOperatorName(name), toDeployment)); }).map(i -> this); } } return Future.succeededFuture(this); }
if (spec.getTemplate() != null && spec.getTemplate().getSpec() != null) { final PodSpec podSpec = spec.getTemplate().getSpec(); builder.accept(new TypedVisitor<PodSpecBuilder>() { @Override
private boolean enableDebug(HasMetadata entity) { if (entity instanceof Deployment) { Deployment resource = (Deployment) entity; DeploymentSpec spec = resource.getSpec(); if (spec != null) { return enableDebugging(entity, spec.getTemplate()); } } else if (entity instanceof ReplicaSet) { ReplicaSet resource = (ReplicaSet) entity; ReplicaSetSpec spec = resource.getSpec(); if (spec != null) { return enableDebugging(entity, spec.getTemplate()); } } else if (entity instanceof ReplicationController) { ReplicationController resource = (ReplicationController) entity; ReplicationControllerSpec spec = resource.getSpec(); if (spec != null) { return enableDebugging(entity, spec.getTemplate()); } } else if (entity instanceof DeploymentConfig) { DeploymentConfig resource = (DeploymentConfig) entity; DeploymentConfigSpec spec = resource.getSpec(); if (spec != null) { return enableDebugging(entity, spec.getTemplate()); } } return false; }
@Override public void adapt(KubernetesListBuilder builder) { super.adapt(builder); List<HasMetadata> items = builder.getItems(); for (HasMetadata item : items) { if (item instanceof Deployment) { Deployment deployment = (Deployment) item; ObjectMeta metadata = deployment.getMetadata(); DeploymentSpec spec = deployment.getSpec(); if (metadata != null && spec != null) { PodTemplateSpec template = spec.getTemplate(); if (template != null) { ObjectMeta templateMetadata = template.getMetadata(); if (templateMetadata == null) { templateMetadata = new ObjectMeta(); template.setMetadata(templateMetadata); } templateMetadata.setAnnotations(MapUtil.mergeMaps(templateMetadata.getAnnotations(), metadata.getAnnotations())); } } } } builder.withItems(items); } }
PodTemplateSpec template = spec.getTemplate(); if (template != null) { specBuilder.withTemplate(template);
DeploymentSpec spec = resource.getSpec(); if (spec != null) { if (enableDebugging(entity, spec.getTemplate())) { kubernetes.extensions().deployments().inNamespace(namespace).withName(name).replace(resource);
resource1OrCopy.setSpec(spec2); } else { PodTemplateSpec template1 = spec1.getTemplate(); PodTemplateSpec template2 = null; if (spec2 != null) { template2 = spec2.getTemplate();
DeploymentSpec spec = resource.getSpec(); if (spec != null) { if (updateImageName(entity, spec.getTemplate(), imagePrefix, imageName)) { kubernetes.extensions().deployments().inNamespace(namespace).withName(name).replace(resource);