Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14129

kubernetesConfiguration.setNamespace is not working

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.24.3, 3.0.0, 2.25.0
    • Component/s: camel-kubernetes
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I am running following code and its not working with "kubernetesConfiguration.setNamespace" but if i set ".setHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, simple("my-ns"))" then its work

      Main Class:

      public static void main(String[] args) throws Exception {        
      KubernetesConfiguration kubernetesConfiguration = new KubernetesConfiguration();        kubernetesConfiguration.setMasterUrl("https://0.0.0.0:8443"); kubernetesConfiguration.setOauthToken("52rAQP_gk3GOtAG8o53loVtozrzPbKy9meNrpNSyCtA"); kubernetesConfiguration.setTrustCerts(true);
      kubernetesConfiguration.setNamespace("my-ns");
      KubernetesClient kc = KubernetesHelper.getKubernetesClient(kubernetesConfiguration);
      final Main main = new Main();
      main.addRouteBuilder(new MyRoute());
      main.bind("kubeClient", kc);
      main.run(args);    
      }

       

      Route Code:

      from("timer://ipc?repeatCount=1")
      //.setHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, simple("my-ns"))
      .setHeader(KubernetesConstants.KUBERNETES_CONFIGMAP_NAME, simple("my-cm"))
      .to("kubernetes-config-maps:///?kubernetesClient=#kubeClient&operation=getConfigMap")
      .to("log:my?showAll=true&multiline=true");

       if in route i set namespace header then it works otherwise it give null body so if we already configured client with namespace it should be used rather than we have to explicitly provide in header of route, yes if we provide in header it should be override on client configuration

        Attachments

          Activity

            People

            • Assignee:
              acosentino Andrea Cosentino
              Reporter:
              imranrazakhan imran raza khan
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: