http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/secrets/KubernetesSecretsProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/secrets/KubernetesSecretsProducer.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/secrets/KubernetesSecretsProducer.java new file mode 100644 index 0000000..76b9730 --- /dev/null +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/secrets/KubernetesSecretsProducer.java @@ -0,0 +1,199 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.kubernetes.secrets; + +import java.util.Map; + +import io.fabric8.kubernetes.api.model.DoneableSecret; +import io.fabric8.kubernetes.api.model.Secret; +import io.fabric8.kubernetes.api.model.SecretList; +import io.fabric8.kubernetes.client.dsl.MixedOperation; +import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; +import io.fabric8.kubernetes.client.dsl.Resource; + +import org.apache.camel.Exchange; +import org.apache.camel.component.kubernetes.AbstractKubernetesEndpoint; +import org.apache.camel.component.kubernetes.KubernetesConstants; +import org.apache.camel.component.kubernetes.KubernetesOperations; +import org.apache.camel.impl.DefaultProducer; +import org.apache.camel.util.MessageHelper; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class KubernetesSecretsProducer extends DefaultProducer { + + private static final Logger LOG = LoggerFactory + .getLogger(KubernetesSecretsProducer.class); + + public KubernetesSecretsProducer(AbstractKubernetesEndpoint endpoint) { + super(endpoint); + } + + @Override + public AbstractKubernetesEndpoint getEndpoint() { + return (AbstractKubernetesEndpoint) super.getEndpoint(); + } + + @Override + public void process(Exchange exchange) throws Exception { + String operation; + + if (ObjectHelper.isEmpty(getEndpoint().getKubernetesConfiguration() + .getOperation())) { + operation = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_OPERATION, String.class); + } else { + operation = getEndpoint().getKubernetesConfiguration() + .getOperation(); + } + + switch (operation) { + + case KubernetesOperations.LIST_SECRETS: + doList(exchange, operation); + break; + + case KubernetesOperations.LIST_SECRETS_BY_LABELS_OPERATION: + doListSecretsByLabels(exchange, operation); + break; + + case KubernetesOperations.GET_SECRET_OPERATION: + doGetSecret(exchange, operation); + break; + + case KubernetesOperations.CREATE_SECRET_OPERATION: + doCreateSecret(exchange, operation); + break; + + case KubernetesOperations.DELETE_SECRET_OPERATION: + doDeleteSecret(exchange, operation); + break; + + default: + throw new IllegalArgumentException("Unsupported operation " + + operation); + } + } + + protected void doList(Exchange exchange, String operation) throws Exception { + SecretList secretsList = getEndpoint().getKubernetesClient().secrets() + .list(); + exchange.getOut().setBody(secretsList.getItems()); + } + + protected void doListSecretsByLabels(Exchange exchange, String operation) + throws Exception { + SecretList secretsList = null; + Map<String, String> labels = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SECRETS_LABELS, Map.class); + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + if (!ObjectHelper.isEmpty(namespaceName)) { + NonNamespaceOperation<Secret, SecretList, DoneableSecret, Resource<Secret, DoneableSecret>> secrets; + secrets = getEndpoint().getKubernetesClient().secrets() + .inNamespace(namespaceName); + for (Map.Entry<String, String> entry : labels.entrySet()) { + secrets.withLabel(entry.getKey(), entry.getValue()); + } + secretsList = secrets.list(); + } else { + MixedOperation<Secret, SecretList, DoneableSecret, Resource<Secret, DoneableSecret>> secrets; + secrets = getEndpoint().getKubernetesClient().secrets(); + for (Map.Entry<String, String> entry : labels.entrySet()) { + secrets.withLabel(entry.getKey(), entry.getValue()); + } + secretsList = secrets.list(); + } + + MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true); + exchange.getOut().setBody(secretsList.getItems()); + } + + protected void doGetSecret(Exchange exchange, String operation) + throws Exception { + Secret secret = null; + String secretName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SECRET_NAME, String.class); + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + if (ObjectHelper.isEmpty(secretName)) { + LOG.error("Get a specific Secret require specify a Secret name"); + throw new IllegalArgumentException( + "Get a specific Secret require specify a Secret name"); + } + if (ObjectHelper.isEmpty(namespaceName)) { + LOG.error("Get a specific Secret require specify a namespace name"); + throw new IllegalArgumentException( + "Get a specific Secret require specify a namespace name"); + } + secret = getEndpoint().getKubernetesClient().secrets() + .inNamespace(namespaceName).withName(secretName).get(); + + MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true); + exchange.getOut().setBody(secret); + } + + protected void doCreateSecret(Exchange exchange, String operation) + throws Exception { + Secret secret = null; + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + Secret secretToCreate = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SECRET, Secret.class); + if (ObjectHelper.isEmpty(namespaceName)) { + LOG.error("Create a specific secret require specify a namespace name"); + throw new IllegalArgumentException( + "Create a specific secret require specify a namespace name"); + } + if (ObjectHelper.isEmpty(secretToCreate)) { + LOG.error("Create a specific secret require specify a secret bean"); + throw new IllegalArgumentException( + "Create a specific secret require specify a secret bean"); + } + Map<String, String> labels = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SECRETS_LABELS, Map.class); + secret = getEndpoint().getKubernetesClient().secrets() + .inNamespace(namespaceName).create(secretToCreate); + + MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true); + exchange.getOut().setBody(secret); + } + + protected void doDeleteSecret(Exchange exchange, String operation) + throws Exception { + String secretName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SECRET_NAME, String.class); + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + if (ObjectHelper.isEmpty(secretName)) { + LOG.error("Delete a specific secret require specify a secret name"); + throw new IllegalArgumentException( + "Delete a specific secret require specify a secret name"); + } + if (ObjectHelper.isEmpty(namespaceName)) { + LOG.error("Delete a specific secret require specify a namespace name"); + throw new IllegalArgumentException( + "Delete a specific secret require specify a namespace name"); + } + boolean secretDeleted = getEndpoint().getKubernetesClient().secrets() + .inNamespace(namespaceName).withName(secretName).delete(); + + MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true); + exchange.getOut().setBody(secretDeleted); + } +}
http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/service_accounts/KubernetesServiceAccountsComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/service_accounts/KubernetesServiceAccountsComponent.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/service_accounts/KubernetesServiceAccountsComponent.java new file mode 100644 index 0000000..79f752a --- /dev/null +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/service_accounts/KubernetesServiceAccountsComponent.java @@ -0,0 +1,28 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.kubernetes.service_accounts; + +import org.apache.camel.component.kubernetes.AbstractKubernetesComponent; +import org.apache.camel.component.kubernetes.KubernetesConfiguration; + +public class KubernetesServiceAccountsComponent extends AbstractKubernetesComponent { + + protected KubernetesServiceAccountsEndpoint doCreateEndpoint(String uri, String remaining, KubernetesConfiguration config) throws Exception { + KubernetesServiceAccountsEndpoint endpoint = new KubernetesServiceAccountsEndpoint(uri, this, config); + return endpoint; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/service_accounts/KubernetesServiceAccountsEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/service_accounts/KubernetesServiceAccountsEndpoint.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/service_accounts/KubernetesServiceAccountsEndpoint.java new file mode 100644 index 0000000..cd5da73 --- /dev/null +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/service_accounts/KubernetesServiceAccountsEndpoint.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.kubernetes.service_accounts; + +import org.apache.camel.Consumer; +import org.apache.camel.Processor; +import org.apache.camel.Producer; +import org.apache.camel.component.kubernetes.AbstractKubernetesEndpoint; +import org.apache.camel.component.kubernetes.KubernetesConfiguration; +import org.apache.camel.spi.UriEndpoint; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Kubernetes Service Accounts component provides a producer to execute service account operations. + */ +@UriEndpoint(firstVersion = "2.17.0", scheme = "kubernetes-service-account", title = "Kubernetes Servkce Account", + syntax = "kubernetes-service-account:masterUrl", producerOnly = true, label = "container,cloud,paas") +public class KubernetesServiceAccountsEndpoint extends AbstractKubernetesEndpoint { + + private static final Logger LOG = LoggerFactory.getLogger(KubernetesServiceAccountsEndpoint.class); + + public KubernetesServiceAccountsEndpoint(String uri, KubernetesServiceAccountsComponent component, KubernetesConfiguration config) { + super(uri, component, config); + } + + @Override + public Producer createProducer() throws Exception { + return new KubernetesServiceAccountsProducer(this); + } + + @Override + public Consumer createConsumer(Processor processor) throws Exception { + throw new IllegalArgumentException("The kubernetes-service-accounts doesn't support consumer"); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/service_accounts/KubernetesServiceAccountsProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/service_accounts/KubernetesServiceAccountsProducer.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/service_accounts/KubernetesServiceAccountsProducer.java new file mode 100644 index 0000000..acecca8 --- /dev/null +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/service_accounts/KubernetesServiceAccountsProducer.java @@ -0,0 +1,199 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.kubernetes.service_accounts; + +import java.util.Map; + +import io.fabric8.kubernetes.api.model.DoneableServiceAccount; +import io.fabric8.kubernetes.api.model.ServiceAccount; +import io.fabric8.kubernetes.api.model.ServiceAccountList; +import io.fabric8.kubernetes.client.dsl.MixedOperation; +import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; +import io.fabric8.kubernetes.client.dsl.Resource; + +import org.apache.camel.Exchange; +import org.apache.camel.component.kubernetes.AbstractKubernetesEndpoint; +import org.apache.camel.component.kubernetes.KubernetesConstants; +import org.apache.camel.component.kubernetes.KubernetesOperations; +import org.apache.camel.impl.DefaultProducer; +import org.apache.camel.util.MessageHelper; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class KubernetesServiceAccountsProducer extends DefaultProducer { + + private static final Logger LOG = LoggerFactory + .getLogger(KubernetesServiceAccountsProducer.class); + + public KubernetesServiceAccountsProducer(AbstractKubernetesEndpoint endpoint) { + super(endpoint); + } + + @Override + public AbstractKubernetesEndpoint getEndpoint() { + return (AbstractKubernetesEndpoint) super.getEndpoint(); + } + + @Override + public void process(Exchange exchange) throws Exception { + String operation; + + if (ObjectHelper.isEmpty(getEndpoint().getKubernetesConfiguration() + .getOperation())) { + operation = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_OPERATION, String.class); + } else { + operation = getEndpoint().getKubernetesConfiguration() + .getOperation(); + } + + switch (operation) { + + case KubernetesOperations.LIST_SERVICE_ACCOUNTS: + doList(exchange, operation); + break; + + case KubernetesOperations.LIST_SERVICE_ACCOUNTS_BY_LABELS_OPERATION: + doListServiceAccountsByLabels(exchange, operation); + break; + + case KubernetesOperations.GET_SECRET_OPERATION: + doGetServiceAccount(exchange, operation); + break; + + case KubernetesOperations.CREATE_SERVICE_ACCOUNT_OPERATION: + doCreateServiceAccount(exchange, operation); + break; + + case KubernetesOperations.DELETE_SERVICE_ACCOUNT_OPERATION: + doDeleteServiceAccount(exchange, operation); + break; + + default: + throw new IllegalArgumentException("Unsupported operation " + + operation); + } + } + + protected void doList(Exchange exchange, String operation) throws Exception { + ServiceAccountList saList = getEndpoint().getKubernetesClient().serviceAccounts() + .list(); + exchange.getOut().setBody(saList.getItems()); + } + + protected void doListServiceAccountsByLabels(Exchange exchange, String operation) + throws Exception { + ServiceAccountList saList = null; + Map<String, String> labels = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SERVICE_ACCOUNTS_LABELS, Map.class); + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + if (!ObjectHelper.isEmpty(namespaceName)) { + NonNamespaceOperation<ServiceAccount, ServiceAccountList, DoneableServiceAccount, Resource<ServiceAccount, DoneableServiceAccount>> serviceAccounts; + serviceAccounts = getEndpoint().getKubernetesClient().serviceAccounts() + .inNamespace(namespaceName); + for (Map.Entry<String, String> entry : labels.entrySet()) { + serviceAccounts.withLabel(entry.getKey(), entry.getValue()); + } + saList = serviceAccounts.list(); + } else { + MixedOperation<ServiceAccount, ServiceAccountList, DoneableServiceAccount, Resource<ServiceAccount, DoneableServiceAccount>> serviceAccounts; + serviceAccounts = getEndpoint().getKubernetesClient().serviceAccounts(); + for (Map.Entry<String, String> entry : labels.entrySet()) { + serviceAccounts.withLabel(entry.getKey(), entry.getValue()); + } + saList = serviceAccounts.list(); + } + + MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true); + exchange.getOut().setBody(saList.getItems()); + } + + protected void doGetServiceAccount(Exchange exchange, String operation) + throws Exception { + ServiceAccount sa = null; + String saName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SERVICE_ACCOUNT_NAME, String.class); + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + if (ObjectHelper.isEmpty(saName)) { + LOG.error("Get a specific Service Account require specify a Service Account name"); + throw new IllegalArgumentException( + "Get a specific Service Account require specify a Service Account name"); + } + if (ObjectHelper.isEmpty(namespaceName)) { + LOG.error("Get a specific Service Account require specify a namespace name"); + throw new IllegalArgumentException( + "Get a specific Service Account require specify a namespace name"); + } + sa = getEndpoint().getKubernetesClient().serviceAccounts() + .inNamespace(namespaceName).withName(saName).get(); + + MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true); + exchange.getOut().setBody(sa); + } + + protected void doCreateServiceAccount(Exchange exchange, String operation) + throws Exception { + ServiceAccount sa = null; + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + ServiceAccount saToCreate = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SERVICE_ACCOUNT, ServiceAccount.class); + if (ObjectHelper.isEmpty(namespaceName)) { + LOG.error("Create a specific Service Account require specify a namespace name"); + throw new IllegalArgumentException( + "Create a specific Service Account require specify a namespace name"); + } + if (ObjectHelper.isEmpty(saToCreate)) { + LOG.error("Create a specific Service Account require specify a Service Account bean"); + throw new IllegalArgumentException( + "Create a specific Service Account require specify a Service Account bean"); + } + Map<String, String> labels = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SERVICE_ACCOUNTS_LABELS, Map.class); + sa = getEndpoint().getKubernetesClient().serviceAccounts() + .inNamespace(namespaceName).create(saToCreate); + + MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true); + exchange.getOut().setBody(sa); + } + + protected void doDeleteServiceAccount(Exchange exchange, String operation) + throws Exception { + String saName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SERVICE_ACCOUNT_NAME, String.class); + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + if (ObjectHelper.isEmpty(saName)) { + LOG.error("Delete a specific Service Account require specify a Service Account name"); + throw new IllegalArgumentException( + "Delete a specific Service Account require specify a Service Account name"); + } + if (ObjectHelper.isEmpty(namespaceName)) { + LOG.error("Delete a specific Service Account require specify a namespace name"); + throw new IllegalArgumentException( + "Delete a specific Service Account require specify a namespace name"); + } + boolean saDeleted = getEndpoint().getKubernetesClient().serviceAccounts() + .inNamespace(namespaceName).withName(saName).delete(); + + MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true); + exchange.getOut().setBody(saDeleted); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesComponent.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesComponent.java new file mode 100644 index 0000000..19ed4dc --- /dev/null +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesComponent.java @@ -0,0 +1,28 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.kubernetes.services; + +import org.apache.camel.component.kubernetes.AbstractKubernetesComponent; +import org.apache.camel.component.kubernetes.KubernetesConfiguration; + +public class KubernetesServicesComponent extends AbstractKubernetesComponent { + + protected KubernetesServicesEndpoint doCreateEndpoint(String uri, String remaining, KubernetesConfiguration config) throws Exception { + KubernetesServicesEndpoint endpoint = new KubernetesServicesEndpoint(uri, this, config); + return endpoint; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesConsumer.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesConsumer.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesConsumer.java new file mode 100644 index 0000000..8b25131 --- /dev/null +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesConsumer.java @@ -0,0 +1,141 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.kubernetes.services; + +import java.util.concurrent.ExecutorService; + +import io.fabric8.kubernetes.api.model.DoneableService; +import io.fabric8.kubernetes.api.model.Service; +import io.fabric8.kubernetes.api.model.ServiceList; +import io.fabric8.kubernetes.client.KubernetesClientException; +import io.fabric8.kubernetes.client.Watch; +import io.fabric8.kubernetes.client.Watcher; +import io.fabric8.kubernetes.client.dsl.MixedOperation; +import io.fabric8.kubernetes.client.dsl.Resource; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; +import org.apache.camel.component.kubernetes.AbstractKubernetesEndpoint; +import org.apache.camel.component.kubernetes.KubernetesConstants; +import org.apache.camel.component.kubernetes.consumer.common.ServiceEvent; +import org.apache.camel.impl.DefaultConsumer; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class KubernetesServicesConsumer extends DefaultConsumer { + + private static final Logger LOG = LoggerFactory.getLogger(KubernetesServicesConsumer.class); + + private final Processor processor; + private ExecutorService executor; + private ServicesConsumerTask servicesWatcher; + + public KubernetesServicesConsumer(AbstractKubernetesEndpoint endpoint, Processor processor) { + super(endpoint, processor); + this.processor = processor; + } + + @Override + public AbstractKubernetesEndpoint getEndpoint() { + return (AbstractKubernetesEndpoint) super.getEndpoint(); + } + + @Override + protected void doStart() throws Exception { + super.doStart(); + executor = getEndpoint().createExecutor(); + + servicesWatcher = new ServicesConsumerTask(); + executor.submit(servicesWatcher); + + } + + @Override + protected void doStop() throws Exception { + super.doStop(); + LOG.debug("Stopping Kubernetes Services Consumer"); + if (executor != null) { + if (getEndpoint() != null && getEndpoint().getCamelContext() != null) { + if (servicesWatcher != null) { + servicesWatcher.getWatch().close(); + } + getEndpoint().getCamelContext().getExecutorServiceManager().shutdownNow(executor); + } else { + if (servicesWatcher != null) { + servicesWatcher.getWatch().close(); + } + executor.shutdownNow(); + } + } + executor = null; + } + + class ServicesConsumerTask implements Runnable { + + private Watch watch; + + @Override + public void run() { + MixedOperation<Service, ServiceList, DoneableService, Resource<Service, DoneableService>> w = getEndpoint().getKubernetesClient().services(); + if (ObjectHelper.isNotEmpty(getEndpoint().getKubernetesConfiguration().getNamespace())) { + w.inNamespace(getEndpoint().getKubernetesConfiguration().getNamespace()); + } + if (ObjectHelper.isNotEmpty(getEndpoint().getKubernetesConfiguration().getLabelKey()) + && ObjectHelper.isNotEmpty(getEndpoint().getKubernetesConfiguration().getLabelValue())) { + w.withLabel(getEndpoint().getKubernetesConfiguration().getLabelKey(), getEndpoint().getKubernetesConfiguration().getLabelValue()); + } + if (ObjectHelper.isNotEmpty(getEndpoint().getKubernetesConfiguration().getResourceName())) { + w.withName(getEndpoint().getKubernetesConfiguration().getResourceName()); + } + watch = w.watch(new Watcher<Service>() { + + @Override + public void eventReceived(io.fabric8.kubernetes.client.Watcher.Action action, + Service resource) { + ServiceEvent se = new ServiceEvent(action, resource); + Exchange exchange = getEndpoint().createExchange(); + exchange.getIn().setBody(se.getService()); + exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_EVENT_ACTION, se.getAction()); + exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_EVENT_TIMESTAMP, System.currentTimeMillis()); + try { + processor.process(exchange); + } catch (Exception e) { + getExceptionHandler().handleException("Error during processing", exchange, e); + } + + } + + @Override + public void onClose(KubernetesClientException cause) { + if (cause != null) { + LOG.error(cause.getMessage(), cause); + } + } + + }); + } + + public Watch getWatch() { + return watch; + } + + public void setWatch(Watch watch) { + this.watch = watch; + } + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesEndpoint.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesEndpoint.java new file mode 100644 index 0000000..1446b7a --- /dev/null +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesEndpoint.java @@ -0,0 +1,52 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.kubernetes.services; + +import org.apache.camel.Consumer; +import org.apache.camel.Processor; +import org.apache.camel.Producer; +import org.apache.camel.component.kubernetes.AbstractKubernetesEndpoint; +import org.apache.camel.component.kubernetes.KubernetesConfiguration; +import org.apache.camel.spi.UriEndpoint; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Kubernetes Service Accounts component provides a producer to execute service operations + * and a consumer to consume service events. + */ +@UriEndpoint(firstVersion = "2.17.0", scheme = "kubernetes-services", title = "Kubernetes Services", + syntax = "kubernetes-services:masterUrl", consumerClass = KubernetesServicesConsumer.class, label = "container,cloud,paas") +public class KubernetesServicesEndpoint extends AbstractKubernetesEndpoint { + + private static final Logger LOG = LoggerFactory.getLogger(KubernetesServicesEndpoint.class); + + public KubernetesServicesEndpoint(String uri, KubernetesServicesComponent component, KubernetesConfiguration config) { + super(uri, component, config); + } + + @Override + public Producer createProducer() throws Exception { + return new KubernetesServicesProducer(this); + } + + @Override + public Consumer createConsumer(Processor processor) throws Exception { + return new KubernetesServicesConsumer(this, processor); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesProducer.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesProducer.java new file mode 100644 index 0000000..29a608b --- /dev/null +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/services/KubernetesServicesProducer.java @@ -0,0 +1,210 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.kubernetes.services; + +import java.util.Map; + +import io.fabric8.kubernetes.api.model.DoneableService; +import io.fabric8.kubernetes.api.model.Service; +import io.fabric8.kubernetes.api.model.ServiceBuilder; +import io.fabric8.kubernetes.api.model.ServiceList; +import io.fabric8.kubernetes.api.model.ServiceSpec; +import io.fabric8.kubernetes.client.dsl.MixedOperation; +import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; +import io.fabric8.kubernetes.client.dsl.Resource; + +import org.apache.camel.Exchange; +import org.apache.camel.component.kubernetes.AbstractKubernetesEndpoint; +import org.apache.camel.component.kubernetes.KubernetesConstants; +import org.apache.camel.component.kubernetes.KubernetesOperations; +import org.apache.camel.impl.DefaultProducer; +import org.apache.camel.util.ObjectHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class KubernetesServicesProducer extends DefaultProducer { + + private static final Logger LOG = LoggerFactory + .getLogger(KubernetesServicesProducer.class); + + public KubernetesServicesProducer(AbstractKubernetesEndpoint endpoint) { + super(endpoint); + } + + @Override + public AbstractKubernetesEndpoint getEndpoint() { + return (AbstractKubernetesEndpoint) super.getEndpoint(); + } + + @Override + public void process(Exchange exchange) throws Exception { + String operation; + + if (ObjectHelper.isEmpty(getEndpoint().getKubernetesConfiguration() + .getOperation())) { + operation = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_OPERATION, String.class); + } else { + operation = getEndpoint().getKubernetesConfiguration() + .getOperation(); + } + + switch (operation) { + + case KubernetesOperations.LIST_SERVICES_OPERATION: + doList(exchange, operation); + break; + + case KubernetesOperations.LIST_SERVICES_BY_LABELS_OPERATION: + doListServiceByLabels(exchange, operation); + break; + + case KubernetesOperations.GET_SERVICE_OPERATION: + doGetService(exchange, operation); + break; + + case KubernetesOperations.CREATE_SERVICE_OPERATION: + doCreateService(exchange, operation); + break; + + case KubernetesOperations.DELETE_SERVICE_OPERATION: + doDeleteService(exchange, operation); + break; + + default: + throw new IllegalArgumentException("Unsupported operation " + + operation); + } + } + + protected void doList(Exchange exchange, String operation) throws Exception { + ServiceList servicesList = null; + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + if (!ObjectHelper.isEmpty(namespaceName)) { + servicesList = getEndpoint().getKubernetesClient().services() + .inNamespace(namespaceName).list(); + } else { + servicesList = getEndpoint().getKubernetesClient().services() + .list(); + } + exchange.getOut().setBody(servicesList.getItems()); + } + + protected void doListServiceByLabels(Exchange exchange, String operation) + throws Exception { + ServiceList servicesList = null; + Map<String, String> labels = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SERVICE_LABELS, Map.class); + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + if (!ObjectHelper.isEmpty(namespaceName)) { + NonNamespaceOperation<Service, ServiceList, DoneableService, Resource<Service, DoneableService>> services; + services = getEndpoint().getKubernetesClient().services() + .inNamespace(namespaceName); + for (Map.Entry<String, String> entry : labels.entrySet()) { + services.withLabel(entry.getKey(), entry.getValue()); + } + servicesList = services.list(); + } else { + MixedOperation<Service, ServiceList, DoneableService, Resource<Service, DoneableService>> services; + services = getEndpoint().getKubernetesClient().services(); + for (Map.Entry<String, String> entry : labels.entrySet()) { + services.withLabel(entry.getKey(), entry.getValue()); + } + servicesList = services.list(); + } + exchange.getOut().setBody(servicesList.getItems()); + } + + protected void doGetService(Exchange exchange, String operation) + throws Exception { + Service service = null; + String serviceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SERVICE_NAME, String.class); + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + if (ObjectHelper.isEmpty(serviceName)) { + LOG.error("Get a specific service require specify a service name"); + throw new IllegalArgumentException( + "Get a specific service require specify a service name"); + } + if (ObjectHelper.isEmpty(namespaceName)) { + LOG.error("Get a specific service require specify a namespace name"); + throw new IllegalArgumentException( + "Get a specific service require specify a namespace name"); + } + service = getEndpoint().getKubernetesClient().services() + .inNamespace(namespaceName).withName(serviceName).get(); + exchange.getOut().setBody(service); + } + + protected void doCreateService(Exchange exchange, String operation) + throws Exception { + Service service = null; + String serviceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SERVICE_NAME, String.class); + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + ServiceSpec serviceSpec = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SERVICE_SPEC, ServiceSpec.class); + if (ObjectHelper.isEmpty(serviceName)) { + LOG.error("Create a specific service require specify a service name"); + throw new IllegalArgumentException( + "Create a specific service require specify a service name"); + } + if (ObjectHelper.isEmpty(namespaceName)) { + LOG.error("Create a specific service require specify a namespace name"); + throw new IllegalArgumentException( + "Create a specific service require specify a namespace name"); + } + if (ObjectHelper.isEmpty(serviceSpec)) { + LOG.error("Create a specific service require specify a service spec bean"); + throw new IllegalArgumentException( + "Create a specific service require specify a service spec bean"); + } + Map<String, String> labels = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SERVICE_LABELS, Map.class); + Service serviceCreating = new ServiceBuilder() + .withNewMetadata().withName(serviceName).withLabels(labels) + .endMetadata().withSpec(serviceSpec).build(); + service = getEndpoint().getKubernetesClient().services() + .inNamespace(namespaceName).create(serviceCreating); + exchange.getOut().setBody(service); + } + + protected void doDeleteService(Exchange exchange, String operation) + throws Exception { + String serviceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_SERVICE_NAME, String.class); + String namespaceName = exchange.getIn().getHeader( + KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class); + if (ObjectHelper.isEmpty(serviceName)) { + LOG.error("Delete a specific service require specify a service name"); + throw new IllegalArgumentException( + "Delete a specific service require specify a service name"); + } + if (ObjectHelper.isEmpty(namespaceName)) { + LOG.error("Delete a specific service require specify a namespace name"); + throw new IllegalArgumentException( + "Delete a specific service require specify a namespace name"); + } + boolean serviceDeleted = getEndpoint().getKubernetesClient().services() + .inNamespace(namespaceName).withName(serviceName).delete(); + exchange.getOut().setBody(serviceDeleted); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-build-configs ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-build-configs b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-build-configs new file mode 100644 index 0000000..7893186 --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-build-configs @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.build_configs.KubernetesBuildConfigsComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-builds ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-builds b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-builds new file mode 100644 index 0000000..944c980 --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-builds @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.builds.KubernetesBuildsComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-config-maps ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-config-maps b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-config-maps new file mode 100644 index 0000000..5af8e52 --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-config-maps @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.config_maps.KubernetesConfigMapsComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-namespaces ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-namespaces b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-namespaces new file mode 100644 index 0000000..3bcbd81 --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-namespaces @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.namespaces.KubernetesNamespacesComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-nodes ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-nodes b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-nodes new file mode 100644 index 0000000..cc606db --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-nodes @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.nodes.KubernetesNodesComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-persistent-volumes ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-persistent-volumes b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-persistent-volumes new file mode 100644 index 0000000..468f0f0 --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-persistent-volumes @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.persistent_volumes.KubernetesPersistentVolumesComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-persistent-volumes-claims ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-persistent-volumes-claims b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-persistent-volumes-claims new file mode 100644 index 0000000..e969034 --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-persistent-volumes-claims @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.persistent_volumes_claims.KubernetesPersistentVolumesClaimsComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-pods ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-pods b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-pods new file mode 100644 index 0000000..9ec115d --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-pods @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.pods.KubernetesPodsComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-replication-controllers ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-replication-controllers b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-replication-controllers new file mode 100644 index 0000000..865417a --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-replication-controllers @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.replication_controllers.KubernetesReplicationControllersComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-resources-quota ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-resources-quota b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-resources-quota new file mode 100644 index 0000000..4c1d8be --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-resources-quota @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.resources_quota.KubernetesResourcesQuotaComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-secrets ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-secrets b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-secrets new file mode 100644 index 0000000..d30cab2 --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-secrets @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.secrets.KubernetesSecretsComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-service-accounts ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-service-accounts b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-service-accounts new file mode 100644 index 0000000..d3789fd --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-service-accounts @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.service_accounts.KubernetesServiceAccountsComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-services ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-services b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-services new file mode 100644 index 0000000..cff6ab0 --- /dev/null +++ b/components/camel-kubernetes/src/main/resources/META-INF/services/org/apache/camel/component/kubernetes-services @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +class=org.apache.camel.component.kubernetes.services.KubernetesServicesComponent http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesNamespacesConsumerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesNamespacesConsumerTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesNamespacesConsumerTest.java index 97265dc..93662e9 100644 --- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesNamespacesConsumerTest.java +++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesNamespacesConsumerTest.java @@ -120,18 +120,18 @@ public class KubernetesNamespacesConsumerTest extends KubernetesTestSupport { return new RouteBuilder() { @Override public void configure() throws Exception { - from("direct:list").toF("kubernetes://%s?oauthToken=%s&category=namespaces&operation=listNamespaces", + from("direct:list").toF("kubernetes-namespaces://%s?oauthToken=%s&operation=listNamespaces", host, authToken); from("direct:listByLabels").toF( - "kubernetes://%s?oauthToken=%s&category=namespaces&operation=listNamespacesByLabels", host, + "kubernetes-namespaces://%s?oauthToken=%s&operation=listNamespacesByLabels", host, authToken); - from("direct:getNs").toF("kubernetes://%s?oauthToken=%s&category=namespaces&operation=getNamespace", + from("direct:getNs").toF("kubernetes-namespaces://%s?oauthToken=%s&operation=getNamespace", host, authToken); from("direct:createNamespace").toF( - "kubernetes://%s?oauthToken=%s&category=namespaces&operation=createNamespace", host, authToken); + "kubernetes-namespaces://%s?oauthToken=%s&operation=createNamespace", host, authToken); from("direct:deleteNamespace").toF( - "kubernetes://%s?oauthToken=%s&category=namespaces&operation=deleteNamespace", host, authToken); - fromF("kubernetes://%s?oauthToken=%s&category=namespaces", host, authToken).process( + "kubernetes-namespaces://%s?oauthToken=%s&operation=deleteNamespace", host, authToken); + fromF("kubernetes-namespaces://%s?oauthToken=%s", host, authToken).process( new KubernertesProcessor()).to(mockResultEndpoint); } }; http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesNodesConsumerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesNodesConsumerTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesNodesConsumerTest.java index 43c6097..edd9d84 100644 --- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesNodesConsumerTest.java +++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesNodesConsumerTest.java @@ -107,17 +107,17 @@ public class KubernetesNodesConsumerTest extends KubernetesTestSupport { return new RouteBuilder() { @Override public void configure() throws Exception { - from("direct:list").toF("kubernetes://%s?oauthToken=%s&category=pods&operation=listPods", host, + from("direct:list").toF("kubernetes-pods://%s?oauthToken=%s&operation=listPods", host, authToken); from("direct:listByLabels") - .toF("kubernetes://%s?oauthToken=%s&category=pods&operation=listPodsByLabels", host, authToken); - from("direct:getPod").toF("kubernetes://%s?oauthToken=%s&category=pods&operation=getPod", host, + .toF("kubernetes-pods://%s?oauthToken=%s&operation=listPodsByLabels", host, authToken); + from("direct:getPod").toF("kubernetes-pods://%s?oauthToken=%s&operation=getPod", host, authToken); - from("direct:createPod").toF("kubernetes://%s?oauthToken=%s&category=pods&operation=createPod", host, + from("direct:createPod").toF("kubernetes-pods://%s?oauthToken=%s&operation=createPod", host, authToken); - from("direct:deletePod").toF("kubernetes://%s?oauthToken=%s&category=pods&operation=deletePod", host, + from("direct:deletePod").toF("kubernetes-pods://%s?oauthToken=%s&operation=deletePod", host, authToken); - fromF("kubernetes://%s?oauthToken=%s&category=nodes&resourceName=minikube", host, authToken) + fromF("kubernetes-nodes://%s?oauthToken=%s&resourceName=minikube", host, authToken) .process(new KubernertesProcessor()).to(mockResultEndpoint); } }; http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesPodsConsumerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesPodsConsumerTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesPodsConsumerTest.java index b2fabb9..98a7cde 100644 --- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesPodsConsumerTest.java +++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesPodsConsumerTest.java @@ -108,17 +108,17 @@ public class KubernetesPodsConsumerTest extends KubernetesTestSupport { return new RouteBuilder() { @Override public void configure() throws Exception { - from("direct:list").toF("kubernetes://%s?oauthToken=%s&category=pods&operation=listPods", host, + from("direct:list").toF("kubernetes-pods://%s?oauthToken=%s&operation=listPods", host, authToken); from("direct:listByLabels") - .toF("kubernetes://%s?oauthToken=%s&category=pods&operation=listPodsByLabels", host, authToken); - from("direct:getPod").toF("kubernetes://%s?oauthToken=%s&category=pods&operation=getPod", host, + .toF("kubernetes-pods://%s?oauthToken=%s&operation=listPodsByLabels", host, authToken); + from("direct:getPod").toF("kubernetes-pods://%s?oauthToken=%s&operation=getPod", host, authToken); - from("direct:createPod").toF("kubernetes://%s?oauthToken=%s&category=pods&operation=createPod", host, + from("direct:createPod").toF("kubernetes-pods://%s?oauthToken=%s&operation=createPod", host, authToken); - from("direct:deletePod").toF("kubernetes://%s?oauthToken=%s&category=pods&operation=deletePod", host, + from("direct:deletePod").toF("kubernetes-pods://%s?oauthToken=%s&operation=deletePod", host, authToken); - fromF("kubernetes://%s?oauthToken=%s&category=pods&namespace=default&labelKey=this&labelValue=rocks", host, authToken) + fromF("kubernetes-pods://%s?oauthToken=%s&namespace=default&labelKey=this&labelValue=rocks", host, authToken) .process(new KubernertesProcessor()).to(mockResultEndpoint); } }; http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesReplicationControllersConsumerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesReplicationControllersConsumerTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesReplicationControllersConsumerTest.java index 5cb5d15..c79d249 100644 --- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesReplicationControllersConsumerTest.java +++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesReplicationControllersConsumerTest.java @@ -100,21 +100,21 @@ public class KubernetesReplicationControllersConsumerTest extends KubernetesTest @Override public void configure() throws Exception { from("direct:list").toF( - "kubernetes://%s?oauthToken=%s&category=replicationControllers&operation=listReplicationControllers", + "kubernetes-replication-controllers://%s?oauthToken=%s&operation=listReplicationControllers", host, authToken); from("direct:listByLabels").toF( - "kubernetes://%s?oauthToken=%s&category=replicationControllers&operation=listReplicationControllersByLabels", + "kubernetes-replication-controllers://%s?oauthToken=%s&operation=listReplicationControllersByLabels", host, authToken); from("direct:getReplicationController").toF( - "kubernetes://%s?oauthToken=%s&category=replicationControllers&operation=getReplicationController", + "kubernetes-replication-controllers://%s?oauthToken=%s&operation=getReplicationController", host, authToken); from("direct:createReplicationController").toF( - "kubernetes://%s?oauthToken=%s&category=replicationControllers&operation=createReplicationController", + "kubernetes-replication-controllers://%s?oauthToken=%s&operation=createReplicationController", host, authToken); from("direct:deleteReplicationController").toF( - "kubernetes://%s?oauthToken=%s&category=replicationControllers&operation=deleteReplicationController", + "kubernetes-replication-controllers://%s?oauthToken=%s&operation=deleteReplicationController", host, authToken); - fromF("kubernetes://%s?oauthToken=%s&category=replicationControllers&resourceName=wildfly", host, authToken) + fromF("kubernetes-replication-controllers://%s?oauthToken=%s&resourceName=wildfly", host, authToken) .process(new KubernertesProcessor()).to(mockResultEndpoint); } }; http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesServicesConsumerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesServicesConsumerTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesServicesConsumerTest.java index a4ada62..a951164 100644 --- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesServicesConsumerTest.java +++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/consumer/KubernetesServicesConsumerTest.java @@ -102,18 +102,18 @@ public class KubernetesServicesConsumerTest extends KubernetesTestSupport { return new RouteBuilder() { @Override public void configure() throws Exception { - from("direct:list").toF("kubernetes://%s?oauthToken=%s&category=services&operation=listServices", host, + from("direct:list").toF("kubernetes-services://%s?oauthToken=%s&operation=listServices", host, authToken); from("direct:listByLabels").toF( - "kubernetes://%s?oauthToken=%s&category=services&operation=listServicesByLabels", host, + "kubernetes-services://%s?oauthToken=%s&operation=listServicesByLabels", host, authToken); - from("direct:getServices").toF("kubernetes://%s?oauthToken=%s&category=services&operation=getService", + from("direct:getServices").toF("kubernetes-services://%s?oauthToken=%s&operation=getService", host, authToken); from("direct:createService").toF( - "kubernetes://%s?oauthToken=%s&category=services&operation=createService", host, authToken); + "kubernetes-services://%s?oauthToken=%s&operation=createService", host, authToken); from("direct:deleteService").toF( - "kubernetes://%s?oauthToken=%s&category=services&operation=deleteService", host, authToken); - fromF("kubernetes://%s?oauthToken=%s&category=services&labelKey=this&labelValue=rocks", host, authToken) + "kubernetes-services://%s?oauthToken=%s&operation=deleteService", host, authToken); + fromF("kubernetes-services://%s?oauthToken=%s&labelKey=this&labelValue=rocks", host, authToken) .process(new KubernertesProcessor()).to(mockResultEndpoint); } }; http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/deprecated/DeprecatedKubernetesBuildConfigsProducerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/deprecated/DeprecatedKubernetesBuildConfigsProducerTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/deprecated/DeprecatedKubernetesBuildConfigsProducerTest.java new file mode 100644 index 0000000..4423c01 --- /dev/null +++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/deprecated/DeprecatedKubernetesBuildConfigsProducerTest.java @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.kubernetes.deprecated; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.kubernetes.producer.KubernetesBuildConfigsProducerTest; + +@Deprecated +public class DeprecatedKubernetesBuildConfigsProducerTest extends KubernetesBuildConfigsProducerTest { + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:list") + .toF("kubernetes://%s?oauthToken=%s&category=buildConfigs&operation=listBuildConfigs", + host, authToken); + from("direct:listByLabels") + .toF("kubernetes://%s?oauthToken=%s&category=buildConfigs&operation=listBuildConfigsByLabels", + host, authToken); + } + }; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/89eee3b9/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/deprecated/DeprecatedKubernetesBuildsProducerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/deprecated/DeprecatedKubernetesBuildsProducerTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/deprecated/DeprecatedKubernetesBuildsProducerTest.java new file mode 100644 index 0000000..1e12bc6 --- /dev/null +++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/deprecated/DeprecatedKubernetesBuildsProducerTest.java @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.kubernetes.deprecated; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.kubernetes.producer.KubernetesBuildsProducerTest; + +@Deprecated +public class DeprecatedKubernetesBuildsProducerTest extends KubernetesBuildsProducerTest { + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:list") + .toF("kubernetes://%s?oauthToken=%s&category=builds&operation=listBuilds", + host, authToken); + from("direct:listByLabels") + .toF("kubernetes://%s?oauthToken=%s&category=builds&operation=listBuildsByLabels", + host, authToken); + } + }; + } +}
