upgrade to latest dependencies (#1180)

Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
knative-automation 2021-01-05 20:24:56 -08:00 committed by GitHub
parent 3d6c70e744
commit 8a4ab8fc84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 120 additions and 59 deletions

8
go.mod
View File

@ -22,11 +22,11 @@ require (
k8s.io/cli-runtime v0.18.8
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
k8s.io/code-generator v0.18.12
knative.dev/eventing v0.19.1-0.20201222225404-b482c5fad781
knative.dev/eventing v0.19.1-0.20210105232856-0c47fa728be3
knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24
knative.dev/networking v0.0.0-20201223042504-b9e08949dfbc
knative.dev/pkg v0.0.0-20201223002104-9d0775512af8
knative.dev/serving v0.19.1-0.20201223043503-2141153a916b
knative.dev/networking v0.0.0-20201231021130-99ffcf03fd0a
knative.dev/pkg v0.0.0-20201231084629-fb3dc711206a
knative.dev/serving v0.19.1-0.20210106004856-7e0e8de9cc1f
sigs.k8s.io/yaml v1.2.0
)

23
go.sum
View File

@ -1262,31 +1262,28 @@ k8s.io/legacy-cloud-providers v0.18.8/go.mod h1:tgp4xYf6lvjrWnjQwTOPvWQE9IVqSBGP
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451 h1:v8ud2Up6QK1lNOKFgiIVrZdMg7MpmSnvtrOieolJKoE=
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
knative.dev/caching v0.0.0-20201217015204-c3efd692dc36/go.mod h1:4ilQORs+ZBMOQWu6oWGJvQFz/NP3N63DwheA6O8UNVE=
knative.dev/eventing v0.19.1-0.20201222225404-b482c5fad781 h1:DQWHvmBSZwUu75o6JYsTbYE6zAVcKidqxaHbvIVu/3k=
knative.dev/eventing v0.19.1-0.20201222225404-b482c5fad781/go.mod h1:TllNkxV7rozwMG8Ri/O5+VJ/s6NyU0CNNIs5eLNVgR0=
knative.dev/caching v0.0.0-20201221023403-116224f358cd/go.mod h1:upxMcX1I08HDdYA1nusUFzkgwV88C0hKbgGWYnzsgmc=
knative.dev/eventing v0.19.1-0.20210105232856-0c47fa728be3 h1:xjpqizS+CKyWFmq0k3Ad4IlIHMPwXAwhZktLNvk2tgg=
knative.dev/eventing v0.19.1-0.20210105232856-0c47fa728be3/go.mod h1:1F2YE3RDRqu7urMAC8mZDqkRnzS7exaQeAGtEvsD+Ss=
knative.dev/hack v0.0.0-20201112185459-01a34c573bd8 h1:RNbZsAjhswBPtl4C5C5gEFX5/GfWIOZQxfYD9DhkHdY=
knative.dev/hack v0.0.0-20201112185459-01a34c573bd8/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/hack v0.0.0-20201118155651-b31d3bb6bff9/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24 h1:kIztWfvnIFV8Lhlea02K3YO2mIzcDyQNzrBLn0Oq9sA=
knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/networking v0.0.0-20201218160702-9c60344e49e5 h1:ly1etm+T7QOdNTcRBy80f6fwNCmf7Huj4ZRTYT3w6mQ=
knative.dev/networking v0.0.0-20201218160702-9c60344e49e5/go.mod h1:iWk1TS8+tKxghbJ1PlTHLkaC1ivr/6NYugeJlnGdlOg=
knative.dev/networking v0.0.0-20201223042504-b9e08949dfbc h1:I9oJW2LwMaZ/e2MwClWLTVxSVF9457o4qSJTzGK6CP8=
knative.dev/networking v0.0.0-20201223042504-b9e08949dfbc/go.mod h1:MTHF/89uQ3XDklu7Uny5TuobSC9UkHBWmMvFWgnZ5Rk=
knative.dev/networking v0.0.0-20201231021130-99ffcf03fd0a h1:vuTtHGx8W/kBzxyw5v3zTL+xdfZCHu0xH8qc07vGcRs=
knative.dev/networking v0.0.0-20201231021130-99ffcf03fd0a/go.mod h1:N123KICErXy+bPo1oBszM6TVYGG0Za2wMmnEqX4MlFg=
knative.dev/pkg v0.0.0-20201117221452-0fccc54273ed h1:4LNEFhvD2Ya4WgCD3SC1WGXz81bjEvQgbcpe5XACI3I=
knative.dev/pkg v0.0.0-20201117221452-0fccc54273ed/go.mod h1:nxlh3CUvx6WBPr1WKD96AHxFZPD2UKRDo9RUp8ILTyQ=
knative.dev/pkg v0.0.0-20201216162758-261c9b4624df/go.mod h1:VjrwVhfEZUnn6FruncHcBm854FldnRpekpyBbYtBvZM=
knative.dev/pkg v0.0.0-20201217152402-7226f4f447a8 h1:Ti4QhRNR6WSKiobT9gWuJZT3odRQC4v8LcO5tVfsNNI=
knative.dev/pkg v0.0.0-20201217152402-7226f4f447a8/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
knative.dev/pkg v0.0.0-20201218185703-e41409af6cff h1:qLPWOSpK2Nh5r6GboAFBsWIxmaAKlq+XYWdKOhoKht8=
knative.dev/pkg v0.0.0-20201218185703-e41409af6cff/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
knative.dev/pkg v0.0.0-20201222215804-e2d6b4f84573/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
knative.dev/pkg v0.0.0-20201223002104-9d0775512af8 h1:0UaGaAn57/Egp7cfD/Cq6tNYr2QYyGZ8KSzC46CxYq4=
knative.dev/pkg v0.0.0-20201223002104-9d0775512af8/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
knative.dev/pkg v0.0.0-20201224024804-27db5ac24cfb/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
knative.dev/pkg v0.0.0-20201231084629-fb3dc711206a h1:LjZzFXE9VuhuPJFMn7KdjmsukoLOwQasfBuEJPc53ys=
knative.dev/pkg v0.0.0-20201231084629-fb3dc711206a/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
knative.dev/reconciler-test v0.0.0-20201124190335-83a44efcdfef/go.mod h1:YSs1y1rgnjs8w39/drLIOQbWvZUQwqApvd+EizO8UsA=
knative.dev/serving v0.19.1-0.20201223043503-2141153a916b h1:Pvr0Zgr58iQSNtbUehw3JXyoNqFeePcTsyeXI0Kcsno=
knative.dev/serving v0.19.1-0.20201223043503-2141153a916b/go.mod h1:Y143V4rRqaY3Lj/1Ejfvi5f4k4SLvOmkE/NLXOp+YZc=
knative.dev/serving v0.19.1-0.20210106004856-7e0e8de9cc1f h1:bsp8f4RFpB5+AXSLf1kJx72ixbAlmQLAh67KiAOKq34=
knative.dev/serving v0.19.1-0.20210106004856-7e0e8de9cc1f/go.mod h1:uxigOTrsOBhoa15xDoogmnMH+LkRNotEBKJlCrnjmbg=
pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=

View File

@ -22,7 +22,6 @@ import (
"errors"
"fmt"
"os"
"path"
"strconv"
"strings"
"time"
@ -65,6 +64,12 @@ const (
prometheusHostEnvName = "METRICS_PROMETHEUS_HOST"
)
var (
// TestOverrideBundleCount is a variable for testing to reduce the size (number of metrics) buffered before
// Stackdriver will send a bundled metric report. Only applies if non-zero.
TestOverrideBundleCount = 0
)
// Metrics backend "enum".
const (
// stackdriver is used for Stackdriver backend
@ -248,37 +253,8 @@ func createMetricsConfig(ctx context.Context, ops ExporterOptions) (*metricsConf
mc.prometheusPort = pp
mc.prometheusHost = prometheusHost()
case stackdriver:
// If stackdriverClientConfig is not provided for stackdriver backend destination, OpenCensus will try to
// use the application default credentials. If that is not available, Opencensus would fail to create the
// metrics exporter.
scc := NewStackdriverClientConfigFromMap(m)
mc.stackdriverClientConfig = *scc
mc.isStackdriverBackend = true
var allowCustomMetrics bool
var err error
mc.stackdriverMetricTypePrefix = path.Join(mc.domain, mc.component)
customMetricsSubDomain := m[stackdriverCustomMetricSubDomainKey]
if customMetricsSubDomain == "" {
customMetricsSubDomain = defaultCustomMetricSubDomain
}
mc.stackdriverCustomMetricTypePrefix = path.Join(customMetricTypePrefix, customMetricsSubDomain, mc.component)
if ascmStr := m[allowStackdriverCustomMetricsKey]; ascmStr != "" {
allowCustomMetrics, err = strconv.ParseBool(ascmStr)
if err != nil {
return nil, fmt.Errorf("invalid %s value %q", allowStackdriverCustomMetricsKey, ascmStr)
}
}
mc.recorder = sdCustomMetricsRecorder(mc, allowCustomMetrics)
if scc.UseSecret {
secret, err := getStackdriverSecret(ctx, ops.Secrets)
if err != nil {
return nil, err
}
mc.secret = secret
if err := sdinit(ctx, m, &mc, ops); err != nil {
return nil, err
}
}

View File

@ -1,3 +1,5 @@
// +build !nostackdriver
/*
Copyright 2019 The Knative Authors

View File

@ -0,0 +1,35 @@
// +build nostackdriver
/*
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 metrics
import (
"context"
"errors"
"go.opencensus.io/stats/view"
"go.uber.org/zap"
)
func sdinit(ctx context.Context, m map[string]string, mc *metricsConfig, ops ExporterOptions) error {
return errors.New("Stackdriver support is not included")
}
func newStackdriverExporter(config *metricsConfig, logger *zap.SugaredLogger) (view.Exporter, ResourceExporterFactory, error) {
return nil, nil, errors.New("Stackdriver support is not included")
}

View File

@ -1,3 +1,5 @@
// +build !nostackdriver
/*
Copyright 2019 The Knative Authors
@ -20,6 +22,7 @@ import (
"context"
"fmt"
"path"
"strconv"
"sync"
"time"
@ -88,10 +91,6 @@ var (
// metricToResourceLabels provides a quick lookup from a custom metric name to the set of tags
// which should be promoted to Stackdriver Resource labels via opencensus resources.
metricToResourceLabels = map[string]*resourceTemplate{}
// TestOverrideBundleCount is a variable for testing to reduce the size (number of metrics) buffered before
// Stackdriver will send a bundled metric report. Only applies if non-zero.
TestOverrideBundleCount = 0
)
type resourceTemplate struct {
@ -99,6 +98,42 @@ type resourceTemplate struct {
LabelKeys sets.String
}
func sdinit(ctx context.Context, m map[string]string, mc *metricsConfig, ops ExporterOptions) error {
// If stackdriverClientConfig is not provided for stackdriver backend destination, OpenCensus will try to
// use the application default credentials. If that is not available, Opencensus would fail to create the
// metrics exporter.
scc := NewStackdriverClientConfigFromMap(m)
mc.stackdriverClientConfig = *scc
mc.isStackdriverBackend = true
var allowCustomMetrics bool
var err error
mc.stackdriverMetricTypePrefix = path.Join(mc.domain, mc.component)
customMetricsSubDomain := m[stackdriverCustomMetricSubDomainKey]
if customMetricsSubDomain == "" {
customMetricsSubDomain = defaultCustomMetricSubDomain
}
mc.stackdriverCustomMetricTypePrefix = path.Join(customMetricTypePrefix, customMetricsSubDomain, mc.component)
if ascmStr := m[allowStackdriverCustomMetricsKey]; ascmStr != "" {
allowCustomMetrics, err = strconv.ParseBool(ascmStr)
if err != nil {
return fmt.Errorf("invalid %s value %q", allowStackdriverCustomMetricsKey, ascmStr)
}
}
mc.recorder = sdCustomMetricsRecorder(*mc, allowCustomMetrics)
if scc.UseSecret {
secret, err := getStackdriverSecret(ctx, ops.Secrets)
if err != nil {
return err
}
mc.secret = secret
}
return nil
}
// SetStackdriverSecretLocation sets the name and namespace of the Secret that can be used to authenticate with Stackdriver.
// The Secret is only used if both:
// 1. This function has been explicitly called to set the name and namespace

View File

@ -16,6 +16,10 @@ limitations under the License.
package metrics
const (
testComponent = "testComponent"
)
// InitForTesting initialize the necessary global variables for unit tests.
func InitForTesting() {
setCurMetricsConfig(&metricsConfig{

View File

@ -75,6 +75,10 @@ const (
// which Service they are created.
ServiceLabelKey = GroupName + "/service"
// DomainMappingLabelKey is the label key attached to Ingress resources to indicate
// which DomainMapping triggered their creation.
DomainMappingLabelKey = GroupName + "/domainmapping"
// ConfigurationGenerationLabelKey is the label key attached to a Revision indicating the
// metadata generation of the Configuration that created this revision
ConfigurationGenerationLabelKey = GroupName + "/configurationGeneration"

View File

@ -18,7 +18,10 @@ package v1alpha1
import (
"context"
"fmt"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/apimachinery/pkg/util/validation/field"
"knative.dev/pkg/apis"
"knative.dev/serving/pkg/apis/serving"
)
@ -39,6 +42,11 @@ func (dm *DomainMapping) validateMetadata(ctx context.Context) (errs *apis.Field
errs = errs.Also(apis.ErrDisallowedFields("generateName"))
}
err := validation.IsFullyQualifiedDomainName(field.NewPath("name"), dm.Name)
if err != nil {
errs = errs.Also(apis.ErrGeneric(fmt.Sprintf("invalid name %q: %s", dm.Name, err.ToAggregate()), "name"))
}
if apis.IsInUpdate(ctx) {
original := apis.GetBaseline(ctx).(*DomainMapping)
errs = errs.Also(

View File

@ -108,9 +108,9 @@ func WithRoutingStateModified(t time.Time) RevisionOption {
}
// WithRoutingState updates the annotation to the provided timestamp.
func WithRoutingState(s v1.RoutingState) RevisionOption {
func WithRoutingState(s v1.RoutingState, c clock.Clock) RevisionOption {
return func(rev *v1.Revision) {
rev.SetRoutingState(s, clock.RealClock{})
rev.SetRoutingState(s, c)
}
}

8
vendor/modules.txt vendored
View File

@ -756,7 +756,7 @@ k8s.io/kube-openapi/pkg/util/sets
k8s.io/utils/buffer
k8s.io/utils/integer
k8s.io/utils/trace
# knative.dev/eventing v0.19.1-0.20201222225404-b482c5fad781
# knative.dev/eventing v0.19.1-0.20210105232856-0c47fa728be3
## explicit
knative.dev/eventing/pkg/apis/config
knative.dev/eventing/pkg/apis/configs
@ -789,12 +789,12 @@ knative.dev/eventing/pkg/client/clientset/versioned/typed/sources/v1alpha2/fake
# knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24
## explicit
knative.dev/hack
# knative.dev/networking v0.0.0-20201223042504-b9e08949dfbc
# knative.dev/networking v0.0.0-20201231021130-99ffcf03fd0a
## explicit
knative.dev/networking/pkg
knative.dev/networking/pkg/apis/networking
knative.dev/networking/pkg/apis/networking/v1alpha1
# knative.dev/pkg v0.0.0-20201223002104-9d0775512af8
# knative.dev/pkg v0.0.0-20201231084629-fb3dc711206a
## explicit
knative.dev/pkg/apis
knative.dev/pkg/apis/duck
@ -838,7 +838,7 @@ knative.dev/pkg/tracing/config
knative.dev/pkg/tracing/propagation
knative.dev/pkg/tracing/propagation/tracecontextb3
knative.dev/pkg/tracker
# knative.dev/serving v0.19.1-0.20201223043503-2141153a916b
# knative.dev/serving v0.19.1-0.20210106004856-7e0e8de9cc1f
## explicit
knative.dev/serving/pkg/apis/autoscaling
knative.dev/serving/pkg/apis/autoscaling/v1alpha1