Ingress

This generates Kubernetes Ingress objects .

Property Description
Resource type ingress
Account type None

Inputs

Values

Name Type Description
api_version string [Optional] The API version of the ingress object to produce. Must be one of v1beta1 or v1 . Defaults to v1
class string [Optional] The ingress controller class. Will be inserted as an annotation or in the ingressClassName property depending on api_version.
annotations object [Optional] An object with values of type string that will be inserted as annotations on the generated Ingress object.
labels object [Optional] An object with values of type string that will be inserted as labels on the generated Ingress object.
no_tls boolean [Optional] Does not generate a TLS section even if a tls_secret_name is supplied. Useful if TLS termination happens on the Load Balancer.
tls_secret_name string [Optional] Overrides the Humanitec provided secret. Useful if secrets are injected by another mechanism for example, Cert Manager or Rancher.

Secrets

None

Notes

If class is omitted, then the generated ingress object will not have an ingress class defined. See Default Ingress Class in the Kubernetes documentation for possible behaviors.

Example

The Example Library features a range of examples for using the Ingress Driver .

Notice that the Template Driver may alternatively be used to create Ingress objects with greater flexibility. See these examples in the Example Library .

Use the command below for the interface of your choice to create a Resource Definition that adds NGINX specific annotations to generated ingress objects in the development Environment type.

Set the following environment variables for the CLI and API commands:

Variable Example Description
HUMANITEC_TOKEN my-token The authentication token for accessing the Humanitec API.
HUMANITEC_ORG my-org-id The unique identifier for the organization in Humanitec.

  1. Create a file defining the Resource Definition you want to create:
cat << EOF > ingress.yaml
apiVersion: entity.humanitec.io/v1b1
kind: Definition
metadata:
  id: custom-ingress
entity:
  driver_type: humanitec/ingress
  name: Custom Ingress
  type: ingress
  driver_inputs:
    values:
      annotations:
        nginx.ingress.kubernetes.io/cors-allow-headers: Keep-Alive,Authorization
        nginx.ingress.kubernetes.io/rewrite-target: /$2
      api_version: v1
      class: nginx
  criteria:
  - env_type: development
EOF
  1. Use the humctl create command to create the Resource Definition in the Organization defined by your configured context:
humctl create -f ingress.yaml
rm ingress.yaml

curl https://api.humanitec.io/orgs/${HUMANITEC_ORG}/resources/defs \
  -X POST \
  -H "Authorization: Bearer ${HUMANITEC_TOKEN}" \
  -H "Content-Type: application/json" \
  --data-binary '
{
  "id": "custom-ingress",
  "name": "Custom Ingress",
  "type": "ingress",
  "criteria": [
    {
      "env_type": "development"
    }
  ],
  "driver_type": "humanitec/ingress",
  "driver_inputs": {
    "values": {
      "api_version": "v1",
      "class":  "nginx",
      "annotations": {
        "nginx.ingress.kubernetes.io/rewrite-target": "/$2",
        "nginx.ingress.kubernetes.io/cors-allow-headers": "Keep-Alive,Authorization"
      }
    }
  }
}'
Top