Search in sources :

Example 11 with StackGresClusterPodScheduling

use of io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling in project stackgres by ongres.

the class ClusterConstraintValidatorTest method validNodeSelector_shouldPass.

@Test
void validNodeSelector_shouldPass() throws ValidationFailed {
    StackGresClusterReview review = getValidReview();
    review.getRequest().getObject().getSpec().getPod().setScheduling(new StackGresClusterPodScheduling());
    review.getRequest().getObject().getSpec().getPod().getScheduling().setNodeSelector(new HashMap<>());
    review.getRequest().getObject().getSpec().getPod().getScheduling().getNodeSelector().put("test", "true");
    validator.validate(review);
}
Also used : StackGresClusterReview(io.stackgres.operator.common.StackGresClusterReview) StackGresClusterPodScheduling(io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling) ConstraintValidationTest(io.stackgres.operator.validation.ConstraintValidationTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 12 with StackGresClusterPodScheduling

use of io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling in project stackgres by ongres.

the class ClusterResourceMockedTest method checkCustomResource.

@Override
protected void checkCustomResource(StackGresCluster resource, ClusterDto resourceDto, Operation operation) {
    final Metadata dtoMetadata = resourceDto.getMetadata();
    final ObjectMeta resourceMetadata = resource.getMetadata();
    if (dtoMetadata != null) {
        assertNotNull(resourceMetadata);
        assertEquals(dtoMetadata.getName(), resourceMetadata.getName());
        assertEquals(dtoMetadata.getNamespace(), resourceMetadata.getNamespace());
        assertEquals(dtoMetadata.getUid(), resourceMetadata.getUid());
    } else {
        assertNull(resourceMetadata);
    }
    final ClusterSpec dtoSpec = resourceDto.getSpec();
    final StackGresClusterSpec resourceSpec = resource.getSpec();
    if (dtoSpec != null) {
        assertNotNull(resourceSpec);
        assertEquals(dtoSpec.getPrometheusAutobind(), resourceSpec.getPrometheusAutobind());
        assertEquals(dtoSpec.getInstances(), resourceSpec.getInstances());
        assertEquals(dtoSpec.getPostgres().getVersion(), resourceSpec.getPostgres().getVersion());
        assertEquals(dtoSpec.getSgInstanceProfile(), resourceSpec.getResourceProfile());
        final ClusterConfiguration dtoSpecConfigurations = dtoSpec.getConfigurations();
        final StackGresClusterConfiguration resourceSpecConfiguration = resourceSpec.getConfiguration();
        if (dtoSpecConfigurations != null) {
            assertNotNull(resourceSpecConfiguration);
            assertEquals(dtoSpecConfigurations.getSgBackupConfig(), resourceSpecConfiguration.getBackupConfig());
            assertEquals(dtoSpecConfigurations.getSgPoolingConfig(), resourceSpecConfiguration.getConnectionPoolingConfig());
            assertEquals(dtoSpecConfigurations.getSgPostgresConfig(), resourceSpecConfiguration.getPostgresConfig());
        } else {
            assertNull(resourceSpecConfiguration);
        }
        final ClusterPod dtoSpecPods = dtoSpec.getPods();
        if (dtoSpecPods != null) {
            final StackGresClusterPod resourceSpecPod = resourceSpec.getPod();
            assertNotNull(resourceSpecPod);
            assertEquals(dtoSpecPods.getDisableConnectionPooling(), resourceSpecPod.getDisableConnectionPooling());
            assertEquals(dtoSpecPods.getDisableMetricsExporter(), resourceSpecPod.getDisableMetricsExporter());
            assertEquals(dtoSpecPods.getDisableMetricsExporter(), resourceSpecPod.getDisableMetricsExporter());
            final ClusterPodPersistentVolume dtoPV = dtoSpecPods.getPersistentVolume();
            final StackGresPodPersistentVolume resourcePV = resourceSpecPod.getPersistentVolume();
            if (dtoPV != null) {
                assertNotNull(resourcePV);
                assertEquals(dtoPV.getSize(), resourcePV.getSize());
                assertEquals(dtoPV.getStorageClass(), resourcePV.getStorageClass());
            } else {
                assertNull(resourcePV);
            }
            final StackGresClusterSpecLabels resourceMetadataLabels = Optional.ofNullable(resourceSpec.getMetadata()).map(StackGresClusterSpecMetadata::getLabels).orElse(null);
            final ClusterSpecLabels dtoMetadataLabels = Optional.ofNullable(dtoSpec.getMetadata()).map(ClusterSpecMetadata::getLabels).orElse(null);
            if (dtoMetadataLabels != null) {
                assertNotNull(resourceMetadataLabels);
                assertEquals(dtoMetadataLabels.getClusterPods(), resourceMetadataLabels.getClusterPods());
            } else {
                assertNull(resourceMetadataLabels);
            }
            final ClusterPodScheduling podScheduling = dtoSpecPods.getScheduling();
            final StackGresClusterPodScheduling resourceScheduling = resourceSpecPod.getScheduling();
            if (podScheduling != null) {
                assertNotNull(resourceScheduling);
                assertEquals(podScheduling.getNodeSelector(), resourceScheduling.getNodeSelector());
                assertEquals(podScheduling.getNodeAffinity(), resourceScheduling.getNodeAffinity());
            } else {
                assertNull(resourceScheduling);
            }
        }
        final ClusterInitData dtoInitData = dtoSpec.getInitData();
        final StackGresClusterInitData resourceInitData = resourceSpec.getInitData();
        if (dtoInitData != null) {
            assertNotNull(resourceInitData);
            final ClusterRestore dtoRestore = dtoInitData.getRestore();
            final StackGresClusterRestore resourceRestore = resourceInitData.getRestore();
            if (dtoRestore != null) {
                assertNotNull(resourceRestore);
                assertEquals(dtoRestore.getFromBackup().getUid(), resourceRestore.getFromBackup().getUid());
            } else {
                assertNull(resourceRestore);
            }
            if (dtoInitData.getScripts() != null) {
                assertNotNull(resourceInitData.getScripts());
                assertEquals(dtoInitData.getScripts().size(), resourceInitData.getScripts().size());
                Seq.zip(dtoInitData.getScripts(), resourceInitData.getScripts()).forEach(entryTuple -> {
                    ClusterScriptEntry dtoEntry = entryTuple.v1;
                    StackGresClusterScriptEntry resourceEntry = entryTuple.v2;
                    assertEquals(dtoEntry.getDatabase(), resourceEntry.getDatabase());
                    assertEquals(dtoEntry.getName(), resourceEntry.getName());
                    assertEquals(dtoEntry.getScript(), resourceEntry.getScript());
                    final ClusterScriptFrom dtoScriptFrom = dtoEntry.getScriptFrom();
                    final StackGresClusterScriptFrom resourceScriptFrom = resourceEntry.getScriptFrom();
                    if (dtoScriptFrom != null) {
                        assertNotNull(resourceScriptFrom);
                        final SecretKeySelector dtoSecretKeyRef = dtoScriptFrom.getSecretKeyRef();
                        final SecretKeySelector resourceSecretKeyRef = resourceScriptFrom.getSecretKeyRef();
                        if (dtoSecretKeyRef != null) {
                            assertNotNull(resourceSecretKeyRef);
                            assertEquals(dtoSecretKeyRef.getName(), resourceSecretKeyRef.getName());
                            assertEquals(dtoSecretKeyRef.getKey(), resourceSecretKeyRef.getKey());
                        } else {
                            assertNull(resourceSecretKeyRef);
                        }
                        final ConfigMapKeySelector resourceConfigMapKeyRef = resourceScriptFrom.getConfigMapKeyRef();
                        final ConfigMapKeySelector dtoConfigMapKeyRef = dtoScriptFrom.getConfigMapKeyRef();
                        if (dtoConfigMapKeyRef != null) {
                            assertNotNull(resourceConfigMapKeyRef);
                            assertEquals(dtoConfigMapKeyRef.getName(), resourceConfigMapKeyRef.getName());
                            assertEquals(dtoConfigMapKeyRef.getKey(), resourceConfigMapKeyRef.getKey());
                        } else {
                            assertNull(resourceConfigMapKeyRef);
                        }
                    } else {
                        assertNull(resourceScriptFrom);
                    }
                });
            }
        } else {
            assertNull(resourceInitData);
        }
        if (dtoSpec.getDistributedLogs() != null) {
            assertNotNull(resourceSpec.getDistributedLogs());
            assertEquals(dtoSpec.getDistributedLogs().getDistributedLogs(), resourceSpec.getDistributedLogs().getDistributedLogs());
        } else {
            assertNull(resourceSpec.getDistributedLogs());
        }
    } else {
        assertNull(resourceSpec);
    }
}
Also used : StackGresClusterPodScheduling(io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling) StackGresClusterInitData(io.stackgres.common.crd.sgcluster.StackGresClusterInitData) ClusterInitData(io.stackgres.apiweb.dto.cluster.ClusterInitData) StackGresClusterScriptEntry(io.stackgres.common.crd.sgcluster.StackGresClusterScriptEntry) ClusterScriptEntry(io.stackgres.apiweb.dto.cluster.ClusterScriptEntry) ObjectMeta(io.fabric8.kubernetes.api.model.ObjectMeta) StackGresClusterSpec(io.stackgres.common.crd.sgcluster.StackGresClusterSpec) StackGresClusterRestore(io.stackgres.common.crd.sgcluster.StackGresClusterRestore) StackGresClusterScriptEntry(io.stackgres.common.crd.sgcluster.StackGresClusterScriptEntry) StackGresClusterSpecMetadata(io.stackgres.common.crd.sgcluster.StackGresClusterSpecMetadata) ClusterSpecMetadata(io.stackgres.apiweb.dto.cluster.ClusterSpecMetadata) Metadata(io.stackgres.apiweb.dto.Metadata) StackGresClusterPod(io.stackgres.common.crd.sgcluster.StackGresClusterPod) StackGresClusterSpec(io.stackgres.common.crd.sgcluster.StackGresClusterSpec) ClusterSpec(io.stackgres.apiweb.dto.cluster.ClusterSpec) ClusterConfiguration(io.stackgres.apiweb.dto.cluster.ClusterConfiguration) StackGresClusterConfiguration(io.stackgres.common.crd.sgcluster.StackGresClusterConfiguration) ClusterPodScheduling(io.stackgres.apiweb.dto.cluster.ClusterPodScheduling) StackGresClusterPodScheduling(io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling) SecretKeySelector(io.stackgres.common.crd.SecretKeySelector) StackGresClusterPod(io.stackgres.common.crd.sgcluster.StackGresClusterPod) ClusterPod(io.stackgres.apiweb.dto.cluster.ClusterPod) StackGresPodPersistentVolume(io.stackgres.common.crd.sgcluster.StackGresPodPersistentVolume) StackGresClusterSpecLabels(io.stackgres.common.crd.sgcluster.StackGresClusterSpecLabels) ClusterPodPersistentVolume(io.stackgres.apiweb.dto.cluster.ClusterPodPersistentVolume) StackGresClusterInitData(io.stackgres.common.crd.sgcluster.StackGresClusterInitData) StackGresClusterScriptFrom(io.stackgres.common.crd.sgcluster.StackGresClusterScriptFrom) StackGresClusterConfiguration(io.stackgres.common.crd.sgcluster.StackGresClusterConfiguration) ClusterRestore(io.stackgres.apiweb.dto.cluster.ClusterRestore) StackGresClusterRestore(io.stackgres.common.crd.sgcluster.StackGresClusterRestore) ClusterSpecLabels(io.stackgres.apiweb.dto.cluster.ClusterSpecLabels) StackGresClusterSpecLabels(io.stackgres.common.crd.sgcluster.StackGresClusterSpecLabels) StackGresClusterScriptFrom(io.stackgres.common.crd.sgcluster.StackGresClusterScriptFrom) ClusterScriptFrom(io.stackgres.apiweb.dto.cluster.ClusterScriptFrom) ConfigMapKeySelector(io.stackgres.common.crd.ConfigMapKeySelector)

Example 13 with StackGresClusterPodScheduling

use of io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling in project stackgres by ongres.

the class StackGresDistributedLogsUtil method getStackGresClusterForDistributedLogs.

static StackGresCluster getStackGresClusterForDistributedLogs(StackGresDistributedLogs distributedLogs) {
    final StackGresCluster distributedLogsCluster = new StackGresCluster();
    distributedLogsCluster.getMetadata().setNamespace(distributedLogs.getMetadata().getNamespace());
    distributedLogsCluster.getMetadata().setName(distributedLogs.getMetadata().getName());
    distributedLogsCluster.getMetadata().setUid(distributedLogs.getMetadata().getUid());
    final StackGresClusterSpec spec = new StackGresClusterSpec();
    spec.setPostgres(new StackGresClusterPostgres());
    spec.getPostgres().setVersion(getPostgresVersion());
    spec.setInstances(1);
    final StackGresClusterPod pod = new StackGresClusterPod();
    final StackGresPodPersistentVolume persistentVolume = new StackGresPodPersistentVolume();
    persistentVolume.setSize(distributedLogs.getSpec().getPersistentVolume().getSize());
    persistentVolume.setStorageClass(distributedLogs.getSpec().getPersistentVolume().getStorageClass());
    pod.setPersistentVolume(persistentVolume);
    spec.setPostgresServices(buildPostgresServices(distributedLogs.getSpec()));
    StackGresClusterPodScheduling scheduling = new StackGresClusterPodScheduling();
    Optional.of(distributedLogs).map(StackGresDistributedLogs::getSpec).map(StackGresDistributedLogsSpec::getScheduling).ifPresent(distributedLogsScheduling -> {
        scheduling.setNodeSelector(distributedLogsScheduling.getNodeSelector());
        scheduling.setTolerations(distributedLogsScheduling.getTolerations());
    });
    pod.setScheduling(scheduling);
    spec.setPod(pod);
    final StackGresClusterInitData initData = new StackGresClusterInitData();
    final StackGresClusterScriptEntry script = new StackGresClusterScriptEntry();
    script.setName("distributed-logs-template");
    script.setDatabase("template1");
    script.setScript(Unchecked.supplier(() -> Resources.asCharSource(StackGresDistributedLogsUtil.class.getResource("/distributed-logs-template.sql"), StandardCharsets.UTF_8).read()).get());
    initData.setScripts(ImmutableList.of(script));
    spec.setInitData(initData);
    final StackGresClusterNonProduction nonProduction = new StackGresClusterNonProduction();
    nonProduction.setDisableClusterPodAntiAffinity(Optional.ofNullable(distributedLogs.getSpec().getNonProduction()).map(StackGresDistributedLogsNonProduction::getDisableClusterPodAntiAffinity).orElse(false));
    spec.setNonProduction(nonProduction);
    final StackGresClusterSpecMetadata metadata = new StackGresClusterSpecMetadata();
    final StackGresClusterSpecAnnotations annotations = new StackGresClusterSpecAnnotations();
    Optional.of(distributedLogs).map(StackGresDistributedLogs::getSpec).map(StackGresDistributedLogsSpec::getMetadata).map(StackGresDistributedLogsSpecMetadata::getAnnotations).ifPresent(distributedLogsAnnotations -> {
        annotations.setAllResources(distributedLogsAnnotations.getAllResources());
        annotations.setClusterPods(distributedLogsAnnotations.getPods());
        annotations.setPrimaryService(distributedLogsAnnotations.getServices());
        annotations.setReplicasService(distributedLogsAnnotations.getServices());
    });
    metadata.setAnnotations(annotations);
    spec.setMetadata(metadata);
    spec.setToInstallPostgresExtensions(Optional.ofNullable(distributedLogs.getSpec()).map(StackGresDistributedLogsSpec::getToInstallPostgresExtensions).orElse(null));
    distributedLogsCluster.setSpec(spec);
    return distributedLogsCluster;
}
Also used : StackGresClusterPodScheduling(io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling) StackGresClusterSpec(io.stackgres.common.crd.sgcluster.StackGresClusterSpec) StackGresDistributedLogsSpec(io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsSpec) StackGresDistributedLogs(io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogs) StackGresClusterScriptEntry(io.stackgres.common.crd.sgcluster.StackGresClusterScriptEntry) StackGresClusterPod(io.stackgres.common.crd.sgcluster.StackGresClusterPod) StackGresClusterPostgres(io.stackgres.common.crd.sgcluster.StackGresClusterPostgres) StackGresDistributedLogsNonProduction(io.stackgres.common.crd.sgdistributedlogs.StackGresDistributedLogsNonProduction) StackGresCluster(io.stackgres.common.crd.sgcluster.StackGresCluster) StackGresClusterNonProduction(io.stackgres.common.crd.sgcluster.StackGresClusterNonProduction) StackGresClusterSpecAnnotations(io.stackgres.common.crd.sgcluster.StackGresClusterSpecAnnotations) StackGresPodPersistentVolume(io.stackgres.common.crd.sgcluster.StackGresPodPersistentVolume) StackGresClusterInitData(io.stackgres.common.crd.sgcluster.StackGresClusterInitData) StackGresClusterSpecMetadata(io.stackgres.common.crd.sgcluster.StackGresClusterSpecMetadata)

Example 14 with StackGresClusterPodScheduling

use of io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling in project stackgres by ongres.

the class StackGresClusterPodSchedulingFixture method build.

public StackGresClusterPodScheduling build() {
    StackGresClusterPodScheduling scheduling = new StackGresClusterPodScheduling();
    scheduling.setNodeAffinity(nodeAffinity);
    return scheduling;
}
Also used : StackGresClusterPodScheduling(io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling)

Example 15 with StackGresClusterPodScheduling

use of io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling in project stackgres by ongres.

the class PodTemplateSpecFactory method getPodTemplateSpec.

@Override
public PodTemplateResult getPodTemplateSpec(StackGresClusterContainerContext context) {
    final List<ContainerFactory<StackGresClusterContainerContext>> containerFactories = containerFactoryDiscoverer.discoverContainers(context);
    final List<Container> containers = containerFactories.stream().map(f -> f.getContainer(context)).collect(Collectors.toUnmodifiableList());
    Map<String, String> componentVersions = containerFactories.stream().map(f -> f.getComponentVersions(context)).map(Map::entrySet).flatMap(Set::stream).distinct().collect(ImmutableMap.toImmutableMap(Map.Entry::getKey, Map.Entry::getValue));
    final List<ContainerFactory<StackGresClusterContainerContext>> initContainerFactories = initContainerFactoryDiscoverer.discoverContainers(context);
    List<Container> initContainers = initContainerFactories.stream().map(f -> f.getContainer(context)).collect(Collectors.toUnmodifiableList());
    final List<String> claimedVolumes = Stream.concat(containers.stream(), initContainers.stream()).flatMap(container -> container.getVolumeMounts().stream()).map(VolumeMount::getName).distinct().collect(Collectors.toUnmodifiableList());
    claimedVolumes.forEach(rv -> {
        if (!context.availableVolumes().containsKey(rv) && !context.getDataVolumeName().equals(rv)) {
            throw new IllegalStateException("Volume " + rv + " is required but not available");
        }
    });
    List<Volume> volumes = claimedVolumes.stream().map(volumeName -> context.availableVolumes().get(volumeName)).filter(Objects::nonNull).collect(Collectors.toUnmodifiableList());
    StackGresCluster cluster = context.getClusterContext().getSource();
    final Map<String, String> podLabels = labelFactory.statefulSetPodLabels(cluster);
    final Map<String, String> customPodLabels = podsCustomLabels(cluster);
    var podTemplate = new PodTemplateSpecBuilder().withMetadata(new ObjectMetaBuilder().addToLabels(customPodLabels).addToLabels(podLabels).addToAnnotations(StackGresContext.VERSION_KEY, StackGresProperty.OPERATOR_VERSION.getString()).addToAnnotations(componentVersions).build()).withNewSpec().withAffinity(new AffinityBuilder().withNodeAffinity(buildPodNodeAffinity(cluster)).withPodAntiAffinity(new PodAntiAffinityBuilder().addAllToRequiredDuringSchedulingIgnoredDuringExecution(Optional.of(new PodAffinityTermBuilder().withLabelSelector(new LabelSelectorBuilder().withMatchExpressions(new LabelSelectorRequirementBuilder().withKey(StackGresContext.APP_KEY).withOperator("In").withValues(labelFactory.labelMapper().appName()).build(), new LabelSelectorRequirementBuilder().withKey("cluster").withOperator("In").withValues("true").build()).build()).withTopologyKey("kubernetes.io/hostname").build()).filter(ignore -> Optional.ofNullable(cluster.getSpec().getNonProduction()).map(StackGresClusterNonProduction::getDisableClusterPodAntiAffinity).map(disableClusterPodAntiAffinity -> !disableClusterPodAntiAffinity).orElse(true)).stream().collect(Collectors.toList())).build()).build()).withNodeSelector(Optional.ofNullable(cluster.getSpec()).map(StackGresClusterSpec::getPod).map(StackGresClusterPod::getScheduling).map(StackGresClusterPodScheduling::getNodeSelector).orElse(null)).withTolerations(Optional.ofNullable(cluster.getSpec()).map(StackGresClusterSpec::getPod).map(StackGresClusterPod::getScheduling).map(StackGresClusterPodScheduling::getTolerations).map(tolerations -> Seq.seq(tolerations).map(TolerationBuilder::new).map(TolerationBuilder::build).toList()).orElse(null)).withShareProcessNamespace(Boolean.TRUE).withServiceAccountName(PatroniRoleGenerator.roleName(context.getClusterContext())).withSecurityContext(podSecurityContext.createResource(context.getClusterContext())).withVolumes(volumes).withContainers(containers).withInitContainers(initContainers).withTerminationGracePeriodSeconds(60L).endSpec().build();
    return ImmutablePodTemplateResult.builder().spec(podTemplate).claimedVolumes(claimedVolumes).build();
}
Also used : NodeAffinityBuilder(io.fabric8.kubernetes.api.model.NodeAffinityBuilder) VolumeMount(io.fabric8.kubernetes.api.model.VolumeMount) StackGresContext(io.stackgres.common.StackGresContext) ContainerFactoryDiscoverer(io.stackgres.operator.conciliation.ContainerFactoryDiscoverer) PodSecurityContext(io.fabric8.kubernetes.api.model.PodSecurityContext) StackGresClusterNonProduction(io.stackgres.common.crd.sgcluster.StackGresClusterNonProduction) Container(io.fabric8.kubernetes.api.model.Container) StackGresProperty(io.stackgres.common.StackGresProperty) StackGresCluster(io.stackgres.common.crd.sgcluster.StackGresCluster) Singleton(javax.inject.Singleton) Seq(org.jooq.lambda.Seq) StackGresClusterSpecMetadata(io.stackgres.common.crd.sgcluster.StackGresClusterSpecMetadata) Inject(javax.inject.Inject) StackGresClusterPod(io.stackgres.common.crd.sgcluster.StackGresClusterPod) ImmutablePodTemplateResult(io.stackgres.operator.conciliation.factory.ImmutablePodTemplateResult) StackGresClusterSpecLabels(io.stackgres.common.crd.sgcluster.StackGresClusterSpecLabels) Map(java.util.Map) PodAntiAffinityBuilder(io.fabric8.kubernetes.api.model.PodAntiAffinityBuilder) ContainerFactory(io.stackgres.operator.conciliation.factory.ContainerFactory) ResourceFactory(io.stackgres.operator.conciliation.factory.ResourceFactory) ObjectMetaBuilder(io.fabric8.kubernetes.api.model.ObjectMetaBuilder) Volume(io.fabric8.kubernetes.api.model.Volume) PodTemplateSpecBuilder(io.fabric8.kubernetes.api.model.PodTemplateSpecBuilder) LabelSelectorBuilder(io.fabric8.kubernetes.api.model.LabelSelectorBuilder) PatroniRoleGenerator(io.stackgres.operator.conciliation.factory.cluster.patroni.PatroniRoleGenerator) ImmutableMap(com.google.common.collect.ImmutableMap) StackGresClusterContext(io.stackgres.operator.conciliation.cluster.StackGresClusterContext) LabelFactoryForCluster(io.stackgres.common.LabelFactoryForCluster) Set(java.util.Set) PodTemplateFactory(io.stackgres.operator.conciliation.factory.PodTemplateFactory) Collectors(java.util.stream.Collectors) LabelSelectorRequirementBuilder(io.fabric8.kubernetes.api.model.LabelSelectorRequirementBuilder) TolerationBuilder(io.fabric8.kubernetes.api.model.TolerationBuilder) NodeAffinity(io.fabric8.kubernetes.api.model.NodeAffinity) Objects(java.util.Objects) AffinityBuilder(io.fabric8.kubernetes.api.model.AffinityBuilder) StackGresClusterSpec(io.stackgres.common.crd.sgcluster.StackGresClusterSpec) List(java.util.List) PodAffinityTermBuilder(io.fabric8.kubernetes.api.model.PodAffinityTermBuilder) PodTemplateResult(io.stackgres.operator.conciliation.factory.PodTemplateResult) Stream(java.util.stream.Stream) StackGresClusterPodScheduling(io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling) Optional(java.util.Optional) InitContainerFactoryDiscover(io.stackgres.operator.conciliation.InitContainerFactoryDiscover) StackGresClusterPodScheduling(io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling) Set(java.util.Set) NodeAffinityBuilder(io.fabric8.kubernetes.api.model.NodeAffinityBuilder) PodAntiAffinityBuilder(io.fabric8.kubernetes.api.model.PodAntiAffinityBuilder) AffinityBuilder(io.fabric8.kubernetes.api.model.AffinityBuilder) PodAffinityTermBuilder(io.fabric8.kubernetes.api.model.PodAffinityTermBuilder) Container(io.fabric8.kubernetes.api.model.Container) LabelSelectorBuilder(io.fabric8.kubernetes.api.model.LabelSelectorBuilder) StackGresClusterSpec(io.stackgres.common.crd.sgcluster.StackGresClusterSpec) LabelSelectorRequirementBuilder(io.fabric8.kubernetes.api.model.LabelSelectorRequirementBuilder) TolerationBuilder(io.fabric8.kubernetes.api.model.TolerationBuilder) PodAntiAffinityBuilder(io.fabric8.kubernetes.api.model.PodAntiAffinityBuilder) ObjectMetaBuilder(io.fabric8.kubernetes.api.model.ObjectMetaBuilder) StackGresCluster(io.stackgres.common.crd.sgcluster.StackGresCluster) Volume(io.fabric8.kubernetes.api.model.Volume) PodTemplateSpecBuilder(io.fabric8.kubernetes.api.model.PodTemplateSpecBuilder) ContainerFactory(io.stackgres.operator.conciliation.factory.ContainerFactory) VolumeMount(io.fabric8.kubernetes.api.model.VolumeMount) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap)

Aggregations

StackGresClusterPodScheduling (io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling)15 StackGresClusterReview (io.stackgres.operator.common.StackGresClusterReview)9 ConstraintValidationTest (io.stackgres.operator.validation.ConstraintValidationTest)9 Test (org.junit.jupiter.api.Test)9 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 Toleration (io.stackgres.common.crd.Toleration)7 StackGresClusterPod (io.stackgres.common.crd.sgcluster.StackGresClusterPod)3 StackGresClusterSpec (io.stackgres.common.crd.sgcluster.StackGresClusterSpec)3 StackGresClusterSpecMetadata (io.stackgres.common.crd.sgcluster.StackGresClusterSpecMetadata)3 ClusterPodScheduling (io.stackgres.apiweb.dto.cluster.ClusterPodScheduling)2 StackGresCluster (io.stackgres.common.crd.sgcluster.StackGresCluster)2 StackGresClusterInitData (io.stackgres.common.crd.sgcluster.StackGresClusterInitData)2 StackGresClusterNonProduction (io.stackgres.common.crd.sgcluster.StackGresClusterNonProduction)2 StackGresClusterScriptEntry (io.stackgres.common.crd.sgcluster.StackGresClusterScriptEntry)2 StackGresClusterSpecLabels (io.stackgres.common.crd.sgcluster.StackGresClusterSpecLabels)2 StackGresPodPersistentVolume (io.stackgres.common.crd.sgcluster.StackGresPodPersistentVolume)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 AffinityBuilder (io.fabric8.kubernetes.api.model.AffinityBuilder)1 Container (io.fabric8.kubernetes.api.model.Container)1 LabelSelectorBuilder (io.fabric8.kubernetes.api.model.LabelSelectorBuilder)1