Fix accidental tabs in examples

This commit is contained in:
Fabrizio Ferrai 2018-11-12 19:24:18 +01:00
parent ad3eff2c7e
commit 0691ba0078
3 changed files with 84 additions and 82 deletions

View File

@ -189,30 +189,31 @@ in let mkIngress : Config -> Ingress =
\(config : Config) -> \(config : Config) ->
-- Given a service, make a TLS definition with their host and certificate -- Given a service, make a TLS definition with their host and certificate
let makeTLS = \(service : Service) -> let makeTLS = \(service : Service) ->
{ hosts = Some [ service.host ] { hosts = Some [ service.host ]
, secretName = Some "${service.name}-certificate" , secretName = Some "${service.name}-certificate"
} }
-- Given a service, make an Ingress Rule -- Given a service, make an Ingress Rule
in let makeRule = \(service : Service) -> in let makeRule = \(service : Service) ->
{ host = Some service.host { host = Some service.host
, http = Some , http = Some
{ paths = [ { backend = { serviceName = service.name { paths = [ { backend =
, servicePort = IntOrString.Int 80 { serviceName = service.name
} , servicePort = IntOrString.Int 80
, path = None Text }
} , path = None Text
] }
} ]
} }
}
-- Nginx ingress requires a default service as a catchall -- Nginx ingress requires a default service as a catchall
in let defaultService = in let defaultService =
{ name = "default" { name = "default"
, host = "default.example.com" , host = "default.example.com"
, version = " 1.0" , version = " 1.0"
} }
-- List of services -- List of services
in let services = config.services # [ defaultService ] 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 kv = \(k : Text) -> \(v : Text) -> { mapKey = k, mapValue = v }
in let annotations = Some in let annotations = Some
[ kv "kubernetes.io/ingress.class" "nginx" [ kv "kubernetes.io/ingress.class" "nginx"
, kv "kubernetes.io/ingress.allow-http" "false" , kv "kubernetes.io/ingress.allow-http" "false"
] ]
-- Generate spec from services -- Generate spec from services
in let spec = defaultSpec // in let spec = defaultSpec //
{ tls = Some (map Service TLS makeTLS services) { tls = Some (map Service TLS makeTLS services)
, rules = Some (map Service Rule makeRule services) , rules = Some (map Service Rule makeRule services)
} }
in defaultIngress in defaultIngress
{ metadata = defaultMeta { metadata = defaultMeta
{ name = "nginx" } // { name = "nginx" } //
{ annotations = annotations } { annotations = annotations }
} // } //
{ spec = Some spec } { spec = Some spec }
-- Here we import our example service, and generate the ingress with it -- Here we import our example service, and generate the ingress with it

View File

@ -30,34 +30,34 @@ in let mkDeployment : Config -> Deployment =
\(deployment : Config) -> \(deployment : Config) ->
let selector = Some [{ mapKey = "app", mapValue = deployment.name }] let selector = Some [{ mapKey = "app", mapValue = deployment.name }]
in let spec = defaultSpec in let spec = defaultSpec
{ selector = defaultSelector // { matchLabels = selector } { selector = defaultSelector // { matchLabels = selector }
, template = defaultTemplate , template = defaultTemplate
{ metadata = defaultMeta { metadata = defaultMeta
{ name = deployment.name } // { labels = selector } { name = deployment.name } // { labels = selector }
} // } //
{ spec = Some (defaultPodSpec { spec = Some (defaultPodSpec
{ containers = [ { containers = [
defaultContainer defaultContainer
{ name = deployment.name } // { name = deployment.name } //
{ image = Some "your-container-service.io/${deployment.name}:${deployment.version}" { image = Some "your-container-service.io/${deployment.name}:${deployment.version}"
, imagePullPolicy = Some "Always" , imagePullPolicy = Some "Always"
, ports = Some [(defaultContainerPort {containerPort = 8080})] , ports = Some [(defaultContainerPort {containerPort = 8080})]
} }
] ]
}) })
} }
} // } //
{ replicas = Some 2 { replicas = Some 2
, revisionHistoryLimit = Some 10 , revisionHistoryLimit = Some 10
} }
in defaultDeployment in defaultDeployment
{ metadata = defaultMeta { name = deployment.name } { metadata = defaultMeta { name = deployment.name }
} // } //
{ spec = Some spec } : Deployment { spec = Some spec } : Deployment
{- {-

View File

@ -22,30 +22,31 @@ in let mkIngress : Config -> Ingress =
\(config : Config) -> \(config : Config) ->
-- Given a service, make a TLS definition with their host and certificate -- Given a service, make a TLS definition with their host and certificate
let makeTLS = \(service : Service) -> let makeTLS = \(service : Service) ->
{ hosts = Some [ service.host ] { hosts = Some [ service.host ]
, secretName = Some "${service.name}-certificate" , secretName = Some "${service.name}-certificate"
} }
-- Given a service, make an Ingress Rule -- Given a service, make an Ingress Rule
in let makeRule = \(service : Service) -> in let makeRule = \(service : Service) ->
{ host = Some service.host { host = Some service.host
, http = Some , http = Some
{ paths = [ { backend = { serviceName = service.name { paths = [ { backend =
, servicePort = IntOrString.Int 80 { serviceName = service.name
} , servicePort = IntOrString.Int 80
, path = None Text }
} , path = None Text
] }
} ]
} }
}
-- Nginx ingress requires a default service as a catchall -- Nginx ingress requires a default service as a catchall
in let defaultService = in let defaultService =
{ name = "default" { name = "default"
, host = "default.example.com" , host = "default.example.com"
, version = " 1.0" , version = " 1.0"
} }
-- List of services -- List of services
in let services = config.services # [ defaultService ] 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 kv = \(k : Text) -> \(v : Text) -> { mapKey = k, mapValue = v }
in let annotations = Some in let annotations = Some
[ kv "kubernetes.io/ingress.class" "nginx" [ kv "kubernetes.io/ingress.class" "nginx"
, kv "kubernetes.io/ingress.allow-http" "false" , kv "kubernetes.io/ingress.allow-http" "false"
] ]
-- Generate spec from services -- Generate spec from services
in let spec = defaultSpec // in let spec = defaultSpec //
{ tls = Some (map Service TLS makeTLS services) { tls = Some (map Service TLS makeTLS services)
, rules = Some (map Service Rule makeRule services) , rules = Some (map Service Rule makeRule services)
} }
in defaultIngress in defaultIngress
{ metadata = defaultMeta { metadata = defaultMeta
{ name = "nginx" } // { name = "nginx" } //
{ annotations = annotations } { annotations = annotations }
} // } //
{ spec = Some spec } { spec = Some spec }
-- Here we import our example service, and generate the ingress with it -- Here we import our example service, and generate the ingress with it