Documentation ¶
Overview ¶
Package network holds the typed objects that define the schemas for configuring the knative networking layer.
Index ¶
- Constants
- Variables
- func ErrorHandler(logger *zap.SugaredLogger) func(http.ResponseWriter, *http.Request, error)deprecated
- func GetClusterDomainName() string
- func GetServiceHostname(name, namespace string) string
- func IsKubeletProbe(r *http.Request) bool
- func NewAutoTransport(maxIdle, maxIdlePerHost int) http.RoundTripper
- func NewBackoffDialer(backoffConfig wait.Backoff) func(context.Context, string, string) (net.Conn, error)
- func NewH2CTransport() http.RoundTripper
- func NewProberTransport() http.RoundTripper
- func NewProxyAutoTLSTransport(maxIdle, maxIdlePerHost int, tlsConf *tls.Config) http.RoundTripper
- func NewProxyAutoTransport(maxIdle, maxIdlePerHost int) http.RoundTripper
- func NewServer(addr string, h http.Handler) *http.Server
- func NewTLSBackoffDialer(backoffConfig wait.Backoff) func(context.Context, string, string, *tls.Config) (net.Conn, error)
- type RoundTripperFunc
Constants ¶
const ( // DefaultDrainTimeout is the time that Knative components on the data // path will wait before shutting down server, but after starting to fail // readiness probes to ensure network layer propagation and so that no requests // are routed to this pod. // Note that this was bumped from 30s due to intermittent issues where // the webhook would get a bad request from the API Server when running // under chaos. DefaultDrainTimeout = 45 * time.Second // UserAgentKey is the constant for header "User-Agent". UserAgentKey = "User-Agent" // 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" // ProbeHeaderValue is the value of a header that can be added to // requests to probe the knative networking layer. Requests // with `K-Network-Probe` this value will not be passed to the user // container or included in request metrics. ProbeHeaderValue = "probe" // 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" // KubeProbeUAPrefix is the prefix for the User-Agent header. // Since K8s 1.8, prober requests have // User-Agent = "kube-probe/{major-version}.{minor-version}". KubeProbeUAPrefix = "kube-probe/" // KubeletProbeHeaderName is the header name to augment the probes, because // Istio with mTLS rewrites probes, but their probes pass a different // user-agent. KubeletProbeHeaderName = "K-Kubelet-Probe" )
Variables ¶
var AutoTransport = NewAutoTransport(1000, 100)
AutoTransport uses h2c for HTTP2 requests and falls back to `http.DefaultTransport` for all others
var DialTLSWithBackOff = NewTLSBackoffDialer(backOffTemplate)
DialTLSWithBackOff is same with DialWithBackOff but takes tls config.
var DialWithBackOff = NewBackoffDialer(backOffTemplate)
DialWithBackOff executes `net.Dialer.DialContext()` with exponentially increasing dial timeouts. In addition it sleeps with random jitter between tries.
var ErrTimeoutDialing = errors.New("timed out dialing")
ErrTimeoutDialing when the timeout is reached after set amount of time.
Functions ¶
func ErrorHandler
deprecated
func ErrorHandler(logger *zap.SugaredLogger) func(http.ResponseWriter, *http.Request, error)
ErrorHandler sets up a handler suitable for use with the ErrorHandler field on httputil's reverse proxy.
Deprecated: Use handler.Error instead.
func GetClusterDomainName ¶
func GetClusterDomainName() string
GetClusterDomainName returns cluster's domain name or an error Closes issue: https://github.com/knative/eventing/issues/714
func GetServiceHostname ¶
GetServiceHostname returns the fully qualified service hostname
func IsKubeletProbe ¶
IsKubeletProbe returns true if the request is a Kubernetes probe.
func NewAutoTransport ¶
func NewAutoTransport(maxIdle, maxIdlePerHost int) http.RoundTripper
NewAutoTransport creates a RoundTripper that can use appropriate transport based on the request's HTTP version.
func NewBackoffDialer ¶
func NewBackoffDialer(backoffConfig wait.Backoff) func(context.Context, string, string) (net.Conn, error)
NewBackoffDialer returns a dialer that executes `net.Dialer.DialContext()` with exponentially increasing dial timeouts. In addition it sleeps with random jitter between tries.
func NewH2CTransport ¶
func NewH2CTransport() http.RoundTripper
NewH2CTransport constructs a new H2C transport. That transport will reroute all HTTPS traffic to HTTP. This is to explicitly allow h2c (http2 without TLS) transport. See https://github.com/golang/go/issues/14141 for more details.
func NewProberTransport ¶
func NewProberTransport() http.RoundTripper
NewProberTransport creates a RoundTripper that is useful for probing, since it will not cache connections.
func NewProxyAutoTLSTransport ¶
func NewProxyAutoTLSTransport(maxIdle, maxIdlePerHost int, tlsConf *tls.Config) http.RoundTripper
NewProxyAutoTLSTransport is same with NewProxyAutoTransport but it has tls.Config to create HTTPS request.
func NewProxyAutoTransport ¶
func NewProxyAutoTransport(maxIdle, maxIdlePerHost int) http.RoundTripper
NewProxyAutoTransport creates a RoundTripper suitable for use by a reverse proxy. The returned transport uses HTTP or H2C based on the request's HTTP version. The transport has DisableCompression set to true.