Federico Mariani created CAMEL-19825:
----------------------------------------

             Summary: Kubernetes cluster service is produced bur not present in 
camel services
                 Key: CAMEL-19825
                 URL: https://issues.apache.org/jira/browse/CAMEL-19825
             Project: Camel
          Issue Type: Bug
          Components: camel-kubernetes
    Affects Versions: 4.0.0
            Reporter: Federico Mariani


The example 
[master|https://github.com/apache/camel-spring-boot-examples/tree/main/master] 
does not work with camel 4 with the openshift profile due to
{code:java}
Caused by: java.lang.IllegalStateException: No cluster service found
        at 
org.apache.camel.component.master.MasterComponent.lambda$doInit$0(MasterComponent.java:113)
 ~[camel-master-4.0.0.redhat-00002.jar!/:4.0.0.redhat-00002]
        at java.base/java.util.Optional.orElseThrow(Optional.java:403) ~[na:na]
        at 
org.apache.camel.component.master.MasterComponent.doInit(MasterComponent.java:112)
 ~[camel-master-4.0.0.redhat-00002.jar!/:4.0.0.redhat-00002]
{code}
In particular, I noticed that the bean KubernetesClusterService is produced by 
Spring boot, but, the [following line of 
code|https://github.com/apache/camel/blob/main/core/camel-support/src/main/java/org/apache/camel/support/cluster/ClusterServiceHelper.java#L38]
 returns an empty list and I do not fully understand how these kinds of beans 
are added to the services in the camel context.

A workaround exists, the KubernetesClusterService has to be created manually 
and added to the camelContext like this
{code:java}
getContext().addService(new KubernetesClusterService());
{code}
but the same code is working in camel 3.x.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to