Hi, today when I was trying to use Dekorate to generate Kubernetes manifests, I noticed that in some cases they contain duplicate resources, namely ConfigMap volumes in my case. But I suspect that other non-unique resources might be affected too.
I managed to narrow down the cause. This problem seems to occur when kubernetes-spring-starter is used alongside other annotation processors. I tried to debug the annotation processor and found out the following. When multiple annotation processors are used, the SpringBootWebProcessor instance with the same instance of the Session class is invoked multiple times. Each invocation adds a new PropertyConfiguration to the ConfigurationRegistry, KubernetesConfigBuilder supplier to be more specific. After annotation processing is over and the Session is being closed, each PropertyConfiguration will result in a duplicate resource. I am not sure why only ConfigMap volumes are affected. Maybe other configuration of other resources overwritten in the model, while ConfigMap volumes are appended.
I tried older versions of the kubernetes-spring-starter (I think I tried all the way down to 2.1.0) but with the same result.
I prepared a minimal reproducible example, if you would like to try it for yourselves - https://github.com/tomaskralik/dekorate-duplicate-resources-reprex . In this state, Dekorate generates duplicate ConfigMap volumes. If you comment out all annotation processors except kubernetes-spring-starter, everything works fine.
Hi, today when I was trying to use Dekorate to generate Kubernetes manifests, I noticed that in some cases they contain duplicate resources, namely ConfigMap volumes in my case. But I suspect that other non-unique resources might be affected too.
I managed to narrow down the cause. This problem seems to occur when kubernetes-spring-starter is used alongside other annotation processors. I tried to debug the annotation processor and found out the following. When multiple annotation processors are used, the SpringBootWebProcessor instance with the same instance of the Session class is invoked multiple times. Each invocation adds a new PropertyConfiguration to the ConfigurationRegistry, KubernetesConfigBuilder supplier to be more specific. After annotation processing is over and the Session is being closed, each PropertyConfiguration will result in a duplicate resource. I am not sure why only ConfigMap volumes are affected. Maybe other configuration of other resources overwritten in the model, while ConfigMap volumes are appended.
I tried older versions of the kubernetes-spring-starter (I think I tried all the way down to 2.1.0) but with the same result.
I prepared a minimal reproducible example, if you would like to try it for yourselves - https://github.com/tomaskralik/dekorate-duplicate-resources-reprex . In this state, Dekorate generates duplicate ConfigMap volumes. If you comment out all annotation processors except kubernetes-spring-starter, everything works fine.
Thank you for looking into this issue