use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project xp-operator by enonic.
the class CrudTest method v1Xp7Deployment.
@Test
void v1Xp7Deployment() throws IOException, URISyntaxException {
EnonicKubernetesClient client = new DefaultEnonicKubernetesClient(server.getClient());
// Create crd
CustomResourceDefinition crd = client.k8s().apiextensions().v1().customResourceDefinitions().load(getClass().getResourceAsStream("/crds/deployments.yaml")).get();
client.k8s().apiextensions().v1().customResourceDefinitions().create(crd);
// Create crd client
MixedOperation<Xp7Deployment, Xp7Deployment.Xp7DeploymentList, Resource<Xp7Deployment>> crdClient = client.enonic().v1().crds().xp7deployments();
// Create resource
ObjectMetaBuilder metadataBuilder = new ObjectMetaBuilder().withNamespace("test").withName("test-name");
Xp7Deployment resource = new Xp7Deployment().withSpec(new Xp7DeploymentSpec().withEnabled(true).withXpVersion("unstable").withXp7DeploymentSpecNodesSharedDisks(Collections.singletonList(new Xp7DeploymentSpecNodesSharedDisk().withName("blobstore").withSize("150"))).withXp7DeploymentSpecNodeGroups(Collections.singletonList(new Xp7DeploymentSpecNodeGroup().withName("test").withDisplayName("test").withReplicas(1).withData(true).withMaster(true).withXp7DeploymentSpecNodeGroupEnvironment(Collections.singletonList(new Xp7DeploymentSpecNodeGroupEnvVar().withName("test").withValue("test"))).withXp7DeploymentSpecNodeGroupResources(new Xp7DeploymentSpecNodeGroupResources().withCpu("1").withMemory("512Mi").withXp7DeploymentSpecNodeGroupDisks(Collections.singletonList(new Xp7DeploymentSpecNodeGroupDisk().withName("index").withSize("100m")))))));
resource.setMetadata(metadataBuilder.build());
assertCrd(resource, "/crud-deployment.json");
// Send to server
crdClient.create(resource);
// List
Xp7Deployment.Xp7DeploymentList list = crdClient.list();
assertNotNull(list);
assertEquals(1, list.getItems().size());
assertEqualsCrd(resource, list.getItems().get(0));
// Fetch from server
Xp7Deployment get = crdClient.withName("test-name").get();
assertNotNull(get);
assertEquals(resource, get);
// Test put
resource.setMetadata(metadataBuilder.withLabels(Map.of("test2", "test2")).build());
resource.setSpec(resource.getSpec().withEnabled(false));
crdClient.withName("test-name").replace(resource);
// Delete from server
assertTrue(crdClient.withName("test-name").delete());
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project xp-operator by enonic.
the class SchemaTest method v1Xp7Config.
@Test
void v1Xp7Config() throws IOException {
CustomResourceDefinition customResourceDefinition = loadCRD("/crds/configs.yaml");
JSONSchemaProps schema = loadSchema("/schema/v1/xp7config/xp7Config.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 loadCRD.
private CustomResourceDefinition loadCRD(final String file) {
KubernetesClient client = server.getClient();
CustomResourceDefinition customResourceDefinition = client.apiextensions().v1().customResourceDefinitions().load(getClass().getResourceAsStream(file)).get();
assertNotNull(customResourceDefinition);
return customResourceDefinition;
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project xp-operator by enonic.
the class SchemaTest method v1Domain.
@Test
void v1Domain() throws IOException {
CustomResourceDefinition customResourceDefinition = loadCRD("/crds/domains.yaml");
JSONSchemaProps schema = loadSchema("/schema/v1/domain/domain.json");
assertSchema(getSchemaVersion(customResourceDefinition, "v1"), schema);
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project debezium by debezium.
the class OcpApicurioV1Controller method registryOperation.
@Override
protected NonNamespaceOperation<ApicurioRegistry, ApicurioRegistryList, Resource<ApicurioRegistry>> registryOperation() {
CustomResourceDefinition crd = ocp.apiextensions().v1beta1().customResourceDefinitions().load(OcpApicurioV1Controller.class.getResourceAsStream(APICURIO_CRD_DESCRIPTOR)).get();
CustomResourceDefinitionContext context = CustomResourceDefinitionContext.fromCrd(crd);
return ocp.customResources(context, ApicurioRegistry.class, ApicurioRegistryList.class).inNamespace(project);
}
Aggregations