52 lines
1.4 KiB
Plaintext
52 lines
1.4 KiB
Plaintext
let Prelude = ../Prelude.dhall
|
|
|
|
let kubernetes = ../kubernetes.dhall
|
|
|
|
let kv = Prelude.JSON.keyText
|
|
|
|
let Config = ../app/config.dhall
|
|
|
|
let selector = ./selector.dhall
|
|
|
|
let podSpec
|
|
: Config.Type → kubernetes.PodSpec.Type
|
|
= λ(config : Config.Type)
|
|
→ kubernetes.PodSpec::{
|
|
, containers =
|
|
[ kubernetes.Container::{
|
|
, name = "web"
|
|
, env = config.envVars
|
|
, image = Some config.image
|
|
, imagePullPolicy = Some "Always"
|
|
, ports =
|
|
[ kubernetes.ContainerPort::{ containerPort = config.appPort } ]
|
|
}
|
|
]
|
|
, imagePullSecrets =
|
|
[ kubernetes.LocalObjectReference::{ name = Some "regcred" } ]
|
|
}
|
|
|
|
let spec =
|
|
λ(config : Config.Type)
|
|
→ kubernetes.DeploymentSpec::{
|
|
, selector = kubernetes.LabelSelector::{
|
|
, matchLabels = selector config.name
|
|
}
|
|
, template = kubernetes.PodTemplateSpec::{
|
|
, metadata = kubernetes.ObjectMeta::{
|
|
, name = config.name
|
|
, labels = selector config.name
|
|
}
|
|
, spec = Some (podSpec config)
|
|
}
|
|
}
|
|
|
|
let deployment =
|
|
λ(config : Config.Type)
|
|
→ kubernetes.Deployment::{
|
|
, metadata = kubernetes.ObjectMeta::{ name = config.name }
|
|
, spec = Some (spec config)
|
|
}
|
|
|
|
in deployment
|