Add support for custom container image name
This change threads the components input to their resources function so that the container can be configured with the optional custom image name when set. Change-Id: I496cc0237f378057b8125f673a760dcda80ecd99
This commit is contained in:
parent
344a0b763b
commit
ba2691fb47
@ -2,10 +2,12 @@ let Kubernetes = ../../Kubernetes.dhall
|
|||||||
|
|
||||||
let F = ../functions.dhall
|
let F = ../functions.dhall
|
||||||
|
|
||||||
|
let InputExecutor = (../input.dhall).Executor.Type
|
||||||
|
|
||||||
let JobVolume = (../input.dhall).JobVolume.Type
|
let JobVolume = (../input.dhall).JobVolume.Type
|
||||||
|
|
||||||
in \(app-name : Text)
|
in \(app-name : Text)
|
||||||
-> \(image-name : Optional Text)
|
-> \(input-executor : InputExecutor)
|
||||||
-> \(data-dir : List F.Volume.Type)
|
-> \(data-dir : List F.Volume.Type)
|
||||||
-> \(volumes : List F.Volume.Type)
|
-> \(volumes : List F.Volume.Type)
|
||||||
-> \(env : List Kubernetes.EnvVar.Type)
|
-> \(env : List Kubernetes.EnvVar.Type)
|
||||||
@ -31,7 +33,7 @@ in \(app-name : Text)
|
|||||||
, claim-size = 0
|
, claim-size = 0
|
||||||
, container = Kubernetes.Container::{
|
, container = Kubernetes.Container::{
|
||||||
, name = "executor"
|
, name = "executor"
|
||||||
, image = image-name
|
, image = input-executor.image
|
||||||
, args = Some [ "zuul-executor", "-d" ]
|
, args = Some [ "zuul-executor", "-d" ]
|
||||||
, imagePullPolicy = Some "IfNotPresent"
|
, imagePullPolicy = Some "IfNotPresent"
|
||||||
, ports = Some
|
, ports = Some
|
||||||
|
@ -2,8 +2,10 @@ let Kubernetes = ../../Kubernetes.dhall
|
|||||||
|
|
||||||
let F = ../functions.dhall
|
let F = ../functions.dhall
|
||||||
|
|
||||||
|
let InputMerger = (../input.dhall).Merger.Type
|
||||||
|
|
||||||
in \(app-name : Text)
|
in \(app-name : Text)
|
||||||
-> \(image-name : Optional Text)
|
-> \(input-merger : InputMerger)
|
||||||
-> \(data-dir : List F.Volume.Type)
|
-> \(data-dir : List F.Volume.Type)
|
||||||
-> \(volumes : List F.Volume.Type)
|
-> \(volumes : List F.Volume.Type)
|
||||||
-> \(env : List Kubernetes.EnvVar.Type)
|
-> \(env : List Kubernetes.EnvVar.Type)
|
||||||
@ -18,7 +20,7 @@ in \(app-name : Text)
|
|||||||
, volumes = volumes
|
, volumes = volumes
|
||||||
, container = Kubernetes.Container::{
|
, container = Kubernetes.Container::{
|
||||||
, name = "merger"
|
, name = "merger"
|
||||||
, image = image-name
|
, image = input-merger.image
|
||||||
, args = Some [ "zuul-merger", "-d" ]
|
, args = Some [ "zuul-merger", "-d" ]
|
||||||
, imagePullPolicy = Some "IfNotPresent"
|
, imagePullPolicy = Some "IfNotPresent"
|
||||||
, env = Some env
|
, env = Some env
|
||||||
|
@ -5,9 +5,8 @@ let F = ../functions.dhall
|
|||||||
let InputPreview = (../input.dhall).Preview.Type
|
let InputPreview = (../input.dhall).Preview.Type
|
||||||
|
|
||||||
in \(app-name : Text)
|
in \(app-name : Text)
|
||||||
-> \(image-name : Optional Text)
|
|
||||||
-> \(data-dir : List F.Volume.Type)
|
|
||||||
-> \(input-preview : InputPreview)
|
-> \(input-preview : InputPreview)
|
||||||
|
-> \(data-dir : List F.Volume.Type)
|
||||||
-> F.KubernetesComponent::{
|
-> F.KubernetesComponent::{
|
||||||
, Service = Some (F.mkService app-name "preview" "preview" 80)
|
, Service = Some (F.mkService app-name "preview" "preview" 80)
|
||||||
, Deployment = Some
|
, Deployment = Some
|
||||||
@ -19,7 +18,7 @@ in \(app-name : Text)
|
|||||||
, data-dir = data-dir
|
, data-dir = data-dir
|
||||||
, container = Kubernetes.Container::{
|
, container = Kubernetes.Container::{
|
||||||
, name = "preview"
|
, name = "preview"
|
||||||
, image = image-name
|
, image = input-preview.image
|
||||||
, imagePullPolicy = Some "IfNotPresent"
|
, imagePullPolicy = Some "IfNotPresent"
|
||||||
, ports = Some
|
, ports = Some
|
||||||
[ Kubernetes.ContainerPort::{
|
[ Kubernetes.ContainerPort::{
|
||||||
|
@ -30,10 +30,9 @@ let registry-env =
|
|||||||
)
|
)
|
||||||
|
|
||||||
in \(app-name : Text)
|
in \(app-name : Text)
|
||||||
-> \(image-name : Optional Text)
|
-> \(input-registry : InputRegistry)
|
||||||
-> \(data-dir : List F.Volume.Type)
|
-> \(data-dir : List F.Volume.Type)
|
||||||
-> \(volumes : List F.Volume.Type)
|
-> \(volumes : List F.Volume.Type)
|
||||||
-> \(input-registry : InputRegistry)
|
|
||||||
-> F.KubernetesComponent::{
|
-> F.KubernetesComponent::{
|
||||||
, Service = Some (F.mkService app-name "registry" "registry" 9000)
|
, Service = Some (F.mkService app-name "registry" "registry" 9000)
|
||||||
, StatefulSet = Some
|
, StatefulSet = Some
|
||||||
@ -47,7 +46,7 @@ in \(app-name : Text)
|
|||||||
, claim-size = F.defaultNat input-registry.storage-size 20
|
, claim-size = F.defaultNat input-registry.storage-size 20
|
||||||
, container = Kubernetes.Container::{
|
, container = Kubernetes.Container::{
|
||||||
, name = "registry"
|
, name = "registry"
|
||||||
, image = image-name
|
, image = input-registry.image
|
||||||
, args = Some
|
, args = Some
|
||||||
[ "zuul-registry"
|
[ "zuul-registry"
|
||||||
, "-c"
|
, "-c"
|
||||||
|
@ -2,8 +2,10 @@ let Kubernetes = ../../Kubernetes.dhall
|
|||||||
|
|
||||||
let F = ../functions.dhall
|
let F = ../functions.dhall
|
||||||
|
|
||||||
|
let InputScheduler = (../input.dhall).Scheduler.Type
|
||||||
|
|
||||||
in \(app-name : Text)
|
in \(app-name : Text)
|
||||||
-> \(image-name : Optional Text)
|
-> \(input-scheduler : InputScheduler)
|
||||||
-> \(data-dir : List F.Volume.Type)
|
-> \(data-dir : List F.Volume.Type)
|
||||||
-> \(volumes : List F.Volume.Type)
|
-> \(volumes : List F.Volume.Type)
|
||||||
-> \(env : List Kubernetes.EnvVar.Type)
|
-> \(env : List Kubernetes.EnvVar.Type)
|
||||||
@ -20,7 +22,7 @@ in \(app-name : Text)
|
|||||||
, claim-size = 5
|
, claim-size = 5
|
||||||
, container = Kubernetes.Container::{
|
, container = Kubernetes.Container::{
|
||||||
, name = "scheduler"
|
, name = "scheduler"
|
||||||
, image = image-name
|
, image = input-scheduler.image
|
||||||
, args = Some [ "zuul-scheduler", "-d" ]
|
, args = Some [ "zuul-scheduler", "-d" ]
|
||||||
, imagePullPolicy = Some "IfNotPresent"
|
, imagePullPolicy = Some "IfNotPresent"
|
||||||
, ports = Some
|
, ports = Some
|
||||||
|
@ -2,8 +2,10 @@ let Kubernetes = ../../Kubernetes.dhall
|
|||||||
|
|
||||||
let F = ../functions.dhall
|
let F = ../functions.dhall
|
||||||
|
|
||||||
|
let InputWeb = (../input.dhall).Web.Type
|
||||||
|
|
||||||
in \(app-name : Text)
|
in \(app-name : Text)
|
||||||
-> \(image-name : Optional Text)
|
-> \(input-web : InputWeb)
|
||||||
-> \(data-dir : List F.Volume.Type)
|
-> \(data-dir : List F.Volume.Type)
|
||||||
-> \(volumes : List F.Volume.Type)
|
-> \(volumes : List F.Volume.Type)
|
||||||
-> \(env : List Kubernetes.EnvVar.Type)
|
-> \(env : List Kubernetes.EnvVar.Type)
|
||||||
@ -19,7 +21,7 @@ in \(app-name : Text)
|
|||||||
, volumes = volumes
|
, volumes = volumes
|
||||||
, container = Kubernetes.Container::{
|
, container = Kubernetes.Container::{
|
||||||
, name = "web"
|
, name = "web"
|
||||||
, image = image-name
|
, image = input-web.image
|
||||||
, args = Some [ "zuul-web", "-d" ]
|
, args = Some [ "zuul-web", "-d" ]
|
||||||
, imagePullPolicy = Some "IfNotPresent"
|
, imagePullPolicy = Some "IfNotPresent"
|
||||||
, ports = Some
|
, ports = Some
|
||||||
|
@ -148,6 +148,17 @@ in \(input : Input)
|
|||||||
|
|
||||||
let image = \(name : Text) -> "${org}/${name}:${version}"
|
let image = \(name : Text) -> "${org}/${name}:${version}"
|
||||||
|
|
||||||
|
let set-image =
|
||||||
|
\(default-name : Text)
|
||||||
|
-> \(input-name : Optional Text)
|
||||||
|
-> { image =
|
||||||
|
merge
|
||||||
|
{ None = Some default-name
|
||||||
|
, Some = \(_ : Text) -> input-name
|
||||||
|
}
|
||||||
|
input-name
|
||||||
|
}
|
||||||
|
|
||||||
let etc-zuul =
|
let etc-zuul =
|
||||||
Volume::{
|
Volume::{
|
||||||
, name = input.name ++ "-secret-zuul"
|
, name = input.name ++ "-secret-zuul"
|
||||||
@ -306,7 +317,7 @@ in \(input : Input)
|
|||||||
}
|
}
|
||||||
, Zuul =
|
, Zuul =
|
||||||
let zuul-image =
|
let zuul-image =
|
||||||
\(name : Text) -> Some (image ("zuul-" ++ name))
|
\(name : Text) -> set-image (image "zuul-${name}")
|
||||||
|
|
||||||
let zuul-env =
|
let zuul-env =
|
||||||
F.mkEnvVarValue (toMap { HOME = "/var/lib/zuul" })
|
F.mkEnvVarValue (toMap { HOME = "/var/lib/zuul" })
|
||||||
@ -357,14 +368,18 @@ in \(input : Input)
|
|||||||
in { Scheduler =
|
in { Scheduler =
|
||||||
./components/Scheduler.dhall
|
./components/Scheduler.dhall
|
||||||
input.name
|
input.name
|
||||||
(zuul-image "scheduler")
|
( input.scheduler
|
||||||
|
// zuul-image "scheduler" input.scheduler.image
|
||||||
|
)
|
||||||
zuul-data-dir
|
zuul-data-dir
|
||||||
(zuul-volumes # [ sched-config ])
|
(zuul-volumes # [ sched-config ])
|
||||||
(zuul-env # db-secret-env # zk-hosts-secret-env)
|
(zuul-env # db-secret-env # zk-hosts-secret-env)
|
||||||
, Executor =
|
, Executor =
|
||||||
./components/Executor.dhall
|
./components/Executor.dhall
|
||||||
input.name
|
input.name
|
||||||
(zuul-image "executor")
|
( input.executor
|
||||||
|
// zuul-image "executor" input.executor.image
|
||||||
|
)
|
||||||
zuul-data-dir
|
zuul-data-dir
|
||||||
(zuul-volumes # [ executor-ssh-key ])
|
(zuul-volumes # [ executor-ssh-key ])
|
||||||
(zuul-env # db-nosecret-env)
|
(zuul-env # db-nosecret-env)
|
||||||
@ -372,30 +387,34 @@ in \(input : Input)
|
|||||||
, Web =
|
, Web =
|
||||||
./components/Web.dhall
|
./components/Web.dhall
|
||||||
input.name
|
input.name
|
||||||
(zuul-image "web")
|
(input.web // zuul-image "web" input.web.image)
|
||||||
zuul-data-dir
|
zuul-data-dir
|
||||||
zuul-volumes
|
zuul-volumes
|
||||||
(zuul-env # db-secret-env # zk-hosts-secret-env)
|
(zuul-env # db-secret-env # zk-hosts-secret-env)
|
||||||
, Merger =
|
, Merger =
|
||||||
./components/Merger.dhall
|
./components/Merger.dhall
|
||||||
input.name
|
input.name
|
||||||
(zuul-image "merger")
|
( input.merger
|
||||||
|
// zuul-image "merger" input.merger.image
|
||||||
|
)
|
||||||
zuul-data-dir
|
zuul-data-dir
|
||||||
zuul-volumes
|
zuul-volumes
|
||||||
(zuul-env # db-nosecret-env)
|
(zuul-env # db-nosecret-env)
|
||||||
, Registry =
|
, Registry =
|
||||||
./components/Registry.dhall
|
./components/Registry.dhall
|
||||||
input.name
|
input.name
|
||||||
(zuul-image "registry")
|
( input.registry
|
||||||
|
// zuul-image "registry" input.registry.image
|
||||||
|
)
|
||||||
zuul-data-dir
|
zuul-data-dir
|
||||||
[ etc-zuul-registry ]
|
[ etc-zuul-registry ]
|
||||||
input.registry
|
|
||||||
, Preview =
|
, Preview =
|
||||||
./components/Preview.dhall
|
./components/Preview.dhall
|
||||||
input.name
|
input.name
|
||||||
(zuul-image "preview")
|
( input.preview
|
||||||
|
// zuul-image "preview" input.preview.image
|
||||||
|
)
|
||||||
zuul-data-dir
|
zuul-data-dir
|
||||||
input.preview
|
|
||||||
}
|
}
|
||||||
, Nodepool =
|
, Nodepool =
|
||||||
let nodepool-image =
|
let nodepool-image =
|
||||||
|
Loading…
Reference in New Issue
Block a user