Search in sources :

Example 6 with StackGresClusterPodScheduling

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

the class ClusterPodSchedulingConverter method from.

public ClusterPodScheduling from(StackGresClusterPodScheduling source) {
    ClusterPodScheduling podScheduling = new ClusterPodScheduling();
    podScheduling.setNodeSelector(source.getNodeSelector());
    podScheduling.setTolerations(source.getTolerations());
    podScheduling.setNodeAffinity(source.getNodeAffinity());
    return podScheduling;
}
Also used : StackGresClusterPodScheduling(io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling) ClusterPodScheduling(io.stackgres.apiweb.dto.cluster.ClusterPodScheduling)

Example 7 with StackGresClusterPodScheduling

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

the class ClusterPodSchedulingConverter method to.

public StackGresClusterPodScheduling to(ClusterPodScheduling sourceScheduling) {
    StackGresClusterPodScheduling targetScheduling = new StackGresClusterPodScheduling();
    targetScheduling.setNodeSelector(sourceScheduling.getNodeSelector());
    targetScheduling.setTolerations(sourceScheduling.getTolerations());
    targetScheduling.setNodeAffinity(sourceScheduling.getNodeAffinity());
    return targetScheduling;
}
Also used : StackGresClusterPodScheduling(io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling)

Example 8 with StackGresClusterPodScheduling

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

the class ClusterConstraintValidatorTest method invalidTolerationEffect_shouldFail.

@Test
void invalidTolerationEffect_shouldFail() {
    StackGresClusterReview review = getValidReview();
    review.getRequest().getObject().getSpec().getPod().setScheduling(new StackGresClusterPodScheduling());
    review.getRequest().getObject().getSpec().getPod().getScheduling().setTolerations(new ArrayList<>());
    review.getRequest().getObject().getSpec().getPod().getScheduling().getTolerations().add(new Toleration());
    review.getRequest().getObject().getSpec().getPod().getScheduling().getTolerations().get(0).setKey("test");
    review.getRequest().getObject().getSpec().getPod().getScheduling().getTolerations().get(0).setEffect("NeverSchedule");
    checkErrorCause(Toleration.class, "spec.pod.scheduling.tolerations[0].effect", "isEffectValid", review, AssertTrue.class);
}
Also used : StackGresClusterReview(io.stackgres.operator.common.StackGresClusterReview) StackGresClusterPodScheduling(io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling) Toleration(io.stackgres.common.crd.Toleration) ConstraintValidationTest(io.stackgres.operator.validation.ConstraintValidationTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 9 with StackGresClusterPodScheduling

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

the class ClusterConstraintValidatorTest method invalidTolerationKeyEmpty_shouldFail.

@Test
void invalidTolerationKeyEmpty_shouldFail() {
    StackGresClusterReview review = getValidReview();
    review.getRequest().getObject().getSpec().getPod().setScheduling(new StackGresClusterPodScheduling());
    review.getRequest().getObject().getSpec().getPod().getScheduling().setTolerations(new ArrayList<>());
    review.getRequest().getObject().getSpec().getPod().getScheduling().getTolerations().add(new Toleration());
    review.getRequest().getObject().getSpec().getPod().getScheduling().getTolerations().get(0).setKey("");
    checkErrorCause(Toleration.class, new String[] { "spec.pod.scheduling.tolerations[0].key", "spec.pod.scheduling.tolerations[0].operator" }, "isOperatorExistsWhenKeyIsEmpty", review, AssertTrue.class);
}
Also used : StackGresClusterReview(io.stackgres.operator.common.StackGresClusterReview) StackGresClusterPodScheduling(io.stackgres.common.crd.sgcluster.StackGresClusterPodScheduling) Toleration(io.stackgres.common.crd.Toleration) ConstraintValidationTest(io.stackgres.operator.validation.ConstraintValidationTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 10 with StackGresClusterPodScheduling

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

the class ClusterConstraintValidatorTest method invalidNodeSelector_shouldFail.

@Test
void invalidNodeSelector_shouldFail() {
    StackGresClusterReview review = getValidReview();
    review.getRequest().getObject().getSpec().getPod().setScheduling(new StackGresClusterPodScheduling());
    review.getRequest().getObject().getSpec().getPod().getScheduling().setNodeSelector(new HashMap<>());
    checkErrorCause(StackGresClusterPodScheduling.class, "spec.pod.scheduling.nodeSelector", "isNodeSelectorNotEmpty", review, AssertTrue.class);
}
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)

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