Restart POD on ConfigMap Content Change with kubernetes Component - ConfigMapWatcher

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Restart POD on ConfigMap Content Change with kubernetes Component - ConfigMapWatcher

imranrazakhan
This post was updated on .
I am looking for option to restart pods if configmap get change.

On CLI we can watch ConfigMap changes with below command

> oc get configmap my-configmap --watch-only=true

it shows output as soon as configmap data get change

In camel i am able to getConfigMap

 from("timer://foo?fixedRate=true&period=5000")
            .setHeader(KubernetesConstants.KUBERNETES_NAMESPACE_NAME,
simple("default"))
            .setHeader(KubernetesConstants.KUBERNETES_CONFIGMAP_NAME,
simple("my-config"))
            .to("kubernetes-config-maps://
https://localhost:8443?oauthToken=xxxx&operation=getConfigMap")
            .to("mock:result");

But it doesn't support consumer, so i am looking for ConfigMapWatcher like


    from("kubernetes-config-maps:///?kubernetesClient=#kubernetesClient&operation=watchConfigMap")
    .toF("kubernetes-pods://https://x.x:8443?oauthToken=x&operation=deletePod", host,authToken);
    .toF("kubernetes-pods://https://x.x:8443?oauthToken=x&operation=createPod", host,authToken);


A watch on configMap would help in this regard similar to watch_only option