Claus Ibsen created CAMEL-27910:
-----------------------------------

             Summary: camel-kubernetes: job and cronjob producers fail with a 
NullPointerException without an operation, the cluster service ignores 
masterUrl and namespace, the custom-resources consumer retries forever without 
a namespace
                 Key: CAMEL-27910
                 URL: https://issues.apache.org/jira/browse/CAMEL-27910
             Project: Camel
          Issue Type: Bug
          Components: camel-kubernetes
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-kubernetes for 
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31167).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. Job and CronJob producers fail with a NullPointerException without an 
operation
{{KubernetesJobProducer.process}} and {{KubernetesCronJobProducer.process}} 
switch on the operation; when neither the operation option nor the header is 
set, switch(null) throws a NullPointerException.
Proposed change: use KubernetesHelper.extractOperation like the other producers 
(IllegalArgumentException).

h4. 2. The custom-resources producer fails with a NullPointerException without 
an instance
{{KubernetesCustomResourcesProducer.doCreateOrUpdate}} calls 
Serialization.unmarshal(null, ...) when CamelKubernetesCRDInstance is missing.
Proposed change: check the header and throw an IllegalArgumentException.

h4. 3. The custom-resources consumer retries forever without a namespace
{{KubernetesCustomResourcesConsumer.CustomResourcesConsumerTask.run}} only logs 
"namespace is not specified." and then calls inNamespace(null); Fabric8 throws 
"namespace cannot be null", and KubernetesHelper.watch retries it forever (up 
to every 30 s).
Proposed change: fail in doStart with an IllegalArgumentException, as the 
producer does.

h4. 4. The cluster service ignores masterUrl, namespace and connectionTimeout
{{KubernetesClusterService.doInit}} copies masterUrl, namespace and 
connectionTimeout into the KubernetesConfiguration only in the else branch, 
when a configuration was given. With the no-arg constructor (bean or properties 
setup) they are ignored and the client is always auto-configured.
Proposed change: create or copy the configuration first, then apply the three 
values in both cases. groupName also has no effect (each view uses its own 
namespace), and the bean metadata says deprecated while the class is not.

h4. 5. The events producer takes the action of a consumed event
The consumer and the producer use the same header name 
CamelKubernetesEventAction; the events consumer sets it to a Watcher.Action, so 
an exchange forwarded from the consumer to createEvent or updateEvent gets 
ADDED or MODIFIED as the action of the new Event unless the route removes the 
header. The producer header (KUBERNETES_EVENT_ACTION_PRODUCER) is also hidden 
in the catalog, because the consumer header with the same name replaces it.
Proposed change: use a separate producer header name (with an upgrade-guide 
entry).

h4. 6. Event time format
The default of CamelKubernetesEventTime is documented as "server time", but the 
producer uses OffsetDateTime.now() of the Camel JVM formatted with 
ISO_OFFSET_DATE_TIME, which drops trailing zeros, so it does not always have 
the six fractional digits of the Kubernetes MicroTime format (not checked 
against an API server).
Proposed change: format with a fixed six-digit pattern, and fix the documented 
default.

h4. 7. Smaller issues
applicableFor of CamelKubernetesNamespaceName misses kubernetes-cronjob (its 
producer reads it); CamelKubernetesDeploymentsAnnotations lists 
openshift-deploymentconfigs, which never reads it. crdName, crdGroup, crdScope, 
crdVersion and crdPlural are labelled consumer, but the producer uses them too. 
portName, portProtocol and dnsDomain are unused since the ServiceCall EIP was 
removed (deprecation candidates). poolSize > 1 has no use (a single watch 
task). caCertData, caCertFile, clientCertData, clientCertFile, clientKeyAlgo 
and clientKeyFile are marked secret but are not secrets. deleteJob and 
deleteCronJob leave the body unchanged while the other delete operations return 
a boolean. The dev consoles always show login "OAuth Token" when a master URL 
is set.


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to