Quarkus: Kubernetes extension does not generate init containers properly

Created on 20 Oct 2020  路  5Comments  路  Source: quarkusio/quarkus

Describe the bug
When io.quarkus:quarkus-smallrye-health dependency is in the classpath and an init container added to the application.properties file, it generates liveness and readiness probes for the init container which is wrong as per https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#differences-from-regular-containers and generated kubernetes.[yml|json] cannot be applied.

Expected behavior
There shouldn't be any probes defined for the init container

...
      initContainers:
      - command:
        - sh
        - -c
        - echo The init container is running! && sleep 3600'
        image: busybox:1.28
        imagePullPolicy: IfNotPresent
        name: migrate-db
      serviceAccount: code-with-quarkus
...

Actual behavior
Readiness and liveness probes are defined for the init container

...
      initContainers:
      - command:
        - sh
        - -c
        - echo The init container is running! && sleep 3600'
        image: busybox:1.28
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: ""
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 0
          periodSeconds: 30
          successThreshold: 1
          timeoutSeconds: 10
        name: migrate-db
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: ""
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 0
          periodSeconds: 30
          successThreshold: 1
          timeoutSeconds: 10
      serviceAccount: code-with-quarkus
...

To Reproduce

reproducer.zip

Steps to reproduce the behavior:

  1. Extract the reproducer
  2. ./gradlew clean build
  3. Inspect the build/kubernetes/kubernetes.[yml|json]

Configuration

# Add your application.properties here, if applicable.
quarkus.kubernetes.init-containers.migrate-db.image=busybox:1.28
quarkus.kubernetes.init-containers.migrate-db.command=sh,-c,echo The init container is running! && sleep 3600'

Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver: Darwin Emins-MacBook-Pro.local 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
  • Output of java -version: openjdk version "11.0.7" 2020-04-14
  • Quarkus version or git rev: 1.9.0.CR1
  • Build tool (ie. output of mvnw --version or gradlew --version): Gradle 6.5

Additional context

This issue does not appear on 1.8.3.Final version

arekubernetes kinbug

Most helpful comment

Yeah, I'll have a look

All 5 comments

/cc @geoand

cc @iocanel

Seems like a regression

Yeah, I'll have a look

cc @iocanel

Seems like a regression

Not a regression after all. I think that this has been around forever.

And I think its a decorate bug.

Was this page helpful?
0 / 5 - 0 ratings