mirror of
https://github.com/dhall-lang/dhall-kubernetes.git
synced 2024-09-10 23:15:30 +03:00
Fix top-level examples (#129)
This commit is contained in:
parent
49fabcc9a1
commit
170c6e86fc
34
README.md
34
README.md
@ -71,7 +71,7 @@ let deployment =
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = Some
|
||||
[ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
[ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -143,7 +143,7 @@ Things to note in the following example:
|
||||
-- examples/ingress.dhall
|
||||
|
||||
let Prelude =
|
||||
../Prelude.dhall sha256:771c7131fc87e13eb18f770a27c59f9418879f7e230ba2a50e46f4461f43ec69
|
||||
../Prelude.dhall sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e
|
||||
|
||||
let map = Prelude.List.map
|
||||
|
||||
@ -156,31 +156,31 @@ let services = [ { name = "foo", host = "foo.example.com", version = "2.3" } ]
|
||||
|
||||
let makeTLS
|
||||
: Service → kubernetes.IngressTLS.Type
|
||||
= λ(service : Service)
|
||||
→ { hosts = Some [ service.host ]
|
||||
= λ(service : Service) →
|
||||
{ hosts = Some [ service.host ]
|
||||
, secretName = Some "${service.name}-certificate"
|
||||
}
|
||||
|
||||
let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
= λ(service : Service) →
|
||||
{ host = Some service.host
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
: List Service → kubernetes.Ingress.Type
|
||||
= λ(inputServices : List Service)
|
||||
→ let annotations =
|
||||
= λ(inputServices : List Service) →
|
||||
let annotations =
|
||||
toMap
|
||||
{ `kubernetes.io/ingress.class` = "nginx"
|
||||
, `kubernetes.io/ingress.allow-http` = "false"
|
||||
@ -238,7 +238,7 @@ apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
kubernetes.io/ingress.allow-http: "false"
|
||||
kubernetes.io/ingress.allow-http: 'false'
|
||||
kubernetes.io/ingress.class: nginx
|
||||
name: nginx
|
||||
spec:
|
||||
|
@ -16,18 +16,11 @@ let heritage = "dhall"
|
||||
in kubernetes.DaemonSet::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
, name = Some fullName
|
||||
, labels = Some
|
||||
( toMap
|
||||
{ app = name
|
||||
, chart = chart
|
||||
, release = release
|
||||
, heritage = heritage
|
||||
}
|
||||
)
|
||||
, labels = Some (toMap { app = name, chart, release, heritage })
|
||||
}
|
||||
, spec = Some kubernetes.DaemonSetSpec::{
|
||||
, selector = kubernetes.LabelSelector::{
|
||||
, matchLabels = Some (toMap { app = name, release = release })
|
||||
, matchLabels = Some (toMap { app = name, release })
|
||||
}
|
||||
, updateStrategy = Some kubernetes.DaemonSetUpdateStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
@ -37,68 +30,68 @@ in kubernetes.DaemonSet::{
|
||||
, name = Some name
|
||||
, annotations = Some
|
||||
(toMap { `scheduler.alpha.kubernetes.io/critical-pod` = "" })
|
||||
, labels = Some (toMap { app = name, release = release })
|
||||
, labels = Some (toMap { app = name, release })
|
||||
}
|
||||
, spec = Some kubernetes.PodSpec::{
|
||||
, hostNetwork = Some True
|
||||
, nodeSelector = Some
|
||||
(toMap { `node-role.kubernetes.io/master` = "" })
|
||||
, tolerations = Some
|
||||
[ kubernetes.Toleration::{
|
||||
, effect = Some "NoSchedule"
|
||||
, key = Some "node-role.kubernetes.io/master"
|
||||
}
|
||||
, kubernetes.Toleration::{
|
||||
, effect = Some "CriticalAddonsOnly"
|
||||
, key = Some "Exists"
|
||||
}
|
||||
]
|
||||
[ 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 = Some
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
[ "server"
|
||||
, "--config=/etc/aws-iam-authenticator/config.yaml"
|
||||
, "--state-dir=/var/aws-iam-authenticator"
|
||||
, "--generate-kubeconfig=/etc/kubernetes/aws-iam-authenticator/kubeconfig.yaml"
|
||||
]
|
||||
, volumeMounts = Some
|
||||
[ 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/"
|
||||
}
|
||||
]
|
||||
[ 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 = Some
|
||||
[ kubernetes.Volume::{
|
||||
, name = "config"
|
||||
, configMap = Some kubernetes.ConfigMapVolumeSource::{
|
||||
, name = Some fullName
|
||||
}
|
||||
[ 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 = "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/"
|
||||
}
|
||||
}
|
||||
, kubernetes.Volume::{
|
||||
, name = "state"
|
||||
, hostPath = Some kubernetes.HostPathVolumeSource::{
|
||||
, path = "/srv/kubernetes/aws-iam-authenticator/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
let Prelude =
|
||||
../Prelude.dhall sha256:771c7131fc87e13eb18f770a27c59f9418879f7e230ba2a50e46f4461f43ec69
|
||||
../Prelude.dhall sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e
|
||||
|
||||
let kubernetes =
|
||||
../package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
|
||||
@ -16,9 +16,9 @@ let deployment =
|
||||
, strategy = Some kubernetes.DeploymentStrategy::{
|
||||
, type = Some "RollingUpdate"
|
||||
, rollingUpdate = Some
|
||||
{ maxSurge = Some (kubernetes.IntOrString.Int 5)
|
||||
, maxUnavailable = Some (kubernetes.IntOrString.Int 0)
|
||||
}
|
||||
{ maxSurge = Some (kubernetes.IntOrString.Int 5)
|
||||
, maxUnavailable = Some (kubernetes.IntOrString.Int 0)
|
||||
}
|
||||
}
|
||||
, template = kubernetes.PodTemplateSpec::{
|
||||
, metadata = kubernetes.ObjectMeta::{
|
||||
@ -32,11 +32,11 @@ let deployment =
|
||||
, image = Some "nginx:1.15.3"
|
||||
, imagePullPolicy = Some "Always"
|
||||
, ports = Some
|
||||
[ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
[ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
, resources = Some
|
||||
{ limits = Some (toMap { cpu = "500m" })
|
||||
, requests = Some (toMap { cpu = "10m" })
|
||||
}
|
||||
{ limits = Some (toMap { cpu = "500m" })
|
||||
, requests = Some (toMap { cpu = "10m" })
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ let deployment =
|
||||
, name = "nginx"
|
||||
, image = Some "nginx:1.15.3"
|
||||
, ports = Some
|
||||
[ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
[ kubernetes.ContainerPort::{ containerPort = 80 } ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
let Prelude =
|
||||
../Prelude.dhall sha256:771c7131fc87e13eb18f770a27c59f9418879f7e230ba2a50e46f4461f43ec69
|
||||
../Prelude.dhall sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e
|
||||
|
||||
let map = Prelude.List.map
|
||||
|
||||
@ -12,31 +12,31 @@ let services = [ { name = "foo", host = "foo.example.com", version = "2.3" } ]
|
||||
|
||||
let makeTLS
|
||||
: Service → kubernetes.IngressTLS.Type
|
||||
= λ(service : Service)
|
||||
→ { hosts = Some [ service.host ]
|
||||
= λ(service : Service) →
|
||||
{ hosts = Some [ service.host ]
|
||||
, secretName = Some "${service.name}-certificate"
|
||||
}
|
||||
|
||||
let makeRule
|
||||
: Service → kubernetes.IngressRule.Type
|
||||
= λ(service : Service)
|
||||
→ { host = Some service.host
|
||||
= λ(service : Service) →
|
||||
{ host = Some service.host
|
||||
, http = Some
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
, path = None Text
|
||||
{ paths =
|
||||
[ { backend =
|
||||
{ serviceName = service.name
|
||||
, servicePort = kubernetes.IntOrString.Int 80
|
||||
}
|
||||
]
|
||||
}
|
||||
, path = None Text
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
let mkIngress
|
||||
: List Service → kubernetes.Ingress.Type
|
||||
= λ(inputServices : List Service)
|
||||
→ let annotations =
|
||||
= λ(inputServices : List Service) →
|
||||
let annotations =
|
||||
toMap
|
||||
{ `kubernetes.io/ingress.class` = "nginx"
|
||||
, `kubernetes.io/ingress.allow-http` = "false"
|
||||
|
@ -15,7 +15,7 @@ spec:
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
scheduler.alpha.kubernetes.io/critical-pod: ""
|
||||
scheduler.alpha.kubernetes.io/critical-pod: ''
|
||||
labels:
|
||||
app: aws-iam-authenticator
|
||||
release: wintering-rodent
|
||||
@ -38,7 +38,7 @@ spec:
|
||||
name: output
|
||||
hostNetwork: true
|
||||
nodeSelector:
|
||||
node-role.kubernetes.io/master: ""
|
||||
node-role.kubernetes.io/master: ''
|
||||
tolerations:
|
||||
- effect: NoSchedule
|
||||
key: node-role.kubernetes.io/master
|
||||
|
@ -27,6 +27,6 @@ spec:
|
||||
- containerPort: 80
|
||||
resources:
|
||||
limits:
|
||||
cpu: 500m
|
||||
cpu: "500m"
|
||||
requests:
|
||||
cpu: 10m
|
||||
cpu: "10m"
|
||||
|
@ -2,7 +2,7 @@ apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
kubernetes.io/ingress.allow-http: "false"
|
||||
kubernetes.io/ingress.allow-http: 'false'
|
||||
kubernetes.io/ingress.class: nginx
|
||||
name: nginx
|
||||
spec:
|
||||
|
@ -1,5 +1,5 @@
|
||||
let Prelude =
|
||||
../Prelude.dhall sha256:771c7131fc87e13eb18f770a27c59f9418879f7e230ba2a50e46f4461f43ec69
|
||||
../Prelude.dhall sha256:10db3c919c25e9046833df897a8ffe2701dc390fa0893d958c3430524be5a43e
|
||||
|
||||
let kubernetes =
|
||||
../package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
|
||||
@ -8,11 +8,11 @@ let spec =
|
||||
{ selector = Some (toMap { app = "nginx" })
|
||||
, type = Some "NodePort"
|
||||
, ports = Some
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
[ kubernetes.ServicePort::{
|
||||
, targetPort = Some (kubernetes.IntOrString.Int 80)
|
||||
, port = 80
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
let service
|
||||
|
Loading…
Reference in New Issue
Block a user