Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Commit

Permalink
kubernetes namesaces, closes #667
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoslav committed Jan 16, 2017
1 parent 30f0cd1 commit c74466e
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions bootstrap/src/main/resources/reference.conf
Expand Up @@ -68,6 +68,7 @@ vamp {

kubernetes {
url = ""
namespace = "default"
workflow-name-prefix = "vamp-workflow-"
service-type = "NodePort" # NodePort or LoadBalancer
create-services = true
Expand Down
Expand Up @@ -10,6 +10,8 @@ trait KubernetesContainerDriver extends ContainerDriver {

protected def apiUrl: String

protected def namespace: String

protected def apiHeaders: List[(String, String)]

protected val nameDelimiter = "-"
Expand Down
Expand Up @@ -8,7 +8,7 @@ import scala.concurrent.Future
trait KubernetesDaemonSet extends KubernetesArtifact {
this: KubernetesContainerDriver with ActorLogging

private lazy val url = s"$apiUrl/apis/extensions/v1beta1/namespaces/default/daemonsets"
private lazy val url = s"$apiUrl/apis/extensions/v1beta1/namespaces/$namespace/daemonsets"

protected def createDaemonSet(ds: DaemonSet, labels: Map[String, String] = Map()): Future[Any] = {
val request =
Expand Down
Expand Up @@ -15,11 +15,11 @@ trait KubernetesDeployment extends KubernetesArtifact {

private val workflowIdLabel = "workflow"

private lazy val podUrl = s"$apiUrl/api/v1/namespaces/default/pods"
private lazy val podUrl = s"$apiUrl/api/v1/namespaces/$namespace/pods"

private lazy val replicaSetUrl = s"$apiUrl/apis/extensions/v1beta1/namespaces/default/replicasets"
private lazy val replicaSetUrl = s"$apiUrl/apis/extensions/v1beta1/namespaces/$namespace/replicasets"

private lazy val deploymentUrl = s"$apiUrl/apis/extensions/v1beta1/namespaces/default/deployments"
private lazy val deploymentUrl = s"$apiUrl/apis/extensions/v1beta1/namespaces/$namespace/deployments"

override protected def supportedDeployableTypes = RktDeployable :: DockerDeployable :: Nil

Expand Down
Expand Up @@ -30,6 +30,8 @@ object KubernetesDriverActor {

val url = Config.string(s"$config.url")

val namespace = Config.string(s"$config.namespace")

val workflowNamePrefix = Config.string(s"$config.workflow-name-prefix")

val token = Config.string(s"$config.token")
Expand All @@ -53,6 +55,8 @@ class KubernetesDriverActor extends ContainerDriverActor with KubernetesContaine

protected val apiUrl = KubernetesDriverActor.url()

protected val namespace = KubernetesDriverActor.namespace()

protected val apiHeaders = {
def headers(bearer: String) = ("Authorization" s"Bearer $bearer") :: HttpClient.jsonHeaders

Expand Down
Expand Up @@ -15,7 +15,7 @@ object KubernetesServiceType extends Enumeration {
trait KubernetesService extends KubernetesArtifact {
this: KubernetesContainerDriver with ActorLogging

private lazy val url = s"$apiUrl/api/v1/namespaces/default/services"
private lazy val url = s"$apiUrl/api/v1/namespaces/$namespace/services"

private val nameMatcher = """^[a-z]([-a-z0-9]*[a-z0-9])?$""".r

Expand Down
Expand Up @@ -15,7 +15,7 @@ class ConsulStoreActorMapper extends ClassMapper {

class ConsulStoreActor extends KeyValueStoreActor {

private val url = Config.string("vamp.persistence.key-value-store.consul.url")
private val url = Config.string("vamp.persistence.key-value-store.consul.url")()

override protected def info(): Future[Any] = httpClient.get[Any](s"$url/v1/agent/self") map { consul
Map("type" "consul", "consul" consul)
Expand Down
Expand Up @@ -17,7 +17,7 @@ class EtcdStoreActorMapper extends ClassMapper {

class EtcdStoreActor extends KeyValueStoreActor {

private val url = Config.string("vamp.persistence.key-value-store.etcd.url")
private val url = Config.string("vamp.persistence.key-value-store.etcd.url")()

private val valueNode = "value"

Expand Down

0 comments on commit c74466e

Please sign in to comment.