mirror of
https://github.com/dhall-lang/dhall-kubernetes.git
synced 2024-11-03 21:05:47 +03:00
Upgrade to dhall-1.29.0
(#109)
The main motivation for the upgrade is to take advantage of the improved formatting for example code
This commit is contained in:
parent
3c6d09a940
commit
3e160f4a27
@ -58,25 +58,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -91,7 +82,7 @@ in deployment
|
||||
We then run this through `dhall-to-yaml` to generate our Kubernetes definition:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/deploymentSimple.dhall
|
||||
dhall-to-yaml --omit-empty < examples/deploymentSimple.dhall
|
||||
```
|
||||
|
||||
And we get:
|
||||
@ -139,7 +130,7 @@ Things to note in the following example:
|
||||
them over the list of services.
|
||||
- we also defined the list of `services` inline, but you should instead return the
|
||||
`mkIngress` function instead of applying it, so you can do something like
|
||||
`dhall-to-yaml --omitEmpty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
`dhall-to-yaml --omit-empty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
|
||||
```dhall
|
||||
-- examples/ingress.dhall
|
||||
@ -169,8 +160,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -211,8 +201,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
@ -226,7 +215,7 @@ in mkIngress services
|
||||
As before we get the yaml out by running:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/ingress.dhall
|
||||
dhall-to-yaml --omit-empty < examples/ingress.dhall
|
||||
```
|
||||
|
||||
Result:
|
||||
@ -275,7 +264,7 @@ If the objects have the same type, this is very easy: you return a Dhall list co
|
||||
objects, and use the `--documents` flag, e.g.:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --documents --omitEmpty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
dhall-to-yaml --documents --omit-empty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
```
|
||||
|
||||
If the objects are of different type, it's not possible to have separate documents in the same YAML file.
|
||||
|
@ -14,8 +14,7 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
@ -25,30 +24,20 @@ in kubernetes.DaemonSet::{
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
@ -62,8 +51,7 @@ in kubernetes.DaemonSet::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
@ -81,8 +69,7 @@ in kubernetes.DaemonSet::{
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -90,28 +77,20 @@ in kubernetes.DaemonSet::{
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -9,44 +9,32 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, selector =
|
||||
kubernetes.LabelSelector::{ matchLabels = [ kv "app" "nginx" ] }
|
||||
, strategy =
|
||||
Some
|
||||
kubernetes.DeploymentStrategy::{
|
||||
, selector = kubernetes.LabelSelector::{
|
||||
, matchLabels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, strategy = Some kubernetes.DeploymentStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
, rollingUpdate =
|
||||
{ maxSurge = Some (kubernetes.IntOrString.Int 5)
|
||||
, maxUnavailable = Some (kubernetes.IntOrString.Int 0)
|
||||
}
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, imagePullPolicy = Some "Always"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, resources =
|
||||
Some
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
, resources = Some
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
|
@ -4,25 +4,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -65,8 +64,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ let spec =
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
|
@ -58,25 +58,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -91,7 +82,7 @@ in deployment
|
||||
We then run this through `dhall-to-yaml` to generate our Kubernetes definition:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/deploymentSimple.dhall
|
||||
dhall-to-yaml --omit-empty < examples/deploymentSimple.dhall
|
||||
```
|
||||
|
||||
And we get:
|
||||
@ -139,7 +130,7 @@ Things to note in the following example:
|
||||
them over the list of services.
|
||||
- we also defined the list of `services` inline, but you should instead return the
|
||||
`mkIngress` function instead of applying it, so you can do something like
|
||||
`dhall-to-yaml --omitEmpty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
`dhall-to-yaml --omit-empty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
|
||||
```dhall
|
||||
-- examples/ingress.dhall
|
||||
@ -169,8 +160,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -211,8 +201,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
@ -226,7 +215,7 @@ in mkIngress services
|
||||
As before we get the yaml out by running:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/ingress.dhall
|
||||
dhall-to-yaml --omit-empty < examples/ingress.dhall
|
||||
```
|
||||
|
||||
Result:
|
||||
@ -275,7 +264,7 @@ If the objects have the same type, this is very easy: you return a Dhall list co
|
||||
objects, and use the `--documents` flag, e.g.:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --documents --omitEmpty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
dhall-to-yaml --documents --omit-empty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
```
|
||||
|
||||
If the objects are of different type, it's not possible to have separate documents in the same YAML file.
|
||||
|
@ -14,8 +14,7 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
@ -25,30 +24,20 @@ in kubernetes.DaemonSet::{
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
@ -62,8 +51,7 @@ in kubernetes.DaemonSet::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
@ -81,8 +69,7 @@ in kubernetes.DaemonSet::{
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -90,28 +77,20 @@ in kubernetes.DaemonSet::{
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -9,44 +9,32 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, selector =
|
||||
kubernetes.LabelSelector::{ matchLabels = [ kv "app" "nginx" ] }
|
||||
, strategy =
|
||||
Some
|
||||
kubernetes.DeploymentStrategy::{
|
||||
, selector = kubernetes.LabelSelector::{
|
||||
, matchLabels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, strategy = Some kubernetes.DeploymentStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
, rollingUpdate =
|
||||
{ maxSurge = Some (kubernetes.IntOrString.Int 5)
|
||||
, maxUnavailable = Some (kubernetes.IntOrString.Int 0)
|
||||
}
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, imagePullPolicy = Some "Always"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, resources =
|
||||
Some
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
, resources = Some
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
|
@ -4,25 +4,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -65,8 +64,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ let spec =
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
|
@ -58,25 +58,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -91,7 +82,7 @@ in deployment
|
||||
We then run this through `dhall-to-yaml` to generate our Kubernetes definition:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/deploymentSimple.dhall
|
||||
dhall-to-yaml --omit-empty < examples/deploymentSimple.dhall
|
||||
```
|
||||
|
||||
And we get:
|
||||
@ -139,7 +130,7 @@ Things to note in the following example:
|
||||
them over the list of services.
|
||||
- we also defined the list of `services` inline, but you should instead return the
|
||||
`mkIngress` function instead of applying it, so you can do something like
|
||||
`dhall-to-yaml --omitEmpty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
`dhall-to-yaml --omit-empty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
|
||||
```dhall
|
||||
-- examples/ingress.dhall
|
||||
@ -169,8 +160,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -211,8 +201,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
@ -226,7 +215,7 @@ in mkIngress services
|
||||
As before we get the yaml out by running:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/ingress.dhall
|
||||
dhall-to-yaml --omit-empty < examples/ingress.dhall
|
||||
```
|
||||
|
||||
Result:
|
||||
@ -275,7 +264,7 @@ If the objects have the same type, this is very easy: you return a Dhall list co
|
||||
objects, and use the `--documents` flag, e.g.:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --documents --omitEmpty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
dhall-to-yaml --documents --omit-empty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
```
|
||||
|
||||
If the objects are of different type, it's not possible to have separate documents in the same YAML file.
|
||||
|
@ -14,8 +14,7 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
@ -25,30 +24,20 @@ in kubernetes.DaemonSet::{
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
@ -62,8 +51,7 @@ in kubernetes.DaemonSet::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
@ -81,8 +69,7 @@ in kubernetes.DaemonSet::{
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -90,28 +77,20 @@ in kubernetes.DaemonSet::{
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -9,44 +9,32 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, selector =
|
||||
kubernetes.LabelSelector::{ matchLabels = [ kv "app" "nginx" ] }
|
||||
, strategy =
|
||||
Some
|
||||
kubernetes.DeploymentStrategy::{
|
||||
, selector = kubernetes.LabelSelector::{
|
||||
, matchLabels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, strategy = Some kubernetes.DeploymentStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
, rollingUpdate =
|
||||
{ maxSurge = Some (kubernetes.IntOrString.Int 5)
|
||||
, maxUnavailable = Some (kubernetes.IntOrString.Int 0)
|
||||
}
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, imagePullPolicy = Some "Always"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, resources =
|
||||
Some
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
, resources = Some
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
|
@ -4,25 +4,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -65,8 +64,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ let spec =
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
|
@ -58,25 +58,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -91,7 +82,7 @@ in deployment
|
||||
We then run this through `dhall-to-yaml` to generate our Kubernetes definition:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/deploymentSimple.dhall
|
||||
dhall-to-yaml --omit-empty < examples/deploymentSimple.dhall
|
||||
```
|
||||
|
||||
And we get:
|
||||
@ -139,7 +130,7 @@ Things to note in the following example:
|
||||
them over the list of services.
|
||||
- we also defined the list of `services` inline, but you should instead return the
|
||||
`mkIngress` function instead of applying it, so you can do something like
|
||||
`dhall-to-yaml --omitEmpty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
`dhall-to-yaml --omit-empty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
|
||||
```dhall
|
||||
-- examples/ingress.dhall
|
||||
@ -169,8 +160,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -211,8 +201,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
@ -226,7 +215,7 @@ in mkIngress services
|
||||
As before we get the yaml out by running:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/ingress.dhall
|
||||
dhall-to-yaml --omit-empty < examples/ingress.dhall
|
||||
```
|
||||
|
||||
Result:
|
||||
@ -275,7 +264,7 @@ If the objects have the same type, this is very easy: you return a Dhall list co
|
||||
objects, and use the `--documents` flag, e.g.:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --documents --omitEmpty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
dhall-to-yaml --documents --omit-empty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
```
|
||||
|
||||
If the objects are of different type, it's not possible to have separate documents in the same YAML file.
|
||||
|
@ -14,8 +14,7 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
@ -25,30 +24,20 @@ in kubernetes.DaemonSet::{
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
@ -62,8 +51,7 @@ in kubernetes.DaemonSet::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
@ -81,8 +69,7 @@ in kubernetes.DaemonSet::{
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -90,28 +77,20 @@ in kubernetes.DaemonSet::{
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -9,44 +9,32 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, selector =
|
||||
kubernetes.LabelSelector::{ matchLabels = [ kv "app" "nginx" ] }
|
||||
, strategy =
|
||||
Some
|
||||
kubernetes.DeploymentStrategy::{
|
||||
, selector = kubernetes.LabelSelector::{
|
||||
, matchLabels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, strategy = Some kubernetes.DeploymentStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
, rollingUpdate =
|
||||
{ maxSurge = Some (kubernetes.IntOrString.Int 5)
|
||||
, maxUnavailable = Some (kubernetes.IntOrString.Int 0)
|
||||
}
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, imagePullPolicy = Some "Always"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, resources =
|
||||
Some
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
, resources = Some
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
|
@ -4,25 +4,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -65,8 +64,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ let spec =
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
|
@ -58,25 +58,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -91,7 +82,7 @@ in deployment
|
||||
We then run this through `dhall-to-yaml` to generate our Kubernetes definition:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/deploymentSimple.dhall
|
||||
dhall-to-yaml --omit-empty < examples/deploymentSimple.dhall
|
||||
```
|
||||
|
||||
And we get:
|
||||
@ -139,7 +130,7 @@ Things to note in the following example:
|
||||
them over the list of services.
|
||||
- we also defined the list of `services` inline, but you should instead return the
|
||||
`mkIngress` function instead of applying it, so you can do something like
|
||||
`dhall-to-yaml --omitEmpty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
`dhall-to-yaml --omit-empty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
|
||||
```dhall
|
||||
-- examples/ingress.dhall
|
||||
@ -169,8 +160,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -211,8 +201,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
@ -226,7 +215,7 @@ in mkIngress services
|
||||
As before we get the yaml out by running:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/ingress.dhall
|
||||
dhall-to-yaml --omit-empty < examples/ingress.dhall
|
||||
```
|
||||
|
||||
Result:
|
||||
@ -275,7 +264,7 @@ If the objects have the same type, this is very easy: you return a Dhall list co
|
||||
objects, and use the `--documents` flag, e.g.:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --documents --omitEmpty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
dhall-to-yaml --documents --omit-empty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
```
|
||||
|
||||
If the objects are of different type, it's not possible to have separate documents in the same YAML file.
|
||||
|
@ -14,8 +14,7 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
@ -25,30 +24,20 @@ in kubernetes.DaemonSet::{
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
@ -62,8 +51,7 @@ in kubernetes.DaemonSet::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
@ -81,8 +69,7 @@ in kubernetes.DaemonSet::{
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -90,28 +77,20 @@ in kubernetes.DaemonSet::{
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -9,44 +9,32 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, selector =
|
||||
kubernetes.LabelSelector::{ matchLabels = [ kv "app" "nginx" ] }
|
||||
, strategy =
|
||||
Some
|
||||
kubernetes.DeploymentStrategy::{
|
||||
, selector = kubernetes.LabelSelector::{
|
||||
, matchLabels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, strategy = Some kubernetes.DeploymentStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
, rollingUpdate =
|
||||
{ maxSurge = Some (kubernetes.IntOrString.Int 5)
|
||||
, maxUnavailable = Some (kubernetes.IntOrString.Int 0)
|
||||
}
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, imagePullPolicy = Some "Always"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, resources =
|
||||
Some
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
, resources = Some
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
|
@ -4,25 +4,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -65,8 +64,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ let spec =
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
|
@ -58,25 +58,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -91,7 +82,7 @@ in deployment
|
||||
We then run this through `dhall-to-yaml` to generate our Kubernetes definition:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/deploymentSimple.dhall
|
||||
dhall-to-yaml --omit-empty < examples/deploymentSimple.dhall
|
||||
```
|
||||
|
||||
And we get:
|
||||
@ -139,7 +130,7 @@ Things to note in the following example:
|
||||
them over the list of services.
|
||||
- we also defined the list of `services` inline, but you should instead return the
|
||||
`mkIngress` function instead of applying it, so you can do something like
|
||||
`dhall-to-yaml --omitEmpty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
`dhall-to-yaml --omit-empty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
|
||||
```dhall
|
||||
-- examples/ingress.dhall
|
||||
@ -169,8 +160,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -211,8 +201,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
@ -226,7 +215,7 @@ in mkIngress services
|
||||
As before we get the yaml out by running:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/ingress.dhall
|
||||
dhall-to-yaml --omit-empty < examples/ingress.dhall
|
||||
```
|
||||
|
||||
Result:
|
||||
@ -275,7 +264,7 @@ If the objects have the same type, this is very easy: you return a Dhall list co
|
||||
objects, and use the `--documents` flag, e.g.:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --documents --omitEmpty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
dhall-to-yaml --documents --omit-empty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
```
|
||||
|
||||
If the objects are of different type, it's not possible to have separate documents in the same YAML file.
|
||||
|
@ -14,8 +14,7 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
@ -25,30 +24,20 @@ in kubernetes.DaemonSet::{
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
@ -62,8 +51,7 @@ in kubernetes.DaemonSet::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
@ -81,8 +69,7 @@ in kubernetes.DaemonSet::{
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -90,28 +77,20 @@ in kubernetes.DaemonSet::{
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -9,44 +9,32 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, selector =
|
||||
kubernetes.LabelSelector::{ matchLabels = [ kv "app" "nginx" ] }
|
||||
, strategy =
|
||||
Some
|
||||
kubernetes.DeploymentStrategy::{
|
||||
, selector = kubernetes.LabelSelector::{
|
||||
, matchLabels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, strategy = Some kubernetes.DeploymentStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
, rollingUpdate =
|
||||
{ maxSurge = Some (kubernetes.IntOrString.Int 5)
|
||||
, maxUnavailable = Some (kubernetes.IntOrString.Int 0)
|
||||
}
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, imagePullPolicy = Some "Always"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, resources =
|
||||
Some
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
, resources = Some
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
|
@ -4,25 +4,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -65,8 +64,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ let spec =
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
|
23
README.md
23
README.md
@ -58,25 +58,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -169,8 +160,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -211,8 +201,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
|
@ -23,11 +23,11 @@ executable dhall-kubernetes-generator
|
||||
base >= 4.8.2.0 && < 5 ,
|
||||
aeson >= 1.0.0.0 && < 1.5 ,
|
||||
containers >= 0.5.0.0 && < 0.7 ,
|
||||
dhall >= 1.22.0 && < 1.29 ,
|
||||
dhall >= 1.22.0 && < 1.30 ,
|
||||
megaparsec >= 7.0 && < 7.1 ,
|
||||
optparse-applicative >= 0.14.3.0 && < 0.15 ,
|
||||
parser-combinators >= 1.0.3 && < 1.3 ,
|
||||
prettyprinter >= 1.2.0.1 && < 1.6 ,
|
||||
prettyprinter >= 1.2.0.1 && < 1.7 ,
|
||||
sort >= 1.0 && < 1.1 ,
|
||||
text >= 0.11.1.0 && < 1.3 ,
|
||||
turtle >= 1.5.0 && < 1.6 ,
|
||||
|
@ -59,7 +59,7 @@ ${../examples/deploymentSimple.dhall as Text}
|
||||
We then run this through `dhall-to-yaml` to generate our Kubernetes definition:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/deploymentSimple.dhall
|
||||
dhall-to-yaml --omit-empty < examples/deploymentSimple.dhall
|
||||
```
|
||||
|
||||
And we get:
|
||||
@ -92,7 +92,7 @@ Things to note in the following example:
|
||||
them over the list of services.
|
||||
- we also defined the list of `services` inline, but you should instead return the
|
||||
`mkIngress` function instead of applying it, so you can do something like
|
||||
`dhall-to-yaml --omitEmpty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
`dhall-to-yaml --omit-empty <<< "./mkIngress.dhall ./myServices.dhall"`
|
||||
|
||||
```dhall
|
||||
-- examples/ingress.dhall
|
||||
@ -103,7 +103,7 @@ ${../examples/ingress.dhall as Text}
|
||||
As before we get the yaml out by running:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --omitEmpty < examples/ingress.dhall
|
||||
dhall-to-yaml --omit-empty < examples/ingress.dhall
|
||||
```
|
||||
|
||||
Result:
|
||||
@ -124,7 +124,7 @@ If the objects have the same type, this is very easy: you return a Dhall list co
|
||||
objects, and use the `--documents` flag, e.g.:
|
||||
|
||||
```bash
|
||||
dhall-to-yaml --documents --omitEmpty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
dhall-to-yaml --documents --omit-empty <<< "let a = ./examples/deploymentSimple.dhall in [a, a]"
|
||||
```
|
||||
|
||||
If the objects are of different type, it's not possible to have separate documents in the same YAML file.
|
||||
|
@ -14,8 +14,7 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
@ -25,30 +24,20 @@ in kubernetes.DaemonSet::{
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
@ -62,8 +51,7 @@ in kubernetes.DaemonSet::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
@ -81,8 +69,7 @@ in kubernetes.DaemonSet::{
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -90,28 +77,20 @@ in kubernetes.DaemonSet::{
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -9,44 +9,32 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, selector =
|
||||
kubernetes.LabelSelector::{ matchLabels = [ kv "app" "nginx" ] }
|
||||
, strategy =
|
||||
Some
|
||||
kubernetes.DeploymentStrategy::{
|
||||
, selector = kubernetes.LabelSelector::{
|
||||
, matchLabels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, strategy = Some kubernetes.DeploymentStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
, rollingUpdate =
|
||||
{ maxSurge = Some (kubernetes.IntOrString.Int 5)
|
||||
, maxUnavailable = Some (kubernetes.IntOrString.Int 0)
|
||||
}
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, imagePullPolicy = Some "Always"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, resources =
|
||||
Some
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
, resources = Some
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
|
@ -4,25 +4,16 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -23,8 +23,7 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
@ -65,8 +64,7 @@ let mkIngress
|
||||
}
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ let spec =
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
|
20
nix/haskell/cborg-json.nix
Normal file
20
nix/haskell/cborg-json.nix
Normal file
@ -0,0 +1,20 @@
|
||||
{ mkDerivation, aeson, aeson-pretty, base, bytestring, cborg
|
||||
, criterion, deepseq, directory, process, scientific, stdenv, text
|
||||
, unordered-containers, vector, zlib
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "cborg-json";
|
||||
version = "0.2.2.0";
|
||||
sha256 = "ab68a2457cb71a76699d7a8df07a880ea70c51d2c1a891b12669ca9ccfa7517b";
|
||||
libraryHaskellDepends = [
|
||||
aeson aeson-pretty base cborg scientific text unordered-containers
|
||||
vector
|
||||
];
|
||||
benchmarkHaskellDepends = [
|
||||
aeson base bytestring cborg criterion deepseq directory process
|
||||
zlib
|
||||
];
|
||||
homepage = "https://github.com/well-typed/cborg";
|
||||
description = "A library for encoding JSON as CBOR";
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
}
|
29
nix/haskell/dhall-json.nix
Normal file
29
nix/haskell/dhall-json.nix
Normal file
@ -0,0 +1,29 @@
|
||||
{ mkDerivation, aeson, aeson-pretty, aeson-yaml, ansi-terminal
|
||||
, base, bytestring, containers, dhall, exceptions, filepath
|
||||
, optparse-applicative, prettyprinter, prettyprinter-ansi-terminal
|
||||
, scientific, stdenv, tasty, tasty-hunit, text
|
||||
, unordered-containers, vector
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "dhall-json";
|
||||
version = "1.6.1";
|
||||
sha256 = "3ce9b0a9d3a946beb021bb42589426ceb4c44cf5f104e5bdf120659ccb5109c9";
|
||||
revision = "1";
|
||||
editedCabalFile = "07h7vldqd623y7jf15j87mhs3nnbwl3a0121ajqc56qc0vvpgywp";
|
||||
isLibrary = true;
|
||||
isExecutable = true;
|
||||
libraryHaskellDepends = [
|
||||
aeson aeson-pretty aeson-yaml base bytestring containers dhall
|
||||
exceptions filepath optparse-applicative prettyprinter scientific
|
||||
text unordered-containers vector
|
||||
];
|
||||
executableHaskellDepends = [
|
||||
aeson aeson-pretty ansi-terminal base bytestring dhall exceptions
|
||||
optparse-applicative prettyprinter prettyprinter-ansi-terminal text
|
||||
];
|
||||
testHaskellDepends = [
|
||||
aeson base bytestring dhall tasty tasty-hunit text
|
||||
];
|
||||
description = "Convert between Dhall and JSON or YAML";
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
}
|
49
nix/haskell/dhall.nix
Normal file
49
nix/haskell/dhall.nix
Normal file
@ -0,0 +1,49 @@
|
||||
{ mkDerivation, aeson, aeson-pretty, ansi-terminal, atomic-write
|
||||
, base, bytestring, case-insensitive, cborg, cborg-json, containers
|
||||
, contravariant, cryptonite, data-fix, deepseq, Diff, directory
|
||||
, doctest, dotgen, either, exceptions, filepath, foldl, gauge
|
||||
, generic-random, hashable, haskeline, http-client, http-client-tls
|
||||
, http-types, lens-family-core, megaparsec, memory, mockery, mtl
|
||||
, network-uri, optparse-applicative, parsers, pretty-simple
|
||||
, prettyprinter, prettyprinter-ansi-terminal, profunctors
|
||||
, QuickCheck, quickcheck-instances, repline, scientific, semigroups
|
||||
, serialise, special-values, spoon, stdenv, tasty
|
||||
, tasty-expected-failure, tasty-hunit, tasty-quickcheck
|
||||
, template-haskell, text, th-lift-instances, transformers
|
||||
, transformers-compat, turtle, unordered-containers, uri-encode
|
||||
, vector
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "dhall";
|
||||
version = "1.29.0";
|
||||
sha256 = "c73e59717ff15707c77f3ff582f5adf68fc7abc68dbf70aa77ce65333637e7f6";
|
||||
revision = "2";
|
||||
editedCabalFile = "1qksvk63vmypqcd9hasacmqw7gsqcggs5lk85x7w2731mh3c3sa8";
|
||||
isLibrary = true;
|
||||
isExecutable = true;
|
||||
libraryHaskellDepends = [
|
||||
aeson aeson-pretty ansi-terminal atomic-write base bytestring
|
||||
case-insensitive cborg cborg-json containers contravariant
|
||||
cryptonite data-fix deepseq Diff directory dotgen either exceptions
|
||||
filepath hashable haskeline http-client http-client-tls http-types
|
||||
lens-family-core megaparsec memory mtl network-uri
|
||||
optparse-applicative parsers pretty-simple prettyprinter
|
||||
prettyprinter-ansi-terminal profunctors repline scientific
|
||||
serialise template-haskell text th-lift-instances transformers
|
||||
transformers-compat unordered-containers uri-encode vector
|
||||
];
|
||||
executableHaskellDepends = [ base ];
|
||||
testHaskellDepends = [
|
||||
base bytestring cborg containers data-fix deepseq directory doctest
|
||||
either filepath foldl generic-random lens-family-core megaparsec
|
||||
mockery prettyprinter QuickCheck quickcheck-instances scientific
|
||||
semigroups serialise special-values spoon tasty
|
||||
tasty-expected-failure tasty-hunit tasty-quickcheck text
|
||||
transformers turtle unordered-containers vector
|
||||
];
|
||||
benchmarkHaskellDepends = [
|
||||
base bytestring containers directory gauge serialise text
|
||||
];
|
||||
description = "A configuration language guaranteed to terminate";
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
}
|
24
nix/haskell/prettyprinter.nix
Normal file
24
nix/haskell/prettyprinter.nix
Normal file
@ -0,0 +1,24 @@
|
||||
{ mkDerivation, ansi-wl-pprint, base, base-compat, bytestring
|
||||
, containers, deepseq, doctest, gauge, mtl, pgp-wordlist
|
||||
, QuickCheck, quickcheck-instances, random, stdenv, tasty
|
||||
, tasty-hunit, tasty-quickcheck, text, transformers
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "prettyprinter";
|
||||
version = "1.6.0";
|
||||
sha256 = "fdaa85aeaff852c3d96f1ac2a323bc1dd96e0061185d11cdc4d1cdb269f5f2f5";
|
||||
isLibrary = true;
|
||||
isExecutable = true;
|
||||
libraryHaskellDepends = [ base text ];
|
||||
testHaskellDepends = [
|
||||
base bytestring doctest pgp-wordlist QuickCheck
|
||||
quickcheck-instances tasty tasty-hunit tasty-quickcheck text
|
||||
];
|
||||
benchmarkHaskellDepends = [
|
||||
ansi-wl-pprint base base-compat containers deepseq gauge mtl
|
||||
QuickCheck random text transformers
|
||||
];
|
||||
homepage = "http://github.com/quchen/prettyprinter";
|
||||
description = "A modern, easy to use, well-documented, extensible pretty-printer";
|
||||
license = stdenv.lib.licenses.bsd2;
|
||||
}
|
@ -75,7 +75,7 @@ let
|
||||
|
||||
in
|
||||
''echo './${inputFile} → ./${outputFile}'
|
||||
${pkgsNew.dhall-json}/bin/dhall-to-yaml --omitEmpty --file $out/${inputFile} > $out/${outputFile}
|
||||
${pkgsNew.dhall-json}/bin/dhall-to-yaml --omit-empty --file $out/${inputFile} > $out/${outputFile}
|
||||
'';
|
||||
|
||||
checkFile =
|
||||
@ -115,24 +115,30 @@ let
|
||||
previous = old.overrides or (_: _: {});
|
||||
|
||||
packages = pkgsNew.haskell.lib.packageSourceOverrides {
|
||||
dhall = "1.27.0";
|
||||
|
||||
dhall-json = "1.5.0";
|
||||
|
||||
dhall-kubernetes-generator = ../dhall-kubernetes-generator;
|
||||
};
|
||||
|
||||
packagesFromDirectory = pkgsNew.haskell.lib.packagesFromDirectory {
|
||||
directory = ./haskell;
|
||||
};
|
||||
|
||||
manual = haskellPackagesNew: haskellPackagesOld: {
|
||||
dhall = pkgsNew.haskell.lib.dontCheck haskellPackagesOld.dhall;
|
||||
|
||||
dhall-json =
|
||||
pkgsNew.haskell.lib.dontCheck haskellPackagesOld.dhall-json;
|
||||
|
||||
prettyprinter =
|
||||
pkgsNew.haskell.lib.dontCheck haskellPackagesOld.prettyprinter;
|
||||
};
|
||||
|
||||
in
|
||||
pkgsNew.lib.fold pkgsNew.lib.composeExtensions (_: _: {})
|
||||
[ previous
|
||||
packages
|
||||
packagesFromDirectory
|
||||
manual
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user