eclipse-jkube / jkube

Build and Deploy java applications on Kubernetes
https://www.eclipse.dev/jkube/
Eclipse Public License 2.0
769 stars 515 forks source link

`k8s:resource` doesn't automatically pick up port from Micronaut `application.properties` #3326

Closed rohanKanojia closed 2 weeks ago

rohanKanojia commented 2 months ago

Describe the bug

Related to #2239

In a Micronaut project, when I specify port via application.yml:

micronaut:
  server:
    port: 9080

k8s:build does pick up this port and exposes 9000 port in container image. However, k8s:resource doesn't seem to add 9080 port in generated Kubernetes liveness, readiness and startup probes.

If I add extra jkube-healthcheck-micronaut enricher configuration for port, it works:

      <plugin>
          <groupId>org.eclipse.jkube</groupId>
          <artifactId>kubernetes-maven-plugin</artifactId>
          <version>${jkube.version}</version>              
          <configuration>
            <enricher>
              <config>
                  <jkube-healthcheck-micronaut>
                      <port>9080</port>
                  </jkube-healthcheck-micronaut>
              </config>
            </enricher>  
          </configuration>
      </plugin>

Eclipse JKube version

SNAPSHOT

Component

Kubernetes Maven Plugin

Apache Maven version

None

Gradle version

None

Steps to reproduce

  1. Go to quickstarts/maven/micronaut
  2. Run k8s:resource, you would notice generated resources has a different port in YAML manifests target/classes/META-INF/jkube/kubernetes.yml . It's not same as the one set in src/main/resources/application.yml

Expected behavior

MicronautHealthCheckEnricher should automatically read project configuration and read from ports. We need to make changes similar to https://github.com/eclipse-jkube/jkube/pull/2287 here to read ports.

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

1.25.3

Environment

Linux

Eclipse JKube Logs

No response

Sample Reproducer Project

No response

Additional context

No response

arman-yekkehkhani commented 2 months ago

@rohanKanojia Hi Rohan, Can I work on this?