diff --git a/README.md b/README.md index 6afc235e..96577438 100644 --- a/README.md +++ b/README.md @@ -189,30 +189,31 @@ in let mkIngress : Config -> Ingress = \(config : Config) -> -- Given a service, make a TLS definition with their host and certificate - let makeTLS = \(service : Service) -> - { hosts = Some [ service.host ] - , secretName = Some "${service.name}-certificate" - } + let makeTLS = \(service : Service) -> + { hosts = Some [ service.host ] + , secretName = Some "${service.name}-certificate" + } -- Given a service, make an Ingress Rule in let makeRule = \(service : Service) -> - { host = Some service.host - , http = Some - { paths = [ { backend = { serviceName = service.name - , servicePort = IntOrString.Int 80 - } - , path = None Text - } - ] - } - } + { host = Some service.host + , http = Some + { paths = [ { backend = + { serviceName = service.name + , servicePort = IntOrString.Int 80 + } + , path = None Text + } + ] + } + } -- Nginx ingress requires a default service as a catchall in let defaultService = - { name = "default" - , host = "default.example.com" - , version = " 1.0" - } + { name = "default" + , host = "default.example.com" + , version = " 1.0" + } -- List of services in let services = config.services # [ defaultService ] @@ -224,22 +225,22 @@ in let mkIngress : Config -> Ingress = in let kv = \(k : Text) -> \(v : Text) -> { mapKey = k, mapValue = v } in let annotations = Some - [ kv "kubernetes.io/ingress.class" "nginx" - , kv "kubernetes.io/ingress.allow-http" "false" - ] + [ kv "kubernetes.io/ingress.class" "nginx" + , kv "kubernetes.io/ingress.allow-http" "false" + ] -- Generate spec from services in let spec = defaultSpec // - { tls = Some (map Service TLS makeTLS services) - , rules = Some (map Service Rule makeRule services) - } + { tls = Some (map Service TLS makeTLS services) + , rules = Some (map Service Rule makeRule services) + } in defaultIngress - { metadata = defaultMeta - { name = "nginx" } // - { annotations = annotations } - } // - { spec = Some spec } + { metadata = defaultMeta + { name = "nginx" } // + { annotations = annotations } + } // + { spec = Some spec } -- Here we import our example service, and generate the ingress with it diff --git a/examples/deploymentRaw.dhall b/examples/deploymentRaw.dhall index b73f0248..6c551f55 100644 --- a/examples/deploymentRaw.dhall +++ b/examples/deploymentRaw.dhall @@ -30,34 +30,34 @@ in let mkDeployment : Config -> Deployment = \(deployment : Config) -> - let selector = Some [{ mapKey = "app", mapValue = deployment.name }] + let selector = Some [{ mapKey = "app", mapValue = deployment.name }] in let spec = defaultSpec - { selector = defaultSelector // { matchLabels = selector } - , template = defaultTemplate - { metadata = defaultMeta - { name = deployment.name } // { labels = selector } - } // - { spec = Some (defaultPodSpec - { containers = [ - defaultContainer - { name = deployment.name } // - { image = Some "your-container-service.io/${deployment.name}:${deployment.version}" - , imagePullPolicy = Some "Always" - , ports = Some [(defaultContainerPort {containerPort = 8080})] - } - ] - }) - } - } // - { replicas = Some 2 - , revisionHistoryLimit = Some 10 - } + { selector = defaultSelector // { matchLabels = selector } + , template = defaultTemplate + { metadata = defaultMeta + { name = deployment.name } // { labels = selector } + } // + { spec = Some (defaultPodSpec + { containers = [ + defaultContainer + { name = deployment.name } // + { image = Some "your-container-service.io/${deployment.name}:${deployment.version}" + , imagePullPolicy = Some "Always" + , ports = Some [(defaultContainerPort {containerPort = 8080})] + } + ] + }) + } + } // + { replicas = Some 2 + , revisionHistoryLimit = Some 10 + } in defaultDeployment - { metadata = defaultMeta { name = deployment.name } - } // - { spec = Some spec } : Deployment + { metadata = defaultMeta { name = deployment.name } + } // + { spec = Some spec } : Deployment {- diff --git a/examples/ingressRaw.dhall b/examples/ingressRaw.dhall index 9d6daed8..3b3235f3 100644 --- a/examples/ingressRaw.dhall +++ b/examples/ingressRaw.dhall @@ -22,30 +22,31 @@ in let mkIngress : Config -> Ingress = \(config : Config) -> -- Given a service, make a TLS definition with their host and certificate - let makeTLS = \(service : Service) -> - { hosts = Some [ service.host ] - , secretName = Some "${service.name}-certificate" - } + let makeTLS = \(service : Service) -> + { hosts = Some [ service.host ] + , secretName = Some "${service.name}-certificate" + } -- Given a service, make an Ingress Rule in let makeRule = \(service : Service) -> - { host = Some service.host - , http = Some - { paths = [ { backend = { serviceName = service.name - , servicePort = IntOrString.Int 80 - } - , path = None Text - } - ] - } - } + { host = Some service.host + , http = Some + { paths = [ { backend = + { serviceName = service.name + , servicePort = IntOrString.Int 80 + } + , path = None Text + } + ] + } + } -- Nginx ingress requires a default service as a catchall in let defaultService = - { name = "default" - , host = "default.example.com" - , version = " 1.0" - } + { name = "default" + , host = "default.example.com" + , version = " 1.0" + } -- List of services in let services = config.services # [ defaultService ] @@ -57,22 +58,22 @@ in let mkIngress : Config -> Ingress = in let kv = \(k : Text) -> \(v : Text) -> { mapKey = k, mapValue = v } in let annotations = Some - [ kv "kubernetes.io/ingress.class" "nginx" - , kv "kubernetes.io/ingress.allow-http" "false" - ] + [ kv "kubernetes.io/ingress.class" "nginx" + , kv "kubernetes.io/ingress.allow-http" "false" + ] -- Generate spec from services in let spec = defaultSpec // - { tls = Some (map Service TLS makeTLS services) - , rules = Some (map Service Rule makeRule services) - } + { tls = Some (map Service TLS makeTLS services) + , rules = Some (map Service Rule makeRule services) + } in defaultIngress - { metadata = defaultMeta - { name = "nginx" } // - { annotations = annotations } - } // - { spec = Some spec } + { metadata = defaultMeta + { name = "nginx" } // + { annotations = annotations } + } // + { spec = Some spec } -- Here we import our example service, and generate the ingress with it