IngressTrait Custom Resource Definition

The IngressTrait custom resource contains the configuration of host and path rules for traffic routing to an application. Here is a sample ApplicationConfiguration that specifies an IngressTrait. To deploy an example application that demonstrates this IngressTrait, see Hello World Helidon.

kind: ApplicationConfiguration
  name: hello-helidon-appconf
  namespace: hello-helidon
    version: v1.0.0
    description: "Hello Helidon application"
    - componentName: hello-helidon-component
        - trait:
            kind: MetricsTrait
                scraper: verrazzano-system/vmi-system-prometheus-0
        - trait:
            kind: IngressTrait
              name: hello-helidon-ingress
                - paths:
                    - path: "/greet"
                      pathType: Prefix

In the sample configuration, the IngressTrait hello-helidon-ingress is set on the hello-helidon-component application component and defines an ingress rule that configures a path and path type. This exposes a route for external access to the application. Note that because no hosts list is given for the IngressRule, a DNS host name is automatically generated.

For example, with the sample application configuration successfully deployed, the application will be accessible with the path specified in the IngressTrait and the generated host name.

$ HOST=$(kubectl get gateway hello-helidon-hello-helidon-appconf-gw -n hello-helidon -o jsonpath={.spec.servers[0].hosts[0]})
$ echo $HOST

$ curl -sk -X GET https://${HOST}/greet

Alternatively, specific host names can be given in an IngressRule. Doing this implies that a secret and certificate have been created for the specific hosts and the secret name has been specified in the associated IngressSecurity secretName field.


Field Type Description Required
apiVersion string Yes
kind string IngressTrait Yes
metadata ObjectMeta Refer to Kubernetes API documentation for fields of metadata. No
spec IngressTraitSpec The desired state of an ingress trait. Yes


IngressTraitSpec specifies the desired state of an ingress trait.

Field Type Description Required
rules IngressRule array A list of ingress rules to for an ingress trait. Yes
tls IngressSecurity The security parameters for an ingress trait. This is required only if specific hosts are given in an IngressRule. No


IngressRule specifies a rule for an ingress trait.

Field Type Description Required
hosts string array One or more hosts exposed by the ingress trait. Wildcard hosts or hosts that are empty are filtered out. If there are no valid hosts provided, then a DNS host name is automatically generated and used. No
paths IngressPath array The paths to be exposed for an ingress trait. Yes


IngressPath specifies a specific path to be exposed for an ingress trait.

Field Type Description Required
path string If no path is provided, it defaults to /. No
pathType string Path type values are case-sensitive and formatted as follows:
  • exact: exact string match
  • prefix: prefix-based match
  • regex: regex-based match
If the provided ingress path doesn’t contain a pathType, it defaults to prefix if the path is / and exact otherwise.


IngressSecurity specifies the secret containing the certificate securing the transport for an ingress trait.

Field Type Description Required
secretName string The name of a secret containing the certificate securing the transport. The specification of a secret here implies that a certificate was created for specific hosts, as specified in an IngressRule. Yes

Last modified May 7, 2021: Rdonat/vz 2634 (#124) (e402442)