Documentation

Contour API Reference

Packages:

projectcontour.io/v1

This package holds the specification for the projectcontour.io Custom Resource Definitions (CRDs).

In building this CRD, we’ve inadvertently overloaded the word “Condition”, so we’ve tried to make this spec clear as to which types of condition are which.

MatchConditions are used by Routes and Includes to specify rules to match requests against for either routing or inclusion.

DetailedConditions are used in the Status of these objects to hold information about the relevant state of the object and the world around it.

SubConditions are used underneath DetailedConditions to give more detail to errors or warnings.

Resource Types:

HTTPProxy

HTTPProxy is an Ingress CRD specification.

Field Description
apiVersion
string
projectcontour.io/v1
kind
string
HTTPProxy
metadata
Kubernetes meta/v1.ObjectMeta
Refer to the Kubernetes API documentation for the fields of the metadata field.
spec
HTTPProxySpec


virtualhost
VirtualHost
(Optional)

Virtualhost appears at most once. If it is present, the object is considered to be a “root” HTTPProxy.

routes
[]Route
(Optional)

Routes are the ingress routes. If TCPProxy is present, Routes is ignored.

tcpproxy
TCPProxy
(Optional)

TCPProxy holds TCP proxy information.

includes
[]Include
(Optional)

Includes allow for specific routing configuration to be included from another HTTPProxy, possibly in another namespace.

status
HTTPProxyStatus
(Optional)

Status is a container for computed information about the HTTPProxy.

TLSCertificateDelegation

TLSCertificateDelegation is an TLS Certificate Delegation CRD specificiation. See design/tls-certificate-delegation.md for details.

Field Description
apiVersion
string
projectcontour.io/v1
kind
string
TLSCertificateDelegation
metadata
Kubernetes meta/v1.ObjectMeta
Refer to the Kubernetes API documentation for the fields of the metadata field.
spec
TLSCertificateDelegationSpec


delegations
[]CertificateDelegation
status
TLSCertificateDelegationStatus
(Optional)

CertificateDelegation

(Appears on: TLSCertificateDelegationSpec)

CertificateDelegation maps the authority to reference a secret in the current namespace to a set of namespaces.

Field Description
secretName
string

required, the name of a secret in the current namespace.

targetNamespaces
[]string

required, the namespaces the authority to reference the the secret will be delegated to. If TargetNamespaces is nil or empty, the CertificateDelegation’ is ignored. If the TargetNamespace list contains the character, “*” the secret will be delegated to all namespaces.

Condition

(Appears on: DetailedCondition)

Condition contains details for one aspect of the current state of this API Resource.

This struct is intended for direct use as an array at the field path .status.conditions. For example,

type FooStatus struct{
// Represents the observations of a foo's current state.
// Known .status.conditions.type are: "Available", "Progressing", and "Degraded"
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
// other fields
}

Field Description
type
string

Type of condition in CamelCase or in foo.example.com/CamelCase.

Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important.

The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)

status
ConditionStatus

status of the condition, one of True, False, Unknown.

observedGeneration
int64
(Optional)

observedGeneration represents the .metadata.generation that the condition was set based upon.

For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.

lastTransitionTime
Kubernetes meta/v1.Time

lastTransitionTime is the last time the condition transitioned from one status to another.

This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.

reason
string

Reason contains a programmatic identifier indicating the reason for the condition’s last transition.

Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API.

The value should be a CamelCase string.

This field may not be empty.

message
string

message is a human readable message indicating details about the transition.

This may be an empty string.

ConditionStatus (string alias)

(Appears on: Condition, SubCondition)

DetailedCondition

(Appears on: HTTPProxyStatus, TLSCertificateDelegationStatus)

DetailedCondition is an extension of the normal Kubernetes conditions, with two extra fields to hold sub-conditions, which provide more detailed reasons for the state (True or False) of the condition.

errors holds information about sub-conditions which are fatal to that condition and render its state False.

warnings holds information about sub-conditions which are not fatal to that condition and do not force the state to be False.

Remember that Conditions have a type, a status, and a reason.

The type is the type of the condition, the most important one in this CRD set is Valid.

In the case of Valid, status: true means that the object is has been ingested into Contour with no errors. warnings may still be present, and will be indicated in the Reason field.

Valid, status: false means that the object has had one or more fatal errors during processing into Contour. The details of the errors will be present under the errors field.

There should never be subconditions under errors when status is true.

Field Description
Condition
Condition

(Members of Condition are embedded into this type.)

errors
[]SubCondition
(Optional)

Errors contains a slice of relevant error subconditions for this object.

Subconditions are expected to appear when relevant (when there is a error), and disappear when not relevant. An empty slice here indicates no errors.

warnings
[]SubCondition
(Optional)

Warnings contains a slice of relevant warning subconditions for this object.

Subconditions are expected to appear when relevant (when there is a warning), and disappear when not relevant. An empty slice here indicates no warnings.

DownstreamValidation

(Appears on: TLS)

DownstreamValidation defines how to verify the client certificate.

Field Description
caSecret
string

Name of a Kubernetes secret that contains a CA certificate bundle. The client certificate must validate against the certificates in the bundle.

HTTPHealthCheckPolicy

(Appears on: Route)

HTTPHealthCheckPolicy defines health checks on the upstream service.

Field Description
path
string

HTTP endpoint used to perform health checks on upstream service

host
string

The value of the host header in the HTTP health check request. If left empty (default value), the name “contour-envoy-healthcheck” will be used.

intervalSeconds
int64
(Optional)

The interval (seconds) between health checks

timeoutSeconds
int64
(Optional)

The time to wait (seconds) for a health check response

unhealthyThresholdCount
int64
(Optional)

The number of unhealthy health checks required before a host is marked unhealthy

healthyThresholdCount
int64
(Optional)

The number of healthy health checks required before a host is marked healthy

HTTPProxySpec

(Appears on: HTTPProxy)

HTTPProxySpec defines the spec of the CRD.

Field Description
virtualhost
VirtualHost
(Optional)

Virtualhost appears at most once. If it is present, the object is considered to be a “root” HTTPProxy.

routes
[]Route
(Optional)

Routes are the ingress routes. If TCPProxy is present, Routes is ignored.

tcpproxy
TCPProxy
(Optional)

TCPProxy holds TCP proxy information.

includes
[]Include
(Optional)

Includes allow for specific routing configuration to be included from another HTTPProxy, possibly in another namespace.

HTTPProxyStatus

(Appears on: HTTPProxy)

HTTPProxyStatus reports the current state of the HTTPProxy.

Field Description
currentStatus
string
(Optional)
description
string
(Optional)
loadBalancer
Kubernetes core/v1.LoadBalancerStatus
(Optional)

LoadBalancer contains the current status of the load balancer.

conditions
[]DetailedCondition
(Optional)

Conditions contains information about the current status of the HTTPProxy, in an upstream-friendly container.

Contour will update a single condition, Valid, that is in normal-true polarity. That is, when currentStatus is valid, the Valid condition will be status: true, and vice versa.

Contour will leave untouched any other Conditions set in this block, in case some other controller wants to add a Condition.

If you are another controller owner and wish to add a condition, you should namespace your condition with a label, like controller.domain.com/ConditionName.

HeaderMatchCondition

(Appears on: MatchCondition)

HeaderMatchCondition specifies how to conditionally match against HTTP headers. The Name field is required, but only one of the remaining fields should be be provided.

Field Description
name
string

Name is the name of the header to match against. Name is required. Header names are case insensitive.

present
bool
(Optional)

Present specifies that condition is true when the named header is present, regardless of its value. Note that setting Present to false does not make the condition true if the named header is absent.

contains
string
(Optional)

Contains specifies a substring that must be present in the header value.

notcontains
string
(Optional)

NotContains specifies a substring that must not be present in the header value.

exact
string
(Optional)

Exact specifies a string that the header value must be equal to.

notexact
string
(Optional)

NoExact specifies a string that the header value must not be equal to. The condition is true if the header has any other value.

HeaderValue

(Appears on: HeadersPolicy)

HeaderValue represents a header name/value pair

Field Description
name
string

Name represents a key of a header

value
string

Value represents the value of a header specified by a key

HeadersPolicy

(Appears on: Route, Service)

HeadersPolicy defines how headers are managed during forwarding. The Host header is treated specially and if set in a HTTP response will be used as the SNI server name when forwarding over TLS. It is an error to attempt to set the Host header in a HTTP response.

Field Description
set
[]HeaderValue
(Optional)

Set specifies a list of HTTP header values that will be set in the HTTP header. If the header does not exist it will be added, otherwise it will be overwritten with the new value.

remove
[]string
(Optional)

Remove specifies a list of HTTP header names to remove.

Include

(Appears on: HTTPProxySpec)

Include describes a set of policies that can be applied to an HTTPProxy in a namespace.

Field Description
name
string

Name of the HTTPProxy

namespace
string
(Optional)

Namespace of the HTTPProxy to include. Defaults to the current namespace if not supplied.

conditions
[]MatchCondition
(Optional)

Conditions are a set of rules that are applied to included HTTPProxies. In effect, they are added onto the Conditions of included HTTPProxy Route structs. When applied, they are merged using AND, with one exception: There can be only one Prefix MatchCondition per Conditions slice. More than one Prefix, or contradictory Conditions, will make the include invalid.

LoadBalancerPolicy

(Appears on: Route, TCPProxy)

LoadBalancerPolicy defines the load balancing policy.

Field Description
strategy
string

Strategy specifies the policy used to balance requests across the pool of backend pods. Valid policy names are Random, RoundRobin, WeightedLeastRequest, Random and Cookie. If an unknown strategy name is specified or no policy is supplied, the default RoundRobin policy is used.

MatchCondition

(Appears on: Include, Route)

MatchCondition are a general holder for matching rules for HTTPProxies. One of Prefix or Header must be provided.

Field Description
prefix
string
(Optional)

Prefix defines a prefix match for a request.

header
HeaderMatchCondition
(Optional)

Header specifies the header condition to match.

PathRewritePolicy

(Appears on: Route)

PathRewritePolicy specifies how a request URL path should be rewritten. This rewriting takes place after a request is routed and has no subsequent effects on the proxy’s routing decision. No HTTP headers or body content is rewritten.

Exactly one field in this struct may be specified.

Field Description
replacePrefix
[]ReplacePrefix
(Optional)

ReplacePrefix describes how the path prefix should be replaced.

ReplacePrefix

(Appears on: PathRewritePolicy)

ReplacePrefix describes a path prefix replacement.

Field Description
prefix
string
(Optional)

Prefix specifies the URL path prefix to be replaced.

If Prefix is specified, it must exactly match the MatchCondition prefix that is rendered by the chain of including HTTPProxies and only that path prefix will be replaced by Replacement. This allows HTTPProxies that are included through multiple roots to only replace specific path prefixes, leaving others unmodified.

If Prefix is not specified, all routing prefixes rendered by the include chain will be replaced.

replacement
string

Replacement is the string that the routing path prefix will be replaced with. This must not be empty.

RetryOn (string alias)

(Appears on: RetryPolicy)

RetryOn is a string type alias with validation to ensure that the value is valid.

RetryPolicy

(Appears on: Route)

RetryPolicy defines the attributes associated with retrying policy.

Field Description
count
int64
(Optional)

NumRetries is maximum allowed number of retries. If not supplied, the number of retries is one.

perTryTimeout
string

PerTryTimeout specifies the timeout per retry attempt. Ignored if NumRetries is not supplied.

retryOn
[]RetryOn
(Optional)

RetryOn specifies the conditions on which to retry a request.

Supported HTTP conditions:

  • 5xx
  • gateway-error
  • reset
  • connect-failure
  • retriable-4xx
  • refused-stream
  • retriable-status-codes
  • retriable-headers

Supported gRPC conditions:

  • cancelled
  • deadline-exceeded
  • internal
  • resource-exhausted
  • unavailable
retriableStatusCodes
[]uint32
(Optional)

RetriableStatusCodes specifies the HTTP status codes that should be retried.

This field is only respected when you include retriable-status-codes in the RetryOn field.

Route

(Appears on: HTTPProxySpec)

Route contains the set of routes for a virtual host.

Field Description
conditions
[]MatchCondition
(Optional)

Conditions are a set of rules that are applied to a Route. When applied, they are merged using AND, with one exception: There can be only one Prefix MatchCondition per Conditions slice. More than one Prefix, or contradictory Conditions, will make the route invalid.

services
[]Service

Services are the services to proxy traffic.

enableWebsockets
bool
(Optional)

Enables websocket support for the route.

permitInsecure
bool
(Optional)

Allow this path to respond to insecure requests over HTTP which are normally not permitted when a virtualhost.tls block is present.

timeoutPolicy
TimeoutPolicy
(Optional)

The timeout policy for this route.

retryPolicy
RetryPolicy
(Optional)

The retry policy for this route.

healthCheckPolicy
HTTPHealthCheckPolicy
(Optional)

The health check policy for this route.

loadBalancerPolicy
LoadBalancerPolicy
(Optional)

The load balancing policy for this route.

pathRewritePolicy
PathRewritePolicy
(Optional)

The policy for rewriting the path of the request URL after the request has been routed to a Service.

requestHeadersPolicy
HeadersPolicy
(Optional)

The policy for managing request headers during proxying

responseHeadersPolicy
HeadersPolicy
(Optional)

The policy for managing response headers during proxying

Service

(Appears on: Route, TCPProxy)

Service defines an Kubernetes Service to proxy traffic.

Field Description
name
string

Name is the name of Kubernetes service to proxy traffic. Names defined here will be used to look up corresponding endpoints which contain the ips to route.

port
int

Port (defined as Integer) to proxy traffic to since a service can have multiple defined.

protocol
string
(Optional)

Protocol may be used to specify (or override) the protocol used to reach this Service. Values may be tls, h2, h2c. If omitted, protocol-selection falls back on Service annotations.

weight
int64
(Optional)

Weight defines percentage of traffic to balance traffic

validation
UpstreamValidation
(Optional)

UpstreamValidation defines how to verify the backend service’s certificate

mirror
bool

If Mirror is true the Service will receive a read only mirror of the traffic for this route.

requestHeadersPolicy
HeadersPolicy
(Optional)

The policy for managing request headers during proxying

responseHeadersPolicy
HeadersPolicy
(Optional)

The policy for managing response headers during proxying

SubCondition

(Appears on: DetailedCondition)

SubCondition is a Condition-like type intended for use as a subcondition inside a DetailedCondition.

It contains a subset of the Condition fields.

It is intended for warnings and errors, so type names should use abnormal-true polarity, that is, they should be of the form “ErrorPresent: true”.

The expected lifecycle for these errors is that they should only be present when the error or warning is, and should be removed when they are not relevant.

Field Description
type
string

Type of condition in CamelCase or in foo.example.com/CamelCase.

This must be in abnormal-true polarity, that is, ErrorFound or controller.io/ErrorFound.

The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)

status
ConditionStatus

Status of the condition, one of True, False, Unknown.

reason
string

Reason contains a programmatic identifier indicating the reason for the condition’s last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API.

The value should be a CamelCase string.

This field may not be empty.

message
string

Message is a human readable message indicating details about the transition.

This may be an empty string.

TCPHealthCheckPolicy

(Appears on: TCPProxy)

TCPHealthCheckPolicy defines health checks on the upstream service.

Field Description
intervalSeconds
int64
(Optional)

The interval (seconds) between health checks

timeoutSeconds
int64
(Optional)

The time to wait (seconds) for a health check response

unhealthyThresholdCount
uint32
(Optional)

The number of unhealthy health checks required before a host is marked unhealthy

healthyThresholdCount
uint32
(Optional)

The number of healthy health checks required before a host is marked healthy

TCPProxy

(Appears on: HTTPProxySpec)

TCPProxy contains the set of services to proxy TCP connections.

Field Description
loadBalancerPolicy
LoadBalancerPolicy
(Optional)

The load balancing policy for the backend services.

services
[]Service
(Optional)

Services are the services to proxy traffic

include
TCPProxyInclude
(Optional)

Include specifies that this tcpproxy should be delegated to another HTTPProxy.

includes
TCPProxyInclude
(Optional)

IncludesDeprecated allow for specific routing configuration to be appended to another HTTPProxy in another namespace.

Exists due to a mistake when developing HTTPProxy and the field was marked plural when it should have been singular. This field should stay to not break backwards compatibility to v1 users.

healthCheckPolicy
TCPHealthCheckPolicy
(Optional)

The health check policy for this tcp proxy

TCPProxyInclude

(Appears on: TCPProxy)

TCPProxyInclude describes a target HTTPProxy document which contains the TCPProxy details.

Field Description
name
string

Name of the child HTTPProxy

namespace
string
(Optional)

Namespace of the HTTPProxy to include. Defaults to the current namespace if not supplied.

TLS

(Appears on: VirtualHost)

TLS describes tls properties. The SNI names that will be matched on are described in fqdn, the tls.secretName secret must contain a matching certificate unless tls.passthrough is set to true.

Field Description
secretName
string

required, the name of a secret in the current namespace

minimumProtocolVersion
string
(Optional)

Minimum TLS version this vhost should negotiate

passthrough
bool
(Optional)

If Passthrough is set to true, the SecretName will be ignored and the encrypted handshake will be passed through to the backing cluster.

clientValidation
DownstreamValidation
(Optional)

ClientValidation defines how to verify the client certificate when an external client establishes a TLS connection to Envoy.

This setting:

  1. Enables TLS client certificate validation.
  2. Requires clients to present a TLS certificate (i.e. not optional validation).
  3. Specifies how the client certificate will be validated.
enableFallbackCertificate
bool

EnableFallbackCertificate defines if the vhost should allow a default certificate to be applied which handles all requests which don’t match the SNI defined in this vhost.

TLSCertificateDelegationSpec

(Appears on: TLSCertificateDelegation)

TLSCertificateDelegationSpec defines the spec of the CRD

Field Description
delegations
[]CertificateDelegation

TLSCertificateDelegationStatus

(Appears on: TLSCertificateDelegation)

TLSCertificateDelegationStatus allows for the status of the delegation to be presented to the user.

Field Description
conditions
[]DetailedCondition
(Optional)

Conditions contains information about the current status of the HTTPProxy, in an upstream-friendly container.

Contour will update a single condition, Valid, that is in normal-true polarity. That is, when currentStatus is valid, the Valid condition will be status: true, and vice versa.

Contour will leave untouched any other Conditions set in this block, in case some other controller wants to add a Condition.

If you are another controller owner and wish to add a condition, you should namespace your condition with a label, like controller.domain.com\ConditionName.

TimeoutPolicy

(Appears on: Route)

TimeoutPolicy configures timeouts that are used for handling network requests.

TimeoutPolicy durations are expressed in the Go Duration format. Valid time units are “ns”, “us” (or “┬Ás”), “ms”, “s”, “m”, “h”. The string “infinity” is also a valid input and specifies no timeout. A value of “0s” will be treated as if the field were not set, i.e. by using Envoy’s default behavior.

Example input values: “300ms”, “5s”, “1m”.

Field Description
response
string
(Optional)

Timeout for receiving a response from the server after processing a request from client. If not supplied, Envoy’s default value of 15s applies.

idle
string
(Optional)

Timeout after which, if there are no active requests for this route, the connection between Envoy and the backend or Envoy and the external client will be closed. If not specified, there is no per-route idle timeout, though a connection manager-wide stream_idle_timeout default of 5m still applies.

UpstreamValidation

(Appears on: Service)

UpstreamValidation defines how to verify the backend service’s certificate

Field Description
caSecret
string

Name of the Kubernetes secret be used to validate the certificate presented by the backend

subjectName
string

Key which is expected to be present in the ‘subjectAltName’ of the presented certificate

VirtualHost

(Appears on: HTTPProxySpec)

VirtualHost appears at most once. If it is present, the object is considered to be a “root”.

Field Description
fqdn
string

The fully qualified domain name of the root of the ingress tree all leaves of the DAG rooted at this object relate to the fqdn.

tls
TLS
(Optional)

If present describes tls properties. The SNI names that will be matched on are described in fqdn, the tls.secretName secret must contain a certificate that itself contains a name that matches the FQDN.


Generated with gen-crd-api-reference-docs.

Ready to try Contour?

Read our getting started documentation.