use of io.stackgres.common.crd.NodeAffinity in project stackgres by ongres.
the class PodTemplateSpecFactoryTest method shouldNodeAffinity_HasTheSameRequireDuringSchedulingRequirementsSize.
@Test
void shouldNodeAffinity_HasTheSameRequireDuringSchedulingRequirementsSize() {
NodeAffinity nodeAffinity = new NodeAffinityFixture().withValidRequirement().build();
StackGresCluster cluster = new StackGresClusterFixture().withNodeAffinity(nodeAffinity).build();
io.fabric8.kubernetes.api.model.NodeAffinity k8sPodNodeAffinity = this.podTemplateSpecFactory.buildPodNodeAffinity(cluster);
assertEquals(2, k8sPodNodeAffinity.getRequiredDuringSchedulingIgnoredDuringExecution().getNodeSelectorTerms().size());
}
use of io.stackgres.common.crd.NodeAffinity in project stackgres by ongres.
the class PodTemplateSpecFactoryTest method shouldNodeAffinity_HasTheSamePreferredDuringSchedulingRequirementsKey.
@Test
void shouldNodeAffinity_HasTheSamePreferredDuringSchedulingRequirementsKey() {
NodeAffinity nodeAffinity = new NodeAffinityFixture().withValidPreferredScheduling().build();
StackGresCluster cluster = new StackGresClusterFixture().withNodeAffinity(nodeAffinity).build();
io.fabric8.kubernetes.api.model.NodeAffinity k8sPodNodeAffinity = this.podTemplateSpecFactory.buildPodNodeAffinity(cluster);
k8sPodNodeAffinity.getPreferredDuringSchedulingIgnoredDuringExecution().forEach(preference -> {
preference.getPreference().getMatchExpressions().forEach(math -> {
assertEquals(PREFERRED_TOPOLOGY_KEY, math.getKey());
});
});
}
use of io.stackgres.common.crd.NodeAffinity in project stackgres by ongres.
the class PodTemplateSpecFactoryTest method shouldNodeAffinity_HasTheSameRequireDuringSchedulingRequirementsKey.
@Test
void shouldNodeAffinity_HasTheSameRequireDuringSchedulingRequirementsKey() {
NodeAffinity nodeAffinity = new NodeAffinityFixture().withValidRequirement().build();
StackGresCluster cluster = new StackGresClusterFixture().withNodeAffinity(nodeAffinity).build();
io.fabric8.kubernetes.api.model.NodeAffinity k8sPodNodeAffinity = this.podTemplateSpecFactory.buildPodNodeAffinity(cluster);
k8sPodNodeAffinity.getRequiredDuringSchedulingIgnoredDuringExecution().getNodeSelectorTerms().forEach(term -> {
term.getMatchExpressions().forEach(math -> {
assertEquals(REQUIRED_TOPOLY_KEY, math.getKey());
});
});
}
use of io.stackgres.common.crd.NodeAffinity in project stackgres by ongres.
the class NodeAffinityFixture method build.
public NodeAffinity build() {
NodeAffinity nodeAffinity = new NodeAffinity();
io.fabric8.kubernetes.api.model.NodeAffinity k8sNodeAffinity = new NodeAffinityBuilder().withRequiredDuringSchedulingIgnoredDuringExecution(requireds).withPreferredDuringSchedulingIgnoredDuringExecution(preference).build();
nodeAffinity.setPreferredDuringSchedulingIgnoredDuringExecution(k8sNodeAffinity.getPreferredDuringSchedulingIgnoredDuringExecution());
nodeAffinity.setRequiredDuringSchedulingIgnoredDuringExecution(k8sNodeAffinity.getRequiredDuringSchedulingIgnoredDuringExecution());
return nodeAffinity;
}
use of io.stackgres.common.crd.NodeAffinity in project stackgres by ongres.
the class PodTemplateSpecFactoryTest method shouldNodeAffinity_HasTheSamePreferredDuringSchedulingRequirementsSize.
@Test
void shouldNodeAffinity_HasTheSamePreferredDuringSchedulingRequirementsSize() {
NodeAffinity nodeAffinity = new NodeAffinityFixture().withValidPreferredScheduling().build();
StackGresCluster cluster = new StackGresClusterFixture().withNodeAffinity(nodeAffinity).build();
io.fabric8.kubernetes.api.model.NodeAffinity k8sPodNodeAffinity = this.podTemplateSpecFactory.buildPodNodeAffinity(cluster);
assertEquals(nodeAffinity.getPreferredDuringSchedulingIgnoredDuringExecution().size(), k8sPodNodeAffinity.getPreferredDuringSchedulingIgnoredDuringExecution().size());
}
Aggregations