This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new e38784b  (chores) camel-kubernetes: code cleanup (#5961)
e38784b is described below

commit e38784b3927e68e2aa83291c5ff079fff01e97f5
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Tue Aug 17 21:01:40 2021 +0200

    (chores) camel-kubernetes: code cleanup (#5961)
    
    - streamlined classes/interfaces holding constants
    - replaced duplicated logic with code on ObjectHelper class
    - removed duplicated labels logic that is now available in the
      Kubernetes Client
    - removed unused parameters
---
 .../component/kubernetes/KubernetesCategory.java   |  32 ++--
 .../component/kubernetes/KubernetesConstants.java  | 126 ++++++++--------
 .../component/kubernetes/KubernetesHelper.java     |  54 ++-----
 .../component/kubernetes/KubernetesOperations.java | 168 +++++++++++----------
 .../cloud/KubernetesClientServiceDiscovery.java    |  41 ++---
 .../deployments/KubernetesDeploymentsConsumer.java |   6 +-
 .../kubernetes/hpa/KubernetesHPAConsumer.java      |  12 +-
 .../namespaces/KubernetesNamespacesConsumer.java   |   6 +-
 .../namespaces/KubernetesNamespacesProducer.java   |  10 +-
 .../kubernetes/nodes/KubernetesNodesConsumer.java  |   6 +-
 .../KubernetesPersistentVolumesProducer.java       |   4 +-
 .../kubernetes/pods/KubernetesPodsConsumer.java    |  12 +-
 .../KubernetesReplicationControllersConsumer.java  |  11 +-
 .../services/KubernetesServicesConsumer.java       |  12 +-
 .../OpenshiftBuildConfigsProducer.java             |  21 +--
 .../openshift/builds/OpenshiftBuildsProducer.java  |  21 +--
 16 files changed, 239 insertions(+), 303 deletions(-)

diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesCategory.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesCategory.java
index 1ce8c0c..b93eebf 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesCategory.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesCategory.java
@@ -16,31 +16,35 @@
  */
 package org.apache.camel.component.kubernetes;
 
-public interface KubernetesCategory {
+public final class KubernetesCategory {
 
-    String NAMESPACES = "namespaces";
+    public static final String NAMESPACES = "namespaces";
 
-    String SERVICES = "services";
+    public static final String SERVICES = "services";
 
-    String REPLICATION_CONTROLLERS = "replicationControllers";
+    public static final String REPLICATION_CONTROLLERS = 
"replicationControllers";
 
-    String PODS = "pods";
+    public static final String PODS = "pods";
 
-    String PERSISTENT_VOLUMES = "persistentVolumes";
+    public static final String PERSISTENT_VOLUMES = "persistentVolumes";
 
-    String PERSISTENT_VOLUMES_CLAIMS = "persistentVolumesClaims";
+    public static final String PERSISTENT_VOLUMES_CLAIMS = 
"persistentVolumesClaims";
 
-    String SECRETS = "secrets";
+    public static final String SECRETS = "secrets";
 
-    String RESOURCES_QUOTA = "resourcesQuota";
+    public static final String RESOURCES_QUOTA = "resourcesQuota";
 
-    String SERVICE_ACCOUNTS = "serviceAccounts";
+    public static final String SERVICE_ACCOUNTS = "serviceAccounts";
 
-    String NODES = "nodes";
+    public static final String NODES = "nodes";
 
-    String CONFIGMAPS = "configMaps";
+    public static final String CONFIGMAPS = "configMaps";
 
-    String BUILDS = "builds";
+    public static final String BUILDS = "builds";
 
-    String BUILD_CONFIGS = "buildConfigs";
+    public static final String BUILD_CONFIGS = "buildConfigs";
+
+    private KubernetesCategory() {
+
+    }
 }
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesConstants.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesConstants.java
index 77f4ebf..cdcbea4 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesConstants.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesConstants.java
@@ -16,69 +16,73 @@
  */
 package org.apache.camel.component.kubernetes;
 
-public interface KubernetesConstants {
+public final class KubernetesConstants {
     // Producer
-    String KUBERNETES_OPERATION = "CamelKubernetesOperation";
-    String KUBERNETES_NAMESPACE_NAME = "CamelKubernetesNamespaceName";
-    String KUBERNETES_NAMESPACE_LABELS = "CamelKubernetesNamespaceLabels";
-    String KUBERNETES_SERVICE_LABELS = "CamelKubernetesServiceLabels";
-    String KUBERNETES_SERVICE_NAME = "CamelKubernetesServiceName";
-    String KUBERNETES_SERVICE_SPEC = "CamelKubernetesServiceSpec";
-    String KUBERNETES_REPLICATION_CONTROLLERS_LABELS = 
"CamelKubernetesReplicationControllersLabels";
-    String KUBERNETES_REPLICATION_CONTROLLER_NAME = 
"CamelKubernetesReplicationControllerName";
-    String KUBERNETES_REPLICATION_CONTROLLER_SPEC = 
"CamelKubernetesReplicationControllerSpec";
-    String KUBERNETES_REPLICATION_CONTROLLER_REPLICAS = 
"CamelKubernetesReplicationControllerReplicas";
-    String KUBERNETES_PODS_LABELS = "CamelKubernetesPodsLabels";
-    String KUBERNETES_POD_NAME = "CamelKubernetesPodName";
-    String KUBERNETES_POD_SPEC = "CamelKubernetesPodSpec";
-    String KUBERNETES_PERSISTENT_VOLUMES_LABELS = 
"CamelKubernetesPersistentVolumesLabels";
-    String KUBERNETES_PERSISTENT_VOLUME_NAME = 
"CamelKubernetesPersistentVolumeName";
-    String KUBERNETES_PERSISTENT_VOLUMES_CLAIMS_LABELS = 
"CamelKubernetesPersistentVolumesClaimsLabels";
-    String KUBERNETES_PERSISTENT_VOLUME_CLAIM_NAME = 
"CamelKubernetesPersistentVolumeClaimName";
-    String KUBERNETES_PERSISTENT_VOLUME_CLAIM_SPEC = 
"CamelKubernetesPersistentVolumeClaimSpec";
-    String KUBERNETES_SECRETS_LABELS = "CamelKubernetesSecretsLabels";
-    String KUBERNETES_SECRET_NAME = "CamelKubernetesSecretName";
-    String KUBERNETES_SECRET = "CamelKubernetesSecret";
-    String KUBERNETES_RESOURCES_QUOTA_LABELS = 
"CamelKubernetesResourcesQuotaLabels";
-    String KUBERNETES_RESOURCES_QUOTA_NAME = 
"CamelKubernetesResourcesQuotaName";
-    String KUBERNETES_RESOURCE_QUOTA_SPEC = "CamelKubernetesResourceQuotaSpec";
-    String KUBERNETES_SERVICE_ACCOUNTS_LABELS = 
"CamelKubernetesServiceAccountsLabels";
-    String KUBERNETES_SERVICE_ACCOUNT_NAME = 
"CamelKubernetesServiceAccountName";
-    String KUBERNETES_SERVICE_ACCOUNT = "CamelKubernetesServiceAccount";
-    String KUBERNETES_NODES_LABELS = "CamelKubernetesNodesLabels";
-    String KUBERNETES_NODE_NAME = "CamelKubernetesNodeName";
-    String KUBERNETES_NODE_SPEC = "CamelKubernetesNodeSpec";
-    String KUBERNETES_DEPLOYMENTS_LABELS = "CamelKubernetesDeploymentsLabels";
-    String KUBERNETES_DEPLOYMENT_NAME = "CamelKubernetesDeploymentName";
-    String KUBERNETES_DEPLOYMENT_SPEC = "CamelKubernetesDeploymentSpec";
-    String KUBERNETES_CONFIGMAPS_LABELS = "CamelKubernetesConfigMapsLabels";
-    String KUBERNETES_CONFIGMAP_NAME = "CamelKubernetesConfigMapName";
-    String KUBERNETES_CONFIGMAP_DATA = "CamelKubernetesConfigData";
-    String KUBERNETES_BUILDS_LABELS = "CamelKubernetesBuildsLabels";
-    String KUBERNETES_BUILD_NAME = "CamelKubernetesBuildName";
-    String KUBERNETES_BUILD_CONFIGS_LABELS = 
"CamelKubernetesBuildConfigsLabels";
-    String KUBERNETES_BUILD_CONFIG_NAME = "CamelKubernetesBuildConfigName";
-    String KUBERNETES_DEPLOYMENT_REPLICAS = 
"CamelKubernetesDeploymentReplicas";
-    String KUBERNETES_HPA_NAME = "CamelKubernetesHPAName";
-    String KUBERNETES_HPA_SPEC = "CamelKubernetesHPASpec";
-    String KUBERNETES_HPA_LABELS = "CamelKubernetesHPALabels";
-    String KUBERNETES_JOB_NAME = "CamelKubernetesJobName";
-    String KUBERNETES_JOB_SPEC = "CamelKubernetesJobSpec";
-    String KUBERNETES_JOB_LABELS = "CamelKubernetesJobLabels";
-    String KUBERNETES_CRD_INSTANCE_NAME = "CamelKubernetesCRDInstanceName";
-    String KUBERNETES_CRD_EVENT_TIMESTAMP = "CamelKubernetesCRDEventTimestamp";
-    String KUBERNETES_CRD_EVENT_ACTION = "CamelKubernetesCRDEventAction";
-    String KUBERNETES_CRD_NAME = "CamelKubernetesCRDName";
-    String KUBERNETES_CRD_GROUP = "CamelKubernetesCRDGroup";
-    String KUBERNETES_CRD_SCOPE = "CamelKubernetesCRDScope";
-    String KUBERNETES_CRD_VERSION = "CamelKubernetesCRDVersion";
-    String KUBERNETES_CRD_PLURAL = "CamelKubernetesCRDPlural";
-    String KUBERNETES_CRD_LABELS = "CamelKubernetesCRDLabels";
-    String KUBERNETES_CRD_INSTANCE = "CamelKubernetesCRDInstance";
+    public static final String KUBERNETES_OPERATION = 
"CamelKubernetesOperation";
+    public static final String KUBERNETES_NAMESPACE_NAME = 
"CamelKubernetesNamespaceName";
+    public static final String KUBERNETES_NAMESPACE_LABELS = 
"CamelKubernetesNamespaceLabels";
+    public static final String KUBERNETES_SERVICE_LABELS = 
"CamelKubernetesServiceLabels";
+    public static final String KUBERNETES_SERVICE_NAME = 
"CamelKubernetesServiceName";
+    public static final String KUBERNETES_SERVICE_SPEC = 
"CamelKubernetesServiceSpec";
+    public static final String KUBERNETES_REPLICATION_CONTROLLERS_LABELS = 
"CamelKubernetesReplicationControllersLabels";
+    public static final String KUBERNETES_REPLICATION_CONTROLLER_NAME = 
"CamelKubernetesReplicationControllerName";
+    public static final String KUBERNETES_REPLICATION_CONTROLLER_SPEC = 
"CamelKubernetesReplicationControllerSpec";
+    public static final String KUBERNETES_REPLICATION_CONTROLLER_REPLICAS = 
"CamelKubernetesReplicationControllerReplicas";
+    public static final String KUBERNETES_PODS_LABELS = 
"CamelKubernetesPodsLabels";
+    public static final String KUBERNETES_POD_NAME = "CamelKubernetesPodName";
+    public static final String KUBERNETES_POD_SPEC = "CamelKubernetesPodSpec";
+    public static final String KUBERNETES_PERSISTENT_VOLUMES_LABELS = 
"CamelKubernetesPersistentVolumesLabels";
+    public static final String KUBERNETES_PERSISTENT_VOLUME_NAME = 
"CamelKubernetesPersistentVolumeName";
+    public static final String KUBERNETES_PERSISTENT_VOLUMES_CLAIMS_LABELS = 
"CamelKubernetesPersistentVolumesClaimsLabels";
+    public static final String KUBERNETES_PERSISTENT_VOLUME_CLAIM_NAME = 
"CamelKubernetesPersistentVolumeClaimName";
+    public static final String KUBERNETES_PERSISTENT_VOLUME_CLAIM_SPEC = 
"CamelKubernetesPersistentVolumeClaimSpec";
+    public static final String KUBERNETES_SECRETS_LABELS = 
"CamelKubernetesSecretsLabels";
+    public static final String KUBERNETES_SECRET_NAME = 
"CamelKubernetesSecretName";
+    public static final String KUBERNETES_SECRET = "CamelKubernetesSecret";
+    public static final String KUBERNETES_RESOURCES_QUOTA_LABELS = 
"CamelKubernetesResourcesQuotaLabels";
+    public static final String KUBERNETES_RESOURCES_QUOTA_NAME = 
"CamelKubernetesResourcesQuotaName";
+    public static final String KUBERNETES_RESOURCE_QUOTA_SPEC = 
"CamelKubernetesResourceQuotaSpec";
+    public static final String KUBERNETES_SERVICE_ACCOUNTS_LABELS = 
"CamelKubernetesServiceAccountsLabels";
+    public static final String KUBERNETES_SERVICE_ACCOUNT_NAME = 
"CamelKubernetesServiceAccountName";
+    public static final String KUBERNETES_SERVICE_ACCOUNT = 
"CamelKubernetesServiceAccount";
+    public static final String KUBERNETES_NODES_LABELS = 
"CamelKubernetesNodesLabels";
+    public static final String KUBERNETES_NODE_NAME = 
"CamelKubernetesNodeName";
+    public static final String KUBERNETES_NODE_SPEC = 
"CamelKubernetesNodeSpec";
+    public static final String KUBERNETES_DEPLOYMENTS_LABELS = 
"CamelKubernetesDeploymentsLabels";
+    public static final String KUBERNETES_DEPLOYMENT_NAME = 
"CamelKubernetesDeploymentName";
+    public static final String KUBERNETES_DEPLOYMENT_SPEC = 
"CamelKubernetesDeploymentSpec";
+    public static final String KUBERNETES_CONFIGMAPS_LABELS = 
"CamelKubernetesConfigMapsLabels";
+    public static final String KUBERNETES_CONFIGMAP_NAME = 
"CamelKubernetesConfigMapName";
+    public static final String KUBERNETES_CONFIGMAP_DATA = 
"CamelKubernetesConfigData";
+    public static final String KUBERNETES_BUILDS_LABELS = 
"CamelKubernetesBuildsLabels";
+    public static final String KUBERNETES_BUILD_NAME = 
"CamelKubernetesBuildName";
+    public static final String KUBERNETES_BUILD_CONFIGS_LABELS = 
"CamelKubernetesBuildConfigsLabels";
+    public static final String KUBERNETES_BUILD_CONFIG_NAME = 
"CamelKubernetesBuildConfigName";
+    public static final String KUBERNETES_DEPLOYMENT_REPLICAS = 
"CamelKubernetesDeploymentReplicas";
+    public static final String KUBERNETES_HPA_NAME = "CamelKubernetesHPAName";
+    public static final String KUBERNETES_HPA_SPEC = "CamelKubernetesHPASpec";
+    public static final String KUBERNETES_HPA_LABELS = 
"CamelKubernetesHPALabels";
+    public static final String KUBERNETES_JOB_NAME = "CamelKubernetesJobName";
+    public static final String KUBERNETES_JOB_SPEC = "CamelKubernetesJobSpec";
+    public static final String KUBERNETES_JOB_LABELS = 
"CamelKubernetesJobLabels";
+    public static final String KUBERNETES_CRD_INSTANCE_NAME = 
"CamelKubernetesCRDInstanceName";
+    public static final String KUBERNETES_CRD_EVENT_TIMESTAMP = 
"CamelKubernetesCRDEventTimestamp";
+    public static final String KUBERNETES_CRD_EVENT_ACTION = 
"CamelKubernetesCRDEventAction";
+    public static final String KUBERNETES_CRD_NAME = "CamelKubernetesCRDName";
+    public static final String KUBERNETES_CRD_GROUP = 
"CamelKubernetesCRDGroup";
+    public static final String KUBERNETES_CRD_SCOPE = 
"CamelKubernetesCRDScope";
+    public static final String KUBERNETES_CRD_VERSION = 
"CamelKubernetesCRDVersion";
+    public static final String KUBERNETES_CRD_PLURAL = 
"CamelKubernetesCRDPlural";
+    public static final String KUBERNETES_CRD_LABELS = 
"CamelKubernetesCRDLabels";
+    public static final String KUBERNETES_CRD_INSTANCE = 
"CamelKubernetesCRDInstance";
 
-    String KUBERNETES_DELETE_RESULT = "CamelKubernetesDeleteResult";
+    public static final String KUBERNETES_DELETE_RESULT = 
"CamelKubernetesDeleteResult";
 
     // Consumer
-    String KUBERNETES_EVENT_ACTION = "CamelKubernetesEventAction";
-    String KUBERNETES_EVENT_TIMESTAMP = "CamelKubernetesEventTimestamp";
+    public static final String KUBERNETES_EVENT_ACTION = 
"CamelKubernetesEventAction";
+    public static final String KUBERNETES_EVENT_TIMESTAMP = 
"CamelKubernetesEventTimestamp";
+
+    private KubernetesConstants() {
+
+    }
 }
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesHelper.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesHelper.java
index 01ed3aa..6fc390b 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesHelper.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesHelper.java
@@ -60,45 +60,21 @@ public final class KubernetesHelper {
             builder.withUsername(configuration.getUsername());
             builder.withPassword(configuration.getPassword());
         }
-        if (ObjectHelper.isNotEmpty(configuration.getOauthToken())) {
-            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());
-        }
-        if (ObjectHelper.isNotEmpty(configuration.getConnectionTimeout())) {
-            
builder.withConnectionTimeout(configuration.getConnectionTimeout());
-        }
-        if (ObjectHelper.isNotEmpty(configuration.getNamespace())) {
-            builder.withNamespace(configuration.getNamespace());
-        }
+
+        ObjectHelper.ifNotEmpty(configuration.getOauthToken(), 
builder::withOauthToken);
+        ObjectHelper.ifNotEmpty(configuration.getCaCertData(), 
builder::withCaCertData);
+        ObjectHelper.ifNotEmpty(configuration.getCaCertFile(), 
builder::withCaCertFile);
+        ObjectHelper.ifNotEmpty(configuration.getClientCertData(), 
builder::withClientCertData);
+        ObjectHelper.ifNotEmpty(configuration.getClientCertFile(), 
builder::withClientCertFile);
+        ObjectHelper.ifNotEmpty(configuration.getApiVersion(), 
builder::withApiVersion);
+        ObjectHelper.ifNotEmpty(configuration.getClientKeyAlgo(), 
builder::withClientKeyAlgo);
+        ObjectHelper.ifNotEmpty(configuration.getClientKeyData(), 
builder::withClientKeyData);
+        ObjectHelper.ifNotEmpty(configuration.getClientKeyFile(), 
builder::withClientKeyFile);
+        ObjectHelper.ifNotEmpty(configuration.getClientKeyPassphrase(), 
builder::withClientKeyPassphrase);
+        ObjectHelper.ifNotEmpty(configuration.getTrustCerts(), 
builder::withTrustCerts);
+        ObjectHelper.ifNotEmpty(configuration.getConnectionTimeout(), 
builder::withConnectionTimeout);
+        ObjectHelper.ifNotEmpty(configuration.getNamespace(), 
builder::withNamespace);
+
         Config conf = builder.build();
         return new DefaultKubernetesClient(conf);
     }
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesOperations.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesOperations.java
index 738552e..9cde948 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesOperations.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/KubernetesOperations.java
@@ -16,120 +16,124 @@
  */
 package org.apache.camel.component.kubernetes;
 
-public interface KubernetesOperations {
+public final class KubernetesOperations {
 
     // Namespaces
-    String LIST_NAMESPACE_OPERATION = "listNamespaces";
-    String LIST_NAMESPACE_BY_LABELS_OPERATION = "listNamespacesByLabels";
-    String GET_NAMESPACE_OPERATION = "getNamespace";
-    String CREATE_NAMESPACE_OPERATION = "createNamespace";
-    String DELETE_NAMESPACE_OPERATION = "deleteNamespace";
+    public static final String LIST_NAMESPACE_OPERATION = "listNamespaces";
+    public static final String LIST_NAMESPACE_BY_LABELS_OPERATION = 
"listNamespacesByLabels";
+    public static final String GET_NAMESPACE_OPERATION = "getNamespace";
+    public static final String CREATE_NAMESPACE_OPERATION = "createNamespace";
+    public static final String DELETE_NAMESPACE_OPERATION = "deleteNamespace";
 
     // Services
-    String LIST_SERVICES_OPERATION = "listServices";
-    String LIST_SERVICES_BY_LABELS_OPERATION = "listServicesByLabels";
-    String GET_SERVICE_OPERATION = "getService";
-    String CREATE_SERVICE_OPERATION = "createService";
-    String DELETE_SERVICE_OPERATION = "deleteService";
+    public static final String LIST_SERVICES_OPERATION = "listServices";
+    public static final String LIST_SERVICES_BY_LABELS_OPERATION = 
"listServicesByLabels";
+    public static final String GET_SERVICE_OPERATION = "getService";
+    public static final String CREATE_SERVICE_OPERATION = "createService";
+    public static final String DELETE_SERVICE_OPERATION = "deleteService";
 
     // Replication Controllers
-    String LIST_REPLICATION_CONTROLLERS_OPERATION = 
"listReplicationControllers";
-    String LIST_REPLICATION_CONTROLLERS_BY_LABELS_OPERATION = 
"listReplicationControllersByLabels";
-    String GET_REPLICATION_CONTROLLER_OPERATION = "getReplicationController";
-    String CREATE_REPLICATION_CONTROLLER_OPERATION = 
"createReplicationController";
-    String DELETE_REPLICATION_CONTROLLER_OPERATION = 
"deleteReplicationController";
-    String SCALE_REPLICATION_CONTROLLER_OPERATION = 
"scaleReplicationController";
+    public static final String LIST_REPLICATION_CONTROLLERS_OPERATION = 
"listReplicationControllers";
+    public static final String 
LIST_REPLICATION_CONTROLLERS_BY_LABELS_OPERATION = 
"listReplicationControllersByLabels";
+    public static final String GET_REPLICATION_CONTROLLER_OPERATION = 
"getReplicationController";
+    public static final String CREATE_REPLICATION_CONTROLLER_OPERATION = 
"createReplicationController";
+    public static final String DELETE_REPLICATION_CONTROLLER_OPERATION = 
"deleteReplicationController";
+    public static final String SCALE_REPLICATION_CONTROLLER_OPERATION = 
"scaleReplicationController";
 
     // Pods
-    String LIST_PODS_OPERATION = "listPods";
-    String LIST_PODS_BY_LABELS_OPERATION = "listPodsByLabels";
-    String GET_POD_OPERATION = "getPod";
-    String CREATE_POD_OPERATION = "createPod";
-    String DELETE_POD_OPERATION = "deletePod";
+    public static final String LIST_PODS_OPERATION = "listPods";
+    public static final String LIST_PODS_BY_LABELS_OPERATION = 
"listPodsByLabels";
+    public static final String GET_POD_OPERATION = "getPod";
+    public static final String CREATE_POD_OPERATION = "createPod";
+    public static final String DELETE_POD_OPERATION = "deletePod";
 
     // Persistent Volumes
-    String LIST_PERSISTENT_VOLUMES = "listPersistentVolumes";
-    String LIST_PERSISTENT_VOLUMES_BY_LABELS_OPERATION = 
"listPersistentVolumesByLabels";
-    String GET_PERSISTENT_VOLUME_OPERATION = "getPersistentVolume";
+    public static final String LIST_PERSISTENT_VOLUMES = 
"listPersistentVolumes";
+    public static final String LIST_PERSISTENT_VOLUMES_BY_LABELS_OPERATION = 
"listPersistentVolumesByLabels";
+    public static final String GET_PERSISTENT_VOLUME_OPERATION = 
"getPersistentVolume";
 
     // Persistent Volumes Claims
-    String LIST_PERSISTENT_VOLUMES_CLAIMS = "listPersistentVolumesClaims";
-    String LIST_PERSISTENT_VOLUMES_CLAIMS_BY_LABELS_OPERATION = 
"listPersistentVolumesClaimsByLabels";
-    String GET_PERSISTENT_VOLUME_CLAIM_OPERATION = "getPersistentVolumeClaim";
-    String CREATE_PERSISTENT_VOLUME_CLAIM_OPERATION = 
"createPersistentVolumeClaim";
-    String DELETE_PERSISTENT_VOLUME_CLAIM_OPERATION = 
"deletePersistentVolumeClaim";
+    public static final String LIST_PERSISTENT_VOLUMES_CLAIMS = 
"listPersistentVolumesClaims";
+    public static final String 
LIST_PERSISTENT_VOLUMES_CLAIMS_BY_LABELS_OPERATION = 
"listPersistentVolumesClaimsByLabels";
+    public static final String GET_PERSISTENT_VOLUME_CLAIM_OPERATION = 
"getPersistentVolumeClaim";
+    public static final String CREATE_PERSISTENT_VOLUME_CLAIM_OPERATION = 
"createPersistentVolumeClaim";
+    public static final String DELETE_PERSISTENT_VOLUME_CLAIM_OPERATION = 
"deletePersistentVolumeClaim";
 
     // Secrets
-    String LIST_SECRETS = "listSecrets";
-    String LIST_SECRETS_BY_LABELS_OPERATION = "listSecretsByLabels";
-    String GET_SECRET_OPERATION = "getSecret";
-    String CREATE_SECRET_OPERATION = "createSecret";
-    String DELETE_SECRET_OPERATION = "deleteSecret";
+    public static final String LIST_SECRETS = "listSecrets";
+    public static final String LIST_SECRETS_BY_LABELS_OPERATION = 
"listSecretsByLabels";
+    public static final String GET_SECRET_OPERATION = "getSecret";
+    public static final String CREATE_SECRET_OPERATION = "createSecret";
+    public static final String DELETE_SECRET_OPERATION = "deleteSecret";
 
     // Resources quota
-    String LIST_RESOURCES_QUOTA = "listResourcesQuota";
-    String LIST_RESOURCES_QUOTA_BY_LABELS_OPERATION = 
"listResourcesQuotaByLabels";
-    String GET_RESOURCE_QUOTA_OPERATION = "getResourceQuota";
-    String CREATE_RESOURCE_QUOTA_OPERATION = "createResourceQuota";
-    String DELETE_RESOURCE_QUOTA_OPERATION = "deleteResourceQuota";
+    public static final String LIST_RESOURCES_QUOTA = "listResourcesQuota";
+    public static final String LIST_RESOURCES_QUOTA_BY_LABELS_OPERATION = 
"listResourcesQuotaByLabels";
+    public static final String GET_RESOURCE_QUOTA_OPERATION = 
"getResourceQuota";
+    public static final String CREATE_RESOURCE_QUOTA_OPERATION = 
"createResourceQuota";
+    public static final String DELETE_RESOURCE_QUOTA_OPERATION = 
"deleteResourceQuota";
 
     // Service Accounts
-    String LIST_SERVICE_ACCOUNTS = "listServiceAccounts";
-    String LIST_SERVICE_ACCOUNTS_BY_LABELS_OPERATION = 
"listServiceAccountsByLabels";
-    String GET_SERVICE_ACCOUNT_OPERATION = "getServiceAccount";
-    String CREATE_SERVICE_ACCOUNT_OPERATION = "createServiceAccount";
-    String DELETE_SERVICE_ACCOUNT_OPERATION = "deleteServiceAccount";
+    public static final String LIST_SERVICE_ACCOUNTS = "listServiceAccounts";
+    public static final String LIST_SERVICE_ACCOUNTS_BY_LABELS_OPERATION = 
"listServiceAccountsByLabels";
+    public static final String GET_SERVICE_ACCOUNT_OPERATION = 
"getServiceAccount";
+    public static final String CREATE_SERVICE_ACCOUNT_OPERATION = 
"createServiceAccount";
+    public static final String DELETE_SERVICE_ACCOUNT_OPERATION = 
"deleteServiceAccount";
 
     // Nodes
-    String LIST_NODES = "listNodes";
-    String LIST_NODES_BY_LABELS_OPERATION = "listNodesByLabels";
-    String GET_NODE_OPERATION = "getNode";
-    String CREATE_NODE_OPERATION = "createNode";
-    String DELETE_NODE_OPERATION = "deleteNode";
+    public static final String LIST_NODES = "listNodes";
+    public static final String LIST_NODES_BY_LABELS_OPERATION = 
"listNodesByLabels";
+    public static final String GET_NODE_OPERATION = "getNode";
+    public static final String CREATE_NODE_OPERATION = "createNode";
+    public static final String DELETE_NODE_OPERATION = "deleteNode";
 
     // HPA
-    String LIST_HPA = "listHPA";
-    String LIST_HPA_BY_LABELS_OPERATION = "listHPAByLabels";
-    String GET_HPA_OPERATION = "getHPA";
-    String CREATE_HPA_OPERATION = "createHPA";
-    String DELETE_HPA_OPERATION = "deleteHPA";
+    public static final String LIST_HPA = "listHPA";
+    public static final String LIST_HPA_BY_LABELS_OPERATION = 
"listHPAByLabels";
+    public static final String GET_HPA_OPERATION = "getHPA";
+    public static final String CREATE_HPA_OPERATION = "createHPA";
+    public static final String DELETE_HPA_OPERATION = "deleteHPA";
 
     // Deployments
-    String LIST_DEPLOYMENTS = "listDeployments";
-    String LIST_DEPLOYMENTS_BY_LABELS_OPERATION = "listDeploymentsByLabels";
-    String GET_DEPLOYMENT = "getDeployment";
-    String DELETE_DEPLOYMENT = "deleteDeployment";
-    String CREATE_DEPLOYMENT = "createDeployment";
-    String SCALE_DEPLOYMENT = "scaleDeployment";
+    public static final String LIST_DEPLOYMENTS = "listDeployments";
+    public static final String LIST_DEPLOYMENTS_BY_LABELS_OPERATION = 
"listDeploymentsByLabels";
+    public static final String GET_DEPLOYMENT = "getDeployment";
+    public static final String DELETE_DEPLOYMENT = "deleteDeployment";
+    public static final String CREATE_DEPLOYMENT = "createDeployment";
+    public static final String SCALE_DEPLOYMENT = "scaleDeployment";
 
     // Config Maps
-    String LIST_CONFIGMAPS = "listConfigMaps";
-    String LIST_CONFIGMAPS_BY_LABELS_OPERATION = "listConfigMapsByLabels";
-    String GET_CONFIGMAP_OPERATION = "getConfigMap";
-    String CREATE_CONFIGMAP_OPERATION = "createConfigMap";
-    String DELETE_CONFIGMAP_OPERATION = "deleteConfigMap";
+    public static final String LIST_CONFIGMAPS = "listConfigMaps";
+    public static final String LIST_CONFIGMAPS_BY_LABELS_OPERATION = 
"listConfigMapsByLabels";
+    public static final String GET_CONFIGMAP_OPERATION = "getConfigMap";
+    public static final String CREATE_CONFIGMAP_OPERATION = "createConfigMap";
+    public static final String DELETE_CONFIGMAP_OPERATION = "deleteConfigMap";
 
     // Builds
-    String LIST_BUILD = "listBuilds";
-    String LIST_BUILD_BY_LABELS_OPERATION = "listBuildsByLabels";
-    String GET_BUILD_OPERATION = "getBuild";
+    public static final String LIST_BUILD = "listBuilds";
+    public static final String LIST_BUILD_BY_LABELS_OPERATION = 
"listBuildsByLabels";
+    public static final String GET_BUILD_OPERATION = "getBuild";
 
     // Build Configs
-    String LIST_BUILD_CONFIGS = "listBuildConfigs";
-    String LIST_BUILD_CONFIGS_BY_LABELS_OPERATION = "listBuildConfigsByLabels";
-    String GET_BUILD_CONFIG_OPERATION = "getBuildConfig";
+    public static final String LIST_BUILD_CONFIGS = "listBuildConfigs";
+    public static final String LIST_BUILD_CONFIGS_BY_LABELS_OPERATION = 
"listBuildConfigsByLabels";
+    public static final String GET_BUILD_CONFIG_OPERATION = "getBuildConfig";
 
     // Secrets
-    String LIST_JOB = "listJob";
-    String LIST_JOB_BY_LABELS_OPERATION = "listJobByLabels";
-    String GET_JOB_OPERATION = "getJob";
-    String CREATE_JOB_OPERATION = "createJob";
-    String DELETE_JOB_OPERATION = "deleteJob";
+    public static final String LIST_JOB = "listJob";
+    public static final String LIST_JOB_BY_LABELS_OPERATION = 
"listJobByLabels";
+    public static final String GET_JOB_OPERATION = "getJob";
+    public static final String CREATE_JOB_OPERATION = "createJob";
+    public static final String DELETE_JOB_OPERATION = "deleteJob";
 
     // Custom Resources
-    String LIST_CUSTOMRESOURCES = "listCustomResources";
-    String LIST_CUSTOMRESOURCES_BY_LABELS_OPERATION = 
"listCustomResourcesByLabels";
-    String GET_CUSTOMRESOURCE = "getCustomResource";
-    String DELETE_CUSTOMRESOURCE = "deleteCustomResource";
-    String CREATE_CUSTOMRESOURCE = "createCustomResource";
+    public static final String LIST_CUSTOMRESOURCES = "listCustomResources";
+    public static final String LIST_CUSTOMRESOURCES_BY_LABELS_OPERATION = 
"listCustomResourcesByLabels";
+    public static final String GET_CUSTOMRESOURCE = "getCustomResource";
+    public static final String DELETE_CUSTOMRESOURCE = "deleteCustomResource";
+    public static final String CREATE_CUSTOMRESOURCE = "createCustomResource";
+
+    private KubernetesOperations() {
+
+    }
 }
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java
index cea85ad..4ed096f 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/cloud/KubernetesClientServiceDiscovery.java
@@ -109,36 +109,17 @@ public class KubernetesClientServiceDiscovery extends 
KubernetesServiceDiscovery
         } 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());
-        }
+
+        ObjectHelper.ifNotEmpty(configuration.getCaCertData(), 
builder::withCaCertData);
+        ObjectHelper.ifNotEmpty(configuration.getCaCertFile(), 
builder::withCaCertFile);
+        ObjectHelper.ifNotEmpty(configuration.getClientCertData(), 
builder::withClientCertData);
+        ObjectHelper.ifNotEmpty(configuration.getClientCertFile(), 
builder::withClientCertFile);
+        ObjectHelper.ifNotEmpty(configuration.getApiVersion(), 
builder::withApiVersion);
+        ObjectHelper.ifNotEmpty(configuration.getClientKeyAlgo(), 
builder::withClientKeyAlgo);
+        ObjectHelper.ifNotEmpty(configuration.getClientKeyData(), 
builder::withClientKeyData);
+        ObjectHelper.ifNotEmpty(configuration.getClientKeyFile(), 
builder::withClientKeyFile);
+        ObjectHelper.ifNotEmpty(configuration.getClientKeyPassphrase(), 
builder::withClientKeyPassphrase);
+        ObjectHelper.ifNotEmpty(configuration.getTrustCerts(), 
builder::withTrustCerts);
 
         client = new AutoAdaptableKubernetesClient(builder.build());
     }
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/deployments/KubernetesDeploymentsConsumer.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/deployments/KubernetesDeploymentsConsumer.java
index fe05ed1..a39318c 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/deployments/KubernetesDeploymentsConsumer.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/deployments/KubernetesDeploymentsConsumer.java
@@ -94,9 +94,9 @@ public class KubernetesDeploymentsConsumer extends 
DefaultConsumer {
                 
w.withLabel(getEndpoint().getKubernetesConfiguration().getLabelKey(),
                         
getEndpoint().getKubernetesConfiguration().getLabelValue());
             }
-            if 
(ObjectHelper.isNotEmpty(getEndpoint().getKubernetesConfiguration().getResourceName()))
 {
-                
w.withName(getEndpoint().getKubernetesConfiguration().getResourceName());
-            }
+
+            
ObjectHelper.ifNotEmpty(getEndpoint().getKubernetesConfiguration().getResourceName(),
 w::withName);
+
             watch = w.watch(new Watcher<Deployment>() {
 
                 @Override
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/hpa/KubernetesHPAConsumer.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/hpa/KubernetesHPAConsumer.java
index 3b16f26..73a7f2e 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/hpa/KubernetesHPAConsumer.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/hpa/KubernetesHPAConsumer.java
@@ -89,17 +89,17 @@ public class KubernetesHPAConsumer extends DefaultConsumer {
             MixedOperation<HorizontalPodAutoscaler, 
HorizontalPodAutoscalerList, Resource<HorizontalPodAutoscaler>> w
                     = getEndpoint()
                             
.getKubernetesClient().autoscaling().v1().horizontalPodAutoscalers();
-            if 
(ObjectHelper.isNotEmpty(getEndpoint().getKubernetesConfiguration().getNamespace()))
 {
-                
w.inNamespace(getEndpoint().getKubernetesConfiguration().getNamespace());
-            }
+
+            
ObjectHelper.ifNotEmpty(getEndpoint().getKubernetesConfiguration().getNamespace(),
 w::inNamespace);
+
             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());
-            }
+
+            
ObjectHelper.ifNotEmpty(getEndpoint().getKubernetesConfiguration().getResourceName(),
 w::withName);
+
             watch = w.watch(new Watcher<HorizontalPodAutoscaler>() {
 
                 @Override
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/namespaces/KubernetesNamespacesConsumer.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/namespaces/KubernetesNamespacesConsumer.java
index 9571046..e8b0916 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/namespaces/KubernetesNamespacesConsumer.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/namespaces/KubernetesNamespacesConsumer.java
@@ -88,9 +88,9 @@ public class KubernetesNamespacesConsumer extends 
DefaultConsumer {
         public void run() {
             NonNamespaceOperation<Namespace, NamespaceList, 
Resource<Namespace>> w
                     = getEndpoint().getKubernetesClient().namespaces();
-            if 
(ObjectHelper.isNotEmpty(getEndpoint().getKubernetesConfiguration().getNamespace()))
 {
-                
w.withName(getEndpoint().getKubernetesConfiguration().getNamespace());
-            }
+
+            
ObjectHelper.ifNotEmpty(getEndpoint().getKubernetesConfiguration().getNamespace(),
 w::withName);
+
             watch = w.watch(new Watcher<Namespace>() {
 
                 @Override
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/namespaces/KubernetesNamespacesProducer.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/namespaces/KubernetesNamespacesProducer.java
index 0fe209a..6d861ce 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/namespaces/KubernetesNamespacesProducer.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/namespaces/KubernetesNamespacesProducer.java
@@ -21,8 +21,6 @@ import java.util.Map;
 import io.fabric8.kubernetes.api.model.Namespace;
 import io.fabric8.kubernetes.api.model.NamespaceBuilder;
 import io.fabric8.kubernetes.api.model.NamespaceList;
-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;
@@ -91,12 +89,8 @@ public class KubernetesNamespacesProducer extends 
DefaultProducer {
             LOG.error("Get a specific namespace by labels require specify a 
labels set");
             throw new IllegalArgumentException("Get a specific namespace by 
labels require specify a labels set");
         }
-        NonNamespaceOperation<Namespace, NamespaceList, Resource<Namespace>> 
namespaces
-                = getEndpoint().getKubernetesClient().namespaces();
-        for (Map.Entry<String, String> entry : labels.entrySet()) {
-            namespaces.withLabel(entry.getKey(), entry.getValue());
-        }
-        NamespaceList namespace = namespaces.list();
+
+        NamespaceList namespace = 
getEndpoint().getKubernetesClient().namespaces().withLabels(labels).list();
 
         prepareOutboundMessage(exchange, namespace.getItems());
     }
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/nodes/KubernetesNodesConsumer.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/nodes/KubernetesNodesConsumer.java
index 5ce3993..17814fc 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/nodes/KubernetesNodesConsumer.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/nodes/KubernetesNodesConsumer.java
@@ -92,9 +92,9 @@ public class KubernetesNodesConsumer extends DefaultConsumer {
                 
w.withLabel(getEndpoint().getKubernetesConfiguration().getLabelKey(),
                         
getEndpoint().getKubernetesConfiguration().getLabelValue());
             }
-            if 
(ObjectHelper.isNotEmpty(getEndpoint().getKubernetesConfiguration().getResourceName()))
 {
-                
w.withName(getEndpoint().getKubernetesConfiguration().getResourceName());
-            }
+
+            
ObjectHelper.ifNotEmpty(getEndpoint().getKubernetesConfiguration().getResourceName(),
 w::withName);
+
             watch = w.watch(new Watcher<Node>() {
 
                 @Override
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/persistent_volumes/KubernetesPersistentVolumesProducer.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/persistent_volumes/KubernetesPersistentVolumesProducer.java
index aa4aaa2..b5b0ccd 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/persistent_volumes/KubernetesPersistentVolumesProducer.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/persistent_volumes/KubernetesPersistentVolumesProducer.java
@@ -60,7 +60,7 @@ public class KubernetesPersistentVolumesProducer extends 
DefaultProducer {
                 break;
 
             case KubernetesOperations.GET_PERSISTENT_VOLUME_OPERATION:
-                doGetPersistentVolume(exchange, operation);
+                doGetPersistentVolume(exchange);
                 break;
 
             default:
@@ -82,7 +82,7 @@ public class KubernetesPersistentVolumesProducer extends 
DefaultProducer {
         prepareOutboundMessage(exchange, pvList.getItems());
     }
 
-    protected void doGetPersistentVolume(Exchange exchange, String operation) {
+    protected void doGetPersistentVolume(Exchange exchange) {
         PersistentVolume pv = null;
         String pvName = 
exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_PERSISTENT_VOLUME_NAME,
 String.class);
         if (ObjectHelper.isEmpty(pvName)) {
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/pods/KubernetesPodsConsumer.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/pods/KubernetesPodsConsumer.java
index ade03c7..81aee59 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/pods/KubernetesPodsConsumer.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/pods/KubernetesPodsConsumer.java
@@ -87,17 +87,17 @@ public class KubernetesPodsConsumer extends DefaultConsumer 
{
         @Override
         public void run() {
             MixedOperation<Pod, PodList, PodResource<Pod>> w = 
getEndpoint().getKubernetesClient().pods();
-            if 
(ObjectHelper.isNotEmpty(getEndpoint().getKubernetesConfiguration().getNamespace()))
 {
-                
w.inNamespace(getEndpoint().getKubernetesConfiguration().getNamespace());
-            }
+
+            
ObjectHelper.ifNotEmpty(getEndpoint().getKubernetesConfiguration().getNamespace(),
 w::inNamespace);
+
             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());
-            }
+
+            
ObjectHelper.ifNotEmpty(getEndpoint().getKubernetesConfiguration().getResourceName(),
 w::withName);
+
             watch = w.watch(new Watcher<Pod>() {
 
                 @Override
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/KubernetesReplicationControllersConsumer.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/KubernetesReplicationControllersConsumer.java
index d2cb3c1..6ad2e76 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/KubernetesReplicationControllersConsumer.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/replication_controllers/KubernetesReplicationControllersConsumer.java
@@ -89,17 +89,16 @@ public class KubernetesReplicationControllersConsumer 
extends DefaultConsumer {
             MixedOperation<ReplicationController, ReplicationControllerList, 
RollableScalableResource<ReplicationController>> w
                     = getEndpoint()
                             .getKubernetesClient().replicationControllers();
-            if 
(ObjectHelper.isNotEmpty(getEndpoint().getKubernetesConfiguration().getNamespace()))
 {
-                
w.inNamespace(getEndpoint().getKubernetesConfiguration().getNamespace());
-            }
+            
ObjectHelper.ifNotEmpty(getEndpoint().getKubernetesConfiguration().getNamespace(),
 w::inNamespace);
+
             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());
-            }
+
+            
ObjectHelper.ifNotEmpty(getEndpoint().getKubernetesConfiguration().getResourceName(),
 w::withName);
+
             watch = w.watch(new Watcher<ReplicationController>() {
 
                 @Override
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
index 8315151..32e60a4 100644
--- 
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
@@ -87,17 +87,17 @@ public class KubernetesServicesConsumer extends 
DefaultConsumer {
         @Override
         public void run() {
             MixedOperation<Service, ServiceList, ServiceResource<Service>> w = 
getEndpoint().getKubernetesClient().services();
-            if 
(ObjectHelper.isNotEmpty(getEndpoint().getKubernetesConfiguration().getNamespace()))
 {
-                
w.inNamespace(getEndpoint().getKubernetesConfiguration().getNamespace());
-            }
+
+            
ObjectHelper.ifNotEmpty(getEndpoint().getKubernetesConfiguration().getNamespace(),
 w::inNamespace);
+
             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());
-            }
+
+            
ObjectHelper.ifNotEmpty(getEndpoint().getKubernetesConfiguration().getResourceName(),
 w::withName);
+
             watch = w.watch(new Watcher<Service>() {
 
                 @Override
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/openshift/build_configs/OpenshiftBuildConfigsProducer.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/openshift/build_configs/OpenshiftBuildConfigsProducer.java
index db60282..e485d3d 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/openshift/build_configs/OpenshiftBuildConfigsProducer.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/openshift/build_configs/OpenshiftBuildConfigsProducer.java
@@ -18,13 +18,9 @@ package org.apache.camel.component.openshift.build_configs;
 
 import java.util.Map;
 
-import io.fabric8.kubernetes.client.dsl.FilterWatchListMultiDeletable;
-import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
-import io.fabric8.openshift.api.model.Build;
 import io.fabric8.openshift.api.model.BuildConfig;
 import io.fabric8.openshift.api.model.BuildConfigList;
 import io.fabric8.openshift.client.OpenShiftClient;
-import io.fabric8.openshift.client.dsl.BuildConfigResource;
 import org.apache.camel.Exchange;
 import org.apache.camel.component.kubernetes.AbstractKubernetesEndpoint;
 import org.apache.camel.component.kubernetes.KubernetesConstants;
@@ -84,20 +80,11 @@ public class OpenshiftBuildConfigsProducer extends 
DefaultProducer {
         Map<String, String> labels = 
exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_BUILD_CONFIGS_LABELS, 
Map.class);
         String namespaceName = 
exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, 
String.class);
         if (!ObjectHelper.isEmpty(namespaceName)) {
-            NonNamespaceOperation<BuildConfig, BuildConfigList, 
BuildConfigResource<BuildConfig, Void, Build>> buildConfigs
-                    = 
getEndpoint().getKubernetesClient().adapt(OpenShiftClient.class).buildConfigs()
-                            .inNamespace(namespaceName);
-            for (Map.Entry<String, String> entry : labels.entrySet()) {
-                buildConfigs.withLabel(entry.getKey(), entry.getValue());
-            }
-            buildConfigsList = buildConfigs.list();
+            buildConfigsList = 
getEndpoint().getKubernetesClient().adapt(OpenShiftClient.class).buildConfigs()
+                    .inNamespace(namespaceName).withLabels(labels).list();
         } else {
-            FilterWatchListMultiDeletable<BuildConfig, BuildConfigList> 
buildConfigs
-                    = 
getEndpoint().getKubernetesClient().adapt(OpenShiftClient.class).buildConfigs().inAnyNamespace();
-            for (Map.Entry<String, String> entry : labels.entrySet()) {
-                buildConfigs.withLabel(entry.getKey(), entry.getValue());
-            }
-            buildConfigsList = buildConfigs.list();
+            buildConfigsList = 
getEndpoint().getKubernetesClient().adapt(OpenShiftClient.class).buildConfigs()
+                    .inAnyNamespace().withLabels(labels).list();
         }
         prepareOutboundMessage(exchange, buildConfigsList.getItems());
     }
diff --git 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/openshift/builds/OpenshiftBuildsProducer.java
 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/openshift/builds/OpenshiftBuildsProducer.java
index f0f7f19..da5474c 100644
--- 
a/components/camel-kubernetes/src/main/java/org/apache/camel/component/openshift/builds/OpenshiftBuildsProducer.java
+++ 
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/openshift/builds/OpenshiftBuildsProducer.java
@@ -18,13 +18,9 @@ package org.apache.camel.component.openshift.builds;
 
 import java.util.Map;
 
-import io.fabric8.kubernetes.client.dsl.FilterWatchListMultiDeletable;
-import io.fabric8.kubernetes.client.dsl.LogWatch;
-import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation;
 import io.fabric8.openshift.api.model.Build;
 import io.fabric8.openshift.api.model.BuildList;
 import io.fabric8.openshift.client.OpenShiftClient;
-import io.fabric8.openshift.client.dsl.BuildResource;
 import org.apache.camel.Exchange;
 import org.apache.camel.component.kubernetes.AbstractKubernetesEndpoint;
 import org.apache.camel.component.kubernetes.KubernetesConstants;
@@ -83,20 +79,11 @@ public class OpenshiftBuildsProducer extends 
DefaultProducer {
         Map<String, String> labels = 
exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_BUILDS_LABELS, 
Map.class);
         String namespaceName = 
exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, 
String.class);
         if (!ObjectHelper.isEmpty(namespaceName)) {
-            NonNamespaceOperation<Build, BuildList, BuildResource<Build, 
LogWatch>> builds = getEndpoint().getKubernetesClient()
-                    
.adapt(OpenShiftClient.class).builds().inNamespace(namespaceName);
-            for (Map.Entry<String, String> entry : labels.entrySet()) {
-                builds.withLabel(entry.getKey(), entry.getValue());
-            }
-            buildList = builds.list();
+            buildList = getEndpoint().getKubernetesClient()
+                    
.adapt(OpenShiftClient.class).builds().inNamespace(namespaceName).withLabels(labels).list();
         } else {
-            FilterWatchListMultiDeletable<Build, BuildList> builds
-                    = 
getEndpoint().getKubernetesClient().adapt(OpenShiftClient.class).builds()
-                            .inAnyNamespace();
-            for (Map.Entry<String, String> entry : labels.entrySet()) {
-                builds.withLabel(entry.getKey(), entry.getValue());
-            }
-            buildList = builds.list();
+            buildList = 
getEndpoint().getKubernetesClient().adapt(OpenShiftClient.class).builds()
+                    .inAnyNamespace().withLabels(labels).list();
         }
 
         prepareOutboundMessage(exchange, buildList.getItems());

Reply via email to