use of io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext in project syndesis-qe by syndesisio.
the class Syndesis method makeSyndesisContext.
private CustomResourceDefinitionContext makeSyndesisContext(String version) {
CustomResourceDefinition syndesisCrd = getCrd();
CustomResourceDefinitionContext.Builder builder = new CustomResourceDefinitionContext.Builder().withGroup(syndesisCrd.getSpec().getGroup()).withPlural(syndesisCrd.getSpec().getNames().getPlural()).withScope(syndesisCrd.getSpec().getScope()).withVersion(version);
return builder.build();
}
use of io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext in project jbosstools-openshift by jbosstools.
the class OdoCli method createService.
@Override
public void createService(String project, String application, ServiceTemplate serviceTemplate, OperatorCRD serviceCRD, String service, ObjectNode spec, boolean wait) throws IOException {
try {
CustomResourceDefinitionContext context = toCustomResourceDefinitionContext(serviceCRD);
ObjectNode payload = serviceCRD.getSample().deepCopy();
updatePayload(payload, spec, project, service);
client.customResource(context).create(project, JSON_MAPPER.writeValueAsString(payload));
UsageStats.getInstance().odoCommand("service create", true);
UsageStats.getInstance().createService(serviceTemplate.getName(), true);
} catch (KubernetesClientException e) {
UsageStats.getInstance().odoCommand("service create", false);
UsageStats.getInstance().createService(serviceTemplate.getName(), false);
throw new IOException(e.getLocalizedMessage(), e);
} catch (IOException e) {
UsageStats.getInstance().odoCommand("service create", false);
UsageStats.getInstance().createService(serviceTemplate.getName(), false);
throw e;
}
}
use of io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext in project syndesis-qe by syndesisio.
the class Syndesis method getSubscription.
private static JSONObject getSubscription() {
CustomResourceDefinitionContext context = getSubscriptionCRDContext();
JSONObject subs = new JSONObject(OpenShiftUtils.getInstance().customResource(context).list(TestConfiguration.openShiftNamespace()));
JSONArray items = subs.getJSONArray("items");
for (int i = 0; i < items.length(); i++) {
if (items.getJSONObject(i).getJSONObject("spec").getString("name").equals("fuse-online")) {
return items.getJSONObject(i);
}
}
return null;
}
use of io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext in project syndesis-qe by syndesisio.
the class CamelK method getCamelKCRD.
private CustomResourceDefinitionContext getCamelKCRD() {
CustomResourceDefinition crd = OpenShiftUtils.getInstance().customResourceDefinitions().withName("integrations.camel.apache.org").get();
CustomResourceDefinitionContext.Builder builder = new CustomResourceDefinitionContext.Builder().withGroup(crd.getSpec().getGroup()).withPlural(crd.getSpec().getNames().getPlural()).withScope(crd.getSpec().getScope()).withVersion(crd.getSpec().getVersion());
return builder.build();
}
use of io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext in project jbosstools-openshift by jbosstools.
the class OdoCli method deleteService.
@Override
public void deleteService(String project, String application, org.jboss.tools.openshift.core.odo.Service service) throws IOException {
try {
CustomResourceDefinitionContext context = toCustomResourceDefinitionContext(service);
client.customResource(context).delete(project, service.getName());
UsageStats.getInstance().odoCommand("service delete", true);
} catch (KubernetesClientException e) {
UsageStats.getInstance().odoCommand("service delete", false);
throw e;
}
}
Aggregations