Created
July 25, 2019 18:00
-
-
Save sderosiaux/999d40babba171364d34b84b385ff808 to your computer and use it in GitHub Desktop.
Dhall with Kubernetes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let types = /private/tmp/dhall-kubernetes/types.dhall | |
let defaults = /private/tmp/dhall-kubernetes/defaults.dhall | |
let deployment: types.Deployment = | |
defaults.Deployment | |
//{ | |
metadata = defaults.ObjectMeta //{ name = "nginx" }, | |
spec = Some ( | |
defaults.DeploymentSpec | |
//{ | |
replicas = Some 2, | |
template = | |
defaults.PodTemplateSpec | |
//{ | |
metadata = defaults.ObjectMeta //{ name = "nginx" }, | |
spec = Some ( | |
defaults.PodSpec | |
//{ containers = [ | |
defaults.Container | |
//{ | |
name = "nginx", | |
image = Some "nginx:1.15.3", | |
ports = [ defaults.ContainerPort //{ containerPort = 80 } ] | |
} | |
] } | |
) | |
} | |
} | |
) | |
} | |
in deployment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cat test.dhall| dhall-to-yaml --omitEmpty | |
apiVersion: apps/v1 | |
kind: Deployment | |
spec: | |
template: | |
spec: | |
containers: | |
- image: nginx:1.15.3 | |
name: nginx | |
ports: | |
- containerPort: 80 | |
metadata: | |
name: nginx | |
replicas: 2 | |
metadata: | |
name: nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment