The napptive-ingress trait creates an Ingress to make the component publicly available to the Internet. The resulting ingress will automatically be given a valid DNS name and associated TLS certificate so that it can be consumed by all major browsers without modification.
The following snippet shows an example application with an napptive-ingress trait to expose an HTTP route on port 80 of the target component. Notice that an https route will be automatically created as major browsers automatically switch to the secure route.
apiVersion: core.oam.dev/v1beta1 kind: Application metadata: name: my-app annotations: version: "v0.0.1" description: "My apply-application application" spec: components: - name: component type: webservice properties: image: my-app-image:v1.0.0 ports: - port: 80 expose: true traits: - type: napptive-ingress # Set to napptive-ingress properties: name: nginx-ingress # (Optional) endpoint name port: 80 # (Required) port where the service is listening for incomming connections. path: / # (Required) path to be exposed rewritePath: / # (Optional) rewrite rule if one is needed. targetServiceName: service # (Optional) name of the service associated with the endpoint extraDNSName: my.domain.com # (Optional) additional DNS name in which this ingress must accept traffic
The ingress will automatically redirect requests to the component even if the component has just started. Please wait some time depending on the image being execute so that the component is fully up and running.
Major browsers implement HTTP Strict Transport Security (STS) which translates in automatic promotion of plain requests to
https://. We recomended adapting the client consuming the service to support TLS. Alternatively, check your browser documentation to see whether it is possible to switch off this protection layer.
The napptive-ingress trait supports custom domains to expose an application with the extraDNSName property. For more information, follow our guide of setting up a custom domain for an application.