Skip to content

Commit

Permalink
v2.6.6-rc0
Browse files Browse the repository at this point in the history
  • Loading branch information
doriordan committed Oct 19, 2022
1 parent 10e8a63 commit 4656c29
Show file tree
Hide file tree
Showing 77 changed files with 371 additions and 413 deletions.
29 changes: 15 additions & 14 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@

resolvers += "Typesafe Releases" at "https://repo.typesafe.com/typesafe/releases/"

val akkaVersion = "2.6.15"
val akkaVersion = "2.6.19"

val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.15.4"
val specs2 = "org.specs2" %% "specs2-core" % "4.11.0"
val scalaTest = "org.scalatest" %% "scalatest" % "3.0.9"
val mockito = "org.mockito" % "mockito-core" % "3.11.0"
val specs2 = "org.specs2" %% "specs2-core" % "4.17.0"
val scalaTest = "org.scalatest" %% "scalatest" % "3.2.14"
val mockito = "org.mockito" % "mockito-core" % "4.6.1"
val scalaTestMockito = "org.scalatestplus" %% "mockito-4-6" % "3.2.14.0"
val akkaStreamTestKit = "com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion

val snakeYaml = "org.yaml" % "snakeyaml" % "1.31"
val commonsIO = "commons-io" % "commons-io" % "2.9.0"
val snakeYaml = "org.yaml" % "snakeyaml" % "1.33"
val commonsIO = "commons-io" % "commons-io" % "2.11.0"
val commonsCodec = "commons-codec" % "commons-codec" % "1.15"

// the client API request/response handing uses Akka Http
val akkaHttp = "com.typesafe.akka" %% "akka-http" % "10.2.4"
val akkaHttp = "com.typesafe.akka" %% "akka-http" % "10.2.9"
val akkaStream = "com.typesafe.akka" %% "akka-stream" % akkaVersion
val akka = "com.typesafe.akka" %% "akka-actor" % akkaVersion

// Skuber uses akka logging, so the examples config uses the akka slf4j logger with logback backend
val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % akkaVersion
val logback = "ch.qos.logback" % "logback-classic" % "1.2.3" % Runtime
val logback = "ch.qos.logback" % "logback-classic" % "1.4.4" % Runtime

// the Json formatters are based on Play Json
val playJson = "com.typesafe.play" %% "play-json" % "2.9.2"
val playJson = "com.typesafe.play" %% "play-json" % "2.9.3"

// Need Java 8 or later as the java.time package is used to represent K8S timestamps
scalacOptions += "-target:jvm-1.8"

scalacOptions in Test ++= Seq("-Yrangepos")

ThisBuild / version := "2.6.5"
ThisBuild / version := "2.6.6-rc0"

sonatypeProfileName := "io.skuber"

Expand All @@ -51,8 +52,8 @@ developers in ThisBuild := List(Developer(id="doriordan", name="David ORiordan",

lazy val commonSettings = Seq(
organization := "io.skuber",
crossScalaVersions := Seq("2.12.13", "2.13.6"),
scalaVersion := "2.13.6",
crossScalaVersions := Seq("2.12.17", "2.13.10"),
scalaVersion := "2.13.10",
publishTo := sonatypePublishToBundle.value,
pomIncludeRepository := { _ => false },
Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat
Expand All @@ -62,8 +63,8 @@ lazy val skuberSettings = Seq(
name := "skuber",
libraryDependencies ++= Seq(
akkaHttp, akkaStream, playJson, snakeYaml, commonsIO, commonsCodec,
scalaCheck % Test, specs2 % Test, mockito % Test, akkaStreamTestKit % Test,
scalaTest % Test
scalaCheck % Test, specs2 % Test, mockito % Test, scalaTestMockito % Test,
akkaStreamTestKit % Test, scalaTest % Test
).map(_.exclude("commons-logging", "commons-logging"))
)

Expand Down
4 changes: 2 additions & 2 deletions client/src/it/scala/skuber/CustomResourceSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package skuber
import akka.stream._
import akka.stream.scaladsl._
import skuber.apiextensions.CustomResourceDefinition
import org.scalatest.Matchers
import org.scalatest.matchers.should.Matchers
import org.scalatest.concurrent.Eventually
import play.api.libs.json._
import skuber.ResourceSpecification.{Subresources,ScaleSubresource}
import skuber.ResourceSpecification.{ScaleSubresource, Subresources}

import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
Expand Down
2 changes: 1 addition & 1 deletion client/src/it/scala/skuber/DeploymentSpec.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package skuber

import org.scalatest.Matchers
import org.scalatest.matchers.should.Matchers
import org.scalatest.concurrent.{Eventually, ScalaFutures}
import skuber.LabelSelector.IsEqualRequirement
import skuber.apps.v1.Deployment
Expand Down
3 changes: 2 additions & 1 deletion client/src/it/scala/skuber/ExecSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package skuber

import akka.Done
import akka.stream.scaladsl.{Sink, Source}
import org.scalatest.{BeforeAndAfterAll, Matchers}
import org.scalatest.BeforeAndAfterAll
import org.scalatest.concurrent.Eventually
import org.scalatest.matchers.should.Matchers
import skuber.json.format._

import scala.concurrent.duration._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package skuber

import org.scalatest.Matchers
import org.scalatest.matchers.should.Matchers
import org.scalatest.concurrent.Eventually
import skuber.apps.v1.Deployment
import skuber.autoscaling.v2beta1.HorizontalPodAutoscaler
Expand Down
8 changes: 4 additions & 4 deletions client/src/it/scala/skuber/K8SFixture.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package skuber

import akka.actor.ActorSystem
import org.scalatest.{FutureOutcome, fixture}
import skuber.api.client._
import org.scalatest.FutureOutcome
import com.typesafe.config.ConfigFactory
import skuber.api.client.impl.KubernetesClientImpl
import org.scalatest.flatspec.FixtureAsyncFlatSpec

trait K8SFixture extends fixture.AsyncFlatSpec {
trait K8SFixture extends FixtureAsyncFlatSpec {

override type FixtureParam = K8SRequestContext

Expand All @@ -17,6 +16,7 @@ trait K8SFixture extends fixture.AsyncFlatSpec {

override def withFixture(test: OneArgAsyncTest): FutureOutcome = {
val k8s = k8sInit(config)

complete {
withFixture(test.toNoArgAsyncTest(k8s))
} lastly {
Expand Down
2 changes: 1 addition & 1 deletion client/src/it/scala/skuber/NamespaceSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package skuber

import java.util.UUID.randomUUID

import org.scalatest.Matchers
import org.scalatest.matchers.should.Matchers
import org.scalatest.concurrent.Eventually
import json.format.{namespaceFormat, podFormat}

Expand Down
3 changes: 2 additions & 1 deletion client/src/it/scala/skuber/PatchSpec.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package skuber

import org.scalatest.{BeforeAndAfterAll, Matchers}
import org.scalatest.BeforeAndAfterAll
import org.scalatest.concurrent.Eventually
import org.scalatest.matchers.should.Matchers
import skuber.api.patch._
import skuber.json.format._

Expand Down
2 changes: 1 addition & 1 deletion client/src/it/scala/skuber/PodDisruptionBudgetSpec.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package skuber

import org.scalatest.Matchers
import org.scalatest.matchers.should.Matchers
import org.scalatest.concurrent.Eventually
import skuber.apps.v1.Deployment
import skuber.policy.v1beta1.PodDisruptionBudget
Expand Down
3 changes: 2 additions & 1 deletion client/src/it/scala/skuber/PodLogSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import java.time.ZonedDateTime

import akka.stream.scaladsl.TcpIdleTimeoutException
import com.typesafe.config.ConfigFactory
import org.scalatest.{BeforeAndAfterAll, Matchers}
import org.scalatest.BeforeAndAfterAll
import org.scalatest.concurrent.Eventually
import org.scalatest.matchers.should.Matchers
import skuber.Pod.LogQueryParams
import skuber.json.format._

Expand Down
3 changes: 2 additions & 1 deletion client/src/it/scala/skuber/PodSpec.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package skuber

import org.scalatest.{BeforeAndAfterAll, Matchers}
import org.scalatest.BeforeAndAfterAll
import org.scalatest.concurrent.Eventually
import org.scalatest.matchers.should.Matchers
import skuber.json.format._

import scala.concurrent.duration._
Expand Down
2 changes: 1 addition & 1 deletion client/src/it/scala/skuber/ServiceSpec.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package skuber

import skuber.json.format.serviceFmt
import org.scalatest.Matchers
import org.scalatest.matchers.should.Matchers
import org.scalatest.concurrent.Eventually

import scala.concurrent.Await
Expand Down
2 changes: 1 addition & 1 deletion client/src/it/scala/skuber/WatchContinuouslySpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package skuber

import akka.stream.KillSwitches
import akka.stream.scaladsl.{Keep, Sink}
import org.scalatest.Matchers
import org.scalatest.matchers.should.Matchers
import org.scalatest.concurrent.{Eventually, ScalaFutures}
import org.scalatest.time.{Seconds, Span}
import skuber.apps.v1.{Deployment, DeploymentList}
Expand Down
11 changes: 7 additions & 4 deletions client/src/main/scala/skuber/ConfigMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ package skuber
*/


case class ConfigMap(val kind: String ="ConfigMap",
override val apiVersion: String = v1,
val metadata: ObjectMeta,
data: Map[String, String] = Map()) extends ObjectResource {
case class ConfigMap(
kind: String ="ConfigMap",
apiVersion: String = v1,
metadata: ObjectMeta,
data: Map[String, String] = Map())
extends ObjectResource
{

def withData(data: Map[String, String]): ConfigMap =
this.copy(data = data)
Expand Down
50 changes: 23 additions & 27 deletions client/src/main/scala/skuber/Container.scala
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
package skuber

import java.net.URL
import java.util.Date

/**
* @author David O'Riordan
*/

case class Container(
name: String,
image: String,
command: List[String] = List(),
args: List[String] = List(),
workingDir: Option[String] = None,
ports : List[Container.Port] = List(),
env: List[EnvVar] = List(),
resources: Option[Resource.Requirements] = None,
volumeMounts: List[Volume.Mount] = List(),
livenessProbe: Option[Probe] = None,
readinessProbe: Option[Probe] = None,
lifecycle: Option[Lifecycle] = None,
terminationMessagePath: Option[String] = None,
terminationMessagePolicy: Option[Container.TerminationMessagePolicy.Value] = None,
imagePullPolicy: Container.PullPolicy.Value = Container.PullPolicy.IfNotPresent,
securityContext: Option[SecurityContext] = None,
envFrom: List[EnvFromSource] = Nil,
stdin: Option[Boolean] = None,
stdinOnce: Option[Boolean] = None,
tty: Option[Boolean] = None,
volumeDevices: List[Volume.Device] = Nil,
startupProbe: Option[Probe] = None
)
extends Limitable
name: String,
image: String,
command: List[String] = List(),
args: List[String] = List(),
workingDir: Option[String] = None,
ports : List[Container.Port] = List(),
env: List[EnvVar] = List(),
resources: Option[Resource.Requirements] = None,
volumeMounts: List[Volume.Mount] = List(),
livenessProbe: Option[Probe] = None,
readinessProbe: Option[Probe] = None,
lifecycle: Option[Lifecycle] = None,
terminationMessagePath: Option[String] = None,
terminationMessagePolicy: Option[Container.TerminationMessagePolicy.Value] = None,
imagePullPolicy: Container.PullPolicy.Value = Container.PullPolicy.IfNotPresent,
securityContext: Option[SecurityContext] = None,
envFrom: List[EnvFromSource] = Nil,
stdin: Option[Boolean] = None,
stdinOnce: Option[Boolean] = None,
tty: Option[Boolean] = None,
volumeDevices: List[Volume.Device] = Nil,
startupProbe: Option[Probe] = None)
extends Limitable
{
def exposePort(p: Container.Port) : Container = this.copy(ports=p::this.ports)
def exposePort(port: Int) : Container = exposePort(Container.Port(containerPort=port))
Expand Down
6 changes: 3 additions & 3 deletions client/src/main/scala/skuber/CustomResource.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import scala.reflect.runtime.universe._
* pattern of being composed of "spec" and "status" subobjects.
*/
case class CustomResource[Sp,St](
override val kind: String,
override val apiVersion: String,
override val metadata: ObjectMeta,
kind: String,
apiVersion: String,
metadata: ObjectMeta,
spec: Sp,
status: Option[St]) extends ObjectResource
{
Expand Down
10 changes: 5 additions & 5 deletions client/src/main/scala/skuber/Endpoints.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ package skuber
* @author David O'Riordan
*/
case class Endpoints(
kind: String ="Endpoints",
override val apiVersion: String = v1,
metadata: ObjectMeta,
subsets: List[Endpoints.Subset] = Nil)
extends ObjectResource
kind: String ="Endpoints",
apiVersion: String = v1,
metadata: ObjectMeta,
subsets: List[Endpoints.Subset] = Nil)
extends ObjectResource
{
// unlikely any skuber clients will construct their own endpoints, but if so can use these fluent methods

Expand Down
5 changes: 1 addition & 4 deletions client/src/main/scala/skuber/EnvFromSource.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ package skuber
* @author David O'Riordan
*/

case class EnvFromSource(
prefix: Option[String] = None,
source:EnvFromSource.EnvSource
)
case class EnvFromSource(prefix: Option[String] = None, source:EnvFromSource.EnvSource)

object EnvFromSource {

Expand Down
4 changes: 1 addition & 3 deletions client/src/main/scala/skuber/EnvVar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package skuber
/**
* @author David O'Riordan
*/
case class EnvVar(
name: String,
value: EnvVar.Value = "")
case class EnvVar(name: String, value: EnvVar.Value = "")

object EnvVar {
sealed trait Value
Expand Down
25 changes: 11 additions & 14 deletions client/src/main/scala/skuber/Event.scala
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
package skuber

import java.util.Date

/**
* @author David O'Riordan
*/
case class Event(
val kind: String ="Event",
override val apiVersion: String = v1,
val metadata: ObjectMeta,
involvedObject: ObjectReference,
reason: Option[String] = None,
message: Option[String] = None,
source: Option[Event.Source] = None,
firstTimestamp: Option[Timestamp] = None,
lastTimestamp: Option[Timestamp] = None,
count: Option[Int] = None,
`type`: Option[String] = None)
extends ObjectResource
kind: String ="Event",
apiVersion: String = v1,
metadata: ObjectMeta,
involvedObject: ObjectReference,
reason: Option[String] = None,
message: Option[String] = None,
source: Option[Event.Source] = None,
firstTimestamp: Option[Timestamp] = None,
lastTimestamp: Option[Timestamp] = None,
count: Option[Int] = None,
`type`: Option[String] = None) extends ObjectResource

object Event {

Expand Down
4 changes: 1 addition & 3 deletions client/src/main/scala/skuber/LabelSelector.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package skuber

import java.beans.Expression

/**
* @author David O'Riordan
*/

case class LabelSelector(val requirements: LabelSelector.Requirement*) {
case class LabelSelector(requirements: LabelSelector.Requirement*) {
override def toString=requirements.mkString(",")

override def equals(o: Any) = o match {
Expand Down
11 changes: 6 additions & 5 deletions client/src/main/scala/skuber/LimitRange.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ package skuber
* @author David O'Riordan
*/
case class LimitRange (
val kind: String ="LimitRange",
override val apiVersion: String = v1,
val metadata: ObjectMeta = ObjectMeta(),
spec: Option[LimitRange.Spec] = None)
extends ObjectResource {
kind: String ="LimitRange",
apiVersion: String = v1,
metadata: ObjectMeta = ObjectMeta(),
spec: Option[LimitRange.Spec] = None)
extends ObjectResource
{

def withResourceVersion(version: String) = this.copy(metadata = metadata.copy(resourceVersion=version))

Expand Down
Loading

0 comments on commit 4656c29

Please sign in to comment.