Skip to content

Commit

Permalink
build(deps): Update dataflow dependencies (#5278)
Browse files Browse the repository at this point in the history
* build(deps): bump Kotlin to 1.8.20 and Gradle to 8.5.0

* build(deps): bump klogging to 0.5.8

- fix minor API change in dataflow code

* bump(deps): grpc to 1.61, protobuf to 3.25.2, kotlinx-coroutines to 1.7.3

Upgrading grpc introduced a breaking change, where dataflow was not
able to connect to the scheduler at runtime due to a name resolution
failure.

The problem appeared due to a naming resolution code rewrite, which
made it modular and reliant on the implementation being loaded at
runtime by the JVM, from the jar's META-INF/services.

Both grpc (core) and grpc-netty-shaded wrote the information about
the naming resolution implementation to the same path within their
packages. When building the dataflow fat jar, only one implementation
ended up being available, the one for naming resolution of URIs for
unix domain sockets.

The solution was to use the ShadowJdk gradle plugin and configure it
to merge files with the same name in META-INF/services coming from
multiple dependencies.

Other version bumps:
  - kubernetes:client-java
  - junit-jupyter-params

* update(licenses): refresh license list for dependencies after Gradle update to 8.5.0
  • Loading branch information
lc525 authored Feb 1, 2024
1 parent de7a672 commit ef6e321
Show file tree
Hide file tree
Showing 13 changed files with 579 additions and 532 deletions.
8 changes: 4 additions & 4 deletions scheduler/Dockerfile.dataflow
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM azul/zulu-openjdk-alpine:17.0.2-17.32.13 AS builder
FROM azul/zulu-openjdk-alpine:17-latest AS builder

COPY --from=gradle:7.4.2-jdk17 /opt/gradle /opt/gradle
COPY --from=gradle:8.5.0-jdk17-alpine /opt/gradle /opt/gradle
RUN ln -s /opt/gradle/bin/gradle /usr/bin/gradle

WORKDIR /build
Expand Down Expand Up @@ -30,8 +30,8 @@ RUN mkdir -p /tmp/certs/kafka/broker/ && \
USER default

WORKDIR /app
COPY --from=builder /build/src/data-flow/build/libs/*.jar .
COPY --from=builder /build/src/data-flow/build/libs/*-all.jar .
COPY scheduler/data-flow/opentelemetry-javaagent.jar opentelemetry-javaagent.jar

# TODO - inject JAR name & version from build pipeline
ENTRYPOINT ["/usr/bin/java", "-XX:+PreserveFramePointer", "-javaagent:./opentelemetry-javaagent.jar", "-Dotel.resource.attributes=service.name=seldon-dataflow", "-jar", "dataflow-1.0-SNAPSHOT.jar"]
ENTRYPOINT ["/usr/bin/java", "-XX:+PreserveFramePointer", "-javaagent:./opentelemetry-javaagent.jar", "-Dotel.resource.attributes=service.name=seldon-dataflow", "-jar", "dataflow-1.0-SNAPSHOT-all.jar"]
48 changes: 20 additions & 28 deletions scheduler/data-flow/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar


plugins {
id("com.github.hierynomus.license-report") version "0.16.1"
kotlin("jvm") version "1.6.21"
id("com.github.johnrengelman.shadow") version "8.1.1"
kotlin("jvm") version "1.8.20"

java
application
}

Expand All @@ -19,28 +24,28 @@ repositories {

dependencies {
implementation("com.natpryce:konfig:1.6.10.0")
implementation("io.klogging:klogging-jvm:0.4.4")
implementation("io.klogging:klogging-jvm:0.5.8")

// Kafka
implementation("org.apache.kafka:kafka-streams:3.4.0")
implementation("io.klogging:slf4j-klogging:0.2.5")
implementation("io.klogging:slf4j-klogging:0.5.8")
testImplementation("org.apache.kafka:kafka-streams-test-utils:3.5.0")

// gRPC
implementation("io.grpc:grpc-kotlin-stub:1.2.1")
implementation("io.grpc:grpc-stub:1.57.2")
implementation("io.grpc:grpc-protobuf:1.57.2")
runtimeOnly("io.grpc:grpc-netty-shaded:1.44.1")
implementation("com.google.protobuf:protobuf-java:3.21.7")
implementation("com.google.protobuf:protobuf-kotlin:3.21.7")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0")
implementation("io.grpc:grpc-kotlin-stub:1.4.1")
implementation("io.grpc:grpc-stub:1.61.0")
implementation("io.grpc:grpc-protobuf:1.61.0")
runtimeOnly("io.grpc:grpc-netty-shaded:1.61.0")
implementation("com.google.protobuf:protobuf-java:3.25.2")
implementation("com.google.protobuf:protobuf-kotlin:3.25.2")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
implementation("com.michael-bull.kotlin-retry:kotlin-retry:1.0.9")

// k8s
implementation("io.kubernetes:client-java:18.0.0")
implementation("io.kubernetes:client-java:19.0.0")

testImplementation(kotlin("test"))
testImplementation("org.junit.jupiter:junit-jupiter-params:5.8.2")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.1")
testImplementation("io.strikt:strikt-core:0.34.1")
}

Expand Down Expand Up @@ -71,26 +76,13 @@ tasks.withType<KotlinCompile> {

val dataflowMainClass = "io.seldon.dataflow.Main"

tasks.withType<Jar> {

manifest {
attributes["Main-Class"] = dataflowMainClass
}

from(
configurations.runtimeClasspath
.get()
.map { if (it is Directory) it else zipTree(it) }
) { exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA")}

duplicatesStrategy = DuplicatesStrategy.EXCLUDE

}

application {
mainClass.set(dataflowMainClass)
}

tasks.named<ShadowJar>("shadowJar") {
mergeServiceFiles()
}

downloadLicenses {
includeProjectDependencies = true
Expand Down
Binary file modified scheduler/data-flow/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion scheduler/data-flow/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit ef6e321

Please sign in to comment.