diff --git a/go.mod b/go.mod index 7d7254df5..283a574c7 100644 --- a/go.mod +++ b/go.mod @@ -22,8 +22,8 @@ require ( k8s.io/cli-runtime v0.0.0-20191016113937-7693ce2cae74 k8s.io/client-go v0.0.0-20191016110837-54936ba21026 knative.dev/eventing v0.12.0 - knative.dev/pkg v0.0.0-20200113182502-b8dc5fbc6d2f - knative.dev/serving v0.11.0 + knative.dev/pkg v0.0.0-20200120180006-96d3b8c24c34 + knative.dev/serving v0.12.0 knative.dev/test-infra v0.0.0-20200116044902-d5990f0e5a05 sigs.k8s.io/yaml v1.1.0 ) diff --git a/go.sum b/go.sum index 26fceadb1..747458667 100644 --- a/go.sum +++ b/go.sum @@ -523,10 +523,10 @@ k8s.io/utils v0.0.0-20190221042446-c2654d5206da h1:ElyM7RPonbKnQqOcw7dG2IK5uvQQn k8s.io/utils v0.0.0-20190221042446-c2654d5206da/go.mod h1:8k8uAuAQ0rXslZKaEWd0c3oVhZz7sSzSiPnVZayjIX0= knative.dev/eventing v0.12.0 h1:u3Ck5+dpr2affDlsGfRKnBTb87Is/tfzWNfZz1FSAMI= knative.dev/eventing v0.12.0/go.mod h1:UxweNv8yXhsdHJitcb9R6rmfNaUD2DFi9GWwNRyIs58= -knative.dev/pkg v0.0.0-20200113182502-b8dc5fbc6d2f h1:EFhlUkg97lfwyAxsNZUqbmHxVzQ0YpPdNyf/o16WkAw= -knative.dev/pkg v0.0.0-20200113182502-b8dc5fbc6d2f/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q= -knative.dev/serving v0.11.0 h1:FK8aPpMuiBHZbfBfT+Avxyk11TaIlOMDEw/Va2sw1w0= -knative.dev/serving v0.11.0/go.mod h1:x2n255JS2XBI39tmjZ8CwTxIf9EKNMCrkVuiOttLRm0= +knative.dev/pkg v0.0.0-20200120180006-96d3b8c24c34 h1:rzwD07KAeJ8IfHMV8VWZ0y4txfWHhA07fH2G1mYvKYs= +knative.dev/pkg v0.0.0-20200120180006-96d3b8c24c34/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q= +knative.dev/serving v0.12.0 h1:Jdtc3WwaBNhDY8n5mKwmLqldXra5RKk8FesjIR8k4ts= +knative.dev/serving v0.12.0/go.mod h1:x2n255JS2XBI39tmjZ8CwTxIf9EKNMCrkVuiOttLRm0= knative.dev/test-infra v0.0.0-20200116044902-d5990f0e5a05 h1:DALgmfmA58b52qfouySXvyHCbc692C3RJUSYNjHNG5U= knative.dev/test-infra v0.0.0-20200116044902-d5990f0e5a05/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= diff --git a/pkg/kn/commands/version/version.go b/pkg/kn/commands/version/version.go index f01b45eb9..c088159de 100644 --- a/pkg/kn/commands/version/version.go +++ b/pkg/kn/commands/version/version.go @@ -29,7 +29,7 @@ var GitRevision string // update this var as we add more deps var apiVersions = map[string][]string{ "serving": { - "serving.knative.dev/v1alpha1 (knative-serving v0.11.0)", + "serving.knative.dev/v1alpha1 (knative-serving v0.12.0)", }, "eventing": { "sources.eventing.knative.dev/v1alpha1 (knative-eventing v0.12.0)", diff --git a/pkg/kn/commands/version/version_test.go b/pkg/kn/commands/version/version_test.go index 24ee9cbbc..5e6ae6c1e 100644 --- a/pkg/kn/commands/version/version_test.go +++ b/pkg/kn/commands/version/version_test.go @@ -36,7 +36,7 @@ Build Date: {{.BuildDate}} Git Revision: {{.GitRevision}} Supported APIs: * Serving - - serving.knative.dev/v1alpha1 (knative-serving v0.11.0) + - serving.knative.dev/v1alpha1 (knative-serving v0.12.0) * Eventing - sources.eventing.knative.dev/v1alpha1 (knative-eventing v0.12.0) - eventing.knative.dev/v1alpha1 (knative-eventing v0.12.0) diff --git a/test/presubmit-integration-tests-latest-release.sh b/test/presubmit-integration-tests-latest-release.sh index 3bde02f28..47e7cf373 100755 --- a/test/presubmit-integration-tests-latest-release.sh +++ b/test/presubmit-integration-tests-latest-release.sh @@ -19,7 +19,7 @@ # We currently take 0.10.0 for Serving and 0.10.2 for Eventing as the # latest release version. -export KNATIVE_SERVING_VERSION="0.11.0" +export KNATIVE_SERVING_VERSION="0.12.0" export KNATIVE_EVENTING_VERSION="0.11.0" $(dirname $0)/presubmit-tests.sh --integration-tests diff --git a/vendor/knative.dev/pkg/metrics/config_observability.go b/vendor/knative.dev/pkg/metrics/config_observability.go index 496443e91..5eaf0eb9f 100644 --- a/vendor/knative.dev/pkg/metrics/config_observability.go +++ b/vendor/knative.dev/pkg/metrics/config_observability.go @@ -27,6 +27,10 @@ import ( const ( // The following is used to set the default log url template DefaultLogURLTemplate = "http://localhost:8001/api/v1/namespaces/knative-monitoring/services/kibana-logging/proxy/app/kibana#/discover?_a=(query:(match:(kubernetes.labels.knative-dev%2FrevisionUID:(query:'${REVISION_UID}',type:phrase))))" + + // The following is used to set the default metrics backend + DefaultRequestMetricsBackend = "prometheus" + // The env var name for config-observability ConfigMapNameEnv = "CONFIG_OBSERVABILITY_NAME" ) @@ -84,6 +88,8 @@ func NewObservabilityConfigFromConfigMap(configMap *corev1.ConfigMap) (*Observab if mb, ok := configMap.Data["metrics.request-metrics-backend-destination"]; ok { oc.RequestMetricsBackend = mb + } else { + oc.RequestMetricsBackend = DefaultRequestMetricsBackend } if prof, ok := configMap.Data["profiling.enable"]; ok { diff --git a/vendor/knative.dev/serving/AUTHORS b/vendor/knative.dev/serving/AUTHORS index 5ab90824c..f42714c4e 100644 --- a/vendor/knative.dev/serving/AUTHORS +++ b/vendor/knative.dev/serving/AUTHORS @@ -8,3 +8,4 @@ Pivotal Software, Inc. IBM Corp Red Hat, Inc. Cisco Systems, Inc. +VMware, Inc. diff --git a/vendor/knative.dev/serving/pkg/apis/autoscaling/v1alpha1/pa_types.go b/vendor/knative.dev/serving/pkg/apis/autoscaling/v1alpha1/pa_types.go index c878bcade..9f0545417 100644 --- a/vendor/knative.dev/serving/pkg/apis/autoscaling/v1alpha1/pa_types.go +++ b/vendor/knative.dev/serving/pkg/apis/autoscaling/v1alpha1/pa_types.go @@ -80,7 +80,7 @@ type PodAutoscalerSpec struct { // This property will be dropped in future Knative releases and should // not be used - use metadata.generation // - // Tracking issue: https://knative.dev/serving/issues/643 + // Tracking issue: https://github.com/knative/serving/issues/643 // // +optional DeprecatedGeneration int64 `json:"generation,omitempty"` diff --git a/vendor/knative.dev/serving/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go b/vendor/knative.dev/serving/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go index 4e2b521a3..a4a822dfa 100644 --- a/vendor/knative.dev/serving/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/knative.dev/serving/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/apis/config/zz_generated.deepcopy.go b/vendor/knative.dev/serving/pkg/apis/config/zz_generated.deepcopy.go index d0e78d8c0..341f6334b 100644 --- a/vendor/knative.dev/serving/pkg/apis/config/zz_generated.deepcopy.go +++ b/vendor/knative.dev/serving/pkg/apis/config/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/apis/networking/generic_types.go b/vendor/knative.dev/serving/pkg/apis/networking/generic_types.go index 92e28218c..82685b1e4 100644 --- a/vendor/knative.dev/serving/pkg/apis/networking/generic_types.go +++ b/vendor/knative.dev/serving/pkg/apis/networking/generic_types.go @@ -26,7 +26,7 @@ import ( // unlikely to change from version to version. // ProtocolType is an enumeration of the supported application-layer protocols -// See also: https://knative.dev/serving/blob/master/docs/runtime-contract.md#protocols-and-ports +// See also: https://github.com/knative/serving/blob/master/docs/runtime-contract.md#protocols-and-ports type ProtocolType string const ( diff --git a/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/ingress_defaults.go b/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/ingress_defaults.go index 4da79a16c..b0a724991 100644 --- a/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/ingress_defaults.go +++ b/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/ingress_defaults.go @@ -51,14 +51,9 @@ func (s *IngressSpec) SetDefaults(ctx context.Context) { // SetDefaults populates default values in IngressTLS func (t *IngressTLS) SetDefaults(ctx context.Context) { - // Default Secret key for ServerCertificate is `tls.crt`. - if t.ServerCertificate == "" { - t.ServerCertificate = "tls.crt" - } - // Default Secret key for PrivateKey is `tls.key`. - if t.PrivateKey == "" { - t.PrivateKey = "tls.key" - } + // Deprecated, do not use. + t.DeprecatedServerCertificate = "" + t.DeprecatedPrivateKey = "" } // SetDefaults populates default values in IngressRule diff --git a/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/ingress_lifecycle.go b/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/ingress_lifecycle.go index fe840dc50..c6fd1b9e2 100644 --- a/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/ingress_lifecycle.go +++ b/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/ingress_lifecycle.go @@ -29,10 +29,6 @@ var ingressCondSet = apis.NewLivingConditionSet( IngressConditionLoadBalancerReady, ) -// VirtualServiceNotReconciled is used for the reason of MarkLoadBalancerFailed -// when VirtualService is failed to be reconciled. -var VirtualServiceNotReconciled = "ReconcileVirtualServiceFailed" - // GetGroupVersionKind returns SchemeGroupVersion of an Ingress func (i *Ingress) GetGroupVersionKind() schema.GroupVersionKind { return SchemeGroupVersion.WithKind("Ingress") @@ -79,7 +75,7 @@ func (is *IngressStatus) MarkLoadBalancerReady(lbs []LoadBalancerIngressStatus, // reflect that the load balancer is not ready yet. func (is *IngressStatus) MarkLoadBalancerNotReady() { ingressCondSet.Manage(is).MarkUnknown(IngressConditionLoadBalancerReady, "Uninitialized", - "Waiting for VirtualService to be ready") + "Waiting for load balancer to be ready") } // MarkLoadBalancerFailed marks the "IngressConditionLoadBalancerReady" condition to false. diff --git a/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/ingress_types.go b/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/ingress_types.go index 9d2811e0b..f779bef9e 100644 --- a/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/ingress_types.go +++ b/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/ingress_types.go @@ -90,7 +90,7 @@ type IngressSpec struct { // This property will be dropped in future Knative releases and should // not be used - use metadata.generation // - // Tracking issue: https://knative.dev/serving/issues/643 + // Tracking issue: https://github.com/knative/serving/issues/643 // // +optional DeprecatedGeneration int64 `json:"generation,omitempty"` @@ -143,12 +143,12 @@ type IngressTLS struct { // ServerCertificate identifies the certificate filename in the secret. // Defaults to `tls.crt`. // +optional - ServerCertificate string `json:"serverCertificate,omitempty"` + DeprecatedServerCertificate string `json:"serverCertificate,omitempty"` // PrivateKey identifies the private key filename in the secret. // Defaults to `tls.key`. // +optional - PrivateKey string `json:"privateKey,omitempty"` + DeprecatedPrivateKey string `json:"privateKey,omitempty"` } // IngressRule represents the rules mapping the paths under a specified host to diff --git a/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/zz_generated.deepcopy.go b/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/zz_generated.deepcopy.go index ea652386c..0f4641d8b 100644 --- a/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/knative.dev/serving/pkg/apis/networking/v1alpha1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go b/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go index 11cf71907..09be21098 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/k8s_validation.go @@ -61,7 +61,7 @@ var ( // The port is named "user-port" on the deployment, but a user cannot set an arbitrary name on the port // in Configuration. The name field is reserved for content-negotiation. Currently 'h2c' and 'http1' are // allowed. - // https://knative.dev/serving/blob/master/docs/runtime-contract.md#inbound-network-connectivity + // https://github.com/knative/serving/blob/master/docs/runtime-contract.md#inbound-network-connectivity validPortNames = sets.NewString( "h2c", "http1", diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/configuration_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/configuration_types.go index 7c2c4a2bf..dc18e1829 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/configuration_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/configuration_types.go @@ -30,7 +30,7 @@ import ( // Users create new Revisions by updating the Configuration's spec. // The "latest created" revision's name is available under status, as is the // "latest ready" revision's name. -// See also: https://knative.dev/serving/blob/master/docs/spec/overview.md#configuration +// See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#configuration type Configuration struct { metav1.TypeMeta `json:",inline"` // +optional diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_types.go index 8eb83f7b2..d4e5deba9 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/revision_types.go @@ -31,7 +31,7 @@ import ( // references a container image. Revisions are created by updates to a // Configuration. // -// See also: https://knative.dev/serving/blob/master/docs/spec/overview.md#revision +// See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#revision type Revision struct { metav1.TypeMeta `json:",inline"` // +optional diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/route_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/route_types.go index 0d470ea5b..6a8eed1bb 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/route_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/route_types.go @@ -32,7 +32,7 @@ import ( // referencing the Configuration responsible for creating them; in these cases // the Route is additionally responsible for monitoring the Configuration for // "latest ready revision" changes, and smoothly rolling out latest revisions. -// See also: https://knative.dev/serving/blob/master/docs/spec/overview.md#route +// See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#route type Route struct { metav1.TypeMeta `json:",inline"` // +optional diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/service_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/service_types.go index 19c4758ac..0fa860b60 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/service_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/service_types.go @@ -38,7 +38,7 @@ import ( // The Service's controller will track the statuses of its owned Configuration // and Route, reflecting their statuses and conditions as its own. // -// See also: https://knative.dev/serving/blob/master/docs/spec/overview.md#service +// See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#service type Service struct { metav1.TypeMeta `json:",inline"` // +optional diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1/zz_generated.deepcopy.go b/vendor/knative.dev/serving/pkg/apis/serving/v1/zz_generated.deepcopy.go index 7d8eeddce..bfff38f19 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1/zz_generated.deepcopy.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/configuration_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/configuration_types.go index 87addf0d5..0bc29f921 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/configuration_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/configuration_types.go @@ -32,7 +32,7 @@ import ( // Users create new Revisions by updating the Configuration's spec. // The "latest created" revision's name is available under status, as is the // "latest ready" revision's name. -// See also: https://knative.dev/serving/blob/master/docs/spec/overview.md#configuration +// See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#configuration type Configuration struct { metav1.TypeMeta `json:",inline"` // +optional @@ -68,7 +68,7 @@ type ConfigurationSpec struct { // This property will be dropped in future Knative releases and should // not be used - use metadata.generation // - // Tracking issue: https://knative.dev/serving/issues/643 + // Tracking issue: https://github.com/knative/serving/issues/643 // // +optional DeprecatedGeneration int64 `json:"generation,omitempty"` diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/revision_lifecycle.go b/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/revision_lifecycle.go index 6bfbcca72..f8ca021bd 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/revision_lifecycle.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/revision_lifecycle.go @@ -53,10 +53,6 @@ const ( // UserQueueMetricsPortName specifies the port name to use for metrics // emitted by queue-proxy for end user. UserQueueMetricsPortName = "http-usermetric" - - // ServiceQueueMetricsPortName is the name of the port that serves metrics - // on the Kubernetes service. - ServiceQueueMetricsPortName = "http-metrics" ) var revCondSet = apis.NewLivingConditionSet( diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/revision_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/revision_types.go index 99704e971..e7a90c657 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/revision_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/revision_types.go @@ -34,7 +34,7 @@ import ( // materializing that container image from source. Revisions are created by // updates to a Configuration. // -// See also: https://knative.dev/serving/blob/master/docs/spec/overview.md#revision +// See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#revision type Revision struct { metav1.TypeMeta `json:",inline"` // +optional @@ -72,7 +72,7 @@ type RevisionTemplateSpec struct { } // DeprecatedRevisionServingStateType is an enumeration of the levels of serving readiness of the Revision. -// See also: https://knative.dev/serving/blob/master/docs/spec/errors.md#error-conditions-and-reporting +// See also: https://github.com/knative/serving/blob/master/docs/spec/errors.md#error-conditions-and-reporting type DeprecatedRevisionServingStateType string const ( @@ -87,7 +87,7 @@ const ( // anymore. It should not have any Istio routes or Kubernetes resources. // A Revision may be brought out of retirement, but it may take longer than // it would from a "Reserve" state. - // Note: currently not set anywhere. See https://knative.dev/serving/issues/1203 + // Note: currently not set anywhere. See https://github.com/knative/serving/issues/1203 DeprecatedRevisionServingStateRetired DeprecatedRevisionServingStateType = "Retired" ) @@ -118,7 +118,7 @@ type RevisionSpec struct { // This property will be dropped in future Knative releases and should // not be used - use metadata.generation // - // Tracking issue: https://knative.dev/serving/issues/643 + // Tracking issue: https://github.com/knative/serving/issues/643 // // +optional DeprecatedGeneration int64 `json:"generation,omitempty"` @@ -153,7 +153,7 @@ type RevisionSpec struct { // this Container, including: name and lifecycle. // See also the runtime contract for more information about the execution // environment: - // https://knative.dev/serving/blob/master/docs/runtime-contract.md + // https://github.com/knative/serving/blob/master/docs/runtime-contract.md // +optional DeprecatedContainer *corev1.Container `json:"container,omitempty"` } diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/route_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/route_types.go index 1067a7d04..da51e92a8 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/route_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/route_types.go @@ -35,7 +35,7 @@ import ( // referencing the Configuration responsible for creating them; in these cases // the Route is additionally responsible for monitoring the Configuration for // "latest ready" revision changes, and smoothly rolling out latest revisions. -// See also: https://knative.dev/serving/blob/master/docs/spec/overview.md#route +// See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#route type Route struct { metav1.TypeMeta `json:",inline"` // +optional @@ -83,7 +83,7 @@ type RouteSpec struct { // This property will be dropped in future Knative releases and should // not be used - use metadata.generation // - // Tracking issue: https://knative.dev/serving/issues/643 + // Tracking issue: https://github.com/knative/serving/issues/643 // // +optional DeprecatedGeneration int64 `json:"generation,omitempty"` diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/service_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/service_types.go index ece0c5f9c..16580a386 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/service_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/service_types.go @@ -38,7 +38,7 @@ import ( // The Service's controller will track the statuses of its owned Configuration // and Route, reflecting their statuses and conditions as its own. // -// See also: https://knative.dev/serving/blob/master/docs/spec/overview.md#service +// See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#service type Service struct { metav1.TypeMeta `json:",inline"` // +optional @@ -73,7 +73,7 @@ type ServiceSpec struct { // This property will be dropped in future Knative releases and should // not be used - use metadata.generation // - // Tracking issue: https://knative.dev/serving/issues/643 + // Tracking issue: https://github.com/knative/serving/issues/643 // // +optional DeprecatedGeneration int64 `json:"generation,omitempty"` diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go b/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go index 25ac6e511..8d347d821 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/configuration_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/configuration_types.go index 344e43286..fbc18a92c 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/configuration_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/configuration_types.go @@ -30,7 +30,7 @@ import ( // Users create new Revisions by updating the Configuration's spec. // The "latest created" revision's name is available under status, as is the // "latest ready" revision's name. -// See also: https://knative.dev/serving/blob/master/docs/spec/overview.md#configuration +// See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#configuration type Configuration struct { metav1.TypeMeta `json:",inline"` // +optional diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/revision_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/revision_types.go index fe72a4471..fcaa9fbf4 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/revision_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/revision_types.go @@ -30,7 +30,7 @@ import ( // references a container image. Revisions are created by updates to a // Configuration. // -// See also: https://knative.dev/serving/blob/master/docs/spec/overview.md#revision +// See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#revision type Revision struct { metav1.TypeMeta `json:",inline"` // +optional diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/route_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/route_types.go index 800ed30e5..f98d1fc59 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/route_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/route_types.go @@ -32,7 +32,7 @@ import ( // referencing the Configuration responsible for creating them; in these cases // the Route is additionally responsible for monitoring the Configuration for // "latest ready revision" changes, and smoothly rolling out latest revisions. -// See also: https://knative.dev/serving/blob/master/docs/spec/overview.md#route +// See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#route type Route struct { metav1.TypeMeta `json:",inline"` // +optional diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/service_types.go b/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/service_types.go index 332ee83b3..3c224273e 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/service_types.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/service_types.go @@ -38,7 +38,7 @@ import ( // The Service's controller will track the statuses of its owned Configuration // and Route, reflecting their statuses and conditions as its own. // -// See also: https://knative.dev/serving/blob/master/docs/spec/overview.md#service +// See also: https://github.com/knative/serving/blob/master/docs/spec/overview.md#service type Service struct { metav1.TypeMeta `json:",inline"` // +optional diff --git a/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/zz_generated.deepcopy.go b/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/zz_generated.deepcopy.go index ef7830bf1..0c9d27d13 100644 --- a/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/zz_generated.deepcopy.go +++ b/vendor/knative.dev/serving/pkg/apis/serving/v1beta1/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/scheme/doc.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/scheme/doc.go index 7d7653848..7acc2dcf2 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/scheme/doc.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/scheme/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/scheme/register.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/scheme/register.go index b9049aef8..d35b6c429 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/scheme/register.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/scheme/register.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/configuration.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/configuration.go index a747d3ff0..1d583fdba 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/configuration.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/configuration.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/doc.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/doc.go index a1c6bb9fe..41e872fe9 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/doc.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/doc.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/doc.go index a00e5d7b2..c7f6e65ca 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/doc.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_configuration.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_configuration.go index 10da68b91..670989b3f 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_configuration.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_configuration.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_revision.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_revision.go index 1df1766c8..113ab1aab 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_revision.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_revision.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_route.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_route.go index e77a2ad04..a972e90cf 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_route.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_route.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_service.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_service.go index d3d4ac00e..c319e904d 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_service.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_service.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_serving_client.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_serving_client.go index 384a951c0..dfe37782e 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_serving_client.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/fake/fake_serving_client.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/generated_expansion.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/generated_expansion.go index 6ce17decf..1e9bae536 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/generated_expansion.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/generated_expansion.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/revision.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/revision.go index 3bb2663c1..efac4f465 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/revision.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/revision.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/route.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/route.go index 0d8edf885..82e9d2373 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/route.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/route.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/service.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/service.go index 384c98781..a5b669ab3 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/service.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/service.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/serving_client.go b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/serving_client.go index 1c7173ddf..e6ade911b 100644 --- a/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/serving_client.go +++ b/vendor/knative.dev/serving/pkg/client/clientset/versioned/typed/serving/v1alpha1/serving_client.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/gc/config.go b/vendor/knative.dev/serving/pkg/gc/config.go index 7090bf119..25c2d6384 100644 --- a/vendor/knative.dev/serving/pkg/gc/config.go +++ b/vendor/knative.dev/serving/pkg/gc/config.go @@ -18,7 +18,7 @@ package gc import ( "context" - "errors" + "fmt" "strconv" "time" @@ -56,7 +56,7 @@ func NewConfigFromConfigMapFunc(ctx context.Context) func(configMap *corev1.Conf }{{ key: "stale-revision-create-delay", field: &c.StaleRevisionCreateDelay, - defaultValue: 24 * time.Hour, + defaultValue: 48 * time.Hour, }, { key: "stale-revision-timeout", field: &c.StaleRevisionTimeout, @@ -76,17 +76,17 @@ func NewConfigFromConfigMapFunc(ctx context.Context) func(configMap *corev1.Conf } if raw, ok := configMap.Data["stale-revision-minimum-generations"]; !ok { - c.StaleRevisionMinimumGenerations = 1 - } else if val, err := strconv.ParseInt(raw, 10, 64); err != nil { + c.StaleRevisionMinimumGenerations = 20 + } else if val, err := strconv.ParseInt(raw, 10 /*base*/, 64 /*bit count*/); err != nil { return nil, err } else if val < 0 { - return nil, errors.New("stale-revision-minimum-generations must be zero or greater") + return nil, fmt.Errorf("stale-revision-minimum-generations must be non-negative, was: %d", val) } else { c.StaleRevisionMinimumGenerations = val } if c.StaleRevisionTimeout-c.StaleRevisionLastpinnedDebounce < minRevisionTimeout { - logger.Errorf("Got revision timeout of %v, minimum supported value is %v", c.StaleRevisionTimeout, minRevisionTimeout+c.StaleRevisionLastpinnedDebounce) + logger.Warnf("Got revision timeout of %v, minimum supported value is %v", c.StaleRevisionTimeout, minRevisionTimeout+c.StaleRevisionLastpinnedDebounce) c.StaleRevisionTimeout = minRevisionTimeout + c.StaleRevisionLastpinnedDebounce return &c, nil } diff --git a/vendor/knative.dev/serving/pkg/gc/zz_generated.deepcopy.go b/vendor/knative.dev/serving/pkg/gc/zz_generated.deepcopy.go index 7a08eb69b..9a3151e12 100644 --- a/vendor/knative.dev/serving/pkg/gc/zz_generated.deepcopy.go +++ b/vendor/knative.dev/serving/pkg/gc/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/network/bufferpool.go b/vendor/knative.dev/serving/pkg/network/bufferpool.go new file mode 100644 index 000000000..d571fb118 --- /dev/null +++ b/vendor/knative.dev/serving/pkg/network/bufferpool.go @@ -0,0 +1,55 @@ +/* +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 + + https://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 network + +import ( + "net/http/httputil" + "sync" +) + +// bufferPool implements the BufferPool interface to be used in +// httputil.ReverseProxy. It stores pointers to to slices to +// further avoid allocations, see https://staticcheck.io/docs/checks#SA6002. +type bufferPool struct { + pool *sync.Pool +} + +// 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 NewBufferPool() httputil.BufferPool { + return &bufferPool{ + 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/serving/pkg/network/error_handler.go b/vendor/knative.dev/serving/pkg/network/error_handler.go deleted file mode 100644 index 486518b96..000000000 --- a/vendor/knative.dev/serving/pkg/network/error_handler.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright 2019 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 network - -import ( - "io/ioutil" - "net/http" - - "go.uber.org/zap" -) - -// ErrorHandler sets up a handler suitable for use with the ErrorHandler field on -// httputil's reverse proxy. -func ErrorHandler(logger *zap.SugaredLogger) func(http.ResponseWriter, *http.Request, error) { - return func(w http.ResponseWriter, req *http.Request, err error) { - ss := readSockStat(logger) - logger.Errorw("error reverse proxying request; sockstat: "+ss, zap.Error(err)) - http.Error(w, err.Error(), http.StatusBadGateway) - } -} - -func readSockStat(logger *zap.SugaredLogger) string { - b, err := ioutil.ReadFile("/proc/net/sockstat") - if err != nil { - logger.Errorw("Unable to read sockstat", zap.Error(err)) - return "" - } - return string(b) -} diff --git a/vendor/knative.dev/serving/pkg/network/h2c.go b/vendor/knative.dev/serving/pkg/network/h2c.go deleted file mode 100644 index 2aa19441d..000000000 --- a/vendor/knative.dev/serving/pkg/network/h2c.go +++ /dev/null @@ -1,54 +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 network - -import ( - "crypto/tls" - "net" - "net/http" - "time" - - "golang.org/x/net/http2" - "golang.org/x/net/http2/h2c" -) - -// NewServer returns a new HTTP Server with HTTP2 handler. -func NewServer(addr string, h http.Handler) *http.Server { - h1s := &http.Server{ - Addr: addr, - Handler: h2c.NewHandler(h, &http2.Server{}), - } - - return h1s -} - -// 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 NewH2CTransport() http.RoundTripper { - return &http2.Transport{ - AllowHTTP: true, - DialTLS: func(netw, addr string, cfg *tls.Config) (net.Conn, error) { - d := &net.Dialer{ - Timeout: DefaultConnTimeout, - KeepAlive: 5 * time.Second, - DualStack: true, - } - return d.Dial(netw, addr) - }, - } -} diff --git a/vendor/knative.dev/serving/pkg/network/network.go b/vendor/knative.dev/serving/pkg/network/network.go index a393cb6db..c620b81bb 100644 --- a/vendor/knative.dev/serving/pkg/network/network.go +++ b/vendor/knative.dev/serving/pkg/network/network.go @@ -26,7 +26,6 @@ import ( "net/url" "strings" "text/template" - "time" corev1 "k8s.io/api/core/v1" ) @@ -97,19 +96,6 @@ const ( // user-agent. So we augment the probes with this header. KubeletProbeHeaderName = "K-Kubelet-Probe" - // DefaultConnTimeout specifies a short default connection timeout - // to avoid hitting the issue fixed in - // https://github.com/kubernetes/kubernetes/pull/72534 but only - // avalailable after Kubernetes 1.14. - // - // Our connections are usually between pods in the same cluster - // like activator <-> queue-proxy, or even between containers - // within the same pod queue-proxy <-> user-container, so a - // smaller connect timeout would be justifiable. - // - // We should consider exposing this as a configuration. - DefaultConnTimeout = 200 * time.Millisecond - // DefaultDomainTemplate is the default golang template to use when // constructing the Knative Route's Domain(host) DefaultDomainTemplate = "{{.Name}}.{{.Namespace}}.{{.Domain}}" @@ -398,3 +384,23 @@ func RewriteHostOut(r *http.Request) { r.Header.Del(OriginalHostHeader) } } + +// 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/knative.dev/serving/pkg/network/transports.go b/vendor/knative.dev/serving/pkg/network/transports.go deleted file mode 100644 index 27df66577..000000000 --- a/vendor/knative.dev/serving/pkg/network/transports.go +++ /dev/null @@ -1,120 +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 network - -import ( - "context" - "errors" - "net" - "net/http" - "time" - - "k8s.io/apimachinery/pkg/util/wait" -) - -// RoundTripperFunc implementation roundtrips a request. -type RoundTripperFunc func(*http.Request) (*http.Response, error) - -// RoundTrip implements http.RoundTripper. -func (rt RoundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) { - return rt(r) -} - -func newAutoTransport(v1 http.RoundTripper, v2 http.RoundTripper) http.RoundTripper { - return RoundTripperFunc(func(r *http.Request) (*http.Response, error) { - t := v1 - if r.ProtoMajor == 2 { - t = v2 - } - return t.RoundTrip(r) - }) -} - -const sleepTO = 30 * time.Millisecond - -var backOffTemplate = wait.Backoff{ - Duration: 50 * time.Millisecond, - Factor: 1.4, - Jitter: 0.1, // At most 10% jitter. - Steps: 15, -} - -var errDialTimeout = errors.New("timed out dialing") - -// dialWithBackOff executes `net.Dialer.DialContext()` with exponentially increasing -// dial timeouts. In addition it sleeps with random jitter between tries. -func dialWithBackOff(ctx context.Context, network, address string) (net.Conn, error) { - return dialBackOffHelper(ctx, network, address, backOffTemplate, sleepTO) -} - -func dialBackOffHelper(ctx context.Context, network, address string, bo wait.Backoff, sleep time.Duration) (net.Conn, error) { - dialer := &net.Dialer{ - Timeout: bo.Duration, // Initial duration. - KeepAlive: 5 * time.Second, - DualStack: true, - } - for { - c, err := dialer.DialContext(ctx, network, address) - if err != nil { - if err, ok := err.(net.Error); ok && err.Timeout() { - if bo.Steps < 1 { - break - } - dialer.Timeout = bo.Step() - time.Sleep(wait.Jitter(sleep, 1.0)) // Sleep with jitter. - continue - } - return nil, err - } - return c, nil - } - return nil, errDialTimeout -} - -func newHTTPTransport(connTimeout time.Duration, disableKeepAlives bool) http.RoundTripper { - return &http.Transport{ - // Those match net/http/transport.go - Proxy: http.ProxyFromEnvironment, - MaxIdleConns: 1000, - MaxIdleConnsPerHost: 100, - IdleConnTimeout: 5 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - DisableKeepAlives: disableKeepAlives, - - // This is bespoke. - DialContext: dialWithBackOff, - } -} - -// NewProberTransport creates a RoundTripper that is useful for probing, -// since it will not cache connections. -func NewProberTransport() http.RoundTripper { - return newAutoTransport( - newHTTPTransport(DefaultConnTimeout, true /*disable keep-alives*/), - NewH2CTransport()) -} - -// NewAutoTransport creates a RoundTripper that can use appropriate transport -// based on the request's HTTP version. -func NewAutoTransport() http.RoundTripper { - return newAutoTransport( - newHTTPTransport(DefaultConnTimeout, false /*disable keep-alives*/), - NewH2CTransport()) -} - -// AutoTransport uses h2c for HTTP2 requests and falls back to `http.DefaultTransport` for all others -var AutoTransport = NewAutoTransport() diff --git a/vendor/knative.dev/serving/pkg/network/zz_generated.deepcopy.go b/vendor/knative.dev/serving/pkg/network/zz_generated.deepcopy.go index 1a180f397..43e67b193 100644 --- a/vendor/knative.dev/serving/pkg/network/zz_generated.deepcopy.go +++ b/vendor/knative.dev/serving/pkg/network/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/knative.dev/serving/pkg/reconciler/route/config/zz_generated.deepcopy.go b/vendor/knative.dev/serving/pkg/reconciler/route/config/zz_generated.deepcopy.go index 8e6a4a773..86b30c499 100644 --- a/vendor/knative.dev/serving/pkg/reconciler/route/config/zz_generated.deepcopy.go +++ b/vendor/knative.dev/serving/pkg/reconciler/route/config/zz_generated.deepcopy.go @@ -1,7 +1,7 @@ // +build !ignore_autogenerated /* -Copyright 2019 The Knative Authors +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. diff --git a/vendor/modules.txt b/vendor/modules.txt index b212502e2..58295146b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -649,7 +649,7 @@ knative.dev/eventing/pkg/legacyclient/clientset/versioned/scheme knative.dev/eventing/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1 knative.dev/eventing/pkg/legacyclient/clientset/versioned/typed/legacysources/v1alpha1/fake knative.dev/eventing/pkg/logging -# knative.dev/pkg v0.0.0-20200113182502-b8dc5fbc6d2f +# knative.dev/pkg v0.0.0-20200120180006-96d3b8c24c34 knative.dev/pkg/apis knative.dev/pkg/apis/duck knative.dev/pkg/apis/duck/v1 @@ -668,7 +668,7 @@ knative.dev/pkg/network knative.dev/pkg/profiling knative.dev/pkg/ptr knative.dev/pkg/tracker -# knative.dev/serving v0.11.0 +# knative.dev/serving v0.12.0 knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1 knative.dev/serving/pkg/apis/config