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

The flyway extension generates Kubernetes resources as if quarkus.flyway.enabled was a runtime property #37040

Closed
PierreBtz opened this issue Nov 13, 2023 · 8 comments · Fixed by #44468
Labels
Milestone

Comments

@PierreBtz
Copy link

Describe the bug

I noticed that when generating Kubernetes resource with the flyway extension in the classpath, an initialization task is created (as expected), but then the main container containing the application defines the QUARKUS_FLYWAY_ENABLED as false, which cannot have any effect since the quarkus.flyway.enabled is now a build time property.

Expected behavior

Either the variable is removed if it's useless anymore, or the logic is changed.

Actual behavior

With the variable set, at startup, Quarkus will warn that a change on a build property has no effect at runtime.
I cannot say if it breaks a previous workflow since I detected this while playing around with the extension, I suspect it's not breaking anything but it's not optimal since migration logic will try to run in any application container.

How to Reproduce?

To reproduce:

    spec:
      containers:
        - env:
            - name: KUBERNETES_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: QUARKUS_FLYWAY_ENABLED
              value: "false"

Output of uname -a or ver

Darwin ** 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk version "17.0.4" 2022-07-19 OpenJDK Runtime Environment Temurin-17.0.4+8 (build 17.0.4+8) OpenJDK 64-Bit Server VM Temurin-17.0.4+8 (build 17.0.4+8, mixed mode)

Quarkus version or git rev

3.5.1

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546)

Additional information

Note that the same is true for the init task (which sets the variable to true):

- env:
    - name: QUARKUS_INIT_AND_EXIT
      value: "true"
    - name: QUARKUS_FLYWAY_ENABLED
      value: "true"
@PierreBtz PierreBtz added the kind/bug Something isn't working label Nov 13, 2023
Copy link

quarkus-bot bot commented Nov 13, 2023

/cc @cristhiank (flyway), @gastaldi (flyway), @geoand (flyway,kubernetes), @gsmet (flyway), @iocanel (kubernetes)

@PierreBtz
Copy link
Author

Hey folks, gentle ping. Let me know if you need more details.

@phillipvanheerden
Copy link

phillipvanheerden commented Dec 20, 2023

I was wondering why my <project>-flyway-init container wasn't doing anything.

After reading this issue, I ended up setting quarkus.flyway.migrate-at-start=true in application.properties and changing the environment variable in the generated manifests from QUARKUS_FLYWAY_ENABLED to QUARKUS_FLYWAY_ACTIVE and that did the trick.

So looks like we might need to make a small fix to the quarkus-flyway extension (or quarkus-kubernetes, had a quick look and I'm not too sure which is responsible for the manifests) if I'm understanding the situation correctly?

edit: found it

.withAppEnvVars(Map.of("QUARKUS_FLYWAY_ENABLED", "false"))

@anchialas
Copy link

As a workaround, set this in your application.properties:

 quarkus.flyway.migrate-at-start=${QUARKUS_FLYWAY_ENABLED:true}

@jbgomond
Copy link

Hi, this is still a thing. Should it be QUARKUS_FLYWAY_ACTIVE now ?

@geoand geoand added the triage/needs-feedback We are waiting for feedback. label Jul 15, 2024
@geoand
Copy link
Contributor

geoand commented Sep 13, 2024

Is this still an issue with the latest version of Quarkus?

@PierreBtz
Copy link
Author

PierreBtz commented Sep 13, 2024

I just reproduced the issue using my initial reproduction steps.

Updated informations:

Output of uname -a or ver

Darwin ****** 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk version "21.0.4" 2024-07-16 LTS
OpenJDK Runtime Environment Temurin-21.0.4+7 (build 21.0.4+7-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.4+7 (build 21.0.4+7-LTS, mixed mode)

Quarkus version or git rev

3.14.3

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)

@geoand
Copy link
Contributor

geoand commented Sep 13, 2024

Thanks a lot for the info!

@geoand geoand removed the triage/needs-feedback We are waiting for feedback. label Sep 13, 2024
@quarkus-bot quarkus-bot bot added this to the 3.18 - main milestone Nov 14, 2024
@gsmet gsmet modified the milestones: 3.18 - main, 3.16.4 Nov 19, 2024
benkard pushed a commit to benkard/quarkus-googlecloud-jsonlogging that referenced this issue Nov 27, 2024
…oud-jsonlogging!25)

This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io.quarkus:quarkus-extension-processor](https://github.com/quarkusio/quarkus) |  | minor | `3.16.3` -> `3.17.0` |
| [io.quarkus:quarkus-extension-maven-plugin](https://github.com/quarkusio/quarkus) | build | minor | `3.16.3` -> `3.17.0` |
| [io.quarkus:quarkus-bom](https://github.com/quarkusio/quarkus) | import | minor | `3.16.3` -> `3.17.0` |
| [io.quarkus:quarkus-maven-plugin](https://github.com/quarkusio/quarkus) | build | minor | `3.16.3` -> `3.17.0` |
| [org.jboss.logmanager:jboss-logmanager](https://jboss.org) ([source](https://github.com/jboss-logging/jboss-logmanager)) | optional | minor | `3.0.6.Final` -> `3.1.0.Final` |

---

### Release Notes

<details>
<summary>quarkusio/quarkus</summary>

### [`v3.17.0`](quarkusio/quarkus@3.16.4...3.17.0)

[Compare Source](quarkusio/quarkus@3.16.4...3.17.0)

### [`v3.16.4`](https://github.com/quarkusio/quarkus/releases/tag/3.16.4)

[Compare Source](quarkusio/quarkus@3.16.3...3.16.4)

##### Complete changelog

-   [#&#8203;37040](quarkusio/quarkus#37040) - The flyway extension generates Kubernetes resources as if quarkus.flyway.enabled was a runtime property
-   [#&#8203;42446](quarkusio/quarkus#42446) - Add explanation/concept for extension maturity model
-   [#&#8203;44367](quarkusio/quarkus#44367) - Gradle 3.16 fails with missing required property `additionalForcedProperties`
-   [#&#8203;44399](quarkusio/quarkus#44399) - Declaring explicitly the build service in the QuarkusBuildTask
-   [#&#8203;44433](quarkusio/quarkus#44433) - Reflection free serializers ArrayIndexOutOfBoundsException
-   [#&#8203;44438](quarkusio/quarkus#44438) - Gradle `buildForkOptions` no longer used since quarkus 3.16.1
-   [#&#8203;44457](quarkusio/quarkus#44457) - Support for short and uncommon field names like set, get, and is
-   [#&#8203;44468](quarkusio/quarkus#44468) - Use `QUARKUS_FLYWAY_ACTIVE` instead of `QUARKUS_FLYWAY_ENABLED` env in Kubernetes resources
-   [#&#8203;44472](quarkusio/quarkus#44472) - Kotlin native Jackson serialization regression: EmptyList & EmptyMap missing
-   [#&#8203;44480](quarkusio/quarkus#44480) - Fix nullpointer on null code websockets-next
-   [#&#8203;44493](quarkusio/quarkus#44493) - Using BuildForkOptions in QuarkusBuildTask
-   [#&#8203;44494](quarkusio/quarkus#44494) - Register Kotlin's empty list and map for reflection
-   [#&#8203;44505](quarkusio/quarkus#44505) - Log in smallrye-jwt and oauth2 extensions when no bearer access token is available
-   [#&#8203;44507](quarkusio/quarkus#44507) - Fixed Timestamp not being set for otel log signals
-   [#&#8203;44509](quarkusio/quarkus#44509) - Updates to Infinispan 15.0.11.Final
-   [#&#8203;44515](quarkusio/quarkus#44515) - Coordinated Vert.x 4.5.11 upgrades
-   [#&#8203;44531](quarkusio/quarkus#44531) - Correct image file name to resolve broken image
-   [#&#8203;44537](quarkusio/quarkus#44537) - Update smallrye-jwt to 4.6.1
-   [#&#8203;44545](quarkusio/quarkus#44545) - Wrong index of ParameterizedType argument of Map when register type to be generated in JacksonCodeGenerator
-   [#&#8203;44571](quarkusio/quarkus#44571) - Update `CacheJsonRPCService.java` reference
-   [#&#8203;44574](quarkusio/quarkus#44574) - Grammar corrections for en-us

</details>

<details>
<summary>jboss-logging/jboss-logmanager</summary>

### [`v3.1.0.Final`](https://github.com/jboss-logging/jboss-logmanager/releases/tag/v3.1.0.Final): 3.1.0.Final

[Compare Source](jboss-logging/jboss-logmanager@3.0.6.Final...v3.1.0.Final)

#### What's Changed

-   \[LOGMGR-345] Ensure logger FQCN is correct for system logger by [@&#8203;dmlloyd](https://github.com/dmlloyd) in jboss-logging/jboss-logmanager#457
-   Migrate tests to keep the log files that were created. Put the log fi… by [@&#8203;jamezp](https://github.com/jamezp) in jboss-logging/jboss-logmanager#459
-   Bump org.junit:junit-bom from 5.10.1 to 5.10.2 by [@&#8203;dependabot](https://github.com/dependabot) in jboss-logging/jboss-logmanager#461
-   \[LOGMGR-346] Bump org.jboss.modules:jboss-modules from 2.1.2.Final to 2.1.3.Final by [@&#8203;dependabot](https://github.com/dependabot) in jboss-logging/jboss-logmanager#462
-   \[LOGMGR-347] Do not use deprecated SmallRye Common OS `Process` by [@&#8203;dmlloyd](https://github.com/dmlloyd) in jboss-logging/jboss-logmanager#464
-   \[LOGMGR-349] Bump org.eclipse.parsson:parsson from 1.1.5 to 1.1.6 by [@&#8203;dependabot](https://github.com/dependabot) in jboss-logging/jboss-logmanager#466
-   \[LOGMGR-351] Fix periodic file rotation by week, month, year. by [@&#8203;alex-pumpkin](https://github.com/alex-pumpkin) in jboss-logging/jboss-logmanager#468
-   Bump org.jboss.modules:jboss-modules from 2.1.3.Final to 2.1.5.Final by [@&#8203;dependabot](https://github.com/dependabot) in jboss-logging/jboss-logmanager#467
-   \[LOGMGR-350] Avoid TCCL when configuring the log manager by [@&#8203;dmlloyd](https://github.com/dmlloyd) in jboss-logging/jboss-logmanager#469
-   \[LOGMGR-351] Remove the deprecated per-deployment logging options. by [@&#8203;jamezp](https://github.com/jamezp) in jboss-logging/jboss-logmanager#471
-   Bump org.junit:junit-bom from 5.10.2 to 5.10.3 by [@&#8203;dependabot](https://github.com/dependabot) in jboss-logging/jboss-logmanager#478
-   Bump org.jboss.byteman:byteman-bmunit5 from 4.0.22 to 4.0.23 by [@&#8203;dependabot](https://github.com/dependabot) in jboss-logging/jboss-logmanager#476
-   Bump org.junit:junit-bom from 5.10.3 to 5.11.2 by [@&#8203;dependabot](https://github.com/dependabot) in jboss-logging/jboss-logmanager#488
-   Bump org.junit:junit-bom from 5.11.2 to 5.11.3 by [@&#8203;dependabot](https://github.com/dependabot) in jboss-logging/jboss-logmanager#490
-   \[LOGMGR-354] Avoid expensive JLine setup on JDK 23+ by [@&#8203;dmlloyd](https://github.com/dmlloyd) in jboss-logging/jboss-logmanager#491
-   Save head encoding on sanitized String(s) by [@&#8203;franz1981](https://github.com/franz1981) in jboss-logging/jboss-logmanager#492
-   Use `NO_FORMAT` when using parameterless log methods by [@&#8203;dmlloyd](https://github.com/dmlloyd) in jboss-logging/jboss-logmanager#493
-   Switch to formal module descriptor by [@&#8203;dmlloyd](https://github.com/dmlloyd) in jboss-logging/jboss-logmanager#494
-   Module descriptor updates by [@&#8203;dmlloyd](https://github.com/dmlloyd) in jboss-logging/jboss-logmanager#496
-   Bump org.jboss.modules:jboss-modules from 2.1.5.Final to 2.1.6.Final by [@&#8203;dependabot](https://github.com/dependabot) in jboss-logging/jboss-logmanager#495
-   Add smart service provider method by [@&#8203;dmlloyd](https://github.com/dmlloyd) in jboss-logging/jboss-logmanager#497

#### New Contributors

-   [@&#8203;alex-pumpkin](https://github.com/alex-pumpkin) made their first contribution in jboss-logging/jboss-logmanager#468
-   [@&#8203;franz1981](https://github.com/franz1981) made their first contribution in jboss-logging/jboss-logmanager#492

**Full Changelog**: jboss-logging/jboss-logmanager@3.0.4.Final...v3.1.0.Final

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

👻 **Immortal**: This MR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants