diff --git a/pkg/reconciler/ingress/config/store.go b/pkg/reconciler/ingress/config/store.go index 9732b0787..78ccd51f1 100644 --- a/pkg/reconciler/ingress/config/store.go +++ b/pkg/reconciler/ingress/config/store.go @@ -19,7 +19,6 @@ package config import ( "context" - network "knative.dev/networking/pkg" netconfig "knative.dev/networking/pkg/config" "knative.dev/pkg/configmap" ) @@ -73,7 +72,7 @@ func NewStore(logger configmap.Logger, onAfterStore ...func(name string, value i logger, configmap.Constructors{ ConfigName: NewKourierConfigFromConfigMap, - netconfig.ConfigMapName: network.NewConfigFromConfigMap, + netconfig.ConfigMapName: netconfig.NewConfigFromConfigMap, }, onAfterStore..., ), diff --git a/vendor/knative.dev/networking/pkg/deprecated_config.go b/vendor/knative.dev/networking/pkg/deprecated_config.go deleted file mode 100644 index 50c322d45..000000000 --- a/vendor/knative.dev/networking/pkg/deprecated_config.go +++ /dev/null @@ -1,213 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package pkg - -import ( - corev1 "k8s.io/api/core/v1" - "knative.dev/networking/pkg/config" -) - -const ( - // ConfigName is the name of the configmap containing all - // customizations for networking features. - // - // Deprecated: use knative.dev/networking/pkg/config.ConfigMapName - ConfigName = config.ConfigMapName - - // DefaultDomainTemplate is the default golang template to use when - // constructing the Knative Route's Domain(host) - // - // Deprecated: use knative.dev/networking/pkg/config.DefaultDomainTemplate - DefaultDomainTemplate = config.DefaultDomainTemplate - - // DefaultTagTemplate is the default golang template to use when - // constructing the Knative Route's tag names. - // - // Deprecated: use knative.dev/networking/pkg/config.DefaultTagTemplate - DefaultTagTemplate = config.DefaultTagTemplate - - // DefaultIngressClassKey is the name of the configuration entry - // that specifies the default Ingress. - // - // Deprecated: use knative.dev/networking/pkg/config.DefaultIngressClassKey - DefaultIngressClassKey = config.DefaultIngressClassKey - - // DefaultCertificateClassKey is the name of the configuration entry - // that specifies the default Certificate. - // - // Deprecated: use knative.dev/networking/pkg/config.DefaultCertificateClassKey - DefaultCertificateClassKey = config.DefaultCertificateClassKey - - // IstioIngressClassName value for specifying knative's Istio - // Ingress reconciler. - // - // Deprecated: use knative.dev/networking/pkg/config.IstioIngressClassName - IstioIngressClassName = config.IstioIngressClassName - - // CertManagerCertificateClassName value for specifying Knative's Cert-Manager - // Certificate reconciler. - // - // Deprecated: use knative.dev/networking/pkg/config.CertManagerCertificateClassName - CertManagerCertificateClassName = config.CertManagerCertificateClassName - - // DomainTemplateKey is the name of the configuration entry that - // specifies the golang template string to use to construct the - // Knative service's DNS name. - // - // Deprecated: use knative.dev/networking/pkg/config.DomainTemplateKey - DomainTemplateKey = config.DomainTemplateKey - - // 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. - // - // Deprecated: use knative.dev/networking/pkg/config.TagTemplateKey - TagTemplateKey = config.TagTemplateKey - - // RolloutDurationKey is the name of the configuration entry - // that specifies the default duration of the configuration rollout. - // - // Deprecated: use knative.dev/networking/pkg/config.RolloutDurationKey - RolloutDurationKey = config.RolloutDurationKey - - // NamespaceWildcardCertSelectorKey is the name of the configuration - // entry that specifies a LabelSelector to control which namespaces - // have a wildcard certificate provisioned for them. - // - // Deprecated: use knative.dev/networking/pkg/config.NamespaceWildcardCertSelectorKey - NamespaceWildcardCertSelectorKey = config.NamespaceWildcardCertSelectorKey - - // AutocreateClusterDomainClaimsKey is the key for the - // AutocreateClusterDomainClaims property. - // - // Deprecated: use knative.dev/networking/pkg/config.AutocreateClusterDomainClaimsKey - AutocreateClusterDomainClaimsKey = config.AutocreateClusterDomainClaimsKey - - // AutoTLSKey is the name of the configuration entry - // that specifies enabling auto-TLS or not. - // - // Deprecated: use knative.dev/networking/pkg/config.AutoTLSKey - AutoTLSKey = config.AutoTLSKey - - // HTTPProtocolKey is the name of the configuration entry that - // specifies the HTTP endpoint behavior of Knative ingress. - // - // Deprecated: use knative.dev/networking/pkg/config.HTTPProtocolKey - HTTPProtocolKey = config.HTTPProtocolKey - - // EnableMeshPodAddressabilityKey is the config for enabling pod addressability in mesh. - // - // Deprecated: use knative.dev/networking/pkg/config.EnableMeshPodAddressabilityKey - EnableMeshPodAddressabilityKey = config.EnableMeshPodAddressabilityKey - - // MeshCompatibilityModeKey is the config for selecting the mesh compatibility mode. - // - // Deprecated: use knative.dev/networking/pkg/config.MeshCompatibilityModeKey - MeshCompatibilityModeKey = config.MeshCompatibilityModeKey - - // DefaultExternalSchemeKey is the config for defining the scheme of external URLs. - // - // Deprecated: use knative.dev/networking/pkg/config.DefaultExternalSchemeKey - DefaultExternalSchemeKey = config.DefaultExternalSchemeKey -) - -// 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. -// -// Deprecated: use knative.dev/networking/pkg/config.DomainTemplateValues -type DomainTemplateValues = config.DomainTemplateValues - -// TagTemplateValues are the available properties people can choose from -// in their Route's "TagTemplate" golang template sting. -// -// Deprecated: use knative.dev/networking/pkg/config.TagTemplateValues -type TagTemplateValues = config.TagTemplateValues - -// Config contains the networking configuration defined in the -// network config map. -// -// Deprecated: use knative.dev/networking/pkg/config.Config -type Config = config.Config - -// HTTPProtocol indicates a type of HTTP endpoint behavior -// that Knative ingress could take. -// -// Deprecated: use knative.dev/networking/pkg/config.HTTPProtocol -type HTTPProtocol = config.HTTPProtocol - -const ( - // HTTPEnabled represents HTTP protocol is enabled in Knative ingress. - // - // Deprecated: use knative.dev/networking/pkg/config.HTTPEnabled - HTTPEnabled HTTPProtocol = config.HTTPEnabled - - // HTTPDisabled represents HTTP protocol is disabled in Knative ingress. - // - // Deprecated: use knative.dev/networking/pkg/config.HTTPDisabled - HTTPDisabled HTTPProtocol = config.HTTPDisabled - - // HTTPRedirected represents HTTP connection is redirected to HTTPS in Knative ingress. - // - // Deprecated: use knative.dev/networking/pkg/config.HTTPRedirected - HTTPRedirected HTTPProtocol = config.HTTPRedirected -) - -// MeshCompatibilityMode is one of enabled (always use ClusterIP), disabled -// (always use Pod IP), or auto (try PodIP, and fall back to ClusterIP if mesh -// is detected). -// -// Deprecated: use knative.dev/networking/pkg/config.MeshCompatibilityMode -type MeshCompatibilityMode = config.MeshCompatibilityMode - -const ( - // MeshCompatibilityModeEnabled instructs consumers of network plugins, such as - // Knative Serving, to use ClusterIP when connecting to pods. This is - // required when mesh is enabled (unless EnableMeshPodAddressability is set), - // but is less efficient. - // - // Deprecated: Use knative.dev/networking/pkg/config/MeshCompatibilityModeEnabled - MeshCompatibilityModeEnabled MeshCompatibilityMode = config.MeshCompatibilityModeEnabled - - // MeshCompatibilityModeDisabled instructs consumers of network plugins, such as - // Knative Serving, to connect to individual Pod IPs. This is most efficient, - // but will only work with mesh enabled when EnableMeshPodAddressability is - // used. - // - // Deprecated: Use knative.dev/networking/pkg/config/MeshCompatibilityModeDisabled - MeshCompatibilityModeDisabled MeshCompatibilityMode = config.MeshCompatibilityModeDisabled - - // MeshCompatibilityModeAuto instructs consumers of network plugins, such as - // Knative Serving, to heuristically determine whether to connect using the - // Cluster IP, or to ocnnect to individual Pod IPs. This is most efficient, - // determine whether mesh is enabled, and fall back from Direct Pod IP - // communication to Cluster IP as needed. - // - // Deprecated: Use knative.dev/networking/pkg/config/MeshCompatibilityModeAuto - MeshCompatibilityModeAuto MeshCompatibilityMode = config.MeshCompatibilityModeAuto -) - -// NewConfigFromConfigMap creates a Config from the supplied ConfigMap -func NewConfigFromConfigMap(configMap *corev1.ConfigMap) (*Config, error) { - return NewConfigFromMap(configMap.Data) -} - -// NewConfigFromMap creates a Config from the supplied data. -// -// Deprecated: Use knative.dev/networking/pkg/config/NewConfigFromMap -var NewConfigFromMap = config.NewConfigFromMap diff --git a/vendor/knative.dev/networking/pkg/deprecated_header.go b/vendor/knative.dev/networking/pkg/deprecated_header.go deleted file mode 100644 index ce7d3059d..000000000 --- a/vendor/knative.dev/networking/pkg/deprecated_header.go +++ /dev/null @@ -1,167 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package pkg - -import ( - "knative.dev/networking/pkg/http/header" -) - -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. - // - // Deprecated: use knative.dev/networking/pkg/http/header.ProbeKey - ProbeHeaderName = header.ProbeKey - - // ProxyHeaderName is the name of an internal header that activator - // uses to mark requests going through it. - // - // Deprecated: use knative.dev/networking/pkg/http/header.ProxyKey - ProxyHeaderName = header.ProxyKey - - // HashHeaderName is the name of an internal header that Ingress controller - // uses to find out which version of the networking config is deployed. - // - // Deprecated: use knative.dev/networking/pkg/http/header.HashKey - HashHeaderName = header.HashKey - - // HashHeaderValue is the value that must appear in the HashHeaderName - // header in order for our network hash to be injected. - // - // Deprecated: use knative.dev/networking/pkg/http/header.HashValueOverride - HashHeaderValue = header.HashValueOverride - - // 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. - // - // Deprecated: use knative.dev/networking/pkg/http/header.OriginalHostKey - OriginalHostHeader = header.OriginalHostKey - - // KubeProbeUAPrefix is the user agent prefix of the probe. - // Since K8s 1.8, prober requests have - // User-Agent = "kube-probe/{major-version}.{minor-version}". - // - // Deprecated: use knative.dev/networking/pkg/http/header.KubeProbeUAPrefix - KubeProbeUAPrefix = header.KubeProbeUAPrefix - - // KubeletProbeHeaderName is the name of the header supplied by kubelet - // probes. Istio with mTLS rewrites probes, but their probes pass a - // different user-agent. So we augment the probes with this header. - // - // Deprecated: use knative.dev/networking/pkg/http/header.KubeletProbeKey - KubeletProbeHeaderName = header.KubeletProbeKey //nolint:staticheck - - // UserAgentKey is the constant for header "User-Agent". - // - // Deprecated: use knative.dev/networking/pkg/http/header.UserAgentKey - UserAgentKey = header.UserAgentKey - - // ActivatorUserAgent is the user-agent header value set in probe requests sent - // from activator. - // - // Deprecated: use knative.dev/networking/pkg/http/header.ActivatorUserAgent - ActivatorUserAgent = header.ActivatorUserAgent - - // QueueProxyUserAgent is the user-agent header value set in probe requests sent - // from queue-proxy. - // - // Deprecated: use knative.dev/networking/pkg/http/header.QueueProxyUserAgent - QueueProxyUserAgent = header.QueueProxyUserAgent - - // IngressReadinessUserAgent is the user-agent header value - // set in probe requests for Ingress status. - // - // Deprecated: use knative.dev/networking/pkg/http/header.IngressReadinessUserAgent - IngressReadinessUserAgent = header.IngressReadinessUserAgent - - // AutoscalingUserAgent is the user-agent header value set in probe - // requests sent by autoscaling implementations. - // - // Deprecated: use knative.dev/networking/pkg/http/header.AutoscalingUserAgent - AutoscalingUserAgent = header.AutoscalingUserAgent - - // TagHeaderName is the name of the header entry which has a tag name as value. - // The tag name specifies which route was expected to be chosen by Ingress. - // - // Deprecated: use knative.dev/networking/pkg/http/header.RouteTagKey - TagHeaderName = header.RouteTagKey - - // DefaultRouteHeaderName is the name of the header entry - // identifying whether a request is routed via the default route or not. - // It has one of the string value "true" or "false". - // - // Deprecated: use knative.dev/networking/pkg/http/header.DefaultRouteKey - DefaultRouteHeaderName = header.DefaultRouteKey - - // PassthroughLoadbalancingHeaderName is the name of the header that directs - // load balancers to not load balance the respective request but to - // send it to the request's target directly. - // - // Deprecated: use knative.dev/networking/pkg/http/header.PassthroughLoadbalancingKey - PassthroughLoadbalancingHeaderName = header.PassthroughLoadbalancingKey - - // ProtoAcceptContent is the content type to be used when autoscaler scrapes metrics from the QP - // - // Deprecated: use knative.dev/networking/pkg/http/header.ProtobufMIMEType - ProtoAcceptContent = header.ProtobufMIMEType - - // ProbeHeaderValue is the value used in 'K-Network-Probe' - // - // Deprecated: use knative.dev/networking/pkg/http/header.ProbeValue - ProbeHeaderValue = header.ProbeValue -) - -// IsKubeletProbe returns true if the request is a Kubernetes probe. -// -// Deprecated: use knative.dev/networking/pkg/http/header.IsKubeletProbe -var IsKubeletProbe = header.IsKubeletProbe - -// KnativeProbeHeader returns the value for key ProbeHeaderName in request headers. -// -// Deprecated: use knative.dev/networking/pkg/http/header.GetKnativeProbeValue -var KnativeProbeHeader = header.GetKnativeProbeValue - -// KnativeProxyHeader returns the value for key ProxyHeaderName in request headers. -// -// Deprecated: use knative.dev/networking/pkg/http/header.GetKnativeProxyValue -var KnativeProxyHeader = header.GetKnativeProxyValue - -// IsProbe returns true if the request is a Kubernetes probe or a Knative probe, -// i.e. non-empty ProbeHeaderName header. -// -// Deprecated: use knative.dev/networking/pkg/http/header.IsProbe -var IsProbe = header.IsProbe - -// 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. -// -// Deprecated: use knative.dev/networking/pkg/http/header.RewriteHostIn -var RewriteHostIn = header.RewriteHostIn - -// 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. -// -// Deprecated: use knative.dev/networking/pkg/http/header.RewriteHostOut -var RewriteHostOut = header.RewriteHostOut diff --git a/vendor/knative.dev/networking/pkg/deprecated_http.go b/vendor/knative.dev/networking/pkg/deprecated_http.go deleted file mode 100644 index ad4000526..000000000 --- a/vendor/knative.dev/networking/pkg/deprecated_http.go +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright 2018 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package pkg - -import ( - "knative.dev/networking/pkg/http" - "knative.dev/networking/pkg/http/probe" - "knative.dev/networking/pkg/http/proxy" - "knative.dev/networking/pkg/http/stats" -) - -const ( - // ProbePath is the name of a path that activator, autoscaler and - // prober(used by KIngress generally) use for health check. - // - // Deprecated: use knative.dev/networking/pkg/http.HealthCheckPath - ProbePath = http.HealthCheckPath - - // FlushInterval controls the time when we flush the connection in the - // reverse proxies (Activator, QP). - // As of go1.16, a FlushInterval of 0 (the default) still flushes immediately - // when Content-Length is -1, which means the default works properly for - // streaming/websockets, without flushing more often than necessary for - // non-streaming requests. - // - // Deprecated: use knative.dev/networking/pkg/http/proxy.FlushInterval - FlushInterval = proxy.FlushInterval -) - -type ( - // ReqEvent represents either an incoming or closed request. - // - // Deprecated: use knative.dev/networking/pkg/http/stats.ReqEvent - ReqEvent = stats.ReqEvent - - // ReqEventType denotes the type (incoming/closed) of a ReqEvent. - // - // Deprecated: use knative.dev/networking/pkg/http/stats.ReqEventType - ReqEventType = stats.ReqEventType - - // RequestStats collects statistics about requests as they flow in and out of the system. - // - // Deprecated: use knative.dev/networking/pkg/http/stats.RequestStats - RequestStats = stats.RequestStats - - // RequestStatsReport are the metrics reported from the the request stats collector - // at a given time. - // - // Deprecated: use knative.dev/networking/pkg/http/stats.RequestStatsReport - RequestStatsReport = stats.RequestStatsReport -) - -const ( - // ReqIn represents an incoming request - // - // Deprecated: use knative.dev/networking/pkg/http/stats.ReqIn - ReqIn = stats.ReqIn - - // ReqOut represents a finished request - // - // Deprecated: use knative.dev/networking/pkg/http/stats.ReqOut - ReqOut = stats.ReqOut - - // ProxiedIn represents an incoming request through a proxy. - // - // Deprecated: use knative.dev/networking/pkg/http/stats.ProxiedIn - ProxiedIn = stats.ProxiedIn - - // ProxiedOut represents a finished proxied request. - // - // Deprecated: use knative.dev/networking/pkg/http/stats.ProxiedOut - ProxiedOut = stats.ProxiedOut -) - -var ( - // NewRequestStats builds a RequestStats instance, started at the given time. - // - // Deprecated: use knative.dev/networking/pkg/http/stats.NewRequestStats - NewRequestStats = stats.NewRequestStats - - // NewBufferPool creates a new BufferPool. This is only safe to use in the context - // of a httputil.ReverseProxy, as the buffers returned via Put are not cleaned - // explicitly. - // - // Deprecated: use knative.dev/networking/pkg/http/proxy.NewBufferPool - NewBufferPool = proxy.NewBufferPool - - // NewProbeHandler wraps a HTTP handler handling probing requests around the provided HTTP handler - // - // Deprecated: use knative.dev/networking/pkg/http/probe.NewHandler - NewProbeHandler = probe.NewHandler - - // IsPotentialMeshErrorResponse returns whether the HTTP response is compatible - // with having been caused by attempting direct connection when mesh was - // enabled. For example if we get a HTTP 404 status code it's safe to assume - // mesh is not enabled even if a probe was otherwise unsuccessful. This is - // useful to avoid falling back to ClusterIP when we see errors which are - // unrelated to mesh being enabled. - // - // Deprecated: use knative.dev/networking/pkg/http.IsPotentialMeshErrorResponse - IsPotentialMeshErrorResponse = http.IsPotentialMeshErrorResponse -) diff --git a/vendor/knative.dev/networking/pkg/deprecated_labels.go b/vendor/knative.dev/networking/pkg/deprecated_labels.go deleted file mode 100644 index 0a70ca18b..000000000 --- a/vendor/knative.dev/networking/pkg/deprecated_labels.go +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package pkg - -import "knative.dev/networking/pkg/apis/networking" - -const ( - // VisibilityLabelKey is the label to indicate visibility of Route - // and KServices. It can be an annotation too but since users are - // already using labels for domain, it probably best to keep this - // consistent. - // - // Deprecated: use knative.dev/networking/pkg/apis/networking.VisibilityLabelKey - VisibilityLabelKey = networking.VisibilityLabelKey -) diff --git a/vendor/knative.dev/networking/pkg/deprecated_port.go b/vendor/knative.dev/networking/pkg/deprecated_port.go deleted file mode 100644 index 8b218289c..000000000 --- a/vendor/knative.dev/networking/pkg/deprecated_port.go +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package pkg - -import "knative.dev/networking/pkg/k8s" - -// NameForPortNumber finds the name for a given port as defined by a Service. -// -// Deprecated: use knative.dev/networking/pkg/k8s.NameForPortNumber -var NameForPortNumber = k8s.NameForPortNumber - -// PortNumberForName resolves a given name to a portNumber as defined by an EndpointSubset. -// -// Deprecated: use knative.dev/networking/pkg/k8s.PortNumberForName -var PortNumberForName = k8s.PortNumberForName diff --git a/vendor/knative.dev/networking/pkg/http/proxy/bufferpool.go b/vendor/knative.dev/networking/pkg/http/proxy/bufferpool.go deleted file mode 100644 index 80d81f5da..000000000 --- a/vendor/knative.dev/networking/pkg/http/proxy/bufferpool.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2020 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package proxy - -import ( - "net/http/httputil" - "sync" -) - -// bufferPool implements the BufferPool interface to be used in httputil.ReverseProxy. -// -// Sadly, because of the httputil.BufferPool interface, we cannot avoid an allocation -// when returning the slice to the pool. We could choose to not use use pointers of -// slices and use straight slices instead, but that'd cause an allocation likewise -// because of the interface{} API. It'd also trigger a staticcheck warning. -// See https://staticcheck.io/docs/checks#SA6002. -type bufferPool struct { - pool *sync.Pool -} - -// NewBufferPool creates a new BufferPool. This is only safe to use in the context -// of a httputil.ReverseProxy, as the buffers returned via Put are not cleaned -// explicitly. -func NewBufferPool() httputil.BufferPool { - return &bufferPool{ - // We don't use the New function of sync.Pool here to avoid an unnecessary - // allocation when creating the slices. They are implicitly created in the - // Get function below. - pool: &sync.Pool{}, - } -} - -// Get gets a []byte from the bufferPool, or creates a new one if none are -// available in the pool. -func (b *bufferPool) Get() []byte { - buf := b.pool.Get() - if buf == nil { - // Use the default buffer size as defined in the ReverseProxy itself. - return make([]byte, 32*1024) - } - - return *buf.(*[]byte) -} - -// Put returns the given Buffer to the bufferPool. -func (b *bufferPool) Put(buffer []byte) { - b.pool.Put(&buffer) -} diff --git a/vendor/knative.dev/networking/pkg/http/proxy/constants.go b/vendor/knative.dev/networking/pkg/http/proxy/constants.go deleted file mode 100644 index 8d43e4425..000000000 --- a/vendor/knative.dev/networking/pkg/http/proxy/constants.go +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package proxy - -const ( - - // FlushInterval controls the time when we flush the connection in the - // reverse proxies (Activator, QP). - // As of go1.16, a FlushInterval of 0 (the default) still flushes immediately - // when Content-Length is -1, which means the default works properly for - // streaming/websockets, without flushing more often than necessary for - // non-streaming requests. - FlushInterval = 0 -) diff --git a/vendor/knative.dev/networking/pkg/http/stats/request.go b/vendor/knative.dev/networking/pkg/http/stats/request.go deleted file mode 100644 index 0fee36177..000000000 --- a/vendor/knative.dev/networking/pkg/http/stats/request.go +++ /dev/null @@ -1,157 +0,0 @@ -/* -Copyright 2020 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package stats - -import ( - "sync" - "time" - - "k8s.io/apimachinery/pkg/types" -) - -// ReqEvent represents either an incoming or closed request. -type ReqEvent struct { - // Time is the time the request event happened. - Time time.Time - // Type is the type of the request event. - Type ReqEventType - // Key is the revision the event is associated with. - // +optional - Key types.NamespacedName -} - -// ReqEventType denotes the type (incoming/closed) of a ReqEvent. -type ReqEventType int - -const ( - // ReqIn represents an incoming request - ReqIn ReqEventType = iota - // ReqOut represents a finished request - ReqOut - // ProxiedIn represents an incoming request through a proxy. - ProxiedIn - // ProxiedOut represents a finished proxied request. - ProxiedOut -) - -// NewRequestStats builds a RequestStats instance, started at the given time. -func NewRequestStats(startedAt time.Time) *RequestStats { - return &RequestStats{lastChange: startedAt} -} - -// RequestStats collects statistics about requests as they flow in and out of the system. -type RequestStats struct { - mux sync.Mutex - - // State variables that track the current state. Not reset after reporting. - concurrency, proxiedConcurrency float64 - lastChange time.Time - - // Reporting variables that track state over the current window. Reset after - // reporting. - requestCount, proxiedCount float64 - computedConcurrency, computedProxiedConcurrency float64 - secondsInUse float64 -} - -// RequestStatsReport are the metrics reported from the the request stats collector -// at a given time. -type RequestStatsReport struct { - // AverageConcurrency is the average concurrency over the reporting timeframe. - // This is calculated via the utilization at a given concurrency. For example: - // 2 requests each taking 500ms over a 1s reporting window generate an average - // concurrency of 1. - AverageConcurrency float64 - // AverageProxiedConcurrency is the average concurrency of all proxied requests. - // The same calculation as above applies. - AverageProxiedConcurrency float64 - // RequestCount is the number of requests that arrived in the current reporting - // timeframe. - RequestCount float64 - // ProxiedRequestCount is the number of proxied requests that arrived in the current - // reporting timeframe. - ProxiedRequestCount float64 -} - -// compute updates the internal state since the last computed change. -// -// Note: Due to the async nature in which compute can be called, for -// example via HandleEvent and Report, the individual timestamps are not -// guaranteed to be monotonic. We ignore negative changes as they are likely -// benign and are rounding errors at most if the proposed pattern is used. -func (s *RequestStats) compute(now time.Time) { - if durationSinceChange := now.Sub(s.lastChange); durationSinceChange > 0 { - durationSecs := durationSinceChange.Seconds() - s.secondsInUse += durationSecs - s.computedConcurrency += s.concurrency * durationSecs - s.computedProxiedConcurrency += s.proxiedConcurrency * durationSecs - s.lastChange = now - } -} - -// HandleEvent handles an incoming or outgoing request event and updates -// the state accordingly. -func (s *RequestStats) HandleEvent(event ReqEvent) { - s.mux.Lock() - defer s.mux.Unlock() - - s.compute(event.Time) - - switch event.Type { - case ProxiedIn: - s.proxiedConcurrency++ - s.proxiedCount++ - fallthrough - case ReqIn: - s.requestCount++ - s.concurrency++ - case ProxiedOut: - s.proxiedConcurrency-- - fallthrough - case ReqOut: - s.concurrency-- - } -} - -// Report returns a RequestStatsReport relative to the given time. The state -// will be reset for another reporting cycle afterwards. -func (s *RequestStats) Report(now time.Time) RequestStatsReport { - s.mux.Lock() - defer s.mux.Unlock() - - s.compute(now) - defer s.reset() - - report := RequestStatsReport{ - RequestCount: s.requestCount, - ProxiedRequestCount: s.proxiedCount, - } - - if s.secondsInUse > 0 { - report.AverageConcurrency = s.computedConcurrency / s.secondsInUse - report.AverageProxiedConcurrency = s.computedProxiedConcurrency / s.secondsInUse - } - - return report -} - -// reset resets the state so a new reporting cycle can start. -func (s *RequestStats) reset() { - s.computedConcurrency, s.computedProxiedConcurrency = 0, 0 - s.requestCount, s.proxiedCount = 0, 0 - s.secondsInUse = 0 -} diff --git a/vendor/knative.dev/networking/pkg/k8s/ports.go b/vendor/knative.dev/networking/pkg/k8s/ports.go deleted file mode 100644 index 265a6b86b..000000000 --- a/vendor/knative.dev/networking/pkg/k8s/ports.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright 2022 The Knative Authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package k8s - -import ( - "fmt" - - corev1 "k8s.io/api/core/v1" -) - -// NameForPortNumber finds the name for a given port as defined by a Service. -func NameForPortNumber(svc *corev1.Service, portNumber int32) (string, error) { - for _, port := range svc.Spec.Ports { - if port.Port == portNumber { - return port.Name, nil - } - } - return "", fmt.Errorf("no port with number %d found", portNumber) -} - -// PortNumberForName resolves a given name to a portNumber as defined by an EndpointSubset. -func PortNumberForName(sub corev1.EndpointSubset, portName string) (int32, error) { - for _, subPort := range sub.Ports { - if subPort.Name == portName { - return subPort.Port, nil - } - } - return 0, fmt.Errorf("no port for name %q found", portName) -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 93b22491d..86727b2e4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1155,7 +1155,6 @@ knative.dev/hack # knative.dev/networking v0.0.0-20251021092443-0bde19154dce ## explicit; go 1.24.0 knative.dev/networking/config -knative.dev/networking/pkg knative.dev/networking/pkg/apis/networking knative.dev/networking/pkg/apis/networking/v1alpha1 knative.dev/networking/pkg/certificates @@ -1180,10 +1179,7 @@ knative.dev/networking/pkg/config knative.dev/networking/pkg/http knative.dev/networking/pkg/http/header knative.dev/networking/pkg/http/probe -knative.dev/networking/pkg/http/proxy -knative.dev/networking/pkg/http/stats knative.dev/networking/pkg/ingress -knative.dev/networking/pkg/k8s knative.dev/networking/pkg/prober knative.dev/networking/pkg/status knative.dev/networking/test