quarkiverse / quarkus-operator-sdk

Quarkus Extension to create Kubernetes Operators in Java using the Java Operator SDK (https://github.com/java-operator-sdk/java-operator-sdk) project
Apache License 2.0
119 stars 50 forks source link

io.quarkus:quarkus-bom is now explicitly needed in 6.8.0 #963

Closed Donnerbart closed 1 month ago

Donnerbart commented 1 month ago

This could totally be on us, but just to be sure: We never defined the Quarkus BOM in our project, just the QOSDK BOM. With the update to 6.8.0 our build failed and we had to add the Quarkus BOM as explicit dependency.

6.7.3

libs.versions.toml

[versions]
quarkus = "3.13.2"
quarkus-operator-sdk = "6.7.3"

[libraries]
quarkus-operator-sdk = { module = "io.quarkiverse.operatorsdk:quarkus-operator-sdk" }
quarkus-operator-sdk-bom = { module = "io.quarkiverse.operatorsdk:quarkus-operator-sdk-bom", version.ref = "quarkus-operator-sdk" }

[plugins]
quarkus = { id = "io.quarkus", version.ref = "quarkus" }

build.gradle.kts

dependencies {
    // Quarkus Operator SDK
    implementation(enforcedPlatform(libs.quarkus.operator.sdk.bom))
    implementation(libs.quarkus.operator.sdk)
}

6.8.0

libs.versions.toml

[versions]
quarkus = "3.14.2"
quarkus-operator-sdk = "6.8.0"

[libraries]
quarkus-bom = { module = "io.quarkus:quarkus-bom", version.ref = "quarkus" }
quarkus-operator-sdk = { module = "io.quarkiverse.operatorsdk:quarkus-operator-sdk" }
quarkus-operator-sdk-bom = { module = "io.quarkiverse.operatorsdk:quarkus-operator-sdk-bom", version.ref = "quarkus-operator-sdk" }

[plugins]
quarkus = { id = "io.quarkus", version.ref = "quarkus" }

build.gradle.kts

dependencies {
    // Quarkus Operator SDK
    implementation(enforcedPlatform(libs.quarkus.bom))
    implementation(enforcedPlatform(libs.quarkus.operator.sdk.bom))
    implementation(libs.quarkus.operator.sdk)
}

If that is intended it's super fine with us. It's very well possible that we never set up the project correctly. I just wanted to make sure this isn't an issue with the dependency bundling in the 6.8.0 release.

metacosm commented 1 month ago

That's indeed a change in 6.8.0. We did include the Quarkus BOM in previous versions but we felt that it tied a given version of the SDK too much with the Quarkus version so decided to remove it in an attempt to decouple things a little. We figured that most people would set the Quarkus version first, then import this extension as a dependency so this shouldn't be an issue. Sorry for the inconvenience.

Donnerbart commented 1 month ago

Is this documentation still accurate? Do we still need to keep the Quarkus version in sync? Due to this we even have disabled Renovate for QOSDK and Quarkus.

Our current workflow, based on that documentation, is to check the QOSDK BOM for updates and then look up the <quarkus.version>3.x.y</quarkus.version> in the quarkus-operator-sdk-parent dependency.

It would be great if we could automate that (again).

metacosm commented 1 month ago

Good point. I should probably update the documentation. The recommended approach, at this point, is to use the QOSDK BOM from the Quarkus platform as explained in https://developers.redhat.com/articles/2023/09/19/write-operators-java-josdk-part-4-upgrading-strategies#strategies_for_qosdk_and_quarkus_updates, unless you need a specific QOSDK version that's not already part of the platform.

Donnerbart commented 1 month ago

I have to give this a test spin with Renovate, but so far this looks really great. Everything is resolved from a single Quarkus version reference, including the fabric8 Vert.x K8s client.

In case someone needs a base setup for Gradle (Kotlin) with version catalog:

gradle/libs.versions.toml

[versions]
quarkus = "3.14.4"

[libraries]
// Quarkus BOM
quarkus-bom = { module = "io.quarkus:quarkus-bom", version.ref = "quarkus" }
quarkus-platform-operator-sdk-bom = { module = "io.quarkus.platform:quarkus-operator-sdk-bom", version.ref = "quarkus" }

// Quarkus Operator SDK
quarkus-operator-sdk = { module = "io.quarkiverse.operatorsdk:quarkus-operator-sdk" }

// Quarkus
quarkus-arc = { module = "io.quarkus:quarkus-arc" }
quarkus-cache = { module = "io.quarkus:quarkus-cache" }
quarkus-container-image-docker = { module = "io.quarkus:quarkus-container-image-docker" }
quarkus-resteasy-reactive-jackson = { module = "io.quarkus:quarkus-resteasy-reactive-jackson" 

// K8s
kubernetes-client-vertx = { module = "io.fabric8:kubernetes-httpclient-vertx" }
}

[plugins]
quarkus = { id = "io.quarkus", version.ref = "quarkus" }

build.gradle.kts

configurations.all {
    exclude("io.fabric8", "kubernetes-httpclient-okhttp")
}

dependencies {
    // Quarkus BOM
    implementation(enforcedPlatform(libs.quarkus.bom))
    implementation(enforcedPlatform(libs.quarkus.platform.operator.sdk.bom))

    // Quarkus Operator SDK
    implementation(libs.quarkus.operator.sdk)

    // Quarkus
    implementation(libs.quarkus.arc)
    implementation(libs.quarkus.cache)
    implementation(libs.quarkus.container.image.docker)
    implementation(libs.quarkus.micrometer.registry.prometheus)
    implementation(libs.quarkus.resteasy.reactive.jackson)

    // K8s
    implementation(libs.kubernetes.client.vertx)
}
Donnerbart commented 1 month ago

This works fine for us, thanks for the help! Feel free to close the issue directly, or keep it open if you want to link it in case you want to update the documentation.

metacosm commented 1 month ago

Thank you! I updated the documentation. Hopefully, this is clearer, let me know if there's anything I can do to make things clearer.