Claus Ibsen created CAMEL-26934:
-----------------------------------

             Summary: camel-jbang-plugin-kubernetes - --kube-config is ignored 
by delete, logs loops on a finished pod, and traits are dropped for CronJob and 
Knative
                 Key: CAMEL-26934
                 URL: https://issues.apache.org/jira/browse/CAMEL-26934
             Project: Camel
          Issue Type: Bug
          Components: camel-jbang
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found by a scan of the Camel CLI on 2026-11-13, with the unpacked 
4.24.0-SNAPSHOT camel-launcher on macOS (JDK 25). *(exp)* means reproduced by 
experiment, *(read)* means traced in the code. Paths are relative to 
{{dsl/camel-jbang/}}, and line numbers are from main at that time. Earlier 
findings of this kind: CAMEL-26901, CAMEL-26911 to CAMEL-26914.

No real cluster was used: the calls went to an unreachable kubeconfig or a 
local fake API server. Paths are under 
{{camel-jbang-plugin-kubernetes/.../commands/kubernetes/}}.

h3. 1. --kube-config is ignored in three places (exp + read, high)

{{KubernetesDelete.java:51}} uses the static default client, 
{{KubernetesHelper.discoverClusterType}} (147-190) uses the default client, and 
the jkube deploy ({{KubernetesRun}} 668-797) never gets the kubeconfig. 
{{delete --kube-config=<fake>}} with {{KUBECONFIG}} pointing elsewhere made 0 
requests to the given cluster: a delete aimed at staging acts on the current 
context.

h3. 2. The client timeouts are set after the client is built (exp)

{{KubernetesHelper.getKubernetesClient}} (85-91): with an unreachable API {{run 
--output yaml}} takes 40.7 s, against 1.8 s with the timeouts preset. Move one 
line.

h3. 3. kubernetes logs loops forever on a finished pod (exp)

{{isPodTerminated}} (153-161) checks the phase "Terminated", which does not 
exist, and {{retryCount}} is reset for every printed line (137), so the cap 
never triggers. A Succeeded pod's log was printed 6 times in 12 s. Also hits 
CronJob pods and {{run --logs}}/{{--dev}}.

h3. 4. Options dropped for CronJob and Knative Service (exp)

EnvTrait, MountTrait, LabelTrait and AnnotationTrait apply only to the 
Deployment: a cronjob export with {{--env}}, {{--config}}, {{--volume}} and 
{{--annotation}} exits 0 and none is in {{cronjob.yml}}. A Knative Service 
loses the env and the labels, including {{app.kubernetes.io/runtime}}.

h3. 5. Duplicate volume names (exp)

{{MountTrait}} names a volume {{sanitize(name)}} with no type prefix and cuts 
at the first dot: {{--config configmap:db --config secret:db}} gives two 
volumes named {{db}}, which the API server rejects.

h3. 6. Medium

* {{--profile}} drops the traits of {{application.properties}} 
({{KubernetesExport.java:295-309}}).
* {{kubernetes run --property}} drops any value with a {{/}} as a file name 
({{KubernetesRun.java:317-335}}), for example {{camel.server.path=/api}}.
* A comma in a trait value is split into a list even when quoted 
({{TraitHelper.resolveTraitValue}} 182-188): {{cronjob.schedule=0 1,13 * * *}} 
exits 70 with a Jackson trace.
* {{ingress.annotations=k=v}} exits 70; the doc example at 
{{camel-jbang-kubernetes-advanced.adoc:378}} uses {{-t}}, an unknown option; 
with {{--trait}} the annotation is ignored.
* Image settings: {{--registry-mirror}} builds 
{{mirror/mirror.gcr.io/library/...}}; {{--image=localhost:5000/app:1}} gets no 
registry or insecure setting; 4-part names get no registry; {{export 
--cluster-type=openshift}} has no namespace in the image, unlike run.
* {{KubernetesHelper.sanitize}}: {{my.app.v2}} becomes {{my}}, {{2048-game}} is 
not a valid DNS-1035 name, {{___}} gives an empty name and exit 0.
* {{cronjob.enabled=true}} without a schedule generates no workload and exits 
0; {{cronjob.backoff-limit=0}} is dropped (Kubernetes uses 6).

h3. 7. Low

* A Service and port 8080 are always generated, also for timer routes and 
CronJobs; the check is dead code and the port comment is stale (health is on 
9876).
* {{ingress.auto}} is documented but never read.
* A custom container name is reported as "not supported" but applied.
* On Windows the mount path uses backslashes.
* {{delete}} never deletes CronJobs and exits 0 when nothing is found ({{logs}} 
exits 3).
* {{run --output yaml}} still contacts the cluster unless {{--cluster-type}} 
and {{--disable-auto}} are given; the detection message goes to {{System.out}} 
({{KubernetesHelper.java:163,183}}) inside the YAML; {{--quiet}} swallows the 
reasons of "Project export failed!"; typos in trait names are ignored; 
{{delete}} and {{logs}} have no {{--json}}.

h3. Came out clean

{{--cluster-type}} validation, the kind and minikube registry mapping, 
Deployment and Service consistency, the Ingress and Route mapping, {{--env}} 
values with {{=}} or {{,}}.

_Claude Code on behalf of Claus Ibsen_



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

Reply via email to