mirror of
https://github.com/dhall-lang/dhall-kubernetes.git
synced 2024-09-11 07:25: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,30 +58,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
@ -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,17 +160,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -189,15 +179,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -209,13 +199,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
@ -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,108 +14,87 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,52 +9,40 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -4,30 +4,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -23,17 +23,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -43,15 +42,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -63,13 +62,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
|
@ -10,21 +10,20 @@ let spec =
|
||||
{ selector = [ kv "app" "nginx" ]
|
||||
, type = Some "NodePort"
|
||||
, ports =
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec = Some kubernetes.ServiceSpec::spec
|
||||
}
|
||||
|
||||
|
@ -58,30 +58,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
@ -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,17 +160,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -189,15 +179,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -209,13 +199,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
@ -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,108 +14,87 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,52 +9,40 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -4,30 +4,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -23,17 +23,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -43,15 +42,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -63,13 +62,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
|
@ -10,21 +10,20 @@ let spec =
|
||||
{ selector = [ kv "app" "nginx" ]
|
||||
, type = Some "NodePort"
|
||||
, ports =
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec = Some kubernetes.ServiceSpec::spec
|
||||
}
|
||||
|
||||
|
@ -58,30 +58,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
@ -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,17 +160,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -189,15 +179,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -209,13 +199,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
@ -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,108 +14,87 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,52 +9,40 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -4,30 +4,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -23,17 +23,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -43,15 +42,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -63,13 +62,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
|
@ -10,21 +10,20 @@ let spec =
|
||||
{ selector = [ kv "app" "nginx" ]
|
||||
, type = Some "NodePort"
|
||||
, ports =
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec = Some kubernetes.ServiceSpec::spec
|
||||
}
|
||||
|
||||
|
@ -58,30 +58,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
@ -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,17 +160,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -189,15 +179,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -209,13 +199,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
@ -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,108 +14,87 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,52 +9,40 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -4,30 +4,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -23,17 +23,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -43,15 +42,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -63,13 +62,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
|
@ -10,21 +10,20 @@ let spec =
|
||||
{ selector = [ kv "app" "nginx" ]
|
||||
, type = Some "NodePort"
|
||||
, ports =
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec = Some kubernetes.ServiceSpec::spec
|
||||
}
|
||||
|
||||
|
@ -58,30 +58,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
@ -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,17 +160,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -189,15 +179,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -209,13 +199,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
@ -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,108 +14,87 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,52 +9,40 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -4,30 +4,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -23,17 +23,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -43,15 +42,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -63,13 +62,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
|
@ -10,21 +10,20 @@ let spec =
|
||||
{ selector = [ kv "app" "nginx" ]
|
||||
, type = Some "NodePort"
|
||||
, ports =
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec = Some kubernetes.ServiceSpec::spec
|
||||
}
|
||||
|
||||
|
@ -58,30 +58,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
@ -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,17 +160,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -189,15 +179,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -209,13 +199,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
@ -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,108 +14,87 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,52 +9,40 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -4,30 +4,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -23,17 +23,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -43,15 +42,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -63,13 +62,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
|
@ -10,21 +10,20 @@ let spec =
|
||||
{ selector = [ kv "app" "nginx" ]
|
||||
, type = Some "NodePort"
|
||||
, ports =
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec = Some kubernetes.ServiceSpec::spec
|
||||
}
|
||||
|
||||
|
71
README.md
71
README.md
@ -58,30 +58,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
@ -169,17 +160,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -189,15 +179,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -209,13 +199,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
|
@ -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,108 +14,87 @@ let chart = "${name}-${version}"
|
||||
let heritage = "dhall"
|
||||
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = fullName
|
||||
, labels =
|
||||
toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DaemonSetSpec::{
|
||||
, updateStrategy =
|
||||
Some
|
||||
kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
}
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap
|
||||
{ `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector =
|
||||
toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image =
|
||||
Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath =
|
||||
"/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap =
|
||||
Some
|
||||
kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath =
|
||||
Some
|
||||
kubernetes.HostPathVolumeSource::{
|
||||
, path =
|
||||
"/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = name
|
||||
, annotations =
|
||||
toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" }
|
||||
, labels = toMap { app = name, release = release }
|
||||
}
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector = toMap { `node-role.kubernetes.io/master` = "" }
|
||||
, tolerations =
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = fullName
|
||||
, image = Some "gcr.io/heptio-images/authenticator:v0.1.0"
|
||||
, args =
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts =
|
||||
[ kubernetes.VolumeMount::{
|
||||
, name = "config"
|
||||
, mountPath = "/etc/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "state"
|
||||
, mountPath = "/var/aws-iam-authenticator/"
|
||||
}
|
||||
, kubernetes.VolumeMount::{
|
||||
, name = "output"
|
||||
, mountPath = "/etc/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
, volumes =
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "output"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,52 +9,40 @@ let kv = Prelude.JSON.keyText
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, revisionHistoryLimit = Some 10
|
||||
, 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::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, 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
|
||||
{ limits = [ kv "cpu" "500m" ]
|
||||
, requests = [ kv "cpu" "10m" ]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -4,30 +4,21 @@ let kubernetes =
|
||||
let deployment =
|
||||
kubernetes.Deployment::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template =
|
||||
kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec =
|
||||
Some
|
||||
kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports =
|
||||
[ kubernetes.ContainerPort::{
|
||||
, containerPort = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
, spec = Some kubernetes.DeploymentSpec::{
|
||||
, replicas = Some 2
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{ name = "nginx" }
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, containers =
|
||||
[ kubernetes.Container::{
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = [ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in deployment
|
||||
|
@ -23,17 +23,16 @@ let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
, http =
|
||||
Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
@ -43,15 +42,15 @@ let mkIngress
|
||||
[ kv "kubernetes.io/ingress.class" "nginx"
|
||||
, kv "kubernetes.io/ingress.allow-http" "false"
|
||||
]
|
||||
|
||||
|
||||
let defaultService =
|
||||
{ name = "default"
|
||||
, host = "default.example.com"
|
||||
, version = " 1.0"
|
||||
}
|
||||
|
||||
|
||||
let ingressServices = inputServices # [ defaultService ]
|
||||
|
||||
|
||||
let spec =
|
||||
kubernetes.IngressSpec::{
|
||||
, tls =
|
||||
@ -63,13 +62,12 @@ let mkIngress
|
||||
makeRule
|
||||
ingressServices
|
||||
}
|
||||
|
||||
|
||||
in kubernetes.Ingress::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, annotations = annotations
|
||||
}
|
||||
, spec = Some spec
|
||||
}
|
||||
|
||||
|
@ -10,21 +10,20 @@ let spec =
|
||||
{ selector = [ kv "app" "nginx" ]
|
||||
, type = Some "NodePort"
|
||||
, ports =
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
let service
|
||||
: kubernetes.Service.Type
|
||||
= kubernetes.Service::{
|
||||
, metadata =
|
||||
kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = "nginx"
|
||||
, labels = [ kv "app" "nginx" ]
|
||||
}
|
||||
, spec = Some kubernetes.ServiceSpec::spec
|
||||
}
|
||||
|
||||
|
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