Documentation ¶
Overview ¶
+k8s:deepcopy-gen=package Package network holds the typed objects that define the schemas for configuring the knative/serving networking layer.
Index ¶
- Constants
- Variables
- func IsKubeletProbe(r *http.Request) bool
- func IsProbe(r *http.Request) bool
- func KnativeProbeHeader(r *http.Request) string
- func KnativeProxyHeader(r *http.Request) string
- func NameForPortNumber(svc *corev1.Service, portNumber int32) (string, error)
- func NewBufferPool() httputil.BufferPool
- func NewProbeHandler(next http.Handler) http.Handler
- func PortNumberForName(sub corev1.EndpointSubset, portName string) (int32, error)
- func RewriteHostIn(r *http.Request)
- func RewriteHostOut(r *http.Request)
- type Config
- type DomainTemplateValues
- type HTTPProtocol
- type TagTemplateValues
Constants ¶
const ( // ProbeHeaderName is the name of a header that can be added to // requests to probe the knative networking layer. Requests // with this header will not be passed to the user container or // included in request metrics. ProbeHeaderName = "K-Network-Probe" // ProxyHeaderName is the name of an internal header that activator // uses to mark requests going through it. ProxyHeaderName = "K-Proxy-Request" // HashHeaderName is the name of an internal header that Ingress controller // uses to find out which version of the networking config is deployed. HashHeaderName = "K-Network-Hash" // OriginalHostHeader is used to avoid Istio host based routing rules // in Activator. // The header contains the original Host value that can be rewritten // at the Queue proxy level back to be a host header. OriginalHostHeader = "K-Original-Host" // ConfigName is the name of the configmap containing all // customizations for networking features. ConfigName = "config-network" // IstioOutboundIPRangesKey is the name of the configuration entry // that specifies Istio outbound ip ranges. // // DEPRECATED: This will be completely removed in the future release. IstioOutboundIPRangesKey = "istio.sidecar.includeOutboundIPRanges" // DeprecatedDefaultIngressClassKey Please use DefaultIngressClassKey instead. DeprecatedDefaultIngressClassKey = "clusteringress.class" // DefaultIngressClassKey is the name of the configuration entry // that specifies the default Ingress. DefaultIngressClassKey = "ingress.class" // DefaultCertificateClassKey is the name of the configuration entry // that specifies the default Certificate. DefaultCertificateClassKey = "certificate.class" // IstioIngressClassName value for specifying knative's Istio // Ingress reconciler. IstioIngressClassName = "istio.ingress.networking.knative.dev" // CertManagerCertificateClassName value for specifying Knative's Cert-Manager // Certificate reconciler. CertManagerCertificateClassName = "cert-manager.certificate.networking.knative.dev" // DomainTemplateKey is the name of the configuration entry that // specifies the golang template string to use to construct the // Knative service's DNS name. DomainTemplateKey = "domainTemplate" // TagTemplateKey is the name of the configuration entry that // specifies the golang template string to use to construct the // hostname for a Route's tag. TagTemplateKey = "tagTemplate" // Since K8s 1.8, prober requests have // User-Agent = "kube-probe/{major-version}.{minor-version}". KubeProbeUAPrefix = "kube-probe/" // Istio with mTLS rewrites probes, but their probes pass a different // user-agent. So we augment the probes with this header. KubeletProbeHeaderName = "K-Kubelet-Probe" // DefaultDomainTemplate is the default golang template to use when // constructing the Knative Route's Domain(host) DefaultDomainTemplate = "{{.Name}}.{{.Namespace}}.{{.Domain}}" // DefaultTagTemplate is the default golang template to use when // constructing the Knative Route's tag names. DefaultTagTemplate = "{{.Tag}}-{{.Name}}" // AutoTLSKey is the name of the configuration entry // that specifies enabling auto-TLS or not. AutoTLSKey = "autoTLS" // HTTPProtocolKey is the name of the configuration entry that // specifies the HTTP endpoint behavior of Knative ingress. HTTPProtocolKey = "httpProtocol" // UserAgentKey is the constant for header "User-Agent". UserAgentKey = "User-Agent" // ActivatorUserAgent is the user-agent header value set in probe requests sent // from activator. ActivatorUserAgent = "Knative-Activator-Probe" // QueueProxyUserAgent is the user-agent header value set in probe requests sent // from queue-proxy. QueueProxyUserAgent = "Knative-Queue-Proxy-Probe" // IngressReadinessUserAgent is the user-agent header value // set in probe requests for Ingress status. IngressReadinessUserAgent = "Knative-Ingress-Probe" // AutoscalingUserAgent is the user-agent header value set in probe // requests sent by autoscaling implementations. AutoscalingUserAgent = "Knative-Autoscaling-Probe" )
Variables ¶
var ProbeHeaderValue = "probe"
ProbeHeaderValue is the value used in 'K-Network-Probe'
Functions ¶
func IsKubeletProbe ¶
IsKubeletProbe returns true if the request is a Kubernetes probe.
func IsProbe ¶
IsProbe returns true if the request is a Kubernetes probe or a Knative probe, i.e. non-empty ProbeHeaderName header.
func KnativeProbeHeader ¶
KnativeProbeHeader returns the value for key ProbeHeaderName in request headers.
func KnativeProxyHeader ¶
KnativeProxyHeader returns the value for key ProxyHeaderName in request headers.
func NameForPortNumber ¶
NameForPortNumber finds the name for a given port as defined by a Service.
func NewBufferPool ¶
func NewBufferPool() httputil.BufferPool
NewBufferPool creates a new BytePool. This is only safe to use in the context of a httputil.ReverseProxy, as the buffers returned via Put are not cleaned explicitly.
func NewProbeHandler ¶
NewProbeHandler wraps a HTTP handler handling probing requests around the provided HTTP handler
func PortNumberForName ¶
func PortNumberForName(sub corev1.EndpointSubset, portName string) (int32, error)
PortNumberForName resolves a given name to a portNumber as defined by an EndpointSubset.
func RewriteHostIn ¶
RewriteHostIn removes the `Host` header from the inbound (server) request and replaces it with our custom header. This is done to avoid Istio Host based routing, see #3870. Queue-Proxy will execute the reverse process.
func RewriteHostOut ¶
RewriteHostOut undoes the `RewriteHostIn` action. RewriteHostOut checks if network.OriginalHostHeader was set and if it was, then uses that as the r.Host (which takes priority over Request.Header["Host"]). If the request did not have the OriginalHostHeader header set, the request is untouched.
Types ¶
type Config ¶
type Config struct { // DefaultIngressClass specifies the default Ingress class. DefaultIngressClass string // DomainTemplate is the golang text template to use to generate the // Route's domain (host) for the Service. DomainTemplate string // TagTemplate is the golang text template to use to generate the // Route's tag hostnames. TagTemplate string // AutoTLS specifies if auto-TLS is enabled or not. AutoTLS bool // HTTPProtocol specifics the behavior of HTTP endpoint of Knative // ingress. HTTPProtocol HTTPProtocol // DefaultCertificateClass specifies the default Certificate class. DefaultCertificateClass string }
Config contains the networking configuration defined in the network config map.
func NewConfigFromConfigMap ¶
NewConfigFromConfigMap creates a Config from the supplied ConfigMap
func NewConfigFromMap ¶
NewConfogFromMap creates a Config from the supplied data.
func (*Config) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config.
func (*Config) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Config) GetDomainTemplate ¶
GetDomainTemplate returns the golang Template from the config map or panics (the value is validated during CM validation and at this point guaranteed to be parseable).
func (*Config) GetTagTemplate ¶
type DomainTemplateValues ¶
type DomainTemplateValues struct { Name string Namespace string Domain string Annotations map[string]string }
DomainTemplateValues are the available properties people can choose from in their Route's "DomainTemplate" golang template sting. We could add more over time - e.g. RevisionName if we thought that might be of interest to people.
func (*DomainTemplateValues) DeepCopy ¶
func (in *DomainTemplateValues) DeepCopy() *DomainTemplateValues
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DomainTemplateValues.
func (*DomainTemplateValues) DeepCopyInto ¶
func (in *DomainTemplateValues) DeepCopyInto(out *DomainTemplateValues)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HTTPProtocol ¶
type HTTPProtocol string
HTTPProtocol indicates a type of HTTP endpoint behavior that Knative ingress could take.
const ( // HTTPEnabled represents HTTP proocol is enabled in Knative ingress. HTTPEnabled HTTPProtocol = "enabled" // HTTPDisabled represents HTTP protocol is disabled in Knative ingress. HTTPDisabled HTTPProtocol = "disabled" // HTTPRedirected represents HTTP connection is redirected to HTTPS in Knative ingress. HTTPRedirected HTTPProtocol = "redirected" )
type TagTemplateValues ¶
TagTemplateValues are the available properties people can choose from in their Route's "TagTemplate" golang template sting.
func (*TagTemplateValues) DeepCopy ¶
func (in *TagTemplateValues) DeepCopy() *TagTemplateValues
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagTemplateValues.
func (*TagTemplateValues) DeepCopyInto ¶
func (in *TagTemplateValues) DeepCopyInto(out *TagTemplateValues)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.