You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2018/10/22 06:02:44 UTC
[camel] branch camel-2.22.x updated (f0b9b72 -> c515c38)
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a change to branch camel-2.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git.
from f0b9b72 Fixing issue CAMEL-12890
new e998c9f CAMEL-12891 - Allow getConfigMap operation to specify namespace.
new 37c645a CAMEL-12891 - Remove namespace header from default test.
new c515c38 CAMEL-12891 - Fixed CS
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../config_maps/KubernetesConfigMapsProducer.java | 7 +++++-
.../producer/KubernetesConfigMapsProducerTest.java | 25 +++++++++++++++++++---
2 files changed, 28 insertions(+), 4 deletions(-)
[camel] 02/03: CAMEL-12891 - Remove namespace header from default
test.
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch camel-2.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 37c645ab225a26ebda214698eddd8ca2251e4309
Author: Bob Paulin <bo...@bobpaulin.com>
AuthorDate: Fri Oct 19 22:34:14 2018 -0500
CAMEL-12891 - Remove namespace header from default test.
---
.../component/kubernetes/producer/KubernetesConfigMapsProducerTest.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/producer/KubernetesConfigMapsProducerTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/producer/KubernetesConfigMapsProducerTest.java
index 2205c4c..f449769 100644
--- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/producer/KubernetesConfigMapsProducerTest.java
+++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/producer/KubernetesConfigMapsProducerTest.java
@@ -84,7 +84,6 @@ public class KubernetesConfigMapsProducerTest extends KubernetesTestSupport {
@Override
public void process(Exchange exchange) throws Exception {
- exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, "test");
exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_CONFIGMAP_NAME, "cm1");
}
});
[camel] 01/03: CAMEL-12891 - Allow getConfigMap operation to
specify namespace.
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch camel-2.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit e998c9f2d79d5dd916c339178abf1d7bf8977e47
Author: Bob Paulin <bo...@bobpaulin.com>
AuthorDate: Fri Oct 19 22:26:49 2018 -0500
CAMEL-12891 - Allow getConfigMap operation to specify namespace.
---
.../config_maps/KubernetesConfigMapsProducer.java | 7 ++++++-
.../producer/KubernetesConfigMapsProducerTest.java | 24 ++++++++++++++++++++--
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/config_maps/KubernetesConfigMapsProducer.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/config_maps/KubernetesConfigMapsProducer.java
index 7513a8e..6878a33 100644
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/config_maps/KubernetesConfigMapsProducer.java
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/config_maps/KubernetesConfigMapsProducer.java
@@ -109,11 +109,16 @@ public class KubernetesConfigMapsProducer extends DefaultProducer {
protected void doGetConfigMap(Exchange exchange, String operation) throws Exception {
ConfigMap configMap = null;
String cfMapName = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_CONFIGMAP_NAME, String.class);
+ String namespaceName = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, String.class);
if (ObjectHelper.isEmpty(cfMapName)) {
LOG.error("Get a specific ConfigMap require specify a ConfigMap name");
throw new IllegalArgumentException("Get a specific ConfigMap require specify a ConfigMap name");
}
- configMap = getEndpoint().getKubernetesClient().configMaps().withName(cfMapName).get();
+ if(namespaceName != null) {
+ configMap = getEndpoint().getKubernetesClient().configMaps().inNamespace(namespaceName).withName(cfMapName).get();
+ } else {
+ configMap = getEndpoint().getKubernetesClient().configMaps().withName(cfMapName).get();
+ }
MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true);
exchange.getOut().setBody(configMap);
diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/producer/KubernetesConfigMapsProducerTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/producer/KubernetesConfigMapsProducerTest.java
index ef63de6..2205c4c 100644
--- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/producer/KubernetesConfigMapsProducerTest.java
+++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/producer/KubernetesConfigMapsProducerTest.java
@@ -73,9 +73,9 @@ public class KubernetesConfigMapsProducerTest extends KubernetesTestSupport {
assertEquals(3, result.size());
}
-
+
@Test
- public void getConfigMapTest() throws Exception {
+ public void getConfigMapTestDefaultNamespace() throws Exception {
ObjectMeta meta = new ObjectMeta();
meta.setName("cm1");
server.expect().withPath("/api/v1/namespaces/test/configmaps/cm1").andReturn(200, new ConfigMapBuilder().withMetadata(meta).build()).once();
@@ -95,6 +95,26 @@ public class KubernetesConfigMapsProducerTest extends KubernetesTestSupport {
}
@Test
+ public void getConfigMapTestCustomNamespace() throws Exception {
+ ObjectMeta meta = new ObjectMeta();
+ meta.setName("cm1");
+ server.expect().withPath("/api/v1/namespaces/custom/configmaps/cm1").andReturn(200, new ConfigMapBuilder().withMetadata(meta).build()).once();
+ server.expect().withPath("/api/v1/namespaces/custom/configmaps/cm2").andReturn(200, new ConfigMapBuilder().build()).once();
+ Exchange ex = template.request("direct:getConfigMap", new Processor() {
+
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, "custom");
+ exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_CONFIGMAP_NAME, "cm1");
+ }
+ });
+
+ ConfigMap result = ex.getOut().getBody(ConfigMap.class);
+
+ assertEquals("cm1", result.getMetadata().getName());
+ }
+
+ @Test
public void createGetAndDeleteConfigMap() throws Exception {
ConfigMap cm1 = new ConfigMapBuilder().withNewMetadata().withName("cm1").withNamespace("test").and().build();
server.expect().withPath("/api/v1/namespaces/test/configmaps/cm1").andReturn(200, cm1).once();
[camel] 03/03: CAMEL-12891 - Fixed CS
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch camel-2.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit c515c388da3091e5020690798b13b3ee610455ad
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Oct 22 07:56:15 2018 +0200
CAMEL-12891 - Fixed CS
---
.../component/kubernetes/config_maps/KubernetesConfigMapsProducer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/config_maps/KubernetesConfigMapsProducer.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/config_maps/KubernetesConfigMapsProducer.java
index 6878a33..0bad3f3 100644
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/config_maps/KubernetesConfigMapsProducer.java
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/config_maps/KubernetesConfigMapsProducer.java
@@ -114,7 +114,7 @@ public class KubernetesConfigMapsProducer extends DefaultProducer {
LOG.error("Get a specific ConfigMap require specify a ConfigMap name");
throw new IllegalArgumentException("Get a specific ConfigMap require specify a ConfigMap name");
}
- if(namespaceName != null) {
+ if (namespaceName != null) {
configMap = getEndpoint().getKubernetesClient().configMaps().inNamespace(namespaceName).withName(cfMapName).get();
} else {
configMap = getEndpoint().getKubernetesClient().configMaps().withName(cfMapName).get();