Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple annotation processors result in duplicate resources in generated Kubernetes manifest #1108

Open
tomaskralik opened this issue Dec 7, 2022 · 1 comment

Comments

@tomaskralik
Copy link

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

@aureamunoz
Copy link
Collaborator

Thank you @tomaskralik , I will take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants