upgrade to latest dependencies (#355)

Signed-off-by: Matt Moore (via Sockpuppet) <mattmoor@vmware.com>
This commit is contained in:
Matt Moore 2020-10-07 18:59:21 -07:00 committed by GitHub
parent 7fcc1941cc
commit 8bafccac22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 322 additions and 20 deletions

4
go.mod
View File

@ -16,8 +16,8 @@ require (
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
k8s.io/code-generator v0.18.8
k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29
knative.dev/pkg v0.0.0-20201006235820-46761ba7c3dc
knative.dev/test-infra v0.0.0-20201006161322-f94f2bcbb2ee
knative.dev/pkg v0.0.0-20201007215820-7bad84346637
knative.dev/test-infra v0.0.0-20201008002321-0e7582f33f9a
)
replace (

13
go.sum
View File

@ -232,6 +232,7 @@ github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAw
github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b h1:AP/Y7sqYicnjGDfD5VcY4CIfh1hRXBUavxrvELjTiOE=
github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b/go.mod h1:ac9efd0D1fsDb3EJvhqgXRbFx7bs2wqZ10HQPeU8U/Q=
@ -385,6 +386,10 @@ github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0
github.com/go-bindata/go-bindata/v3 v3.1.3/go.mod h1:1/zrpXsLD8YDIbhZRqXzm1Ghc7NhEvIN9+Z6R5/xH4I=
github.com/go-critic/go-critic v0.4.1/go.mod h1:7/14rZGnZbY6E38VEGk2kVhoq6itzc1E68facVDK23g=
github.com/go-critic/go-critic v0.4.3/go.mod h1:j4O3D4RoIwRqlZw5jJpx0BNfXWWbpcJoKu5cYSe4YmQ=
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw=
github.com/go-git/go-git/v5 v5.1.0/go.mod h1:ZKfuPUoY1ZqIG4QG9BDBh3G4gLM5zvPuSJAozQrZuyM=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@ -1894,8 +1899,8 @@ knative.dev/pkg v0.0.0-20200505191044-3da93ebb24c2/go.mod h1:Q6sL35DdGs8hIQZKdaC
knative.dev/pkg v0.0.0-20200515002500-16d7b963416f/go.mod h1:tMOHGbxtRz8zYFGEGpV/bpoTEM1o89MwYFC4YJXl3GY=
knative.dev/pkg v0.0.0-20200528142800-1c6815d7e4c9/go.mod h1:QgNZTxnwpB/oSpNcfnLVlw+WpEwwyKAvJlvR3hgeltA=
knative.dev/pkg v0.0.0-20200711004937-22502028e31a/go.mod h1:AqAJV6rYi8IGikDjJ/9ZQd9qKdkXVlesVnVjwx62YB8=
knative.dev/pkg v0.0.0-20201006235820-46761ba7c3dc h1:oXTD9Cx0RVuCJERAREuI/C7r7QCLXmzHwqAjQdqksqg=
knative.dev/pkg v0.0.0-20201006235820-46761ba7c3dc/go.mod h1:xpPYLHYXh306wQISWkRC/5t3+CD76nOcEHrCQ+5pxBM=
knative.dev/pkg v0.0.0-20201007215820-7bad84346637 h1:g8OuU2fO5ocgawA1ZJ9QKzGrOhAANPXSPvNlLb2EzyU=
knative.dev/pkg v0.0.0-20201007215820-7bad84346637/go.mod h1:xpPYLHYXh306wQISWkRC/5t3+CD76nOcEHrCQ+5pxBM=
knative.dev/test-infra v0.0.0-20200407185800-1b88cb3b45a5/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ=
knative.dev/test-infra v0.0.0-20200505052144-5ea2f705bb55/go.mod h1:WqF1Azka+FxPZ20keR2zCNtiQA1MP9ZB4BH4HuI+SIU=
knative.dev/test-infra v0.0.0-20200513011557-d03429a76034/go.mod h1:aMif0KXL4g19YCYwsy4Ocjjz5xgPlseYV+B95Oo4JGE=
@ -1903,8 +1908,8 @@ knative.dev/test-infra v0.0.0-20200519015156-82551620b0a9/go.mod h1:A5b2OAXTOeHT
knative.dev/test-infra v0.0.0-20200707183444-aed09e56ddc7/go.mod h1:RjYAhXnZqeHw9+B0zsbqSPlae0lCvjekO/nw5ZMpLCs=
knative.dev/test-infra v0.0.0-20201002164834-8c07ff018549 h1:8UObRJ0lnWvU9FuD8ubmkwJo14+aZtboq1ncBWbs2uI=
knative.dev/test-infra v0.0.0-20201002164834-8c07ff018549/go.mod h1:Pmg2c7Z7q7BGFUV/GOpU5BlrD3ePJft4MPqx8AYBplc=
knative.dev/test-infra v0.0.0-20201006161322-f94f2bcbb2ee h1:sMtWVGq7OCEMNaEJc54JK5dHFS/+KhI/R/SSFSAZKlU=
knative.dev/test-infra v0.0.0-20201006161322-f94f2bcbb2ee/go.mod h1:Pmg2c7Z7q7BGFUV/GOpU5BlrD3ePJft4MPqx8AYBplc=
knative.dev/test-infra v0.0.0-20201008002321-0e7582f33f9a h1:nFSjeiIZ3bhBXhKuBOfnjuAJlo7GlzCyVV1dDyulZzk=
knative.dev/test-infra v0.0.0-20201008002321-0e7582f33f9a/go.mod h1:Qj8sZPA2mTFusTOH13YVns7jY7xsnrLsZdPB0aTdejs=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=

View File

@ -0,0 +1,52 @@
/*
Copyright 2017 The Kubernetes 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 fuzzer
import (
"math/rand"
"github.com/google/gofuzz"
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
)
// FuzzerFuncs returns a list of func(*SomeType, c fuzz.Continue) functions.
type FuzzerFuncs func(codecs runtimeserializer.CodecFactory) []interface{}
// FuzzerFor can randomly populate api objects that are destined for version.
func FuzzerFor(funcs FuzzerFuncs, src rand.Source, codecs runtimeserializer.CodecFactory) *fuzz.Fuzzer {
f := fuzz.New().NilChance(.5).NumElements(0, 1)
if src != nil {
f.RandSource(src)
}
f.Funcs(funcs(codecs)...)
return f
}
// MergeFuzzerFuncs will merge the given funcLists, overriding early funcs with later ones if there first
// argument has the same type.
func MergeFuzzerFuncs(funcs ...FuzzerFuncs) FuzzerFuncs {
return FuzzerFuncs(func(codecs runtimeserializer.CodecFactory) []interface{} {
result := []interface{}{}
for _, f := range funcs {
if f != nil {
result = append(result, f(codecs)...)
}
}
return result
})
}

View File

@ -0,0 +1,86 @@
/*
Copyright 2017 The Kubernetes 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 fuzzer
import (
"reflect"
)
// ValueFuzz recursively changes all basic type values in an object. Any kind of references will not
// be touch, i.e. the addresses of slices, maps, pointers will stay unchanged.
func ValueFuzz(obj interface{}) {
valueFuzz(reflect.ValueOf(obj))
}
func valueFuzz(obj reflect.Value) {
switch obj.Kind() {
case reflect.Array:
for i := 0; i < obj.Len(); i++ {
valueFuzz(obj.Index(i))
}
case reflect.Slice:
if obj.IsNil() {
// TODO: set non-nil value
} else {
for i := 0; i < obj.Len(); i++ {
valueFuzz(obj.Index(i))
}
}
case reflect.Interface, reflect.Ptr:
if obj.IsNil() {
// TODO: set non-nil value
} else {
valueFuzz(obj.Elem())
}
case reflect.Struct:
for i, n := 0, obj.NumField(); i < n; i++ {
valueFuzz(obj.Field(i))
}
case reflect.Map:
if obj.IsNil() {
// TODO: set non-nil value
} else {
for _, k := range obj.MapKeys() {
// map values are not addressable. We need a copy.
v := obj.MapIndex(k)
copy := reflect.New(v.Type())
copy.Elem().Set(v)
valueFuzz(copy.Elem())
obj.SetMapIndex(k, copy.Elem())
}
// TODO: set some new value
}
case reflect.Func: // ignore, we don't have function types in our API
default:
if !obj.CanSet() {
return
}
switch obj.Kind() {
case reflect.String:
obj.SetString(obj.String() + "x")
case reflect.Bool:
obj.SetBool(!obj.Bool())
case reflect.Float32, reflect.Float64:
obj.SetFloat(obj.Float()*2.0 + 1.0)
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
obj.SetInt(obj.Int() + 1)
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
obj.SetUint(obj.Uint() + 1)
default:
}
}
}

View File

@ -0,0 +1,44 @@
/*
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 v1
import (
fuzz "github.com/google/gofuzz"
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
"k8s.io/apimachinery/pkg/runtime/serializer"
"knative.dev/pkg/apis"
pkgfuzzer "knative.dev/pkg/apis/testing/fuzzer"
)
var testConditions = apis.Conditions{{Type: apis.ConditionReady}, {Type: apis.ConditionSucceeded}}
// FuzzerFuncs includes fuzzing funcs for knative.dev/duck v1 types
// In particular it makes sure that Delivery has only valid BackoffPolicyType in it.
//
// For other examples see
// https://github.com/kubernetes/apimachinery/blob/master/pkg/apis/meta/fuzzer/fuzzer.go
var FuzzerFuncs = fuzzer.MergeFuzzerFuncs(
func(codecs serializer.CodecFactory) []interface{} {
return []interface{}{
func(status *Status, c fuzz.Continue) {
c.FuzzNoCustom(status) // fuzz the Status
status.SetConditions(testConditions)
pkgfuzzer.FuzzConditions(status, c)
},
}
},
)

View File

@ -0,0 +1,103 @@
/*
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 fuzzer
import (
"math/rand"
"net/url"
fuzz "github.com/google/gofuzz"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/apitesting/fuzzer"
"k8s.io/apimachinery/pkg/runtime/serializer"
"knative.dev/pkg/apis"
)
// Funcs includes fuzzing funcs for knative.dev/serving types
//
// For other examples see
// https://github.com/kubernetes/apimachinery/blob/master/pkg/apis/meta/fuzzer/fuzzer.go
var Funcs = fuzzer.MergeFuzzerFuncs(
func(codecs serializer.CodecFactory) []interface{} {
return []interface{}{
func(u *apis.URL, c fuzz.Continue) {
u.Scheme = randStringAtoZ(c.Rand)
u.Host = randStringAtoZ(c.Rand)
u.User = url.UserPassword(
randStringAtoZ(c.Rand), // username
randStringAtoZ(c.Rand), // password
)
u.RawPath = url.PathEscape(c.RandString())
u.RawQuery = url.QueryEscape(c.RandString())
},
}
},
)
// FuzzConditions fuzzes the values for the conditions. It doesn't add
// any new condition types
//
// Consumers should initialize their conditions prior to fuzzing them.
// For example:
//
// func(s *SomeStatus, c fuzz.Continue) {
// c.FuzzNoCustom(s) // fuzz the status object
//
// // Clear the random fuzzed condition
// s.Status.SetConditions(nil)
//
// // Fuzz the known conditions except their type value
// s.InitializeConditions()
// fuzz.Conditions(&s.Status, c)
// }
func FuzzConditions(accessor apis.ConditionsAccessor, c fuzz.Continue) {
conds := accessor.GetConditions()
for i, cond := range conds {
// Leave condition.Type untouched
cond.Status = corev1.ConditionStatus(c.RandString())
cond.Severity = apis.ConditionSeverity(c.RandString())
cond.Message = c.RandString()
cond.Reason = c.RandString()
c.FuzzNoCustom(&cond.LastTransitionTime)
conds[i] = cond
}
accessor.SetConditions(conds)
}
// taken from gofuzz internals for RandString
type charRange struct {
first, last rune
}
func (c *charRange) choose(r *rand.Rand) rune {
count := int64(c.last - c.first + 1)
ch := c.first + rune(r.Int63n(count))
return ch
}
// not fully exhaustive
func randStringAtoZ(r *rand.Rand) string {
hostCharRange := charRange{'a', 'z'}
n := r.Intn(20)
runes := make([]rune, n)
for i := range runes {
runes[i] = hostCharRange.choose(r)
}
return string(runes)
}

View File

@ -207,7 +207,7 @@ type Impl struct {
// ControllerOptions encapsulates options for creating a new controller,
// including throttling and stats behavior.
type ControllerOptions struct {
type ControllerOptions struct { //nolint for backcompat.
WorkQueueName string
Logger *zap.SugaredLogger
Reporter StatsReporter

View File

@ -153,7 +153,7 @@ func ChooseSubset(from sets.String, n int, target string) sets.String {
}
// Already matched this one. Continue to the next index.
for selection.Has(root) {
root += 1
root++
if root == hpl {
root = 0
}

View File

@ -20,6 +20,7 @@ import (
"errors"
"flag"
"log"
"math"
"os"
"os/user"
"path/filepath"
@ -37,6 +38,9 @@ func ParseAndGetRESTConfigOrDie() *rest.Config {
"The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.")
kubeconfig = flag.String("kubeconfig", "",
"Path to a kubeconfig. Only required if out-of-cluster.")
burst = flag.Int("kube-api-burst", 0, "Maximum burst for throttle.")
qps = flag.Float64("kube-api-qps", 0, "Maximum QPS to the server from the client.")
)
klog.InitFlags(flag.CommandLine)
flag.Parse()
@ -46,6 +50,16 @@ func ParseAndGetRESTConfigOrDie() *rest.Config {
log.Fatal("Error building kubeconfig: ", err)
}
if *burst < 0 {
log.Fatal("Invalid burst value", *burst)
}
if *qps < 0 || *qps > math.MaxFloat32 {
log.Fatal("Invalid QPS value", *qps)
}
cfg.Burst = *burst
cfg.QPS = float32(*qps)
return cfg
}

View File

@ -240,8 +240,7 @@ func ConfigMapName() string {
// JsonToLoggingConfig converts a json string of a Config.
// Returns a non-nil Config always.
// nolint:stylecheck // No rename due to backwards incompatibility.
func JsonToLoggingConfig(jsonCfg string) (*Config, error) {
func JsonToLoggingConfig(jsonCfg string) (*Config, error) { //nolint No rename due to backwards incompatibility.
if jsonCfg == "" {
return nil, errEmptyJSONLogginString
}
@ -260,8 +259,7 @@ func JsonToLoggingConfig(jsonCfg string) (*Config, error) {
}
// LoggingConfigToJson converts a Config to a json string.
// nolint:stylecheck // No rename due to backwards incompatibility.
func LoggingConfigToJson(cfg *Config) (string, error) {
func LoggingConfigToJson(cfg *Config) (string, error) { //nolint No rename due to backwards incompatibility.
if cfg == nil || cfg.LoggingConfig == "" {
return "", nil
}

View File

@ -346,8 +346,7 @@ func prometheusPort() (int, error) {
// JsonToMetricsOptions converts a json string of a
// ExporterOptions. Returns a non-nil ExporterOptions always.
// nolint:stylecheck // No rename due to backwards incompatibility.
func JsonToMetricsOptions(jsonOpts string) (*ExporterOptions, error) {
func JsonToMetricsOptions(jsonOpts string) (*ExporterOptions, error) { // nolint No rename due to backwards incompatibility.
var opts ExporterOptions
if jsonOpts == "" {
return nil, errors.New("json options string is empty")
@ -361,8 +360,7 @@ func JsonToMetricsOptions(jsonOpts string) (*ExporterOptions, error) {
}
// MetricsOptionsToJson converts a ExporterOptions to a json string.
// nolint:stylecheck // No rename due to backwards incompatibility.
func MetricsOptionsToJson(opts *ExporterOptions) (string, error) {
func MetricsOptionsToJson(opts *ExporterOptions) (string, error) { // nolint No rename due to backwards incompatibility.
if opts == nil {
return "", nil
}

View File

@ -89,7 +89,7 @@ var (
// which should be promoted to Stackdriver Resource labels via opencensus resources.
metricToResourceLabels = map[string]*resourceTemplate{}
// A variable for testing to reduce the size (number of metrics) buffered before
// 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
)

View File

@ -62,7 +62,7 @@ func NewEvent(eventtype, reason, messageFmt string, args ...interface{}) Event {
// ReconcilerEvent wraps the fields required for recorders to create a
// kubernetes recorder Event.
type ReconcilerEvent struct {
type ReconcilerEvent struct { //nolint for backcompat.
EventType string
Reason string
Format string

6
vendor/modules.txt vendored
View File

@ -457,6 +457,7 @@ k8s.io/api/storage/v1alpha1
k8s.io/api/storage/v1beta1
# k8s.io/apimachinery v0.18.8 => k8s.io/apimachinery v0.18.8
## explicit
k8s.io/apimachinery/pkg/api/apitesting/fuzzer
k8s.io/apimachinery/pkg/api/equality
k8s.io/apimachinery/pkg/api/errors
k8s.io/apimachinery/pkg/api/meta
@ -735,12 +736,13 @@ k8s.io/kube-openapi/pkg/util/sets
k8s.io/utils/buffer
k8s.io/utils/integer
k8s.io/utils/trace
# knative.dev/pkg v0.0.0-20201006235820-46761ba7c3dc
# knative.dev/pkg v0.0.0-20201007215820-7bad84346637
## explicit
knative.dev/pkg/apis
knative.dev/pkg/apis/duck
knative.dev/pkg/apis/duck/ducktypes
knative.dev/pkg/apis/duck/v1
knative.dev/pkg/apis/testing/fuzzer
knative.dev/pkg/changeset
knative.dev/pkg/codegen/cmd/injection-gen
knative.dev/pkg/codegen/cmd/injection-gen/args
@ -762,7 +764,7 @@ knative.dev/pkg/reconciler
knative.dev/pkg/signals
knative.dev/pkg/system
knative.dev/pkg/tracker
# knative.dev/test-infra v0.0.0-20201006161322-f94f2bcbb2ee
# knative.dev/test-infra v0.0.0-20201008002321-0e7582f33f9a
## explicit
knative.dev/test-infra/scripts
knative.dev/test-infra/tools/dep-collector