From c7948b38b24e3b3c5b3476fff97d43ff7ad82101 Mon Sep 17 00:00:00 2001 From: knative-automation Date: Fri, 3 Sep 2021 21:05:41 -0400 Subject: [PATCH] upgrade to latest dependencies (#214) bumping knative.dev/pkg 952fdd9...983897f: > 983897f [release-0.22] allow unknown metadata fields (# 2257) > 6ea2c43 Drop redundant pointers and decoders (# 2262) bumping knative.dev/serving baed25a...3e9a4e3: > 3e9a4e3 [release-0.22] run kind e2e in release branches (# 11139) > 95fe811 Change magic DNS to sslip.io (# 11299) > 813aa65 dont add labels with empty values (# 11114) > 5dba505 Redo 10615 - add UID labels (# 11108) bumping knative.dev/eventing 8f35d42...6aa0b41: > 6aa0b41 Use new label for defining a cluster-local Knative Service (# 5403) > 6d63984 Add podAntiAffinity labels to remaining HA control plane pods (# 5414) > 0d8411e Drop --strict flag on ko (# 5513) > 7c0b477 fix(PingSource): remove annotation based conversion logic (# 5234) Signed-off-by: Knative Automation --- go.mod | 6 +- go.sum | 17 +-- .../apis/sources/v1beta1/ping_conversion.go | 131 ++---------------- vendor/modules.txt | 6 +- 4 files changed, 27 insertions(+), 133 deletions(-) diff --git a/go.mod b/go.mod index a0916bcf5..ae232d79a 100644 --- a/go.mod +++ b/go.mod @@ -14,8 +14,8 @@ require ( k8s.io/api v0.19.7 k8s.io/apimachinery v0.19.7 k8s.io/client-go v0.19.7 - knative.dev/eventing v0.21.1-0.20210331231822-8f35d42544e0 + knative.dev/eventing v0.22.2 knative.dev/hack v0.0.0-20210325223819-b6ab329907d3 - knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0 - knative.dev/serving v0.21.1-0.20210403073024-baed25a308c3 + knative.dev/pkg v0.0.0-20210902173607-983897f9e37f + knative.dev/serving v0.22.2 ) diff --git a/go.sum b/go.sum index afd5fa44a..ce22bfaf7 100644 --- a/go.sum +++ b/go.sum @@ -357,7 +357,6 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -388,7 +387,6 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -638,7 +636,6 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.19.0 h1:Itb4+NjG9wRdkAWgVucbM/adyIXxEhbw0866e0uZE6A= github.com/prometheus/common v0.19.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= @@ -756,7 +753,6 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4-0.20200608061201-1901b56b9515/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= @@ -1258,23 +1254,22 @@ k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 h1:0T5IaWHO3sJTEmCP6mUlBvMukxPKUQWqiI/YuiBNMiQ= k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= knative.dev/caching v0.0.0-20210331063521-5691bb38d441/go.mod h1:CfW7OVs7gzUXJj0OrIe8YlWEC4Qe0Avnq+5b81/Gw1s= -knative.dev/eventing v0.21.1-0.20210331231822-8f35d42544e0 h1:hTZYXQgaWV3b2BVD7xjr6EMbwGETsnKs/VpgOfVkrZU= -knative.dev/eventing v0.21.1-0.20210331231822-8f35d42544e0/go.mod h1:LOG7bh0eZQkbYANcnORwke6Yy6aUu62o8GeByaOFfRQ= +knative.dev/eventing v0.22.2 h1:O/qCAnMXJ4oL0Rs/aiXIfY68upl7NRkwD9RoUpKi/kU= +knative.dev/eventing v0.22.2/go.mod h1:LOG7bh0eZQkbYANcnORwke6Yy6aUu62o8GeByaOFfRQ= knative.dev/hack v0.0.0-20210325223819-b6ab329907d3 h1:km0Rrh0T9/wA2pivQm1hqSPVwgNgGCHC2WNn3GakZmE= knative.dev/hack v0.0.0-20210325223819-b6ab329907d3/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI= knative.dev/hack/schema v0.0.0-20210325223819-b6ab329907d3/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0= knative.dev/networking v0.0.0-20210331064822-999a7708876c h1:7ggsYXtltPHjbgxi76hg5g2eOtmg8KaBIP40XJsfMyA= knative.dev/networking v0.0.0-20210331064822-999a7708876c/go.mod h1:0V6M1AaWPL/MtQLuEx0NxiwDdtb8Y4b4f7P3C8sp0zo= -knative.dev/pkg v0.0.0-20210329065222-9d92ea16c0d3 h1:JMuMvGa1ke9b8nBcDntQyy1fsJgBy/R7/La3kxiHSGg= knative.dev/pkg v0.0.0-20210329065222-9d92ea16c0d3/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg= -knative.dev/pkg v0.0.0-20210330162221-808d62257db6 h1:hl6lY5ShQ7g7E0I+nPbknXwOOgaKmkJ+7TkCrCo80x0= knative.dev/pkg v0.0.0-20210330162221-808d62257db6/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg= knative.dev/pkg v0.0.0-20210331062321-6317ec6066f4/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg= -knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0 h1:z05hcB4br0qz7JdwIoUSTXLTF+7ThuJ+R6NFfXd1Y4Q= knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg= +knative.dev/pkg v0.0.0-20210902173607-983897f9e37f h1:5XjG0xQQYN/Bw+7vUhLENcDOBQPCVns6v3vJcJ1SXZM= +knative.dev/pkg v0.0.0-20210902173607-983897f9e37f/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg= knative.dev/reconciler-test v0.0.0-20210329214021-2a67496462a4/go.mod h1:qLfJMHc0i9ENTSet/SUp/FcQm4QVfNTX8ZC//aVQN0M= -knative.dev/serving v0.21.1-0.20210403073024-baed25a308c3 h1:kSxzaKKAPBvR+1CERLy/4gRcw8jyBl7irpmbeQaRANI= -knative.dev/serving v0.21.1-0.20210403073024-baed25a308c3/go.mod h1:20yuZH4F7cvoovC2Pi1uQBoIbOjllapVSKDkWAXkItA= +knative.dev/serving v0.22.2 h1:jcBXrUwPma9zSBhXiwduc7M0p/SJLpnfHicGXH/d0v0= +knative.dev/serving v0.22.2/go.mod h1:20yuZH4F7cvoovC2Pi1uQBoIbOjllapVSKDkWAXkItA= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= diff --git a/vendor/knative.dev/eventing/pkg/apis/sources/v1beta1/ping_conversion.go b/vendor/knative.dev/eventing/pkg/apis/sources/v1beta1/ping_conversion.go index 60beedb66..44bd379e9 100644 --- a/vendor/knative.dev/eventing/pkg/apis/sources/v1beta1/ping_conversion.go +++ b/vendor/knative.dev/eventing/pkg/apis/sources/v1beta1/ping_conversion.go @@ -20,7 +20,6 @@ import ( "context" "encoding/json" "fmt" - "reflect" cloudevents "github.com/cloudevents/sdk-go/v2" @@ -28,16 +27,6 @@ import ( "knative.dev/pkg/apis" ) -const ( - // V1B1SpecAnnotationKey is used to indicate that a v1beta2 object is converted from v1beta1 - // also it can be used to downgrade such object to v1beta1 - V1B1SpecAnnotationKey = "pingsources.sources.knative.dev/v1beta1-spec" - - // V1B2SpecAnnotationKey is used to indicate that a v1beta1 object is converted from v1beta2 - // also it can be used to convert the v1beta1 object back to v1beta2, considering that v1beta2 introduces more features. - V1B2SpecAnnotationKey = "pingsources.sources.knative.dev/v1beta2-spec" -) - type message struct { Body string `json:"body"` } @@ -61,35 +50,21 @@ func (source *PingSource) ConvertTo(ctx context.Context, obj apis.Convertible) e sink.Status = v1beta2.PingSourceStatus{ SourceStatus: source.Status.SourceStatus, } - - // deep copy annotations to avoid mutation on source.ObjectMeta.Annotations - annotations := make(map[string]string) - for key, value := range source.GetAnnotations() { - annotations[key] = value + sink.Spec = v1beta2.PingSourceSpec{ + SourceSpec: source.Spec.SourceSpec, + Schedule: source.Spec.Schedule, + Timezone: source.Spec.Timezone, } - if isCreatedViaV1Beta2API(source) { - // try to unmarshal v1beta2.PingSource.Spec from V1B2SpecAnnotationKey - // key existence and json marshal error already checked in isCreatedViaV1Beta2API - v1beta2Spec := annotations[V1B2SpecAnnotationKey] - _ = json.Unmarshal([]byte(v1beta2Spec), &sink.Spec) - } else { - var err error - if sink.Spec, err = toV1Beta2Spec(&source.Spec); err != nil { - return err - } - // marshal and store v1beta1.PingSource.Spec into V1B1SpecAnnotationKey - // this is to help if we need to convert back to v1beta1.PingSource - v1beta1Spec, err := json.Marshal(source.Spec) + if source.Spec.JsonData != "" { + msg, err := makeMessage(source.Spec.JsonData) if err != nil { - return fmt.Errorf("error marshalling source.Spec: %v, err: %v", source.Spec, err) + return fmt.Errorf("error converting jsonData to a higher version: %v", err) } - annotations[V1B1SpecAnnotationKey] = string(v1beta1Spec) + sink.Spec.ContentType = cloudevents.ApplicationJSON + sink.Spec.Data = string(msg) } - // we don't need this annotation in a v1beta2.PingSource object - delete(annotations, V1B2SpecAnnotationKey) - sink.SetAnnotations(annotations) return nil default: return apis.ConvertToViaProxy(ctx, source, &v1beta2.PingSource{}, sink) @@ -106,94 +81,18 @@ func (sink *PingSource) ConvertFrom(ctx context.Context, obj apis.Convertible) e SourceStatus: source.Status.SourceStatus, } - // deep copy annotations to avoid mutation on source.ObjectMeta.Annotations - annotations := make(map[string]string) - for key, value := range source.GetAnnotations() { - annotations[key] = value - } - - if isV1Beta1AnnotationConsistentWithV1Beta2Spec(source) { - // errors already handled in isV1Beta1AnnotationConsistentWithV1Beta2Spec - v1beta1Spec := annotations[V1B1SpecAnnotationKey] - _ = json.Unmarshal([]byte(v1beta1Spec), &sink.Spec) + sink.Spec = PingSourceSpec{ + SourceSpec: source.Spec.SourceSpec, + Schedule: source.Spec.Schedule, + Timezone: source.Spec.Timezone, } - // marshal and store v1beta2.PingSource.Spec into V1B2SpecAnnotationKey - // this is to help if we need to convert back to v1beta2.PingSource - v1beta2Configuration, err := json.Marshal(source.Spec) - if err != nil { - return fmt.Errorf("error marshalling source.Spec: %v, err: %v", source.Spec, err) + if source.Spec.ContentType == cloudevents.ApplicationJSON { + sink.Spec.JsonData = source.Spec.Data } - annotations[V1B2SpecAnnotationKey] = string(v1beta2Configuration) - // we don't need this annotation in a v1beta1.PingSource object - delete(annotations, V1B1SpecAnnotationKey) - sink.SetAnnotations(annotations) return nil default: return apis.ConvertFromViaProxy(ctx, source, &v1beta2.PingSource{}, sink) } } - -func toV1Beta2Spec(srcSpec *PingSourceSpec) (v1beta2.PingSourceSpec, error) { - targetSpec := v1beta2.PingSourceSpec{ - SourceSpec: srcSpec.SourceSpec, - Schedule: srcSpec.Schedule, - Timezone: srcSpec.Timezone, - } - - if srcSpec.JsonData != "" { - msg, err := makeMessage(srcSpec.JsonData) - if err != nil { - return targetSpec, fmt.Errorf("error converting jsonData to a higher version: %v", err) - } - targetSpec.ContentType = cloudevents.ApplicationJSON - targetSpec.Data = string(msg) - } - - return targetSpec, nil -} - -// checks if a v1beta1.PingSource is originally created in v1beta2, it must meet both of the following criteria: -// -// 1. V1B2SpecAnnotationKey annotation must exist and can be unmarshalled to v1beta2.PingSourceSpec, it indicates that it's converted from v1beta2 -> v1beta1. -// 2. Spec.Sink must be {Ref: nil, URI: nil}, as we don't set these values during conversion from v1beta2 -> v1beta1, see PingSource.ConvertFrom; -func isCreatedViaV1Beta2API(source *PingSource) bool { - v1beta2Annotation, ok := source.GetAnnotations()[V1B2SpecAnnotationKey] - if !ok { - return false - } - - v1beta2Spec := &v1beta2.PingSourceSpec{} - if err := json.Unmarshal([]byte(v1beta2Annotation), v1beta2Spec); err != nil { - return false - } - - return source.Spec.Sink.Ref == nil && source.Spec.Sink.URI == nil -} - -// for a v1beta2.PingSource, checks if its V1B1SpecAnnotationKey is consistent with its spec. -// returns false if one of the following satisfies: -// -// 1. V1B1SpecAnnotationKey does not exist. -// 2. V1B1SpecAnnotationKey exists, but we cannot unmarshal it to v1beta1.PingSourceSpec. -// 3. V1B1SpecAnnotationKey exists, but if we unmarshal it to v1beta1.PingSourceSpec and convert it to v1beta2, -// the converted v1beta2.PingSourceSpec is not the same as source.Spec. -func isV1Beta1AnnotationConsistentWithV1Beta2Spec(source *v1beta2.PingSource) bool { - v1beta1Annotation, ok := source.GetAnnotations()[V1B1SpecAnnotationKey] - if !ok { - return false - } - - v1beta1Spec := &PingSourceSpec{} - if err := json.Unmarshal([]byte(v1beta1Annotation), v1beta1Spec); err != nil { - return false - } - - v1beta2Spec, err := toV1Beta2Spec(v1beta1Spec) - if err != nil { - return false - } - - return reflect.DeepEqual(v1beta2Spec, source.Spec) -} diff --git a/vendor/modules.txt b/vendor/modules.txt index efdbcc123..7e167d7d3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -911,7 +911,7 @@ k8s.io/utils/buffer k8s.io/utils/integer k8s.io/utils/pointer k8s.io/utils/trace -# knative.dev/eventing v0.21.1-0.20210331231822-8f35d42544e0 +# knative.dev/eventing v0.22.2 ## explicit knative.dev/eventing/pkg/adapter/v2 knative.dev/eventing/pkg/adapter/v2/util/crstatusevent @@ -978,7 +978,7 @@ knative.dev/hack knative.dev/networking/pkg knative.dev/networking/pkg/apis/networking knative.dev/networking/pkg/apis/networking/v1alpha1 -# knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0 +# knative.dev/pkg v0.0.0-20210902173607-983897f9e37f ## explicit knative.dev/pkg/apis knative.dev/pkg/apis/duck @@ -1041,7 +1041,7 @@ knative.dev/pkg/tracker knative.dev/pkg/version knative.dev/pkg/webhook knative.dev/pkg/webhook/certificates/resources -# knative.dev/serving v0.21.1-0.20210403073024-baed25a308c3 +# knative.dev/serving v0.22.2 ## explicit knative.dev/serving/pkg/apis/autoscaling knative.dev/serving/pkg/apis/autoscaling/v1alpha1