diff --git a/README.md b/README.md index d7dc01a3..c65584f7 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ This example lists pods in `kube-system` namespace: ```scala import skuber._ import skuber.json.format._ - import akka.actor.ActorSystem + import org.apache.pekko.actor.ActorSystem import scala.util.{Success, Failure} implicit val system = ActorSystem() @@ -43,9 +43,11 @@ This example lists pods in `kube-system` namespace: Read the [documentation](https://skuber.co) and join [discord community](https://discord.gg/byEh56vFJR) to ask your questions! -**Note: Since Akka license is no more an "Open Source” license, akka version won't be bumped until there will be an equivalent alternative.** +**Note: Since Akka license is no longer an "Open Source” license, the Skuber project moved on to using [Apache Pekko](https://pekko.apache.org), an open-source Akka fork.** -**Currently, skuber implemented with akka 2.6.19 and the license is open-sourced.** +**To help migration from Akka to Pekko, please refer to Pekko's [migration guides](https://pekko.apache.org/docs/pekko/current/project/migration-guides.html).** + +**Important: please make sure to rename your `akka` configuration keys to `pekko`. This is important when configuring, e.g., the dispatcher for the application.** ## Features diff --git a/build.sbt b/build.sbt index d66a9e2a..5a116530 100644 --- a/build.sbt +++ b/build.sbt @@ -13,19 +13,14 @@ ThisBuild / scalaVersion := currentScalaVersion val supportedScalaVersion = Seq(scala12Version, scala13Version, scala3Version) -/** - * 2.6.19 is the last akka open source version - * To comply with other companies' legal issues, akka version wont be bumped. - * https://www.lightbend.com/blog/why-we-are-changing-the-license-for-akka - */ -val akkaVersion = "2.6.19" +val pekkoVersion = "1.0.1" val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.17.0" val specs2 = "org.specs2" %% "specs2-core" % "4.19.2" val scalaTest = "org.scalatest" %% "scalatest" % "3.2.17" -val akkaStreamTestKit = ("com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion).cross(CrossVersion.for3Use2_13) +val pekkoStreamTestKit = ("org.apache.pekko" %% "pekko-stream-testkit" % pekkoVersion).cross(CrossVersion.for3Use2_13) val snakeYaml = "org.yaml" % "snakeyaml" % "2.0" @@ -35,13 +30,13 @@ val commonsCodec = "commons-codec" % "commons-codec" % "1.15" val bouncyCastle = "org.bouncycastle" % "bcpkix-jdk18on" % "1.76" -// the client API request/response handing uses Akka Http -val akkaHttp = ("com.typesafe.akka" %% "akka-http" % "10.2.9").cross(CrossVersion.for3Use2_13) -val akkaStream = ("com.typesafe.akka" %% "akka-stream" % akkaVersion).cross(CrossVersion.for3Use2_13) -val akka = ("com.typesafe.akka" %% "akka-actor" % akkaVersion).cross(CrossVersion.for3Use2_13) +// the client API request/response handing uses Pkka Http +val pekkoHttp = ("org.apache.pekko" %% "pekko-http" % "1.0.0").cross(CrossVersion.for3Use2_13) +val pekkoStream = ("org.apache.pekko" %% "pekko-stream" % pekkoVersion).cross(CrossVersion.for3Use2_13) +val pekko = ("org.apache.pekko" %% "pekko-actor" % pekkoVersion).cross(CrossVersion.for3Use2_13) -// Skuber uses akka logging, so the examples config uses the akka slf4j logger with logback backend -val akkaSlf4j = ("com.typesafe.akka" %% "akka-slf4j" % akkaVersion).cross(CrossVersion.for3Use2_13) +// Skuber uses pekko logging, so the examples config uses the pekko slf4j logger with logback backend +val pekkoSlf4j = ("org.apache.pekko" %% "pekko-slf4j" % pekkoVersion).cross(CrossVersion.for3Use2_13) val logback = "ch.qos.logback" % "logback-classic" % "1.4.6" % Runtime // the Json formatters are based on Play Json @@ -154,16 +149,16 @@ inThisBuild(List( lazy val skuberSettings = Seq( name := "skuber", libraryDependencies ++= Seq( - akkaHttp, akkaStream, playJson, snakeYaml, commonsIO, commonsCodec, bouncyCastle, + pekkoHttp, pekkoStream, playJson, snakeYaml, commonsIO, commonsCodec, bouncyCastle, awsJavaSdkCore, awsJavaSdkSts, apacheCommonsLogging, jacksonDatabind, - scalaCheck % Test, specs2 % Test, akkaStreamTestKit % Test, + scalaCheck % Test, specs2 % Test, pekkoStreamTestKit % Test, scalaTest % Test ).map(_.exclude("commons-logging", "commons-logging")) ) lazy val examplesSettings = Seq( name := "skuber-examples", - libraryDependencies ++= Seq(akka, akkaSlf4j, logback, playJson) + libraryDependencies ++= Seq(pekko, pekkoSlf4j, logback, playJson) ) // by default run the guestbook example when executing a fat examples JAR diff --git a/client/src/it/scala/skuber/CustomResourceSpec.scala b/client/src/it/scala/skuber/CustomResourceSpec.scala index 32b66c9a..d6ed0c74 100644 --- a/client/src/it/scala/skuber/CustomResourceSpec.scala +++ b/client/src/it/scala/skuber/CustomResourceSpec.scala @@ -1,8 +1,8 @@ package skuber import java.util.UUID.randomUUID -import akka.stream._ -import akka.stream.scaladsl._ +import org.apache.pekko.stream._ +import org.apache.pekko.stream.scaladsl._ import org.scalactic.source.Position import skuber.apiextensions.v1beta1.CustomResourceDefinition import skuber.apiextensions.v1beta1.CustomResourceDefinition._ diff --git a/client/src/it/scala/skuber/CustomResourceV1Spec.scala b/client/src/it/scala/skuber/CustomResourceV1Spec.scala index 07d72e55..d30b6f4a 100644 --- a/client/src/it/scala/skuber/CustomResourceV1Spec.scala +++ b/client/src/it/scala/skuber/CustomResourceV1Spec.scala @@ -1,7 +1,7 @@ package skuber -import akka.stream._ -import akka.stream.scaladsl._ +import org.apache.pekko.stream._ +import org.apache.pekko.stream.scaladsl._ import org.scalatest.BeforeAndAfterAll import skuber.apiextensions.v1.CustomResourceDefinition import org.scalatest.matchers.should.Matchers diff --git a/client/src/it/scala/skuber/ExecSpec.scala b/client/src/it/scala/skuber/ExecSpec.scala index 3b824777..4ef9eb4e 100644 --- a/client/src/it/scala/skuber/ExecSpec.scala +++ b/client/src/it/scala/skuber/ExecSpec.scala @@ -1,8 +1,8 @@ package skuber import java.util.UUID.randomUUID -import akka.Done -import akka.stream.scaladsl.{Sink, Source} +import org.apache.pekko.Done +import org.apache.pekko.stream.scaladsl.{Sink, Source} import org.scalatest.concurrent.{Eventually, ScalaFutures} import org.scalatest.BeforeAndAfterAll import org.scalatest.matchers.should.Matchers diff --git a/client/src/it/scala/skuber/FutureUtil.scala b/client/src/it/scala/skuber/FutureUtil.scala index 36b79d37..896cbf55 100644 --- a/client/src/it/scala/skuber/FutureUtil.scala +++ b/client/src/it/scala/skuber/FutureUtil.scala @@ -1,6 +1,6 @@ package skuber -import akka.actor.{ActorSystem, Scheduler} +import org.apache.pekko.actor.{ActorSystem, Scheduler} import org.scalatest.concurrent.ScalaFutures.convertScalaFuture import scala.concurrent.{ExecutionContext, Future, Promise, TimeoutException} import scala.concurrent.duration._ @@ -13,12 +13,12 @@ object FutureUtil { implicit val patienceConfig: PatienceConfig = PatienceConfig(10.second) - def valueT(implicit executionContext: ExecutionContext, akkaActor: ActorSystem): T = value.withTimeout().futureValue + def valueT(implicit executionContext: ExecutionContext, pekkoActor: ActorSystem): T = value.withTimeout().futureValue def withTimeout(timeout: FiniteDuration = 10.seconds, cleanup: Option[T => Unit] = None) - (implicit executionContext: ExecutionContext, akkaActor: ActorSystem): Future[T] = - futureTimeout(akkaActor.scheduler, timeout, cleanup)(value) + (implicit executionContext: ExecutionContext, pekkoActor: ActorSystem): Future[T] = + futureTimeout(pekkoActor.scheduler, timeout, cleanup)(value) def timeoutException(timeout: FiniteDuration) = new TimeoutException(s"Future timed out after ${timeout.toString()}") with NoStackTrace diff --git a/client/src/it/scala/skuber/K8SFixture.scala b/client/src/it/scala/skuber/K8SFixture.scala index 6fecefe9..6c9fc7b9 100644 --- a/client/src/it/scala/skuber/K8SFixture.scala +++ b/client/src/it/scala/skuber/K8SFixture.scala @@ -1,6 +1,6 @@ package skuber -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import com.typesafe.config.{Config, ConfigFactory} import org.scalatest.Outcome import org.scalatest.flatspec.{AnyFlatSpec, FixtureAnyFlatSpec} diff --git a/client/src/it/scala/skuber/WatchContinuouslySpec.scala b/client/src/it/scala/skuber/WatchContinuouslySpec.scala index df33f22e..b866e04c 100644 --- a/client/src/it/scala/skuber/WatchContinuouslySpec.scala +++ b/client/src/it/scala/skuber/WatchContinuouslySpec.scala @@ -1,8 +1,8 @@ package skuber import java.util.UUID.randomUUID -import akka.stream.KillSwitches -import akka.stream.scaladsl.{Keep, Sink} +import org.apache.pekko.stream.KillSwitches +import org.apache.pekko.stream.scaladsl.{Keep, Sink} import org.scalatest.BeforeAndAfterAll import org.scalatest.matchers.should.Matchers import org.scalatest.concurrent.{Eventually, ScalaFutures} diff --git a/client/src/main/resources/reference.conf b/client/src/main/resources/reference.conf index cedf2ffa..a366effb 100644 --- a/client/src/main/resources/reference.conf +++ b/client/src/main/resources/reference.conf @@ -1,10 +1,10 @@ -akka.http.client.websocket.periodic-keep-alive-max-idle = 10 seconds -akka.http.server.websocket.periodic-keep-alive-max-idle = 10 seconds +pekko.http.client.websocket.periodic-keep-alive-max-idle = 10 seconds +pekko.http.server.websocket.periodic-keep-alive-max-idle = 10 seconds skuber { - akka { - # The ID of the dispatcher to use by Skuber. If undefined or empty the default Akka dispatcher is used. + pekko { + # The ID of the dispatcher to use by Skuber. If undefined or empty the default Pekko dispatcher is used. dispatcher = "" } diff --git a/client/src/main/scala/skuber/api/client/KubernetesClient.scala b/client/src/main/scala/skuber/api/client/KubernetesClient.scala index 3dd0e151..5e151f40 100644 --- a/client/src/main/scala/skuber/api/client/KubernetesClient.scala +++ b/client/src/main/scala/skuber/api/client/KubernetesClient.scala @@ -1,7 +1,7 @@ package skuber.api.client -import akka.stream.scaladsl.{Sink, Source} -import akka.util.ByteString +import org.apache.pekko.stream.scaladsl.{Sink, Source} +import org.apache.pekko.util.ByteString import play.api.libs.json.{Format, Writes} import skuber.api.patch.Patch import skuber.{DeleteOptions, HasStatusSubresource, LabelSelector, ListOptions, ListResource, ObjectResource, Pod, ResourceDefinition, Scale} @@ -198,7 +198,7 @@ trait KubernetesClient { * @param obj the name of the object to watch * @param namespace the namespace (defaults to currently configured namespace) * @tparam O the type of the object to watch e.g. Pod, Deployment - * @return A future containing an Akka streams Source of WatchEvents that will be emitted + * @return A future containing an Pekko streams Source of WatchEvents that will be emitted */ def watch[O <: ObjectResource](obj: O, namespace: Option[String])(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[Source[WatchEvent[O], _]] @@ -217,7 +217,7 @@ trait KubernetesClient { * @param bufSize An optional buffer size for the returned on-the-wire representation of each modified object - normally the default is more than enough. * @param namespace the namespace (defaults to currently configured namespace) * @tparam O the type of the resource to watch - * @return A future containing an Akka streams Source of WatchEvents that will be emitted + * @return A future containing an Pekko streams Source of WatchEvents that will be emitted */ def watch[O <: ObjectResource](name: String, sinceResourceVersion: Option[String] = None, bufSize: Int = 10000, namespace: Option[String] = None)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[Source[WatchEvent[O], _]] @@ -233,7 +233,7 @@ trait KubernetesClient { * @param bufSize optional buffer size for each modified object received, normally the default is more than enough * @param namespace the namespace (defaults to currently configured namespace) * @tparam O the type of resource to watch e.g. Pod, Dpeloyment - * @return A future containing an Akka streams Source of WatchEvents that will be emitted + * @return A future containing an Pekko streams Source of WatchEvents that will be emitted */ def watchAll[O <: ObjectResource](sinceResourceVersion: Option[String] = None, bufSize: Int = 10000, namespace: Option[String] = None)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[Source[WatchEvent[O], _]] @@ -243,7 +243,7 @@ trait KubernetesClient { * @param obj the object resource to watch * @tparam O the type of the resource e.g Pod * @param namespace the namespace (defaults to currently configured namespace) - * @return A future containing an Akka streams Source of WatchEvents that will be emitted + * @return A future containing an Pekko streams Source of WatchEvents that will be emitted */ def watchContinuously[O <: ObjectResource](obj: O, namespace: Option[String])(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Source[WatchEvent[O], _] @@ -263,7 +263,7 @@ trait KubernetesClient { * @param bufSize optional buffer size for received object updates, normally the default is more than enough * @param namespace the namespace (defaults to currently configured namespace) * @tparam O the type of the resource - * @return A future containing an Akka streams Source of WatchEvents that will be emitted + * @return A future containing an Pekko streams Source of WatchEvents that will be emitted */ def watchContinuously[O <: ObjectResource](name: String, sinceResourceVersion: Option[String] = None, bufSize: Int = 10000, namespace: Option[String] = None)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Source[WatchEvent[O], _] @@ -279,7 +279,7 @@ trait KubernetesClient { * @param bufSize optional buffer size for received object updates, normally the default is more than enough * @param namespace the namespace (defaults to currently configured namespace) * @tparam O the type pf the resource - * @return A future containing an Akka streams Source of WatchEvents that will be emitted + * @return A future containing an Pekko streams Source of WatchEvents that will be emitted */ def watchAllContinuously[O <: ObjectResource](sinceResourceVersion: Option[String] = None, bufSize: Int = 10000, namespace: Option[String] = None)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Source[WatchEvent[O], _] @@ -292,7 +292,7 @@ trait KubernetesClient { * @param bufsize optional buffer size for received object updates, normally the default is more than enough * @param namespace the namespace (defaults to currently configured namespace) * @tparam O the resource type to watch - * @return A future containing an Akka streams Source of WatchEvents that will be emitted + * @return A future containing an Pekko streams Source of WatchEvents that will be emitted */ def watchWithOptions[O <: ObjectResource](options: ListOptions, bufsize: Int = 10000, namespace: Option[String] = None)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Source[WatchEvent[O], _] @@ -352,7 +352,7 @@ trait KubernetesClient { def jsonMergePatch[O <: ObjectResource](obj: O, patch: String, namespace: Option[String] = None)(implicit rd: ResourceDefinition[O], fmt: Format[O], lc: LoggingContext): Future[O] /** - * Get the logs from a pod (similar to `kubectl logs ...`). The logs are streamed using an Akka streams source + * Get the logs from a pod (similar to `kubectl logs ...`). The logs are streamed using an Pekko streams source * @param name the name of the pod * @param queryParams optional parameters of the request (for example container name) * @param namespace if set this specifies the namespace of the pod (otherwise the configured namespace is used) @@ -365,9 +365,9 @@ trait KubernetesClient { * @param podName the name of the pod * @param command the command to execute * @param maybeContainerName an optional container name - * @param maybeStdin optional Akka Source for sending input to stdin for the command - * @param maybeStdout optional Akka Sink to receive output from stdout for the command - * @param maybeStderr optional Akka Sink to receive output from stderr for the command + * @param maybeStdin optional Pekko Source for sending input to stdin for the command + * @param maybeStdout optional Pekko Sink to receive output from stdout for the command + * @param maybeStderr optional Pekko Sink to receive output from stderr for the command * @param tty optionally set tty on * @param maybeClose if set, this can be used to close the connection to the pod by completing the promise * @param namespace if set this specifies the namespace of the pod (otherwise the configured namespace is used) diff --git a/client/src/main/scala/skuber/api/client/exec/PodExecImpl.scala b/client/src/main/scala/skuber/api/client/exec/PodExecImpl.scala index 85b750d1..a96e3288 100644 --- a/client/src/main/scala/skuber/api/client/exec/PodExecImpl.scala +++ b/client/src/main/scala/skuber/api/client/exec/PodExecImpl.scala @@ -1,14 +1,14 @@ package skuber.api.client.exec -import akka.actor.ActorSystem -import akka.http.scaladsl.model.headers.RawHeader -import akka.http.scaladsl.model.{HttpHeader, StatusCodes, Uri, ws} -import akka.http.scaladsl.unmarshalling.Unmarshal -import akka.http.scaladsl.{ConnectionContext, Http} -import akka.stream.SinkShape -import akka.stream.scaladsl.{Flow, GraphDSL, Keep, Partition, Sink, Source} -import akka.util.ByteString -import akka.{Done, NotUsed} +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.http.scaladsl.model.headers.RawHeader +import org.apache.pekko.http.scaladsl.model.{HttpHeader, StatusCodes, Uri, ws} +import org.apache.pekko.http.scaladsl.unmarshalling.Unmarshal +import org.apache.pekko.http.scaladsl.{ConnectionContext, Http} +import org.apache.pekko.stream.SinkShape +import org.apache.pekko.stream.scaladsl.{Flow, GraphDSL, Keep, Partition, Sink, Source} +import org.apache.pekko.util.ByteString +import org.apache.pekko.{Done, NotUsed} import play.api.libs.json.JsString import skuber.api.client.impl.KubernetesClientImpl import skuber.api.client.{K8SException, LoggingContext, Status} diff --git a/client/src/main/scala/skuber/api/client/impl/KubernetesClientImpl.scala b/client/src/main/scala/skuber/api/client/impl/KubernetesClientImpl.scala index 3fb4d6f1..58cba691 100644 --- a/client/src/main/scala/skuber/api/client/impl/KubernetesClientImpl.scala +++ b/client/src/main/scala/skuber/api/client/impl/KubernetesClientImpl.scala @@ -1,14 +1,14 @@ package skuber.api.client.impl -import akka.actor.ActorSystem -import akka.event.Logging -import akka.http.scaladsl.marshalling.Marshal -import akka.http.scaladsl.model._ -import akka.http.scaladsl.settings.{ClientConnectionSettings, ConnectionPoolSettings} -import akka.http.scaladsl.unmarshalling.Unmarshal -import akka.http.scaladsl.{ConnectionContext, Http} -import akka.stream.scaladsl.{Sink, Source} -import akka.util.ByteString +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.event.Logging +import org.apache.pekko.http.scaladsl.marshalling.Marshal +import org.apache.pekko.http.scaladsl.model._ +import org.apache.pekko.http.scaladsl.settings.{ClientConnectionSettings, ConnectionPoolSettings} +import org.apache.pekko.http.scaladsl.unmarshalling.Unmarshal +import org.apache.pekko.http.scaladsl.{ConnectionContext, Http} +import org.apache.pekko.stream.scaladsl.{Sink, Source} +import org.apache.pekko.util.ByteString import com.typesafe.config.{Config, ConfigFactory} import play.api.libs.json.{Format, JsString, Reads, Writes} import skuber._ @@ -17,7 +17,7 @@ import skuber.api.client.{K8SException => _, _} import skuber.api.patch._ import skuber.api.security.{HTTPRequestAuth, TLS} import skuber.api.watch.{LongPollingPool, Watch, WatchSource} -import skuber.json.PlayJsonSupportForAkkaHttp._ +import skuber.json.PlayJsonSupportForPekkoHttp._ import skuber.json.format.apiobj.statusReads import skuber.json.format.{apiVersionsFormatReads, deleteOptionsFmt, namespaceListFmt} @@ -32,7 +32,7 @@ import scala.util.{Failure, Success} /** * @author David O'Riordan - * This class implements the KubernetesClient API. It uses the Akka HTTP client to handle the requests to + * This class implements the KubernetesClient API. It uses the Pekko HTTP client to handle the requests to * the Kubernetes API server. */ class KubernetesClientImpl private[client] (val requestMaker: (Uri, HttpMethod) => HttpRequest, // builds the requests to send @@ -45,7 +45,7 @@ class KubernetesClientImpl private[client] (val requestMaker: (Uri, HttpMethod) val defaultPoolSettings: ConnectionPoolSettings, val watchSettings: ConnectionPoolSettings, val podLogSettings: ConnectionPoolSettings, - val sslContext: Option[SSLContext], // provides the Akka client with the SSL details needed for https connections to the API server + val sslContext: Option[SSLContext], // provides the Pekko client with the SSL details needed for https connections to the API server override val logConfig: LoggingConfig, val closeHook: Option[() => Unit])(implicit val actorSystem: ActorSystem, val executionContext: ExecutionContext) extends KubernetesClient @@ -453,7 +453,7 @@ class KubernetesClientImpl private[client] (val requestMaker: (Uri, HttpMethod) // The Watch methods place a Watch on the specified resource on the Kubernetes cluster. - // The methods return Akka streams sources that will reactively emit a stream of updated + // The methods return Pekko streams sources that will reactively emit a stream of updated // values of the watched resources. override def watch[O <: ObjectResource](obj: O, namespace: Option[String])(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[Source[WatchEvent[O], _]] = { @@ -466,7 +466,7 @@ class KubernetesClientImpl private[client] (val requestMaker: (Uri, HttpMethod) } // The Watch methods place a Watch on the specified resource on the Kubernetes cluster. - // The methods return Akka streams sources that will reactively emit a stream of updated + // The methods return Pekko streams sources that will reactively emit a stream of updated // values of the watched resources. override def watch[O <: ObjectResource](name: String, sinceResourceVersion: Option[String] = None, bufSize: Int = 10000, namespace: Option[String] = None)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[Source[WatchEvent[O], _]] = @@ -663,9 +663,9 @@ class KubernetesClientImpl private[client] (val requestMaker: (Uri, HttpMethod) /** * Discards the response - * This is for requests (e.g. delete) for which we normally have no interest in the response body, but Akka Http + * This is for requests (e.g. delete) for which we normally have no interest in the response body, but Pekko Http * requires us to drain it anyway - * (see https://doc.akka.io/docs/akka-http/current/scala/http/implications-of-streaming-http-entity.html) + * (see https://doc.pekko.io/docs/pekko-http/current/scala/http/implications-of-streaming-http-entity.html) * @param response the Http Response that we need to drain * @return A Future[Unit] that will be set to Success or Failure depending on outcome of draining */ @@ -692,7 +692,7 @@ object KubernetesClientImpl { Some(actorSystem.dispatchers.lookup(appConfig.getString(configKey))) } - implicit val dispatcher: ExecutionContext = skuberConfig.getSkuberConfig("akka.dispatcher", dispatcherFromConfig, actorSystem.dispatcher) + implicit val dispatcher: ExecutionContext = skuberConfig.getSkuberConfig("pekko.dispatcher", dispatcherFromConfig, actorSystem.dispatcher) val watchIdleTimeout: Duration = skuberConfig.getDuration("watch.idle-timeout", Duration.Inf) val podLogIdleTimeout: Duration = skuberConfig.getDuration("pod-log.idle-timeout", Duration.Inf) diff --git a/client/src/main/scala/skuber/api/client/package.scala b/client/src/main/scala/skuber/api/client/package.scala index 5f1a1bdc..4c74ff4b 100644 --- a/client/src/main/scala/skuber/api/client/package.scala +++ b/client/src/main/scala/skuber/api/client/package.scala @@ -2,11 +2,11 @@ package skuber.api import java.time.Instant import java.util.UUID -import akka.NotUsed -import akka.actor.ActorSystem -import akka.http.scaladsl.model.{HttpCharsets, HttpRequest, HttpResponse, MediaType} -import akka.http.scaladsl.settings.ConnectionPoolSettings -import akka.stream.scaladsl.Flow +import org.apache.pekko.NotUsed +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.http.scaladsl.model.{HttpCharsets, HttpRequest, HttpResponse, MediaType} +import org.apache.pekko.http.scaladsl.settings.ConnectionPoolSettings +import org.apache.pekko.stream.scaladsl.Flow import com.typesafe.config.{Config, ConfigFactory} import org.joda.time.DateTime import play.api.libs.functional.syntax._ diff --git a/client/src/main/scala/skuber/api/dynamic/client/impl/DynamicKubernetesClientImpl.scala b/client/src/main/scala/skuber/api/dynamic/client/impl/DynamicKubernetesClientImpl.scala index 0e51f780..1554a875 100644 --- a/client/src/main/scala/skuber/api/dynamic/client/impl/DynamicKubernetesClientImpl.scala +++ b/client/src/main/scala/skuber/api/dynamic/client/impl/DynamicKubernetesClientImpl.scala @@ -1,29 +1,29 @@ package skuber.api.dynamic.client.impl -import akka.actor.ActorSystem -import akka.event.Logging -import akka.http.scaladsl.marshalling.{Marshal, Marshaller, ToEntityMarshaller} -import akka.http.scaladsl.model._ -import akka.http.scaladsl.settings.ConnectionPoolSettings -import akka.http.scaladsl.unmarshalling.{Unmarshal, Unmarshaller} -import akka.http.scaladsl.{ConnectionContext, Http, HttpsConnectionContext} +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.event.Logging +import org.apache.pekko.http.scaladsl.marshalling.{Marshal, Marshaller, ToEntityMarshaller} +import org.apache.pekko.http.scaladsl.model._ +import org.apache.pekko.http.scaladsl.settings.ConnectionPoolSettings +import org.apache.pekko.http.scaladsl.unmarshalling.{Unmarshal, Unmarshaller} +import org.apache.pekko.http.scaladsl.{ConnectionContext, Http, HttpsConnectionContext} import play.api.libs.json.{JsString, JsValue} import skuber.{DeleteOptions, ListOptions} import skuber.api.client._ import skuber.api.security.{HTTPRequestAuth, TLS} -import skuber.json.PlayJsonSupportForAkkaHttp._ +import skuber.json.PlayJsonSupportForPekkoHttp._ import skuber.json.format.apiobj.statusReads import scala.concurrent.{ExecutionContext, Future} import scala.util.{Failure, Success} import skuber.json.format.deleteOptionsFmt import DynamicKubernetesClientImpl.jsValueToRequestEntityMarshaller -import akka.util.ByteString +import org.apache.pekko.util.ByteString /** * This is non-typed kubernetes client, for typed client see [[skuber.api.client.impl.KubernetesClientImpl]] * This class provides a dynamic client for the Kubernetes API server. * It is intended to be used for accessing resources / classes that are not part of the skuber library. * - * It uses the Akka HTTP client to handle the requests to + * It uses the Pekko HTTP client to handle the requests to * the Kubernetes API server. */ class DynamicKubernetesClientImpl(context: Context = Context(), @@ -318,9 +318,9 @@ class DynamicKubernetesClientImpl(context: Context = Context(), /** * Discards the response - * This is for requests (e.g. delete) for which we normally have no interest in the response body, but Akka Http + * This is for requests (e.g. delete) for which we normally have no interest in the response body, but Pekko Http * requires us to drain it anyway - * (see https://doc.akka.io/docs/akka-http/current/scala/http/implications-of-streaming-http-entity.html) + * (see https://doc.pekko.io/docs/pekko-http/current/scala/http/implications-of-streaming-http-entity.html) * * @param response the Http Response that we need to drain * @return A Future[Unit] that will be set to Success or Failure depending on outcome of draining diff --git a/client/src/main/scala/skuber/api/patch.scala b/client/src/main/scala/skuber/api/patch.scala index 7ab15216..5c69e787 100644 --- a/client/src/main/scala/skuber/api/patch.scala +++ b/client/src/main/scala/skuber/api/patch.scala @@ -1,6 +1,6 @@ package skuber.api -import akka.http.scaladsl.model.{HttpCharsets, MediaType} +import org.apache.pekko.http.scaladsl.model.{HttpCharsets, MediaType} import play.api.libs.json.Writes package object patch { diff --git a/client/src/main/scala/skuber/api/security/HTTPRequestAuth.scala b/client/src/main/scala/skuber/api/security/HTTPRequestAuth.scala index f0a1ec71..808eea8d 100644 --- a/client/src/main/scala/skuber/api/security/HTTPRequestAuth.scala +++ b/client/src/main/scala/skuber/api/security/HTTPRequestAuth.scala @@ -1,7 +1,7 @@ package skuber.api.security -import akka.http.scaladsl.model.{HttpHeader, HttpRequest} -import akka.http.scaladsl.model.headers.{Authorization, BasicHttpCredentials, OAuth2BearerToken} +import org.apache.pekko.http.scaladsl.model.{HttpHeader, HttpRequest} +import org.apache.pekko.http.scaladsl.model.headers.{Authorization, BasicHttpCredentials, OAuth2BearerToken} import skuber.api.client._ /** diff --git a/client/src/main/scala/skuber/api/watch/BytesToWatchEventSource.scala b/client/src/main/scala/skuber/api/watch/BytesToWatchEventSource.scala index ced6116e..a28e9763 100644 --- a/client/src/main/scala/skuber/api/watch/BytesToWatchEventSource.scala +++ b/client/src/main/scala/skuber/api/watch/BytesToWatchEventSource.scala @@ -1,7 +1,7 @@ package skuber.api.watch -import akka.stream.scaladsl.{JsonFraming, Source} -import akka.util.ByteString +import org.apache.pekko.stream.scaladsl.{JsonFraming, Source} +import org.apache.pekko.util.ByteString import play.api.libs.json.{Format, JsError, JsString, JsSuccess, Json} import skuber.ObjectResource import skuber.api.client.{K8SException, Status, WatchEvent} diff --git a/client/src/main/scala/skuber/api/watch/LongPollingPool.scala b/client/src/main/scala/skuber/api/watch/LongPollingPool.scala index 52916b2d..40ca07df 100644 --- a/client/src/main/scala/skuber/api/watch/LongPollingPool.scala +++ b/client/src/main/scala/skuber/api/watch/LongPollingPool.scala @@ -1,10 +1,10 @@ package skuber.api.watch -import akka.NotUsed -import akka.actor.ActorSystem -import akka.http.scaladsl.settings.{ClientConnectionSettings, ConnectionPoolSettings} -import akka.http.scaladsl.{Http, HttpsConnectionContext} -import akka.stream.Materializer +import org.apache.pekko.NotUsed +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.http.scaladsl.settings.{ClientConnectionSettings, ConnectionPoolSettings} +import org.apache.pekko.http.scaladsl.{Http, HttpsConnectionContext} +import org.apache.pekko.stream.Materializer import skuber.api.client.Pool import scala.concurrent.duration._ diff --git a/client/src/main/scala/skuber/api/watch/Watch.scala b/client/src/main/scala/skuber/api/watch/Watch.scala index 3bc1e778..f1e0b0a0 100644 --- a/client/src/main/scala/skuber/api/watch/Watch.scala +++ b/client/src/main/scala/skuber/api/watch/Watch.scala @@ -1,7 +1,7 @@ package skuber.api.watch -import akka.http.scaladsl.model.{HttpMethods, _} -import akka.stream.scaladsl.Source +import org.apache.pekko.http.scaladsl.model.{HttpMethods, _} +import org.apache.pekko.stream.scaladsl.Source import play.api.libs.json.Format import skuber.api.client._ import skuber.api.client.impl.KubernetesClientImpl @@ -13,7 +13,7 @@ import scala.language.postfixOps /** * @author David O'Riordan * Handling of the Json event objects streamed in response to a Kubernetes API watch request - * Based on Akka streaming + * Based on Pekko streaming */ object Watch { diff --git a/client/src/main/scala/skuber/api/watch/WatchSource.scala b/client/src/main/scala/skuber/api/watch/WatchSource.scala index 0d134d8d..1dd53eea 100644 --- a/client/src/main/scala/skuber/api/watch/WatchSource.scala +++ b/client/src/main/scala/skuber/api/watch/WatchSource.scala @@ -1,10 +1,10 @@ package skuber.api.watch -import akka.NotUsed -import akka.actor.ActorSystem -import akka.http.scaladsl.model._ -import akka.stream.scaladsl.{Broadcast, Flow, GraphDSL, Merge, Source} -import akka.stream.SourceShape +import org.apache.pekko.NotUsed +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.http.scaladsl.model._ +import org.apache.pekko.stream.scaladsl.{Broadcast, Flow, GraphDSL, Merge, Source} +import org.apache.pekko.stream.SourceShape import play.api.libs.json.{Format, JsString} import skuber.api.client._ import skuber.api.client.impl.KubernetesClientImpl diff --git a/client/src/main/scala/skuber/ext/package.scala b/client/src/main/scala/skuber/ext/package.scala index 1f20a374..97c067e1 100644 --- a/client/src/main/scala/skuber/ext/package.scala +++ b/client/src/main/scala/skuber/ext/package.scala @@ -12,14 +12,14 @@ package skuber * @author David O'Riordan */ -import akka.http.scaladsl.marshalling.Marshal +import org.apache.pekko.http.scaladsl.marshalling.Marshal import scala.language.implicitConversions import scala.concurrent.Future import skuber.json.ext.format._ import skuber.api.client._ -import akka.http.scaladsl.model._ -import skuber.json.PlayJsonSupportForAkkaHttp._ +import org.apache.pekko.http.scaladsl.model._ +import skuber.json.PlayJsonSupportForPekkoHttp._ import skuber.networking.Ingress package object ext { diff --git a/client/src/main/scala/skuber/json/PlayJsonSupportForAkkaHttp.scala b/client/src/main/scala/skuber/json/PlayJsonSupportForPekkoHttp.scala similarity index 76% rename from client/src/main/scala/skuber/json/PlayJsonSupportForAkkaHttp.scala rename to client/src/main/scala/skuber/json/PlayJsonSupportForPekkoHttp.scala index e632ed30..f8523004 100644 --- a/client/src/main/scala/skuber/json/PlayJsonSupportForAkkaHttp.scala +++ b/client/src/main/scala/skuber/json/PlayJsonSupportForPekkoHttp.scala @@ -1,9 +1,9 @@ package skuber.json /* - * Support for using Play Json formatters with Akka HTTP client + * Support for using Play Json formatters with Pekko HTTP client * This class is basically a copy of: - * https://github.com/hseeberger/akka-http-json/blob/master/akka-http-play-json/src/main/scala/de/heikoseeberger/akkahttpplayjson/PlayJsonSupport.scala + * https://github.com/hseeberger/pekko-http-json/blob/master/pekko-http-play-json/src/main/scala/de/heikoseeberger/pekkohttpplayjson/PlayJsonSupport.scala * ... but with some logging added to support skuber supportability requirements */ @@ -23,19 +23,19 @@ package skuber.json * limitations under the License. */ -import akka.http.scaladsl.marshalling.{ Marshaller, ToEntityMarshaller } -import akka.http.scaladsl.model.ContentTypeRange -import akka.http.scaladsl.model.MediaTypes.`application/json` -import akka.http.scaladsl.server.{ RejectionError, ValidationRejection } -import akka.http.scaladsl.unmarshalling.{ FromEntityUnmarshaller, Unmarshaller } -import akka.util.ByteString +import org.apache.pekko.http.scaladsl.marshalling.{ Marshaller, ToEntityMarshaller } +import org.apache.pekko.http.scaladsl.model.ContentTypeRange +import org.apache.pekko.http.scaladsl.model.MediaTypes.`application/json` +import org.apache.pekko.http.scaladsl.server.{ RejectionError, ValidationRejection } +import org.apache.pekko.http.scaladsl.unmarshalling.{ FromEntityUnmarshaller, Unmarshaller } +import org.apache.pekko.util.ByteString import play.api.libs.json.{ JsError, JsValue, Json, Reads, Writes } import scala.collection.immutable.Seq /** * Automatic to and from JSON marshalling/unmarshalling using an in-scope *play-json* protocol. */ -object PlayJsonSupportForAkkaHttp extends PlayJsonSupportForAkkaHttp { +object PlayJsonSupportForPekkoHttp extends PlayJsonSupportForPekkoHttp { final case class PlayJsonError(error: JsError) extends RuntimeException { override def getMessage: String = @@ -47,8 +47,8 @@ object PlayJsonSupportForAkkaHttp extends PlayJsonSupportForAkkaHttp { /** * Automatic to and from JSON marshalling/unmarshalling using an in-scope *play-json* protocol. */ -trait PlayJsonSupportForAkkaHttp { - import PlayJsonSupportForAkkaHttp._ +trait PlayJsonSupportForPekkoHttp { + import PlayJsonSupportForPekkoHttp._ def unmarshallerContentTypes: Seq[ContentTypeRange] = List(`application/json`) @@ -91,4 +91,4 @@ trait PlayJsonSupportForAkkaHttp { implicit def marshaller[A](implicit writes: Writes[A], printer: JsValue => String = Json.prettyPrint): ToEntityMarshaller[A] = jsonStringMarshaller.compose(printer).compose(writes.writes) -} \ No newline at end of file +} diff --git a/client/src/main/scala/skuber/package.scala b/client/src/main/scala/skuber/package.scala index 999fa5e5..111a246d 100644 --- a/client/src/main/scala/skuber/package.scala +++ b/client/src/main/scala/skuber/package.scala @@ -283,8 +283,8 @@ package object skuber { // Initialisation of the Skuber Kubernetes client - import akka.actor.ActorSystem - import akka.stream.Materializer + import org.apache.pekko.actor.ActorSystem + import org.apache.pekko.stream.Materializer import com.typesafe.config.Config /** diff --git a/client/src/test/scala/skuber/api/BytesToWatchEventSourceSpec.scala b/client/src/test/scala/skuber/api/BytesToWatchEventSourceSpec.scala index 6d05e235..0e1f175c 100644 --- a/client/src/test/scala/skuber/api/BytesToWatchEventSourceSpec.scala +++ b/client/src/test/scala/skuber/api/BytesToWatchEventSourceSpec.scala @@ -4,9 +4,9 @@ import client._ import skuber.json.format._ import skuber.ReplicationController import org.specs2.mutable.Specification -import akka.util.ByteString -import akka.stream.scaladsl.{Sink, Source} -import akka.actor.ActorSystem +import org.apache.pekko.util.ByteString +import org.apache.pekko.stream.scaladsl.{Sink, Source} +import org.apache.pekko.actor.ActorSystem import skuber.api.watch.BytesToWatchEventSource import scala.concurrent.{Await, ExecutionContext, Future} @@ -115,4 +115,4 @@ class BytesToWatchEventSourceSpec extends Specification { rcSeq(2)._object.status.get.replicas mustEqual 1 rcSeq(3)._object.status.get.replicas mustEqual 0 } -} \ No newline at end of file +} diff --git a/client/src/test/scala/skuber/api/ConfigurationSpec.scala b/client/src/test/scala/skuber/api/ConfigurationSpec.scala index 6ada4bf5..9e9dc499 100644 --- a/client/src/test/scala/skuber/api/ConfigurationSpec.scala +++ b/client/src/test/scala/skuber/api/ConfigurationSpec.scala @@ -6,7 +6,7 @@ import java.nio.file.Paths import java.time.format.DateTimeFormatter import java.time.{Instant, ZoneId} -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import com.typesafe.config.ConfigFactory import scala.util.Try @@ -240,4 +240,4 @@ users: clientCertificate mustEqual Left("/top/level/path/path/to/my/client/cert") } -} \ No newline at end of file +} diff --git a/client/src/test/scala/skuber/api/LongPollingPoolSpec.scala b/client/src/test/scala/skuber/api/LongPollingPoolSpec.scala index 4cace4fe..bf331a8f 100644 --- a/client/src/test/scala/skuber/api/LongPollingPoolSpec.scala +++ b/client/src/test/scala/skuber/api/LongPollingPoolSpec.scala @@ -3,14 +3,14 @@ package skuber.api import java.io.InputStream import java.security.{KeyStore, SecureRandom} -import akka.Done -import akka.actor.ActorSystem -import akka.http.scaladsl.{ConnectionContext, Http, HttpsConnectionContext} -import akka.http.scaladsl.model._ -import akka.http.scaladsl.server.Directives._ -import akka.http.scaladsl.server.Route -import akka.http.scaladsl.settings.ClientConnectionSettings -import akka.stream.scaladsl.{Sink, Source} +import org.apache.pekko.Done +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.http.scaladsl.{ConnectionContext, Http, HttpsConnectionContext} +import org.apache.pekko.http.scaladsl.model._ +import org.apache.pekko.http.scaladsl.server.Directives._ +import org.apache.pekko.http.scaladsl.server.Route +import org.apache.pekko.http.scaladsl.settings.ClientConnectionSettings +import org.apache.pekko.stream.scaladsl.{Sink, Source} import javax.net.ssl.{KeyManagerFactory, SSLContext, TrustManagerFactory} import org.scalatest.concurrent.ScalaFutures diff --git a/docs/README.md b/docs/README.md index cd57c86c..a2ee7dd3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -43,7 +43,7 @@ This example lists pods in `kube-system` namespace: ```scala import skuber._ import skuber.json.format._ -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import scala.util.{Success, Failure} implicit val system = ActorSystem() @@ -85,7 +85,7 @@ Set the env variables with cluster details. ```scala import skuber.api.client.{Cluster, Context, KubernetesClient} import java.util.Base64 -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem val namespace = System.getenv("namespace") val serverUrl = System.getenv("serverUrl") @@ -208,7 +208,7 @@ For client authentication **client certificates** (cert and private key pairs) c import skuber._ import skuber.json.format._ -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem implicit val system = ActorSystem() implicit val dispatcher = system.dispatcher @@ -359,7 +359,7 @@ val stsFut = k8s.jsonMergePatch(myStatefulSet, patchStr) See also the `PatchExamples` example. Note: There is no patch support yet for the other two (`json patch` and `strategic merge patch`) [strategies](https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#patch-operations) ### Logs -Get the logs of a pod (as an Akka Streams Source): +Get the logs of a pod (as an Pekko Streams Source): ```scala val helloWorldLogsSource: Future[Source[ByteString, _]] = k8s.getPodLogSource("hello-world-pod", Pod.LogQueryParams()) @@ -390,15 +390,15 @@ val allPodsMapFut: Future[Map[String, PodList]] = k8s listByNamespace[PodList]() ### Watch API -Kubernetes supports the ability for API clients to watch events on specified resources - as changes occur to the resource(s) on the cluster, Kubernetes sends details of the updates to the watching client. Skuber v2 now uses Akka streams for this (instead of Play iteratees as used in the Skuber v1.x releases), so the `watch[O]` API calls return `Future[Source[O]]` objects which can then be plugged into Akka flows. +Kubernetes supports the ability for API clients to watch events on specified resources - as changes occur to the resource(s) on the cluster, Kubernetes sends details of the updates to the watching client. Skuber v2 now uses Pekko streams for this (instead of Play iteratees as used in the Skuber v1.x releases), so the `watch[O]` API calls return `Future[Source[O]]` objects which can then be plugged into Pekko flows. ```scala import skuber._ import skuber.json.format._ import skuber.apps.v1.Deployment -import akka.actor.ActorSystem -import akka.stream.scaladsl.Sink +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.stream.scaladsl.Sink object WatchExamples { implicit val system = ActorSystem() @@ -417,7 +417,7 @@ object WatchExamples { } ``` -The above example creates a Watch on the frontend deployment, and feeds the resulting events into an Akka sink that simply prints out the replica count from the current version of the deployment as included in each event. To test the above code, call the watchFrontendScaling method to create the watch and then separately run a number of [kubectl scale](https://kubernetes.io/docs/tutorials/kubernetes-basics/scale-interactive/) commands to set different replica counts on the frontend - for example: +The above example creates a Watch on the frontend deployment, and feeds the resulting events into an Pekko sink that simply prints out the replica count from the current version of the deployment as included in each event. To test the above code, call the watchFrontendScaling method to create the watch and then separately run a number of [kubectl scale](https://kubernetes.io/docs/tutorials/kubernetes-basics/scale-interactive/) commands to set different replica counts on the frontend - for example: ```bash kubectl scale --replicas=1 deployment/frontend kubectl scale --replicas=10 deployment/frontend @@ -579,7 +579,7 @@ Code example for using Dynamic Kubernetes Client `DynamicKubernetesClientImpl` ```scala import java.util.UUID.randomUUID -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import play.api.libs.json.Json import skuber.api.dynamic.client.impl.{DynamicKubernetesClientImpl, JsonRaw} import scala.concurrent.duration._ @@ -669,7 +669,7 @@ Using [EventBus](https://github.com/argoproj-labs/argo-eventbus) from argocd for package skuber.examples.argo import java.util.UUID.randomUUID -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import play.api.libs.functional.syntax.unlift import play.api.libs.json.{Format, JsPath, Json} import skuber.ResourceSpecification.{Names, Scope} diff --git a/examples/application.conf b/examples/application.conf index 78f32e3b..9e2c9f5b 100644 --- a/examples/application.conf +++ b/examples/application.conf @@ -1,7 +1,7 @@ -akka { - loggers = ["akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.slf4j"] loglevel = "OFF" - logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + logging-filter = "org.apache.pekko.event.Slf4jLoggingFilter" actor { debug { # receive = on diff --git a/examples/logback.xml b/examples/logback.xml index 1dd8dd05..b1ee0335 100644 --- a/examples/logback.xml +++ b/examples/logback.xml @@ -8,7 +8,7 @@ - + diff --git a/examples/src/main/resources/application.conf b/examples/src/main/resources/application.conf index 0ffef259..22d236d1 100644 --- a/examples/src/main/resources/application.conf +++ b/examples/src/main/resources/application.conf @@ -1,8 +1,8 @@ -akka { - loggers = ["akka.event.slf4j.Slf4jLogger"] +pekko { + loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"] stdout-loglevel = "OFF" loglevel = "OFF" - logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + logging-filter = "org.apache.pekko.event.slf4j.Slf4jLoggingFilter" actor { debug { # receive = on diff --git a/examples/src/main/resources/logback.xml b/examples/src/main/resources/logback.xml index 0db42e39..9a62fc97 100644 --- a/examples/src/main/resources/logback.xml +++ b/examples/src/main/resources/logback.xml @@ -8,7 +8,7 @@ - + diff --git a/examples/src/main/scala/skuber/examples/argo/EventBusExample.scala b/examples/src/main/scala/skuber/examples/argo/EventBusExample.scala index 0be1e7df..4536860d 100644 --- a/examples/src/main/scala/skuber/examples/argo/EventBusExample.scala +++ b/examples/src/main/scala/skuber/examples/argo/EventBusExample.scala @@ -1,7 +1,7 @@ package skuber.examples.argo import java.util.UUID.randomUUID -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import play.api.libs.functional.syntax.unlift import play.api.libs.json.{Format, JsPath, Json} import skuber.ResourceSpecification.{Names, Scope} @@ -82,4 +82,4 @@ object EventBus { implicit val eventBusListFmt: Format[EventBusSetList] = ListResourceFormat[EventBus] -} \ No newline at end of file +} diff --git a/examples/src/main/scala/skuber/examples/auth/AwsAuthExample.scala b/examples/src/main/scala/skuber/examples/auth/AwsAuthExample.scala index d92e337b..b5ad5f87 100644 --- a/examples/src/main/scala/skuber/examples/auth/AwsAuthExample.scala +++ b/examples/src/main/scala/skuber/examples/auth/AwsAuthExample.scala @@ -1,7 +1,7 @@ package skuber.examples.auth import java.util.Base64 -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import com.amazonaws.regions.Regions import org.joda.time.DateTime import skuber.api.Configuration diff --git a/examples/src/main/scala/skuber/examples/auth/InClusterConfigurationExample.scala b/examples/src/main/scala/skuber/examples/auth/InClusterConfigurationExample.scala index 955f527b..ebca20c2 100644 --- a/examples/src/main/scala/skuber/examples/auth/InClusterConfigurationExample.scala +++ b/examples/src/main/scala/skuber/examples/auth/InClusterConfigurationExample.scala @@ -1,6 +1,6 @@ package skuber.examples.auth -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import org.joda.time.DateTime import skuber.api.Configuration import skuber.api.client.KubernetesClient diff --git a/examples/src/main/scala/skuber/examples/customresources/v1/CreateCRD.scala b/examples/src/main/scala/skuber/examples/customresources/v1/CreateCRD.scala index b7220be3..c51ff932 100644 --- a/examples/src/main/scala/skuber/examples/customresources/v1/CreateCRD.scala +++ b/examples/src/main/scala/skuber/examples/customresources/v1/CreateCRD.scala @@ -1,6 +1,6 @@ package skuber.examples.customresources.v1 -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import play.api.libs.json.{JsObject, Json} import skuber.ResourceSpecification.{Schema, Scope} import skuber.apiextensions.v1.CustomResourceDefinition diff --git a/examples/src/main/scala/skuber/examples/customresources/v1beta1/CreateCRD.scala b/examples/src/main/scala/skuber/examples/customresources/v1beta1/CreateCRD.scala index 26c55287..97ae07c2 100644 --- a/examples/src/main/scala/skuber/examples/customresources/v1beta1/CreateCRD.scala +++ b/examples/src/main/scala/skuber/examples/customresources/v1beta1/CreateCRD.scala @@ -3,7 +3,7 @@ package skuber.examples.customresources.v1beta1 import skuber.{K8SException, k8sInit} import skuber.ResourceSpecification.Scope import skuber.apiextensions.v1beta1.CustomResourceDefinition -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import scala.concurrent.ExecutionContextExecutor import scala.util.{Failure, Success} @@ -69,4 +69,4 @@ object CreateCRD extends App { } } } -} \ No newline at end of file +} diff --git a/examples/src/main/scala/skuber/examples/deployment/DeploymentExamples.scala b/examples/src/main/scala/skuber/examples/deployment/DeploymentExamples.scala index 4b7e5a5d..6a73a308 100644 --- a/examples/src/main/scala/skuber/examples/deployment/DeploymentExamples.scala +++ b/examples/src/main/scala/skuber/examples/deployment/DeploymentExamples.scala @@ -3,7 +3,7 @@ package skuber.examples.deployment import skuber._ import skuber.ext.Deployment import skuber.json.ext.format._ -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import scala.concurrent.{Await, ExecutionContextExecutor, Future} import scala.concurrent.duration._ diff --git a/examples/src/main/scala/skuber/examples/dynamicClient/DynamicKubernetesClientImplExample.scala b/examples/src/main/scala/skuber/examples/dynamicClient/DynamicKubernetesClientImplExample.scala index f970ced2..31851d3c 100644 --- a/examples/src/main/scala/skuber/examples/dynamicClient/DynamicKubernetesClientImplExample.scala +++ b/examples/src/main/scala/skuber/examples/dynamicClient/DynamicKubernetesClientImplExample.scala @@ -1,7 +1,7 @@ package skuber.examples.dynamicClient import java.util.UUID.randomUUID -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import play.api.libs.json.Json import skuber.api.dynamic.client.impl.{DynamicKubernetesClientImpl, JsonRaw} import scala.concurrent.duration._ diff --git a/examples/src/main/scala/skuber/examples/exec/ExecExamples.scala b/examples/src/main/scala/skuber/examples/exec/ExecExamples.scala index ab631dcb..dbb9fd4a 100644 --- a/examples/src/main/scala/skuber/examples/exec/ExecExamples.scala +++ b/examples/src/main/scala/skuber/examples/exec/ExecExamples.scala @@ -1,8 +1,8 @@ package skuber.examples.exec -import akka.{Done, NotUsed} -import akka.actor.ActorSystem -import akka.stream.scaladsl.{Sink, Source} +import org.apache.pekko.{Done, NotUsed} +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.stream.scaladsl.{Sink, Source} import skuber._ import scala.concurrent.{Await, ExecutionContextExecutor, Future, Promise} import scala.concurrent.duration.Duration.Inf diff --git a/examples/src/main/scala/skuber/examples/fluent/FluentExamples.scala b/examples/src/main/scala/skuber/examples/fluent/FluentExamples.scala index ae1fd0b1..5b28ef87 100644 --- a/examples/src/main/scala/skuber/examples/fluent/FluentExamples.scala +++ b/examples/src/main/scala/skuber/examples/fluent/FluentExamples.scala @@ -3,7 +3,7 @@ package skuber.examples.fluent import skuber._ import skuber.json.format._ import scala.concurrent.{ExecutionContextExecutor, Future} -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem /** * @author David O'Riordan @@ -317,4 +317,4 @@ object FluentExamples extends App { } } } -} \ No newline at end of file +} diff --git a/examples/src/main/scala/skuber/examples/guestbook/Guestbook.scala b/examples/src/main/scala/skuber/examples/guestbook/Guestbook.scala index de3d4120..1c9c3db2 100644 --- a/examples/src/main/scala/skuber/examples/guestbook/Guestbook.scala +++ b/examples/src/main/scala/skuber/examples/guestbook/Guestbook.scala @@ -1,8 +1,8 @@ package skuber.examples.guestbook -import akka.actor._ -import akka.pattern.ask -import akka.util.Timeout +import org.apache.pekko.actor._ +import org.apache.pekko.pattern.ask +import org.apache.pekko.util.Timeout import scala.concurrent.duration._ import scala.concurrent.Await import scala.concurrent.ExecutionContext.Implicits.global diff --git a/examples/src/main/scala/skuber/examples/guestbook/GuestbookActor.scala b/examples/src/main/scala/skuber/examples/guestbook/GuestbookActor.scala index 78924195..810da7a4 100644 --- a/examples/src/main/scala/skuber/examples/guestbook/GuestbookActor.scala +++ b/examples/src/main/scala/skuber/examples/guestbook/GuestbookActor.scala @@ -5,11 +5,11 @@ import scala.concurrent.duration._ import scala.concurrent.ExecutionContext.Implicits._ import scala.util.{Try, Success,Failure} -import akka.actor.{Actor, ActorRef, ActorLogging} -import akka.actor.Props -import akka.event.{LoggingReceive} -import akka.pattern.ask -import akka.util.Timeout +import org.apache.pekko.actor.{Actor, ActorRef, ActorLogging} +import org.apache.pekko.actor.Props +import org.apache.pekko.event.{LoggingReceive} +import org.apache.pekko.pattern.ask +import org.apache.pekko.util.Timeout import model.GuestbookServiceSpecification diff --git a/examples/src/main/scala/skuber/examples/guestbook/KubernetesProxyActor.scala b/examples/src/main/scala/skuber/examples/guestbook/KubernetesProxyActor.scala index 78a94b4b..491abee1 100644 --- a/examples/src/main/scala/skuber/examples/guestbook/KubernetesProxyActor.scala +++ b/examples/src/main/scala/skuber/examples/guestbook/KubernetesProxyActor.scala @@ -2,12 +2,12 @@ package skuber.examples.guestbook import skuber._ import skuber.json.format._ -import akka.actor.{Actor, ActorLogging, ActorRef} -import akka.actor.Props -import akka.event.LoggingReceive -import akka.pattern.pipe -import akka.actor.ActorSystem -import akka.stream.scaladsl.{Sink, Source} +import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef} +import org.apache.pekko.actor.Props +import org.apache.pekko.event.LoggingReceive +import org.apache.pekko.pattern.pipe +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.stream.scaladsl.{Sink, Source} import scala.concurrent.{ExecutionContextExecutor, Future} import scala.util.{Failure, Success} import scala.collection._ @@ -131,4 +131,4 @@ class KubernetesProxyActor extends Actor with ActorLogging { } } -case class Watching(watch: Future[Source[K8SWatchEvent[ReplicationController], _]], watchers: Set[ActorRef]) \ No newline at end of file +case class Watching(watch: Future[Source[K8SWatchEvent[ReplicationController], _]], watchers: Set[ActorRef]) diff --git a/examples/src/main/scala/skuber/examples/guestbook/README.md b/examples/src/main/scala/skuber/examples/guestbook/README.md index 229c53a5..6e919ccf 100644 --- a/examples/src/main/scala/skuber/examples/guestbook/README.md +++ b/examples/src/main/scala/skuber/examples/guestbook/README.md @@ -110,7 +110,7 @@ You can verify the Guestbook application is available by navigating to a service ## Design -The design of the reactive guestbook example is based on the [actor model](https://en.wikipedia.org/wiki/Actor_model) and uses [Akka](http://doc.akka.io/docs/akka/2.4.1/intro/what-is-akka.html). Note that Skuber itself has no dependency on Akka - an actor model was chosen for this example simply because it seemed an appropriate abstraction, especially due to the asynchronous and reactive nature of the processing. The actors in this example run purely locally. +The design of the reactive guestbook example is based on the [actor model](https://en.wikipedia.org/wiki/Actor_model) and uses [Pekko](https://pekko.apache.org/what-is-pekko.htmll). Note that Skuber itself has no dependency on Pekko - an actor model was chosen for this example simply because it seemed an appropriate abstraction, especially due to the asynchronous and reactive nature of the processing. The actors in this example run purely locally. There are four actors involved in the example: diff --git a/examples/src/main/scala/skuber/examples/guestbook/ScalerActor.scala b/examples/src/main/scala/skuber/examples/guestbook/ScalerActor.scala index be6aaf9c..7c5a8ede 100644 --- a/examples/src/main/scala/skuber/examples/guestbook/ScalerActor.scala +++ b/examples/src/main/scala/skuber/examples/guestbook/ScalerActor.scala @@ -2,17 +2,17 @@ package skuber.examples.guestbook import skuber.ReplicationController -import akka.actor.{Actor, ActorRef, ActorLogging} -import akka.actor.Props -import akka.event.{LoggingReceive} -import akka.util.Timeout -import akka.pattern.ask -import akka.actor.Status.Failure +import org.apache.pekko.actor.{Actor, ActorRef, ActorLogging} +import org.apache.pekko.actor.Props +import org.apache.pekko.event.{LoggingReceive} +import org.apache.pekko.util.Timeout +import org.apache.pekko.pattern.ask +import org.apache.pekko.actor.Status.Failure import scala.concurrent.duration._ import scala.concurrent.ExecutionContext.Implicits._ -import akka.actor.Status.Failure +import org.apache.pekko.actor.Status.Failure /** * The scaler actor is responsible for scaling a replica count up/down for a Guestbook service @@ -139,4 +139,4 @@ class ScalerActor(kubernetes: ActorRef, controllerName: String, targetReplicaCou watching = None context.become(completed) } -} \ No newline at end of file +} diff --git a/examples/src/main/scala/skuber/examples/guestbook/ServiceActor.scala b/examples/src/main/scala/skuber/examples/guestbook/ServiceActor.scala index 50ad53b1..50f74fac 100644 --- a/examples/src/main/scala/skuber/examples/guestbook/ServiceActor.scala +++ b/examples/src/main/scala/skuber/examples/guestbook/ServiceActor.scala @@ -1,9 +1,10 @@ package skuber.examples.guestbook -import akka.actor.{Actor, ActorRef, ActorLogging} -import akka.actor.Props -import akka.util.Timeout -import akka.event.LoggingReceive +import org.apache.pekko +import org.apache.pekko.actor.{Actor, ActorRef, ActorLogging} +import org.apache.pekko.actor.Props +import org.apache.pekko.util.Timeout +import org.apache.pekko.event.LoggingReceive import scala.util.{Success,Failure} import scala.concurrent.Future @@ -109,7 +110,7 @@ class ServiceActor(kubernetes: ActorRef, specification: GuestbookServiceSpecific * response to the service consumer, and stops itself. */ -abstract class ServiceResultHandler(serviceConsumer: ActorRef) extends Actor with akka.actor.ActorLogging { +abstract class ServiceResultHandler(serviceConsumer: ActorRef) extends Actor with pekko.actor.ActorLogging { def complete(response: Any): Unit = { log.debug("Sending service response " + response + " to " + serviceConsumer.path) serviceConsumer ! response @@ -136,7 +137,7 @@ class CreateResultHandler(consumer: ActorRef, name: String) extends ServiceResul } override def receive: Receive = LoggingReceive { - case akka.actor.Status.Failure(ex) => complete(UnexpectedServiceError(name, ex)) + case pekko.actor.Status.Failure(ex) => complete(UnexpectedServiceError(name, ex)) case ResourceNotFound => complete(UnexpectedServiceError(name, new Exception("Not Found"))) case r:skuber.ReplicationController => gotExpectedResult @@ -154,7 +155,7 @@ class RemoveResultHandler(consumer: ActorRef, name: String) extends ServiceResul // two non error results have been received back var countResults = 0 override def receive: Receive = LoggingReceive { - case akka.actor.Status.Failure(ex) => complete(UnexpectedServiceError(name, ex)) + case pekko.actor.Status.Failure(ex) => complete(UnexpectedServiceError(name, ex)) case other => { countResults += 1 if (countResults==2) @@ -170,7 +171,7 @@ object ScaleResultHandler { class ScaleResultHandler(consumer: ActorRef, name: String) extends ServiceResultHandler(consumer) { override def receive: Receive = LoggingReceive { case ScalerActor.ScalingError => complete(UnexpectedServiceError(name,new Exception("An error occured while scaling"))) - case akka.actor.Status.Failure(ex) => complete(UnexpectedServiceError(name, ex)) + case pekko.actor.Status.Failure(ex) => complete(UnexpectedServiceError(name, ex)) case ResourceNotFound => complete(UnexpectedServiceError(name, new Exception("Unable to scale as resource does not exist"))) case s: ScalerActor.ScalingDone => complete(ServiceScaledTo(name, s.toReplicaCount)) } @@ -183,8 +184,8 @@ object StopResultHandler { class StopResultHandler(consumer: ActorRef, name: String) extends ServiceResultHandler(consumer) { override def receive: Receive = LoggingReceive { case ScalerActor.ScalingError => complete(UnexpectedServiceError(name,new Exception("An error occured while scaling"))) - case akka.actor.Status.Failure(ex) => complete(UnexpectedServiceError(name, ex)) + case pekko.actor.Status.Failure(ex) => complete(UnexpectedServiceError(name, ex)) case ResourceNotFound => complete(ServiceStopped) // if service not exists treat as Stopped case s: ScalerActor.ScalingDone => complete(ServiceStopped) } -} \ No newline at end of file +} diff --git a/examples/src/main/scala/skuber/examples/ingress/NginxIngress.scala b/examples/src/main/scala/skuber/examples/ingress/NginxIngress.scala index 06696739..f3a3f4b5 100644 --- a/examples/src/main/scala/skuber/examples/ingress/NginxIngress.scala +++ b/examples/src/main/scala/skuber/examples/ingress/NginxIngress.scala @@ -1,7 +1,7 @@ package skuber.examples.ingress import java.net.HttpURLConnection -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import skuber._ import skuber.ext.ReplicaSet import skuber.networking.Ingress diff --git a/examples/src/main/scala/skuber/examples/job/PrintPiJob.scala b/examples/src/main/scala/skuber/examples/job/PrintPiJob.scala index 6290d4ee..14e9f98a 100644 --- a/examples/src/main/scala/skuber/examples/job/PrintPiJob.scala +++ b/examples/src/main/scala/skuber/examples/job/PrintPiJob.scala @@ -1,6 +1,6 @@ package skuber.examples.job -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import skuber.{Container, Pod, RestartPolicy, k8sInit} import skuber.batch.Job import skuber.json.batch.format._ @@ -44,4 +44,4 @@ object PrintPiJob extends App { } // The job can be tracked using 'kubectl get pods' to get the name of the pod running the job (starts with "pi-") // and then when the pod terminates use "kubectl logs " to see the printed pi result -} \ No newline at end of file +} diff --git a/examples/src/main/scala/skuber/examples/list/ListExamples.scala b/examples/src/main/scala/skuber/examples/list/ListExamples.scala index 034a0ab0..7c0b239a 100644 --- a/examples/src/main/scala/skuber/examples/list/ListExamples.scala +++ b/examples/src/main/scala/skuber/examples/list/ListExamples.scala @@ -1,6 +1,6 @@ package skuber.examples.list -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import skuber.Pod.Phase import skuber._ import scala.concurrent.{Await, ExecutionContextExecutor, Future} @@ -71,4 +71,4 @@ object ListExamples extends App { system.terminate().foreach { f => System.exit(0) } -} \ No newline at end of file +} diff --git a/examples/src/main/scala/skuber/examples/patch/PatchExamples.scala b/examples/src/main/scala/skuber/examples/patch/PatchExamples.scala index 16a492c0..55e6e7ac 100644 --- a/examples/src/main/scala/skuber/examples/patch/PatchExamples.scala +++ b/examples/src/main/scala/skuber/examples/patch/PatchExamples.scala @@ -1,6 +1,6 @@ package skuber.examples.patch -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import skuber._ import skuber.json.format._ import skuber.apps.v1beta1.StatefulSet @@ -97,4 +97,4 @@ object PatchExamples extends App { system.terminate() } scaleNginx -} \ No newline at end of file +} diff --git a/examples/src/main/scala/skuber/examples/podlogs/PodLogsExample.scala b/examples/src/main/scala/skuber/examples/podlogs/PodLogsExample.scala index 7cd74fb7..95df6e57 100644 --- a/examples/src/main/scala/skuber/examples/podlogs/PodLogsExample.scala +++ b/examples/src/main/scala/skuber/examples/podlogs/PodLogsExample.scala @@ -1,11 +1,11 @@ package skuber.examples.podlogs -import akka.NotUsed +import org.apache.pekko.NotUsed import skuber._ import skuber.json.format._ -import akka.actor.ActorSystem -import akka.stream.scaladsl._ -import akka.util.ByteString +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.stream.scaladsl._ +import org.apache.pekko.util.ByteString import skuber.api.client import scala.concurrent.{Await, ExecutionContextExecutor} import scala.concurrent.duration._ diff --git a/examples/src/main/scala/skuber/examples/scale/ScaleExamples.scala b/examples/src/main/scala/skuber/examples/scale/ScaleExamples.scala index 5803280c..46fbc330 100644 --- a/examples/src/main/scala/skuber/examples/scale/ScaleExamples.scala +++ b/examples/src/main/scala/skuber/examples/scale/ScaleExamples.scala @@ -1,6 +1,6 @@ package skuber.examples.scale -import akka.actor.ActorSystem +import org.apache.pekko.actor.ActorSystem import skuber._ import skuber.autoscaling.HorizontalPodAutoscaler @@ -156,4 +156,4 @@ object ScaleExamples extends App { system.terminate() } scaleNginx -} \ No newline at end of file +} diff --git a/examples/src/main/scala/skuber/examples/watch/WatchExamples.scala b/examples/src/main/scala/skuber/examples/watch/WatchExamples.scala index dddba6bc..801aa011 100644 --- a/examples/src/main/scala/skuber/examples/watch/WatchExamples.scala +++ b/examples/src/main/scala/skuber/examples/watch/WatchExamples.scala @@ -3,8 +3,8 @@ package skuber.examples.watch import skuber._ import skuber.json.format._ import skuber.K8SWatchEvent -import akka.actor.ActorSystem -import akka.stream.scaladsl.Sink +import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.stream.scaladsl.Sink import scala.concurrent.ExecutionContextExecutor @@ -54,4 +54,4 @@ object WatchExamples extends App { system.terminate().foreach { f => System.exit(0) } -} \ No newline at end of file +}