let Prelude = ../Prelude.dhall let kubernetes = ../kubernetes.dhall let kv = Prelude.JSON.keyText let Config = ../app/config.dhall let annotations : Config.Type → List { mapKey : Text, mapValue : Text } = λ(config : Config.Type) → [ kv "kubernetes.io/ingress.class" "nginx" , kv "certmanager.k8s.io/cluster-issuer" "letsencrypt-${config.leIssuer}" ] let metadata : Config.Type → kubernetes.ObjectMeta.Type = λ(config : Config.Type) → kubernetes.ObjectMeta::{ , name = config.name , labels = [ kv "app" config.name ] , annotations = annotations config , namespace = Some "apps" } let tls : Config.Type → kubernetes.IngressTLS.Type = λ(config : Config.Type) → kubernetes.IngressTLS::{ , hosts = [ config.domain ] , secretName = Some "${config.leIssuer}-certs-${config.name}" } let rule : Config.Type → kubernetes.IngressRule.Type = λ(config : Config.Type) → kubernetes.IngressRule::{ , host = Some config.domain , http = Some kubernetes.HTTPIngressRuleValue::{ , paths = [ kubernetes.HTTPIngressPath::{ , backend = kubernetes.IngressBackend::{ , serviceName = config.name , servicePort = kubernetes.IntOrString.Int config.appPort } } ] } } let ingress : Config.Type → kubernetes.Ingress.Type = λ(config : Config.Type) → kubernetes.Ingress::{ , metadata = metadata config , spec = Some kubernetes.IngressSpec::{ , tls = [ tls config ] , rules = [ rule config ] } } in ingress