use of org.apache.camel.component.kubernetes.KubernetesConfiguration in project camel by apache.
the class ServiceCallClientRouteTest method createRouteBuilder.
@Override
protected RoutesBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
KubernetesConfiguration kubernetesConfiguration = new KubernetesConfiguration();
kubernetesConfiguration.setMasterUrl("http://172.28.128.80:8080");
kubernetesConfiguration.setUsername("admin");
kubernetesConfiguration.setPassword("admin");
kubernetesConfiguration.setNamespace("default");
ServiceCallConfigurationDefinition config = new ServiceCallConfigurationDefinition();
config.setServiceDiscovery(new KubernetesEnvServiceDiscovery(kubernetesConfiguration));
// register configuration
context.setServiceCallConfiguration(config);
from("direct:start").serviceCall("cdi-camel-jetty").serviceCall("cdi-camel-jetty").to("mock:result");
}
};
}
use of org.apache.camel.component.kubernetes.KubernetesConfiguration in project camel by apache.
the class KubernetesClientServiceDiscovery method doStart.
@Override
protected void doStart() throws Exception {
if (client != null) {
return;
}
final KubernetesConfiguration configuration = getConfiguration();
ConfigBuilder builder = new ConfigBuilder();
builder.withMasterUrl(configuration.getMasterUrl());
if ((ObjectHelper.isNotEmpty(configuration.getUsername()) && ObjectHelper.isNotEmpty(configuration.getPassword())) && ObjectHelper.isEmpty(configuration.getOauthToken())) {
builder.withUsername(configuration.getUsername());
builder.withPassword(configuration.getPassword());
} else {
builder.withOauthToken(configuration.getOauthToken());
}
if (ObjectHelper.isNotEmpty(configuration.getCaCertData())) {
builder.withCaCertData(configuration.getCaCertData());
}
if (ObjectHelper.isNotEmpty(configuration.getCaCertFile())) {
builder.withCaCertFile(configuration.getCaCertFile());
}
if (ObjectHelper.isNotEmpty(configuration.getClientCertData())) {
builder.withClientCertData(configuration.getClientCertData());
}
if (ObjectHelper.isNotEmpty(configuration.getClientCertFile())) {
builder.withClientCertFile(configuration.getClientCertFile());
}
if (ObjectHelper.isNotEmpty(configuration.getApiVersion())) {
builder.withApiVersion(configuration.getApiVersion());
}
if (ObjectHelper.isNotEmpty(configuration.getClientKeyAlgo())) {
builder.withClientKeyAlgo(configuration.getClientKeyAlgo());
}
if (ObjectHelper.isNotEmpty(configuration.getClientKeyData())) {
builder.withClientKeyData(configuration.getClientKeyData());
}
if (ObjectHelper.isNotEmpty(configuration.getClientKeyFile())) {
builder.withClientKeyFile(configuration.getClientKeyFile());
}
if (ObjectHelper.isNotEmpty(configuration.getClientKeyPassphrase())) {
builder.withClientKeyPassphrase(configuration.getClientKeyPassphrase());
}
if (ObjectHelper.isNotEmpty(configuration.getTrustCerts())) {
builder.withTrustCerts(configuration.getTrustCerts());
}
client = new AutoAdaptableKubernetesClient(builder.build());
}
use of org.apache.camel.component.kubernetes.KubernetesConfiguration in project camel by apache.
the class ServiceCallEnvironmentRouteTest method createRouteBuilder.
@Override
protected RoutesBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
KubernetesConfiguration kubernetesConfiguration = new KubernetesConfiguration();
ServiceCallConfigurationDefinition config = new ServiceCallConfigurationDefinition();
config.setServiceDiscovery(new KubernetesEnvServiceDiscovery(kubernetesConfiguration));
// register configuration
context.setServiceCallConfiguration(config);
from("direct:start").serviceCall("cdi-camel-jetty").serviceCall("cdi-camel-jetty").to("mock:result");
}
};
}
Aggregations