mirror of
https://github.com/dhall-lang/dhall-kubernetes.git
synced 2024-09-11 07:25:47 +03:00
Fix accidental tabs in examples
This commit is contained in:
parent
ad3eff2c7e
commit
0691ba0078
59
README.md
59
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
|
||||
|
@ -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
|
||||
|
||||
|
||||
{-
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user