Skip to content

Commit c7948b3

Browse files
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 <automation@knative.team>
1 parent a2e2037 commit c7948b3

4 files changed

Lines changed: 27 additions & 133 deletions

File tree

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ require (
1414
k8s.io/api v0.19.7
1515
k8s.io/apimachinery v0.19.7
1616
k8s.io/client-go v0.19.7
17-
knative.dev/eventing v0.21.1-0.20210331231822-8f35d42544e0
17+
knative.dev/eventing v0.22.2
1818
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3
19-
knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0
20-
knative.dev/serving v0.21.1-0.20210403073024-baed25a308c3
19+
knative.dev/pkg v0.0.0-20210902173607-983897f9e37f
20+
knative.dev/serving v0.22.2
2121
)

go.sum

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
357357
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
358358
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
359359
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
360-
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
361360
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
362361
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
363362
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
388387
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
389388
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
390389
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
391-
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
392390
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
393391
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
394392
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
638636
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
639637
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
640638
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
641-
github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM=
642639
github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
643640
github.com/prometheus/common v0.19.0 h1:Itb4+NjG9wRdkAWgVucbM/adyIXxEhbw0866e0uZE6A=
644641
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=
756753
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
757754
go.opencensus.io v0.22.4-0.20200608061201-1901b56b9515/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
758755
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
759-
go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0=
760756
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
761757
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
762758
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/
12581254
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 h1:0T5IaWHO3sJTEmCP6mUlBvMukxPKUQWqiI/YuiBNMiQ=
12591255
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
12601256
knative.dev/caching v0.0.0-20210331063521-5691bb38d441/go.mod h1:CfW7OVs7gzUXJj0OrIe8YlWEC4Qe0Avnq+5b81/Gw1s=
1261-
knative.dev/eventing v0.21.1-0.20210331231822-8f35d42544e0 h1:hTZYXQgaWV3b2BVD7xjr6EMbwGETsnKs/VpgOfVkrZU=
1262-
knative.dev/eventing v0.21.1-0.20210331231822-8f35d42544e0/go.mod h1:LOG7bh0eZQkbYANcnORwke6Yy6aUu62o8GeByaOFfRQ=
1257+
knative.dev/eventing v0.22.2 h1:O/qCAnMXJ4oL0Rs/aiXIfY68upl7NRkwD9RoUpKi/kU=
1258+
knative.dev/eventing v0.22.2/go.mod h1:LOG7bh0eZQkbYANcnORwke6Yy6aUu62o8GeByaOFfRQ=
12631259
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3 h1:km0Rrh0T9/wA2pivQm1hqSPVwgNgGCHC2WNn3GakZmE=
12641260
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
12651261
knative.dev/hack/schema v0.0.0-20210325223819-b6ab329907d3/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
12661262
knative.dev/networking v0.0.0-20210331064822-999a7708876c h1:7ggsYXtltPHjbgxi76hg5g2eOtmg8KaBIP40XJsfMyA=
12671263
knative.dev/networking v0.0.0-20210331064822-999a7708876c/go.mod h1:0V6M1AaWPL/MtQLuEx0NxiwDdtb8Y4b4f7P3C8sp0zo=
1268-
knative.dev/pkg v0.0.0-20210329065222-9d92ea16c0d3 h1:JMuMvGa1ke9b8nBcDntQyy1fsJgBy/R7/La3kxiHSGg=
12691264
knative.dev/pkg v0.0.0-20210329065222-9d92ea16c0d3/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
1270-
knative.dev/pkg v0.0.0-20210330162221-808d62257db6 h1:hl6lY5ShQ7g7E0I+nPbknXwOOgaKmkJ+7TkCrCo80x0=
12711265
knative.dev/pkg v0.0.0-20210330162221-808d62257db6/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
12721266
knative.dev/pkg v0.0.0-20210331062321-6317ec6066f4/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
1273-
knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0 h1:z05hcB4br0qz7JdwIoUSTXLTF+7ThuJ+R6NFfXd1Y4Q=
12741267
knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
1268+
knative.dev/pkg v0.0.0-20210902173607-983897f9e37f h1:5XjG0xQQYN/Bw+7vUhLENcDOBQPCVns6v3vJcJ1SXZM=
1269+
knative.dev/pkg v0.0.0-20210902173607-983897f9e37f/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
12751270
knative.dev/reconciler-test v0.0.0-20210329214021-2a67496462a4/go.mod h1:qLfJMHc0i9ENTSet/SUp/FcQm4QVfNTX8ZC//aVQN0M=
1276-
knative.dev/serving v0.21.1-0.20210403073024-baed25a308c3 h1:kSxzaKKAPBvR+1CERLy/4gRcw8jyBl7irpmbeQaRANI=
1277-
knative.dev/serving v0.21.1-0.20210403073024-baed25a308c3/go.mod h1:20yuZH4F7cvoovC2Pi1uQBoIbOjllapVSKDkWAXkItA=
1271+
knative.dev/serving v0.22.2 h1:jcBXrUwPma9zSBhXiwduc7M0p/SJLpnfHicGXH/d0v0=
1272+
knative.dev/serving v0.22.2/go.mod h1:20yuZH4F7cvoovC2Pi1uQBoIbOjllapVSKDkWAXkItA=
12781273
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
12791274
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
12801275
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=

vendor/knative.dev/eventing/pkg/apis/sources/v1beta1/ping_conversion.go

Lines changed: 15 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,13 @@ import (
2020
"context"
2121
"encoding/json"
2222
"fmt"
23-
"reflect"
2423

2524
cloudevents "github.com/cloudevents/sdk-go/v2"
2625

2726
"knative.dev/eventing/pkg/apis/sources/v1beta2"
2827
"knative.dev/pkg/apis"
2928
)
3029

31-
const (
32-
// V1B1SpecAnnotationKey is used to indicate that a v1beta2 object is converted from v1beta1
33-
// also it can be used to downgrade such object to v1beta1
34-
V1B1SpecAnnotationKey = "pingsources.sources.knative.dev/v1beta1-spec"
35-
36-
// V1B2SpecAnnotationKey is used to indicate that a v1beta1 object is converted from v1beta2
37-
// also it can be used to convert the v1beta1 object back to v1beta2, considering that v1beta2 introduces more features.
38-
V1B2SpecAnnotationKey = "pingsources.sources.knative.dev/v1beta2-spec"
39-
)
40-
4130
type message struct {
4231
Body string `json:"body"`
4332
}
@@ -61,35 +50,21 @@ func (source *PingSource) ConvertTo(ctx context.Context, obj apis.Convertible) e
6150
sink.Status = v1beta2.PingSourceStatus{
6251
SourceStatus: source.Status.SourceStatus,
6352
}
64-
65-
// deep copy annotations to avoid mutation on source.ObjectMeta.Annotations
66-
annotations := make(map[string]string)
67-
for key, value := range source.GetAnnotations() {
68-
annotations[key] = value
53+
sink.Spec = v1beta2.PingSourceSpec{
54+
SourceSpec: source.Spec.SourceSpec,
55+
Schedule: source.Spec.Schedule,
56+
Timezone: source.Spec.Timezone,
6957
}
7058

71-
if isCreatedViaV1Beta2API(source) {
72-
// try to unmarshal v1beta2.PingSource.Spec from V1B2SpecAnnotationKey
73-
// key existence and json marshal error already checked in isCreatedViaV1Beta2API
74-
v1beta2Spec := annotations[V1B2SpecAnnotationKey]
75-
_ = json.Unmarshal([]byte(v1beta2Spec), &sink.Spec)
76-
} else {
77-
var err error
78-
if sink.Spec, err = toV1Beta2Spec(&source.Spec); err != nil {
79-
return err
80-
}
81-
// marshal and store v1beta1.PingSource.Spec into V1B1SpecAnnotationKey
82-
// this is to help if we need to convert back to v1beta1.PingSource
83-
v1beta1Spec, err := json.Marshal(source.Spec)
59+
if source.Spec.JsonData != "" {
60+
msg, err := makeMessage(source.Spec.JsonData)
8461
if err != nil {
85-
return fmt.Errorf("error marshalling source.Spec: %v, err: %v", source.Spec, err)
62+
return fmt.Errorf("error converting jsonData to a higher version: %v", err)
8663
}
87-
annotations[V1B1SpecAnnotationKey] = string(v1beta1Spec)
64+
sink.Spec.ContentType = cloudevents.ApplicationJSON
65+
sink.Spec.Data = string(msg)
8866
}
8967

90-
// we don't need this annotation in a v1beta2.PingSource object
91-
delete(annotations, V1B2SpecAnnotationKey)
92-
sink.SetAnnotations(annotations)
9368
return nil
9469
default:
9570
return apis.ConvertToViaProxy(ctx, source, &v1beta2.PingSource{}, sink)
@@ -106,94 +81,18 @@ func (sink *PingSource) ConvertFrom(ctx context.Context, obj apis.Convertible) e
10681
SourceStatus: source.Status.SourceStatus,
10782
}
10883

109-
// deep copy annotations to avoid mutation on source.ObjectMeta.Annotations
110-
annotations := make(map[string]string)
111-
for key, value := range source.GetAnnotations() {
112-
annotations[key] = value
113-
}
114-
115-
if isV1Beta1AnnotationConsistentWithV1Beta2Spec(source) {
116-
// errors already handled in isV1Beta1AnnotationConsistentWithV1Beta2Spec
117-
v1beta1Spec := annotations[V1B1SpecAnnotationKey]
118-
_ = json.Unmarshal([]byte(v1beta1Spec), &sink.Spec)
84+
sink.Spec = PingSourceSpec{
85+
SourceSpec: source.Spec.SourceSpec,
86+
Schedule: source.Spec.Schedule,
87+
Timezone: source.Spec.Timezone,
11988
}
12089

121-
// marshal and store v1beta2.PingSource.Spec into V1B2SpecAnnotationKey
122-
// this is to help if we need to convert back to v1beta2.PingSource
123-
v1beta2Configuration, err := json.Marshal(source.Spec)
124-
if err != nil {
125-
return fmt.Errorf("error marshalling source.Spec: %v, err: %v", source.Spec, err)
90+
if source.Spec.ContentType == cloudevents.ApplicationJSON {
91+
sink.Spec.JsonData = source.Spec.Data
12692
}
127-
annotations[V1B2SpecAnnotationKey] = string(v1beta2Configuration)
128-
// we don't need this annotation in a v1beta1.PingSource object
129-
delete(annotations, V1B1SpecAnnotationKey)
130-
sink.SetAnnotations(annotations)
13193

13294
return nil
13395
default:
13496
return apis.ConvertFromViaProxy(ctx, source, &v1beta2.PingSource{}, sink)
13597
}
13698
}
137-
138-
func toV1Beta2Spec(srcSpec *PingSourceSpec) (v1beta2.PingSourceSpec, error) {
139-
targetSpec := v1beta2.PingSourceSpec{
140-
SourceSpec: srcSpec.SourceSpec,
141-
Schedule: srcSpec.Schedule,
142-
Timezone: srcSpec.Timezone,
143-
}
144-
145-
if srcSpec.JsonData != "" {
146-
msg, err := makeMessage(srcSpec.JsonData)
147-
if err != nil {
148-
return targetSpec, fmt.Errorf("error converting jsonData to a higher version: %v", err)
149-
}
150-
targetSpec.ContentType = cloudevents.ApplicationJSON
151-
targetSpec.Data = string(msg)
152-
}
153-
154-
return targetSpec, nil
155-
}
156-
157-
// checks if a v1beta1.PingSource is originally created in v1beta2, it must meet both of the following criteria:
158-
//
159-
// 1. V1B2SpecAnnotationKey annotation must exist and can be unmarshalled to v1beta2.PingSourceSpec, it indicates that it's converted from v1beta2 -> v1beta1.
160-
// 2. Spec.Sink must be {Ref: nil, URI: nil}, as we don't set these values during conversion from v1beta2 -> v1beta1, see PingSource.ConvertFrom;
161-
func isCreatedViaV1Beta2API(source *PingSource) bool {
162-
v1beta2Annotation, ok := source.GetAnnotations()[V1B2SpecAnnotationKey]
163-
if !ok {
164-
return false
165-
}
166-
167-
v1beta2Spec := &v1beta2.PingSourceSpec{}
168-
if err := json.Unmarshal([]byte(v1beta2Annotation), v1beta2Spec); err != nil {
169-
return false
170-
}
171-
172-
return source.Spec.Sink.Ref == nil && source.Spec.Sink.URI == nil
173-
}
174-
175-
// for a v1beta2.PingSource, checks if its V1B1SpecAnnotationKey is consistent with its spec.
176-
// returns false if one of the following satisfies:
177-
//
178-
// 1. V1B1SpecAnnotationKey does not exist.
179-
// 2. V1B1SpecAnnotationKey exists, but we cannot unmarshal it to v1beta1.PingSourceSpec.
180-
// 3. V1B1SpecAnnotationKey exists, but if we unmarshal it to v1beta1.PingSourceSpec and convert it to v1beta2,
181-
// the converted v1beta2.PingSourceSpec is not the same as source.Spec.
182-
func isV1Beta1AnnotationConsistentWithV1Beta2Spec(source *v1beta2.PingSource) bool {
183-
v1beta1Annotation, ok := source.GetAnnotations()[V1B1SpecAnnotationKey]
184-
if !ok {
185-
return false
186-
}
187-
188-
v1beta1Spec := &PingSourceSpec{}
189-
if err := json.Unmarshal([]byte(v1beta1Annotation), v1beta1Spec); err != nil {
190-
return false
191-
}
192-
193-
v1beta2Spec, err := toV1Beta2Spec(v1beta1Spec)
194-
if err != nil {
195-
return false
196-
}
197-
198-
return reflect.DeepEqual(v1beta2Spec, source.Spec)
199-
}

vendor/modules.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ k8s.io/utils/buffer
911911
k8s.io/utils/integer
912912
k8s.io/utils/pointer
913913
k8s.io/utils/trace
914-
# knative.dev/eventing v0.21.1-0.20210331231822-8f35d42544e0
914+
# knative.dev/eventing v0.22.2
915915
## explicit
916916
knative.dev/eventing/pkg/adapter/v2
917917
knative.dev/eventing/pkg/adapter/v2/util/crstatusevent
@@ -978,7 +978,7 @@ knative.dev/hack
978978
knative.dev/networking/pkg
979979
knative.dev/networking/pkg/apis/networking
980980
knative.dev/networking/pkg/apis/networking/v1alpha1
981-
# knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0
981+
# knative.dev/pkg v0.0.0-20210902173607-983897f9e37f
982982
## explicit
983983
knative.dev/pkg/apis
984984
knative.dev/pkg/apis/duck
@@ -1041,7 +1041,7 @@ knative.dev/pkg/tracker
10411041
knative.dev/pkg/version
10421042
knative.dev/pkg/webhook
10431043
knative.dev/pkg/webhook/certificates/resources
1044-
# knative.dev/serving v0.21.1-0.20210403073024-baed25a308c3
1044+
# knative.dev/serving v0.22.2
10451045
## explicit
10461046
knative.dev/serving/pkg/apis/autoscaling
10471047
knative.dev/serving/pkg/apis/autoscaling/v1alpha1

0 commit comments

Comments
 (0)