I am trying to generate all Kubernetes configurations as part of the project build but the generated files do not contain "selector" elements for Services and Deployments. Despite checking their documentation, I am still unable to figure it how it could be added.
here is my plugin configuration
<plugin>
<groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>resource</goal>
</goals>
</execution>
</executions>
<configuration>
<detail>true</detail>
<kubernetesManifest>${project.build.directory}/kubernetes</kubernetesManifest>
<buildStrategy>docker</buildStrategy>
<recreate>true</recreate>
<verbose>true</verbose>
<targetDir>${project.parent.basedir}/generated-kube-configs/${profile}/${project.artifactId}</targetDir>
<images>
<image>
<name>hammadkdar/${project.artifactId}:${project.version}</name>
<build>
<from>openjdk:11-jre-slim</from>
<assembly>
<targetDir>/opt/usr/app</targetDir>
</assembly>
<cmd>java -jar /opt/usr/app/${project.artifactId}-${project.version}.jar</cmd>
<tags>
<tag>${project.version}</tag>
</tags>
<ports>
<port>${port}</port>
</ports>
</build>
</image>
</images>
<resources>
<labels>
<all>
<property>
<name>app</name>
<value>${project.artifactId}</value>
</property>
<property>
<name>version</name>
<value>${project.version}</value>
</property>
</all>
</labels>
<services>
<service>
<name>${project.artifactId}</name>
<type>NodePort</type>
<ports>
<port>
<name>http</name>
<nodePort>${nodePort}</nodePort>
<port>${port}</port>
<targetPort>${port}</targetPort>
<protocol>tcp</protocol>
</port>
</ports>
</service>
</services>
<configMap>
<name>${project.artifactId}</name>
<entries>
<entry>
<name>spring.profiles.active</name>
<value>${profile}</value>
</entry>
<entry>
<file>${project.basedir}/src/main/resources/application-${profile}.properties</file>
</entry>
</entries>
</configMap>
<liveness>
<getUrl>http://${project.artifactId}:${port}/actuator/health</getUrl>
<tcpPort>${port}</tcpPort>
<initialDelaySeconds>20</initialDelaySeconds>
<timeoutSeconds>3</timeoutSeconds>
</liveness>
<readiness>
<getUrl>http://${project.artifactId}:${port}/actuator/health</getUrl>
<tcpPort>${port}</tcpPort>
<initialDelaySeconds>20</initialDelaySeconds>
<timeoutSeconds>3</timeoutSeconds>
</readiness>
</resources>
<enricher>
<excludes>
<exclude>jkube-git</exclude>
<exclude>jkube-maven-issue-mgmt</exclude>
<exclude>jkube-project-label</exclude>
<exclude>jkube-healthcheck-spring-boot</exclude>
</excludes>r
</enricher>
</configuration>
</plugin>
The documentation lacks any configuration value named as selector, here is the link to their official page: enter link description here
As can be seen above, I am very close to achieving what I started for. Currently only "resource" goal is added but build can be added and obviously others to generate the containers, generated kubernetes yml configurations and then pushing the containers automatically as part of the build to some registry.
I need more eyes to search or probably plugin guys can bump into this and share their opinion.