use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project stackgres by ongres.
the class CrdMatchTest method customResourcesYamlDefinitionsPlural_ShouldMatchWithPluralInJavaDefinition.
@Test
void customResourcesYamlDefinitionsPlural_ShouldMatchWithPluralInJavaDefinition() throws IOException {
withEveryYaml(crdTree -> {
JsonNode crdNames = crdTree.get("spec").get("names");
String declaredPlural = crdNames.get("plural").asText();
CustomResourceDefinition definition = getDefinition(crdTree);
assertEquals(declaredPlural, definition.getSpec().getNames().getPlural());
Class<? extends CustomResource> clazz = getCustomResourceClass(crdTree);
String plural = HasMetadata.getPlural(clazz);
assertEquals(declaredPlural, plural, "Kind : " + HasMetadata.getKind(clazz));
});
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project stackgres by ongres.
the class CrdMatchTest method customResourcesYamlNamespaced_ShouldMatchWithNamespacedInJavaDefinition.
@Test
void customResourcesYamlNamespaced_ShouldMatchWithNamespacedInJavaDefinition() throws IOException {
withEveryYaml(crdTree -> {
JsonNode metadataName = crdTree.get("spec").get("scope");
CustomResourceDefinition definition = getDefinition(crdTree);
assertEquals(metadataName.asText(), definition.getSpec().getScope());
});
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project xp-operator by enonic.
the class SchemaTest method v1Xp7App.
@Test
void v1Xp7App() throws IOException {
CustomResourceDefinition customResourceDefinition = loadCRD("/crds/apps.yaml");
JSONSchemaProps schema = loadSchema("/schema/v1/xp7app/xp7App.json");
assertSchema(getSchemaVersion(customResourceDefinition, "v1"), schema);
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project xp-operator by enonic.
the class SchemaTest method v1Xp7Deployment.
@Test
void v1Xp7Deployment() throws IOException {
CustomResourceDefinition customResourceDefinition = loadCRD("/crds/deployments.yaml");
JSONSchemaProps schema = loadSchema("/schema/v1/xp7deployment/xp7Deployment.json");
assertSchema(getSchemaVersion(customResourceDefinition, "v1"), schema);
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project xp-operator by enonic.
the class CrudTest method v1Xp7App.
@Test
void v1Xp7App() throws IOException, URISyntaxException {
EnonicKubernetesClient client = new DefaultEnonicKubernetesClient(server.getClient());
CustomResourceDefinition crd = client.k8s().apiextensions().v1().customResourceDefinitions().load(getClass().getResourceAsStream("/crds/apps.yaml")).get();
client.k8s().apiextensions().v1().customResourceDefinitions().create(crd);
// Create crd client
MixedOperation<Xp7App, Xp7App.Xp7AppList, Resource<Xp7App>> crdClient = client.enonic().v1().crds().xp7apps();
// Create resource
ObjectMetaBuilder metadataBuilder = new ObjectMetaBuilder().withNamespace("test").withName("test-name");
Xp7App resource = new Xp7App().withSpec(new Xp7AppSpec().withUrl("test"));
resource.setMetadata(metadataBuilder.build());
assertCrd(resource, "/crud-app.json");
// Send to server
crdClient.create(resource);
// List
Xp7App.Xp7AppList list = crdClient.list();
assertNotNull(list);
assertEquals(1, list.getItems().size());
assertEqualsCrd(resource, list.getItems().get(0));
// Fetch from server
Xp7App get = crdClient.withName("test-name").get();
assertNotNull(get);
assertEqualsCrd(resource, get);
// Test put
resource.setMetadata(metadataBuilder.withLabels(Map.of("test2", "test2")).build());
resource.setSpec(new Xp7AppSpec().withUrl("test"));
crdClient.withName("test-name").replace(resource);
// Delete from server
assertTrue(crdClient.withName("test-name").delete());
}
Aggregations