Update to dhall lang v17
This change updates the dhall code to the latest version. * Support for record pun where `{ x = x }` can now be written as `{ x }` * Indentation and function definitions are more compact This change has been generated after installing dhall v1.33 using this command: find . -name "*.dhall" -exec dhall --ascii format --inplace {} \; Change-Id: I3b6560f26e28622aa51150dc8083d127d89a8a7b
This commit is contained in:
parent
0fbffe66f2
commit
06b4062e4b
@ -1,10 +1,10 @@
|
||||
FROM quay.io/operator-framework/ansible-operator:v0.13.0
|
||||
|
||||
# dhall versions and digests
|
||||
ARG DHALL_VERSION=1.30.0
|
||||
ARG DHALL_JSON_VERSION=1.6.2
|
||||
ARG DHALL_JSON_DIGEST=ea37627c4e19789af33def099d4cb145b874c03b4d5b98cb33ce06be1debf4f3
|
||||
ARG DHALL_LANG_REF=v14.0.0
|
||||
ARG DHALL_VERSION=1.33.1
|
||||
ARG DHALL_JSON_VERSION=1.7.0
|
||||
ARG DHALL_JSON_DIGEST=cc9fc70e492d35a3986183b589a435653e782f67cda51d33a935dff1ddd15aec
|
||||
ARG DHALL_LANG_REF=v17.0.0
|
||||
ARG DHALL_KUBE_REF=v4.0.0
|
||||
|
||||
# kubectl versions and digests
|
||||
|
@ -56,9 +56,4 @@ let Union =
|
||||
| Certificate : Certificate.Type
|
||||
>
|
||||
|
||||
in { IssuerSpec = IssuerSpec
|
||||
, Issuer = Issuer
|
||||
, CertificateSpec = CertificateSpec
|
||||
, Certificate = Certificate
|
||||
, Union = Union
|
||||
}
|
||||
in { IssuerSpec, Issuer, CertificateSpec, Certificate, Union }
|
||||
|
@ -24,5 +24,5 @@
|
||||
* https://github.com/dhall-lang/dhall-nethack/blob/master/Prelude.dhall
|
||||
-}
|
||||
env:DHALL_PRELUDE
|
||||
? https://prelude.dhall-lang.org/v13.0.0/package.dhall sha256:4aa8581954f7734d09b7b21fddbf5d8df901a44b54b4ef26ea71db92de0b1a12
|
||||
? https://prelude.dhall-lang.org/v13.0.0/package.dhall
|
||||
? https://prelude.dhall-lang.org/v17.0.0/package.dhall sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e
|
||||
? https://prelude.dhall-lang.org/v17.0.0/package.dhall
|
||||
|
@ -4,11 +4,11 @@ let F = ../functions.dhall
|
||||
|
||||
let db-volumes = [ F.Volume::{ name = "pg-data", dir = "/var/lib/pg/" } ]
|
||||
|
||||
in \(app-name : Text)
|
||||
-> \ ( db-internal-password-env
|
||||
in \(app-name : Text) ->
|
||||
\ ( db-internal-password-env
|
||||
: forall (env-name : Text) -> List Kubernetes.EnvVar.Type
|
||||
)
|
||||
-> F.KubernetesComponent::{
|
||||
) ->
|
||||
F.KubernetesComponent::{
|
||||
, Service = Some (F.mkService app-name "db" "pg" 5432)
|
||||
, StatefulSet = Some
|
||||
( F.mkStatefulSet
|
||||
|
@ -6,13 +6,13 @@ let InputExecutor = (../input.dhall).Executor.Type
|
||||
|
||||
let JobVolume = (../input.dhall).JobVolume.Type
|
||||
|
||||
in \(app-name : Text)
|
||||
-> \(input-executor : InputExecutor)
|
||||
-> \(data-dir : List F.Volume.Type)
|
||||
-> \(volumes : List F.Volume.Type)
|
||||
-> \(env : List Kubernetes.EnvVar.Type)
|
||||
-> \(jobVolumes : Optional (List JobVolume))
|
||||
-> F.KubernetesComponent::{
|
||||
in \(app-name : Text) ->
|
||||
\(input-executor : InputExecutor) ->
|
||||
\(data-dir : List F.Volume.Type) ->
|
||||
\(volumes : List F.Volume.Type) ->
|
||||
\(env : List Kubernetes.EnvVar.Type) ->
|
||||
\(jobVolumes : Optional (List JobVolume)) ->
|
||||
F.KubernetesComponent::{
|
||||
, Service = Some (F.mkService app-name "executor" "finger" 7900)
|
||||
, StatefulSet = Some
|
||||
( F.mkStatefulSet
|
||||
@ -20,8 +20,8 @@ in \(app-name : Text)
|
||||
F.Component::{
|
||||
, name = "executor"
|
||||
, count = 1
|
||||
, data-dir = data-dir
|
||||
, volumes = volumes
|
||||
, data-dir
|
||||
, volumes
|
||||
, extra-volumes =
|
||||
let job-volumes =
|
||||
F.mkJobVolume
|
||||
@ -47,8 +47,8 @@ in \(app-name : Text)
|
||||
let job-volumes-mount =
|
||||
F.mkJobVolume
|
||||
F.Volume.Type
|
||||
( \(job-volume : JobVolume)
|
||||
-> F.Volume::{
|
||||
( \(job-volume : JobVolume) ->
|
||||
F.Volume::{
|
||||
, name = job-volume.volume.name
|
||||
, dir = job-volume.dir
|
||||
}
|
||||
|
@ -4,20 +4,20 @@ let F = ../functions.dhall
|
||||
|
||||
let InputMerger = (../input.dhall).Merger.Type
|
||||
|
||||
in \(app-name : Text)
|
||||
-> \(input-merger : InputMerger)
|
||||
-> \(data-dir : List F.Volume.Type)
|
||||
-> \(volumes : List F.Volume.Type)
|
||||
-> \(env : List Kubernetes.EnvVar.Type)
|
||||
-> F.KubernetesComponent::{
|
||||
in \(app-name : Text) ->
|
||||
\(input-merger : InputMerger) ->
|
||||
\(data-dir : List F.Volume.Type) ->
|
||||
\(volumes : List F.Volume.Type) ->
|
||||
\(env : List Kubernetes.EnvVar.Type) ->
|
||||
F.KubernetesComponent::{
|
||||
, Deployment = Some
|
||||
( F.mkDeployment
|
||||
app-name
|
||||
F.Component::{
|
||||
, name = "merger"
|
||||
, count = 1
|
||||
, data-dir = data-dir
|
||||
, volumes = volumes
|
||||
, data-dir
|
||||
, volumes
|
||||
, container = Kubernetes.Container::{
|
||||
, name = "merger"
|
||||
, image = input-merger.image
|
||||
|
@ -4,10 +4,10 @@ let F = ../functions.dhall
|
||||
|
||||
let InputPreview = (../input.dhall).Preview.Type
|
||||
|
||||
in \(app-name : Text)
|
||||
-> \(input-preview : InputPreview)
|
||||
-> \(data-dir : List F.Volume.Type)
|
||||
-> F.KubernetesComponent::{
|
||||
in \(app-name : Text) ->
|
||||
\(input-preview : InputPreview) ->
|
||||
\(data-dir : List F.Volume.Type) ->
|
||||
F.KubernetesComponent::{
|
||||
, Service = Some (F.mkService app-name "preview" "preview" 80)
|
||||
, Deployment = Some
|
||||
( F.mkDeployment
|
||||
@ -15,7 +15,7 @@ in \(app-name : Text)
|
||||
F.Component::{
|
||||
, name = "preview"
|
||||
, count = F.defaultNat input-preview.count 0
|
||||
, data-dir = data-dir
|
||||
, data-dir
|
||||
, container = Kubernetes.Container::{
|
||||
, name = "preview"
|
||||
, image = input-preview.image
|
||||
|
@ -7,33 +7,33 @@ let F = ../functions.dhall
|
||||
let InputRegistry = (../input.dhall).Registry.Type
|
||||
|
||||
let registry-volumes =
|
||||
\(app-name : Text)
|
||||
-> [ F.Volume::{
|
||||
\(app-name : Text) ->
|
||||
[ F.Volume::{
|
||||
, name = app-name ++ "-registry-tls"
|
||||
, dir = "/etc/zuul-registry"
|
||||
}
|
||||
]
|
||||
|
||||
let registry-env =
|
||||
\(app-name : Text)
|
||||
-> F.mkEnvVarSecret
|
||||
\(app-name : Text) ->
|
||||
F.mkEnvVarSecret
|
||||
( Prelude.List.map
|
||||
Text
|
||||
F.EnvSecret
|
||||
( \(key : Text)
|
||||
-> { name = "ZUUL_REGISTRY_${key}"
|
||||
, key = key
|
||||
( \(key : Text) ->
|
||||
{ name = "ZUUL_REGISTRY_${key}"
|
||||
, key
|
||||
, secret = "${app-name}-registry-user-rw"
|
||||
}
|
||||
)
|
||||
[ "secret", "username", "password" ]
|
||||
)
|
||||
|
||||
in \(app-name : Text)
|
||||
-> \(input-registry : InputRegistry)
|
||||
-> \(data-dir : List F.Volume.Type)
|
||||
-> \(volumes : List F.Volume.Type)
|
||||
-> F.KubernetesComponent::{
|
||||
in \(app-name : Text) ->
|
||||
\(input-registry : InputRegistry) ->
|
||||
\(data-dir : List F.Volume.Type) ->
|
||||
\(volumes : List F.Volume.Type) ->
|
||||
F.KubernetesComponent::{
|
||||
, Service = Some (F.mkService app-name "registry" "registry" 9000)
|
||||
, StatefulSet = Some
|
||||
( F.mkStatefulSet
|
||||
@ -41,18 +41,14 @@ in \(app-name : Text)
|
||||
F.Component::{
|
||||
, name = "registry"
|
||||
, count = F.defaultNat input-registry.count 0
|
||||
, data-dir = data-dir
|
||||
, data-dir
|
||||
, volumes = volumes # registry-volumes app-name
|
||||
, claim-size = F.defaultNat input-registry.storage-size 20
|
||||
, container = Kubernetes.Container::{
|
||||
, name = "registry"
|
||||
, image = input-registry.image
|
||||
, args = Some
|
||||
[ "zuul-registry"
|
||||
, "-c"
|
||||
, "/etc/zuul/registry.yaml"
|
||||
, "serve"
|
||||
]
|
||||
[ "zuul-registry", "-c", "/etc/zuul/registry.yaml", "serve" ]
|
||||
, imagePullPolicy = Some "IfNotPresent"
|
||||
, ports = Some
|
||||
[ Kubernetes.ContainerPort::{
|
||||
|
@ -4,12 +4,12 @@ let F = ../functions.dhall
|
||||
|
||||
let InputScheduler = (../input.dhall).Scheduler.Type
|
||||
|
||||
in \(app-name : Text)
|
||||
-> \(input-scheduler : InputScheduler)
|
||||
-> \(data-dir : List F.Volume.Type)
|
||||
-> \(volumes : List F.Volume.Type)
|
||||
-> \(env : List Kubernetes.EnvVar.Type)
|
||||
-> F.KubernetesComponent::{
|
||||
in \(app-name : Text) ->
|
||||
\(input-scheduler : InputScheduler) ->
|
||||
\(data-dir : List F.Volume.Type) ->
|
||||
\(volumes : List F.Volume.Type) ->
|
||||
\(env : List Kubernetes.EnvVar.Type) ->
|
||||
F.KubernetesComponent::{
|
||||
, Service = Some (F.mkService app-name "scheduler" "gearman" 4730)
|
||||
, StatefulSet = Some
|
||||
( F.mkStatefulSet
|
||||
@ -17,8 +17,8 @@ in \(app-name : Text)
|
||||
F.Component::{
|
||||
, name = "scheduler"
|
||||
, count = 1
|
||||
, data-dir = data-dir
|
||||
, volumes = volumes
|
||||
, data-dir
|
||||
, volumes
|
||||
, claim-size = 5
|
||||
, container = Kubernetes.Container::{
|
||||
, name = "scheduler"
|
||||
|
@ -4,12 +4,12 @@ let F = ../functions.dhall
|
||||
|
||||
let InputWeb = (../input.dhall).Web.Type
|
||||
|
||||
in \(app-name : Text)
|
||||
-> \(input-web : InputWeb)
|
||||
-> \(data-dir : List F.Volume.Type)
|
||||
-> \(volumes : List F.Volume.Type)
|
||||
-> \(env : List Kubernetes.EnvVar.Type)
|
||||
-> F.KubernetesComponent::{
|
||||
in \(app-name : Text) ->
|
||||
\(input-web : InputWeb) ->
|
||||
\(data-dir : List F.Volume.Type) ->
|
||||
\(volumes : List F.Volume.Type) ->
|
||||
\(env : List Kubernetes.EnvVar.Type) ->
|
||||
F.KubernetesComponent::{
|
||||
, Service = Some (F.mkService app-name "web" "api" 9000)
|
||||
, Deployment = Some
|
||||
( F.mkDeployment
|
||||
@ -17,8 +17,8 @@ in \(app-name : Text)
|
||||
F.Component::{
|
||||
, name = "web"
|
||||
, count = 1
|
||||
, data-dir = data-dir
|
||||
, volumes = volumes
|
||||
, data-dir
|
||||
, volumes
|
||||
, container = Kubernetes.Container::{
|
||||
, name = "web"
|
||||
, image = input-web.image
|
||||
|
@ -10,9 +10,9 @@ let data-volumes =
|
||||
, F.Volume::{ name = "zk-dat", dir = "/var/lib/zookeeper/" }
|
||||
]
|
||||
|
||||
in \(app-name : Text)
|
||||
-> \(client-conf : List F.Volume.Type)
|
||||
-> F.KubernetesComponent::{
|
||||
in \(app-name : Text) ->
|
||||
\(client-conf : List F.Volume.Type) ->
|
||||
F.KubernetesComponent::{
|
||||
, Service = Some (F.mkService app-name "zk" "zk" 2281)
|
||||
, StatefulSet = Some
|
||||
( F.mkStatefulSet
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
TODO: replace opaque Text by structured zk host list and tls configuration
|
||||
-}
|
||||
\(zk-host : Text)
|
||||
-> ''
|
||||
\(zk-host : Text) ->
|
||||
''
|
||||
${zk-host}
|
||||
|
||||
webapp:
|
||||
|
@ -1,8 +1,8 @@
|
||||
{- This function converts a public-url Text to a registry.yaml file content
|
||||
|
||||
-}
|
||||
\(public-url : Text)
|
||||
-> ''
|
||||
\(public-url : Text) ->
|
||||
''
|
||||
registry:
|
||||
address: '0.0.0.0'
|
||||
port: 9000
|
||||
|
@ -1,8 +1,8 @@
|
||||
{- This function converts a client-dir and server-dir Text to a zoo.cfg file content
|
||||
-}
|
||||
\(client-dir : Text)
|
||||
-> \(server-dir : Text)
|
||||
-> ''
|
||||
\(client-dir : Text) ->
|
||||
\(server-dir : Text) ->
|
||||
''
|
||||
dataDir=/data
|
||||
dataLogDir=/datalog
|
||||
tickTime=2000
|
||||
|
@ -3,9 +3,9 @@
|
||||
TODO: replace input schemas by the required attributes.
|
||||
-}
|
||||
|
||||
\(input : (../input.dhall).Input.Type)
|
||||
-> \(zk-hosts : Text)
|
||||
-> let Prelude = ../../Prelude.dhall
|
||||
\(input : (../input.dhall).Input.Type) ->
|
||||
\(zk-hosts : Text) ->
|
||||
let Prelude = ../../Prelude.dhall
|
||||
|
||||
let Schemas = ../input.dhall
|
||||
|
||||
@ -18,14 +18,12 @@ TODO: replace input schemas by the required attributes.
|
||||
|
||||
Then it returns a text blob for all the connections
|
||||
-} mkConns =
|
||||
\(type : Type)
|
||||
-> \(list : Optional (List type))
|
||||
-> \(f : type -> Text)
|
||||
-> F.newlineSep
|
||||
\(type : Type) ->
|
||||
\(list : Optional (List type)) ->
|
||||
\(f : type -> Text) ->
|
||||
F.newlineSep
|
||||
( merge
|
||||
{ None = [] : List Text
|
||||
, Some = Prelude.List.map type Text f
|
||||
}
|
||||
{ None = [] : List Text, Some = Prelude.List.map type Text f }
|
||||
list
|
||||
)
|
||||
|
||||
@ -53,8 +51,8 @@ TODO: replace input schemas by the required attributes.
|
||||
mkConns
|
||||
Schemas.Gerrit.Type
|
||||
input.connections.gerrits
|
||||
( \(gerrit : Schemas.Gerrit.Type)
|
||||
-> let key = F.defaultText gerrit.sshkey.key "id_rsa"
|
||||
( \(gerrit : Schemas.Gerrit.Type) ->
|
||||
let key = F.defaultText gerrit.sshkey.key "id_rsa"
|
||||
|
||||
let server = F.defaultText gerrit.server gerrit.name
|
||||
|
||||
@ -72,8 +70,8 @@ TODO: replace input schemas by the required attributes.
|
||||
mkConns
|
||||
Schemas.GitHub.Type
|
||||
input.connections.githubs
|
||||
( \(github : Schemas.GitHub.Type)
|
||||
-> let key = F.defaultText github.app_key.key "github_rsa"
|
||||
( \(github : Schemas.GitHub.Type) ->
|
||||
let key = F.defaultText github.app_key.key "github_rsa"
|
||||
|
||||
in ''
|
||||
[connection ${github.name}]
|
||||
@ -88,8 +86,8 @@ TODO: replace input schemas by the required attributes.
|
||||
mkConns
|
||||
Schemas.Git.Type
|
||||
input.connections.gits
|
||||
( \(git : Schemas.Git.Type)
|
||||
-> ''
|
||||
( \(git : Schemas.Git.Type) ->
|
||||
''
|
||||
[connection ${git.name}]
|
||||
driver=git
|
||||
baseurl=${git.baseurl}
|
||||
@ -101,8 +99,8 @@ TODO: replace input schemas by the required attributes.
|
||||
mkConns
|
||||
Schemas.Mqtt.Type
|
||||
input.connections.mqtts
|
||||
( \(mqtt : Schemas.Mqtt.Type)
|
||||
-> let user =
|
||||
( \(mqtt : Schemas.Mqtt.Type) ->
|
||||
let user =
|
||||
merge
|
||||
{ None = "", Some = \(some : Text) -> "user=${some}" }
|
||||
mqtt.user
|
||||
@ -111,8 +109,8 @@ TODO: replace input schemas by the required attributes.
|
||||
merge
|
||||
{ None = ""
|
||||
, Some =
|
||||
\(some : Schemas.UserSecret.Type)
|
||||
-> "password=%(ZUUL_MQTT_PASSWORD)"
|
||||
\(some : Schemas.UserSecret.Type) ->
|
||||
"password=%(ZUUL_MQTT_PASSWORD)"
|
||||
}
|
||||
mqtt.password
|
||||
|
||||
@ -128,8 +126,8 @@ TODO: replace input schemas by the required attributes.
|
||||
let job-volumes =
|
||||
F.mkJobVolume
|
||||
Text
|
||||
( \(job-volume : Schemas.JobVolume.Type)
|
||||
-> let {- TODO: add support for abritary lists of path per (context, access)
|
||||
( \(job-volume : Schemas.JobVolume.Type) ->
|
||||
let {- TODO: add support for abritary lists of path per (context, access)
|
||||
-} context =
|
||||
merge
|
||||
{ trusted = "trusted", untrusted = "untrusted" }
|
||||
@ -139,8 +137,8 @@ TODO: replace input schemas by the required attributes.
|
||||
merge
|
||||
{ None = "ro"
|
||||
, Some =
|
||||
\(access : < ro | rw >)
|
||||
-> merge { ro = "ro", rw = "rw" } access
|
||||
\(access : < ro | rw >) ->
|
||||
merge { ro = "ro", rw = "rw" } access
|
||||
}
|
||||
job-volume.access
|
||||
|
||||
|
@ -16,45 +16,45 @@ let {- This methods process the optional input.job-volumes list. It takes:
|
||||
|
||||
Then it returns a list of the output type
|
||||
-} mkJobVolume =
|
||||
\(OutputType : Type)
|
||||
-> \(f : JobVolume -> OutputType)
|
||||
-> \(job-volumes : Optional (List JobVolume))
|
||||
-> merge
|
||||
\(OutputType : Type) ->
|
||||
\(f : JobVolume -> OutputType) ->
|
||||
\(job-volumes : Optional (List JobVolume)) ->
|
||||
merge
|
||||
{ None = [] : List OutputType
|
||||
, Some = Prelude.List.map JobVolume OutputType f
|
||||
}
|
||||
job-volumes
|
||||
|
||||
let defaultNat =
|
||||
\(value : Optional Natural)
|
||||
-> \(default : Natural)
|
||||
-> merge { None = default, Some = \(some : Natural) -> some } value
|
||||
\(value : Optional Natural) ->
|
||||
\(default : Natural) ->
|
||||
merge { None = default, Some = \(some : Natural) -> some } value
|
||||
|
||||
let defaultText =
|
||||
\(value : Optional Text)
|
||||
-> \(default : Text)
|
||||
-> merge { None = default, Some = \(some : Text) -> some } value
|
||||
\(value : Optional Text) ->
|
||||
\(default : Text) ->
|
||||
merge { None = default, Some = \(some : Text) -> some } value
|
||||
|
||||
let defaultKey =
|
||||
\(secret : Optional UserSecret)
|
||||
-> \(default : Text)
|
||||
-> merge
|
||||
\(secret : Optional UserSecret) ->
|
||||
\(default : Text) ->
|
||||
merge
|
||||
{ None = default
|
||||
, Some = \(some : UserSecret) -> defaultText some.key default
|
||||
}
|
||||
secret
|
||||
|
||||
let mkAppLabels =
|
||||
\(app-name : Text)
|
||||
-> [ { mapKey = "app.kubernetes.io/name", mapValue = app-name }
|
||||
\(app-name : Text) ->
|
||||
[ { mapKey = "app.kubernetes.io/name", mapValue = app-name }
|
||||
, { mapKey = "app.kubernetes.io/instance", mapValue = app-name }
|
||||
, { mapKey = "app.kubernetes.io/part-of", mapValue = "zuul" }
|
||||
]
|
||||
|
||||
let mkComponentLabel =
|
||||
\(app-name : Text)
|
||||
-> \(component-name : Text)
|
||||
-> mkAppLabels app-name
|
||||
\(app-name : Text) ->
|
||||
\(component-name : Text) ->
|
||||
mkAppLabels app-name
|
||||
# [ { mapKey = "app.kubernetes.io/component"
|
||||
, mapValue = component-name
|
||||
}
|
||||
@ -65,20 +65,20 @@ let Label = { mapKey : Text, mapValue : Text }
|
||||
let Labels = List Label
|
||||
|
||||
let mkObjectMeta =
|
||||
\(name : Text)
|
||||
-> \(labels : Labels)
|
||||
-> Kubernetes.ObjectMeta::{ name = name, labels = Some labels }
|
||||
\(name : Text) ->
|
||||
\(labels : Labels) ->
|
||||
Kubernetes.ObjectMeta::{ name, labels = Some labels }
|
||||
|
||||
let mkSelector =
|
||||
\(labels : Labels)
|
||||
-> Kubernetes.LabelSelector::{ matchLabels = Some labels }
|
||||
\(labels : Labels) ->
|
||||
Kubernetes.LabelSelector::{ matchLabels = Some labels }
|
||||
|
||||
let mkService =
|
||||
\(app-name : Text)
|
||||
-> \(name : Text)
|
||||
-> \(port-name : Text)
|
||||
-> \(port : Natural)
|
||||
-> let labels = mkComponentLabel app-name name
|
||||
\(app-name : Text) ->
|
||||
\(name : Text) ->
|
||||
\(port-name : Text) ->
|
||||
\(port : Natural) ->
|
||||
let labels = mkComponentLabel app-name name
|
||||
|
||||
in Kubernetes.Service::{
|
||||
, metadata = mkObjectMeta name labels
|
||||
@ -89,9 +89,8 @@ let mkService =
|
||||
[ Kubernetes.ServicePort::{
|
||||
, name = Some port-name
|
||||
, protocol = Some "TCP"
|
||||
, targetPort = Some
|
||||
(Kubernetes.IntOrString.String port-name)
|
||||
, port = port
|
||||
, targetPort = Some (Kubernetes.IntOrString.String port-name)
|
||||
, port
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -143,8 +142,8 @@ let mkVolumeEmptyDir =
|
||||
Prelude.List.map
|
||||
Volume.Type
|
||||
Kubernetes.Volume.Type
|
||||
( \(volume : Volume.Type)
|
||||
-> Kubernetes.Volume::{
|
||||
( \(volume : Volume.Type) ->
|
||||
Kubernetes.Volume::{
|
||||
, name = volume.name
|
||||
, emptyDir = Some Kubernetes.EmptyDirVolumeSource::{=}
|
||||
}
|
||||
@ -154,8 +153,8 @@ let mkVolumeSecret =
|
||||
Prelude.List.map
|
||||
Volume.Type
|
||||
Kubernetes.Volume.Type
|
||||
( \(volume : Volume.Type)
|
||||
-> Kubernetes.Volume::{
|
||||
( \(volume : Volume.Type) ->
|
||||
Kubernetes.Volume::{
|
||||
, name = volume.name
|
||||
, secret = Some Kubernetes.SecretVolumeSource::{
|
||||
, secretName = Some volume.name
|
||||
@ -165,9 +164,9 @@ let mkVolumeSecret =
|
||||
)
|
||||
|
||||
let mkPodTemplateSpec =
|
||||
\(component : Component.Type)
|
||||
-> \(labels : Labels)
|
||||
-> Kubernetes.PodTemplateSpec::{
|
||||
\(component : Component.Type) ->
|
||||
\(labels : Labels) ->
|
||||
Kubernetes.PodTemplateSpec::{
|
||||
, metadata = mkObjectMeta component.name labels
|
||||
, spec = Some Kubernetes.PodSpec::{
|
||||
, volumes = Some
|
||||
@ -181,17 +180,15 @@ let mkPodTemplateSpec =
|
||||
}
|
||||
|
||||
let mkStatefulSet =
|
||||
\(app-name : Text)
|
||||
-> \(component : Component.Type)
|
||||
-> let labels = mkComponentLabel app-name component.name
|
||||
\(app-name : Text) ->
|
||||
\(component : Component.Type) ->
|
||||
let labels = mkComponentLabel app-name component.name
|
||||
|
||||
let component-name = app-name ++ "-" ++ component.name
|
||||
|
||||
let claim =
|
||||
if Natural/isZero component.claim-size
|
||||
|
||||
then [] : List Kubernetes.PersistentVolumeClaim.Type
|
||||
|
||||
else [ Kubernetes.PersistentVolumeClaim::{
|
||||
, apiVersion = ""
|
||||
, kind = ""
|
||||
@ -204,8 +201,7 @@ let mkStatefulSet =
|
||||
, requests = Some
|
||||
( toMap
|
||||
{ storage =
|
||||
Natural/show component.claim-size
|
||||
++ "Gi"
|
||||
Natural/show component.claim-size ++ "Gi"
|
||||
}
|
||||
)
|
||||
}
|
||||
@ -225,9 +221,9 @@ let mkStatefulSet =
|
||||
}
|
||||
|
||||
let mkDeployment =
|
||||
\(app-name : Text)
|
||||
-> \(component : Component.Type)
|
||||
-> let labels = mkComponentLabel app-name component.name
|
||||
\(app-name : Text) ->
|
||||
\(component : Component.Type) ->
|
||||
let labels = mkComponentLabel app-name component.name
|
||||
|
||||
let component-name = app-name ++ "-" ++ component.name
|
||||
|
||||
@ -244,19 +240,16 @@ let mkEnvVarValue =
|
||||
Prelude.List.map
|
||||
Label
|
||||
Kubernetes.EnvVar.Type
|
||||
( \(env : Label)
|
||||
-> Kubernetes.EnvVar::{
|
||||
, name = env.mapKey
|
||||
, value = Some env.mapValue
|
||||
}
|
||||
( \(env : Label) ->
|
||||
Kubernetes.EnvVar::{ name = env.mapKey, value = Some env.mapValue }
|
||||
)
|
||||
|
||||
let mkEnvVarSecret =
|
||||
Prelude.List.map
|
||||
EnvSecret
|
||||
Kubernetes.EnvVar.Type
|
||||
( \(env : EnvSecret)
|
||||
-> Kubernetes.EnvVar::{
|
||||
( \(env : EnvSecret) ->
|
||||
Kubernetes.EnvVar::{
|
||||
, name = env.name
|
||||
, valueFrom = Some Kubernetes.EnvVarSource::{
|
||||
, secretKeyRef = Some Kubernetes.SecretKeySelector::{
|
||||
@ -271,31 +264,31 @@ let mkVolumeMount =
|
||||
Prelude.List.map
|
||||
Volume.Type
|
||||
Kubernetes.VolumeMount.Type
|
||||
( \(volume : Volume.Type)
|
||||
-> Kubernetes.VolumeMount::{
|
||||
( \(volume : Volume.Type) ->
|
||||
Kubernetes.VolumeMount::{
|
||||
, name = volume.name
|
||||
, mountPath = volume.dir
|
||||
}
|
||||
)
|
||||
|
||||
in { defaultNat = defaultNat
|
||||
, defaultText = defaultText
|
||||
, defaultKey = defaultKey
|
||||
in { defaultNat
|
||||
, defaultText
|
||||
, defaultKey
|
||||
, newlineSep = Prelude.Text.concatSep "\n"
|
||||
, mkJobVolume = mkJobVolume
|
||||
, mkComponentLabel = mkComponentLabel
|
||||
, mkObjectMeta = mkObjectMeta
|
||||
, mkSelector = mkSelector
|
||||
, mkService = mkService
|
||||
, mkDeployment = mkDeployment
|
||||
, mkStatefulSet = mkStatefulSet
|
||||
, mkVolumeMount = mkVolumeMount
|
||||
, mkEnvVarValue = mkEnvVarValue
|
||||
, mkEnvVarSecret = mkEnvVarSecret
|
||||
, EnvSecret = EnvSecret
|
||||
, Label = Label
|
||||
, Labels = Labels
|
||||
, Volume = Volume
|
||||
, Component = Component
|
||||
, KubernetesComponent = KubernetesComponent
|
||||
, mkJobVolume
|
||||
, mkComponentLabel
|
||||
, mkObjectMeta
|
||||
, mkSelector
|
||||
, mkService
|
||||
, mkDeployment
|
||||
, mkStatefulSet
|
||||
, mkVolumeMount
|
||||
, mkEnvVarValue
|
||||
, mkEnvVarSecret
|
||||
, EnvSecret
|
||||
, Label
|
||||
, Labels
|
||||
, Volume
|
||||
, Component
|
||||
, KubernetesComponent
|
||||
}
|
||||
|
@ -70,10 +70,7 @@ let Schemas =
|
||||
, status_url : Optional Text
|
||||
}
|
||||
, default =
|
||||
{ image = None Text
|
||||
, count = None Natural
|
||||
, status_url = None Text
|
||||
}
|
||||
{ image = None Text, count = None Natural, status_url = None Text }
|
||||
}
|
||||
, Scheduler =
|
||||
{ Type =
|
||||
@ -175,4 +172,4 @@ let Input =
|
||||
}
|
||||
}
|
||||
|
||||
in Schemas // { Input = Input }
|
||||
in Schemas // { Input }
|
||||
|
@ -54,8 +54,8 @@ let UserSecret = Schemas.UserSecret.Type
|
||||
|
||||
let Volume = F.Volume
|
||||
|
||||
in \(input : Input)
|
||||
-> let zk-conf =
|
||||
in \(input : Input) ->
|
||||
let zk-conf =
|
||||
merge
|
||||
{ None =
|
||||
{ ServiceVolumes =
|
||||
@ -95,8 +95,8 @@ in \(input : Input)
|
||||
, Env = [] : List Kubernetes.EnvVar.Type
|
||||
}
|
||||
, Some =
|
||||
\(some : UserSecret)
|
||||
-> let empty = [] : List Volume.Type
|
||||
\(some : UserSecret) ->
|
||||
let empty = [] : List Volume.Type
|
||||
|
||||
in { ServiceVolumes = empty
|
||||
, ClientVolumes = empty
|
||||
@ -118,8 +118,8 @@ in \(input : Input)
|
||||
input.zookeeper
|
||||
|
||||
let db-internal-password-env =
|
||||
\(env-name : Text)
|
||||
-> F.mkEnvVarSecret
|
||||
\(env-name : Text) ->
|
||||
F.mkEnvVarSecret
|
||||
[ { name = env-name
|
||||
, secret = "${input.name}-database-password"
|
||||
, key = "password"
|
||||
@ -136,9 +136,9 @@ in \(input : Input)
|
||||
let image = \(name : Text) -> "${org}/${name}:${version}"
|
||||
|
||||
let set-image =
|
||||
\(default-name : Text)
|
||||
-> \(input-name : Optional Text)
|
||||
-> { image =
|
||||
\(default-name : Text) ->
|
||||
\(input-name : Optional Text) ->
|
||||
{ image =
|
||||
merge
|
||||
{ None = Some default-name
|
||||
, Some = \(_ : Text) -> input-name
|
||||
@ -199,7 +199,6 @@ in \(input : Input)
|
||||
|
||||
let registry-cert =
|
||||
if registry-enabled
|
||||
|
||||
then [ CertManager.Certificate::{
|
||||
, metadata =
|
||||
F.mkObjectMeta
|
||||
@ -212,12 +211,10 @@ in \(input : Input)
|
||||
, secretName = "${input.name}-registry-tls"
|
||||
, issuerRef = issuer
|
||||
, dnsNames = Some [ "registry" ]
|
||||
, usages = Some
|
||||
[ "server auth", "client auth" ]
|
||||
, usages = Some [ "server auth", "client auth" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
else [] : List CertManager.Certificate.Type
|
||||
|
||||
in { Issuers =
|
||||
@ -264,10 +261,7 @@ in \(input : Input)
|
||||
, metadata =
|
||||
F.mkObjectMeta
|
||||
"${input.name}-gearman-tls"
|
||||
( F.mkComponentLabel
|
||||
input.name
|
||||
"cert-gearman"
|
||||
)
|
||||
(F.mkComponentLabel input.name "cert-gearman")
|
||||
, spec = CertManager.CertificateSpec::{
|
||||
, secretName = "${input.name}-gearman-tls"
|
||||
, issuerRef = issuer
|
||||
@ -286,8 +280,7 @@ in \(input : Input)
|
||||
input.name
|
||||
db-internal-password-env
|
||||
, Some =
|
||||
\(some : UserSecret)
|
||||
-> F.KubernetesComponent.default
|
||||
\(some : UserSecret) -> F.KubernetesComponent.default
|
||||
}
|
||||
input.database
|
||||
, ZooKeeper =
|
||||
@ -297,8 +290,7 @@ in \(input : Input)
|
||||
input.name
|
||||
(zk-conf.ClientVolumes # zk-conf.ServiceVolumes)
|
||||
, Some =
|
||||
\(some : UserSecret)
|
||||
-> F.KubernetesComponent.default
|
||||
\(some : UserSecret) -> F.KubernetesComponent.default
|
||||
}
|
||||
input.zookeeper
|
||||
}
|
||||
@ -313,8 +305,8 @@ in \(input : Input)
|
||||
merge
|
||||
{ None = db-internal-password-env "ZUUL_DB_PASSWORD"
|
||||
, Some =
|
||||
\(some : UserSecret)
|
||||
-> F.mkEnvVarSecret
|
||||
\(some : UserSecret) ->
|
||||
F.mkEnvVarSecret
|
||||
[ { name = "ZUUL_DB_URI"
|
||||
, secret = some.secretName
|
||||
, key = F.defaultText some.key "db_uri"
|
||||
@ -328,8 +320,7 @@ in \(input : Input)
|
||||
F.mkEnvVarValue (toMap { ZUUL_DB_PASSWORD = "unused" })
|
||||
|
||||
let zuul-data-dir =
|
||||
[ Volume::{ name = "zuul-data", dir = "/var/lib/zuul" }
|
||||
]
|
||||
[ Volume::{ name = "zuul-data", dir = "/var/lib/zuul" } ]
|
||||
|
||||
let sched-config =
|
||||
Volume::{
|
||||
@ -424,8 +415,8 @@ in \(input : Input)
|
||||
merge
|
||||
{ None = [] : List Volume.Type
|
||||
, Some =
|
||||
\(some : UserSecret)
|
||||
-> [ Volume::{
|
||||
\(some : UserSecret) ->
|
||||
[ Volume::{
|
||||
, name = some.secretName
|
||||
, dir = "/etc/nodepool-openstack"
|
||||
}
|
||||
@ -437,8 +428,8 @@ in \(input : Input)
|
||||
merge
|
||||
{ None = [] : List Volume.Type
|
||||
, Some =
|
||||
\(some : UserSecret)
|
||||
-> [ Volume::{
|
||||
\(some : UserSecret) ->
|
||||
[ Volume::{
|
||||
, name = some.secretName
|
||||
, dir = "/etc/nodepool-kubernetes"
|
||||
}
|
||||
@ -504,18 +495,16 @@ in \(input : Input)
|
||||
}
|
||||
|
||||
let mkSecret =
|
||||
\(volume : Volume.Type)
|
||||
-> Kubernetes.Resource.Secret
|
||||
\(volume : Volume.Type) ->
|
||||
Kubernetes.Resource.Secret
|
||||
Kubernetes.Secret::{
|
||||
, metadata = Kubernetes.ObjectMeta::{ name = volume.name }
|
||||
, stringData = Some
|
||||
( Prelude.List.map
|
||||
{ path : Text, content : Text }
|
||||
{ mapKey : Text, mapValue : Text }
|
||||
( \(config : { path : Text, content : Text })
|
||||
-> { mapKey = config.path
|
||||
, mapValue = config.content
|
||||
}
|
||||
( \(config : { path : Text, content : Text }) ->
|
||||
{ mapKey = config.path, mapValue = config.content }
|
||||
)
|
||||
volume.files
|
||||
)
|
||||
@ -524,28 +513,28 @@ in \(input : Input)
|
||||
let {- This function transforms the different types into the Kubernetes.Resource
|
||||
union to enable using them inside a single List array
|
||||
-} mkUnion =
|
||||
\(component : F.KubernetesComponent.Type)
|
||||
-> let empty = [] : List Kubernetes.Resource
|
||||
\(component : F.KubernetesComponent.Type) ->
|
||||
let empty = [] : List Kubernetes.Resource
|
||||
|
||||
in merge
|
||||
{ None = empty
|
||||
, Some =
|
||||
\(some : Kubernetes.Service.Type)
|
||||
-> [ Kubernetes.Resource.Service some ]
|
||||
\(some : Kubernetes.Service.Type) ->
|
||||
[ Kubernetes.Resource.Service some ]
|
||||
}
|
||||
component.Service
|
||||
# merge
|
||||
{ None = empty
|
||||
, Some =
|
||||
\(some : Kubernetes.StatefulSet.Type)
|
||||
-> [ Kubernetes.Resource.StatefulSet some ]
|
||||
\(some : Kubernetes.StatefulSet.Type) ->
|
||||
[ Kubernetes.Resource.StatefulSet some ]
|
||||
}
|
||||
component.StatefulSet
|
||||
# merge
|
||||
{ None = empty
|
||||
, Some =
|
||||
\(some : Kubernetes.Deployment.Type)
|
||||
-> [ Kubernetes.Resource.Deployment some ]
|
||||
\(some : Kubernetes.Deployment.Type) ->
|
||||
[ Kubernetes.Resource.Deployment some ]
|
||||
}
|
||||
component.Deployment
|
||||
|
||||
@ -555,15 +544,14 @@ in \(input : Input)
|
||||
Prelude.List.map
|
||||
Kubernetes.Resource
|
||||
CertManager.Union
|
||||
( \(resource : Kubernetes.Resource)
|
||||
-> CertManager.Union.Kubernetes resource
|
||||
( \(resource : Kubernetes.Resource) ->
|
||||
CertManager.Union.Kubernetes resource
|
||||
)
|
||||
|
||||
let {- if cert-manager is enabled, then includes and transforms the CertManager types
|
||||
into the new Union that combines Kubernetes and CertManager resources
|
||||
-} all-certificates =
|
||||
if input.withCertManager
|
||||
|
||||
then Prelude.List.map
|
||||
CertManager.Issuer.Type
|
||||
CertManager.Union
|
||||
@ -574,10 +562,9 @@ in \(input : Input)
|
||||
CertManager.Union
|
||||
CertManager.Union.Certificate
|
||||
Components.CertManager.Certificates
|
||||
|
||||
else [] : List CertManager.Union
|
||||
|
||||
in { Components = Components
|
||||
in { Components
|
||||
, List =
|
||||
{ apiVersion = "v1"
|
||||
, kind = "List"
|
||||
|
Loading…
Reference in New Issue
Block a user