use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project stackgres by ongres.
the class CrdMatchTest method customResourcesYamlSingular_shouldMatchWithSingularInJavaDefinition.
@Test
void customResourcesYamlSingular_shouldMatchWithSingularInJavaDefinition() throws IOException {
withEveryYaml(crdTree -> {
JsonNode crdNames = crdTree.get("spec").get("names");
String declaredSingular = crdNames.get("singular").asText();
CustomResourceDefinition definition = getDefinition(crdTree);
assertEquals(declaredSingular, definition.getSpec().getNames().getSingular());
Class<? extends CustomResource> clazz = getCustomResourceClass(crdTree);
String singular = HasMetadata.getSingular(clazz);
assertEquals(declaredSingular, singular, "Kind : " + HasMetadata.getKind(clazz));
});
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project jkube by eclipse.
the class ApplyService method applyCustomResourceDefinition.
public void applyCustomResourceDefinition(CustomResourceDefinition entity, String sourceName) {
String currentNamespace = applicableNamespace(entity, namespace, fallbackNamespace);
String id = getName(entity);
Objects.requireNonNull(id, "No name for " + entity + " " + sourceName);
if (isServicesOnlyMode()) {
log.debug("Only processing Services right now so ignoring Custom Resource Definition: " + currentNamespace + ":" + id);
return;
}
CustomResourceDefinition old = kubernetesClient.apiextensions().v1().customResourceDefinitions().withName(id).get();
if (isRunning(old)) {
if (UserConfigurationCompare.configEqual(entity, old)) {
log.info("Custom Resource Definition has not changed so not doing anything");
} else {
if (isRecreateMode()) {
log.info("Deleting Custom Resource Definition: " + id);
kubernetesClient.apiextensions().v1().customResourceDefinitions().withName(id).delete();
doCreateCustomResourceDefinition(entity, sourceName);
} else {
doPatchEntity(old, entity, currentNamespace, sourceName);
}
}
} else {
if (!isAllowCreate()) {
log.warn("Creation disabled so not creating a Custom Resource Definition from " + sourceName + " name " + getName(entity));
} else {
doCreateCustomResourceDefinition(entity, sourceName);
}
}
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class StrimziBundleManagerTest method createKafkaCRDs.
private CustomResourceDefinition createKafkaCRDs() {
CustomResourceDefinition crd = new CustomResourceDefinitionBuilder(Crds.kafka()).editMetadata().withName("kafkas.kafka.strimzi.io").withLabels(Map.of("app", "strimzi")).endMetadata().build();
this.openShiftClient.apiextensions().v1().customResourceDefinitions().create(crd);
return crd;
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class PrometheusRegisterInterceptor method registerPrometheus.
@AroundInvoke
public Object registerPrometheus(InvocationContext context) throws Exception {
if (!ServiceMonitorClient.isServiceMonitorAvailable(kubernetesClient)) {
final CustomResourceDefinition serviceMonitorCRD = kubernetesClient.apiextensions().v1().customResourceDefinitions().load(this.getClass().getResourceAsStream("/k8s/servicemonitor.v1.crd.yaml")).get();
kubernetesClient.apiextensions().v1().customResourceDefinitions().withName(SERVICE_MONITOR_CRD_NAME).create(serviceMonitorCRD);
}
return context.proceed();
}
use of io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition in project syndesis by syndesisio.
the class CamelKPublishHandler method createIntegration.
@SuppressWarnings({ "unchecked" })
protected StateUpdate createIntegration(IntegrationDeployment integrationDeployment, CustomResourceDefinition integrationCRD) {
logInfo(integrationDeployment, "Creating Camel-K resource");
prepareDeployment(integrationDeployment);
io.syndesis.server.controller.integration.camelk.crd.Integration camelkIntegration = createIntegrationCR(integrationDeployment);
camelkIntegration = applyCustomizers(integrationDeployment, camelkIntegration);
Secret camelkSecret = createIntegrationSecret(integrationDeployment);
getOpenShiftService().createOrReplaceSecret(camelkSecret);
getOpenShiftService().createOrReplaceCR(integrationCRD, io.syndesis.server.controller.integration.camelk.crd.Integration.class, IntegrationList.class, DoneableIntegration.class, camelkIntegration);
logInfo(integrationDeployment, "Camel-K resource created " + camelkIntegration.getMetadata().getName());
return new StateUpdate(IntegrationDeploymentState.Pending, Collections.emptyMap());
}
Aggregations