mirror of
https://github.com/dhall-lang/dhall-kubernetes.git
synced 2024-11-03 21:05: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) ->
|
\(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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
{-
|
{-
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user