This generates an ingress as defined here

The ingress derives some properties from the service but it requires you to set the hostname.

If we continue with our nginx example from the service section, the ingress looks like this

import kubeyml.protocol.Host
import kubeyml.ingress.{CustomIngress, HttpRule, Ingress, ServiceMapping, Path => IngressPath, Spec => IngressSpec}
import kubeyml.ingress.api.Annotate

import kubeyml.deployment.{HttpProbe, IfNotPresent, HttpGet, Port => DeployPort}
import kubeyml.service._
import kubeyml.deployment.api._
import scala.concurrent.duration._
val deployment = deploy.namespace("yournamespace")
      livenessProbe = HttpProbe(HttpGet("/", port = 80, httpHeaders = List.empty), period = 10 seconds),
      readinessProbe = HttpProbe(HttpGet("/", port = 80, httpHeaders = List.empty), failureThreshold = 10)
    .addPorts(List(DeployPort(None, 80))

  val service = Service.fromDeployment(deployment)
val ingress: Ingress = CustomIngress(
    Map(Annotate.nginxRewriteTarget("/"), Annotate.nginxIngress()),
      List(IngressPath(ServiceMapping("nginx-deployment", 80), "/testpath"))))

Since version 0.2.9, ingress uses the new API version following this migration guide

This would generate the following yaml file

kind: Ingress
    annotations: / nginx
    name: nginx-ingress
    namespace: yournamespace
    -   host: your-host.domain.smth
            -   backend:
                    serviceName: nginx-deployment
                    servicePort: 80
                path: /testpath

To switch to the legacy apiVersion simply do:

def toExtensions_v1beta1(customIngress: CustomIngress) =

Of course in most cases you won’t have to write any of this as the sbt properties that sit on top of the API are derived from the service plugin which this depends upon. See the recipe for an example.

Sbt properties

sbt key description default
ingressRules A list of Rules (currently only supports HttpRule N/A
ingressName The name of the ingress The application name from deployment
ingress Key configuration for modifying the ingress properties Some values are derived from service