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;
}
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;
}
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);
}
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);
}
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);
}
Aggregations