use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project quarkus by quarkusio.
the class KnativeClusterLocalTest method assertGeneratedResources.
@Test
public void assertGeneratedResources() throws IOException {
Path kubernetesDir = prodModeTestResults.getBuildDir().resolve("kubernetes");
assertThat(kubernetesDir).isDirectoryContaining(p -> p.getFileName().endsWith("knative.json")).isDirectoryContaining(p -> p.getFileName().endsWith("knative.yml"));
assertThat(getKNativeService(kubernetesDir)).satisfies(service -> {
assertThat(service.getMetadata()).satisfies(m -> {
assertThat(m.getLabels()).contains(entry("networking.knative.dev/visibility", "cluster-local"));
});
});
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project yakc by manusa.
the class ServiceIT method deleteNamespacedService.
@Test
@DisplayName("deleteNamespacedService, should delete existing Service")
void deleteNamespacedService() throws IOException {
// When
final Service result = KC.create(CoreV1Api.class).deleteNamespacedService(serviceName, NAMESPACE).get();
// Then
assertThat(result).isNotNull().extracting(Service::getMetadata).hasFieldOrPropertyWithValue("name", serviceName);
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project yakc by manusa.
the class ServiceLegacyIT method patchNamespacedService.
@Test
@DisplayName("patchNamespacedService, should patch labels of Service")
void patchNamespacedService() throws IOException {
// When
final Service result = KC.create(CoreV1Api.class).patchNamespacedService(serviceName, NAMESPACE, Service.builder().metadata(ObjectMeta.builder().putInLabels("patched", "label").build()).build()).get();
// Then
assertThat(result).isNotNull().extracting(Service::getMetadata).hasFieldOrPropertyWithValue("name", serviceName).extracting(ObjectMeta::getLabels).asInstanceOf(InstanceOfAssertFactories.MAP).hasSize(2).containsEntry("patched", "label");
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project yakc by manusa.
the class ServiceLegacyIT method replaceNamespacedService.
@Test
@DisplayName("replaceNamespacedService, should replace existing Service's port")
void replaceNamespacedService() throws IOException {
// Given
final Service existingService = KC.create(CoreV1Api.class).readNamespacedService(serviceName, NAMESPACE).get();
existingService.getSpec().getPorts().get(0).setTargetPort("http");
// When
final Service result = KC.create(CoreV1Api.class).replaceNamespacedService(serviceName, NAMESPACE, existingService).get();
// Then
assertThat(result).isNotNull().hasFieldOrPropertyWithValue("metadata.name", serviceName).extracting(Service::getSpec).extracting(ServiceSpec::getPorts).asList().hasSize(2).element(0).hasFieldOrPropertyWithValue("targetPort", "http");
}
use of com.marcnuri.yakc.model.io.k8s.api.core.v1.Service in project dekorate by dekorateio.
the class Feat458Test method shouldHaveKubernetestLabelsKnativeYml.
@Test
public void shouldHaveKubernetestLabelsKnativeYml() {
KubernetesList list = Serialization.unmarshalAsList(Feat458Test.class.getClassLoader().getResourceAsStream("META-INF/dekorate/knative.yml"));
assertNotNull(list);
Service s = findFirst(list, Service.class).orElseThrow(() -> new IllegalStateException());
assertNotNull(s);
Map<String, String> labels = s.getMetadata().getLabels();
assertNotNull(labels);
assertTrue(labels.containsKey(Labels.NAME));
assertTrue(labels.containsKey(Labels.VERSION));
assertFalse(labels.containsKey(OpenshiftLabels.RUNTIME));
Map<String, String> annotations = s.getMetadata().getAnnotations();
assertNotNull(annotations);
assertTrue(annotations.containsKey(Annotations.COMMIT_ID));
assertFalse(annotations.containsKey(OpenshiftAnnotations.VCS_URL));
assertTrue(annotations.containsKey(Annotations.VCS_URL));
}
Aggregations