Claus Ibsen created CAMEL-25653:
-----------------------------------

             Summary: camel-kubernetes - share the watch loop of the secret and 
config map reload tasks, and use an informer so no update is missed
                 Key: CAMEL-25653
                 URL: https://issues.apache.org/jira/browse/CAMEL-25653
             Project: Camel
          Issue Type: Improvement
          Components: camel-kubernetes
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Follow-up from the review of https://github.com/apache/camel/pull/27801 
(CAMEL-25614).

h3. 1. Share the reload watch loop

After CAMEL-25614, {{SecretsReloadTriggerTask}} and 
{{ConfigmapsReloadTriggerTask}} have the same {{run()}}, 
{{waitBeforeWatchingAgain()}} and {{doStop()}} logic (about 70 lines), apart 
from the resource type they watch. The retry delays (1 s, doubling to 30 s) are 
a third copy of the constants in {{KubernetesHelper}} (CAMEL-25273). The 
{{KubernetesHelper}} constants are package-private, so the {{secrets.vault}} 
and {{config_maps.vault}} packages cannot use them.

Move the loop into one shared helper, for example one that takes a 
{{Function<CountDownLatch, Watch>}}, and have the tasks and 
{{KubernetesHelper}} use the same delay constants, so the three copies cannot 
drift apart.

h3. 2. Do not miss updates while re-watching

The reload tasks miss any secret or config map update made between the close of 
a watch and the start of the next one. A fabric8 informer ({{inform()}} with a 
{{ResourceEventHandler}}) lists the resources again after a 410 Gone, which 
would close that gap.

The PR author (allthingssecurity) offered to do both as a follow-up.

_Claude Code on behalf of davsclaus_



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

Reply via email to