Skip to content

Commit 8fc5955

Browse files
[release-0.22] Upgrade to latest dependencies (#406)
* upgrade to latest dependencies 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) bumping knative.dev/pkg 952fdd9...983897f: > 983897f [release-0.22] allow unknown metadata fields (# 2257) > 6ea2c43 Drop redundant pointers and decoders (# 2262) Signed-off-by: Knative Automation <[email protected]> * bump kind and image versions * bump ko for e2e * pin topology operator to v0.7.0 newer versions drop v1alpha APIs Co-authored-by: dprotaso <[email protected]>
1 parent 523393f commit 8fc5955

File tree

10 files changed

+195
-180
lines changed

10 files changed

+195
-180
lines changed

.github/workflows/kind-conformance.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ jobs:
2323
fail-fast: false # Keep running if one leg fails.
2424
matrix:
2525
k8s-version:
26-
- v1.18.8
27-
- v1.19.1
28-
- v1.20.0
26+
- v1.18.19
27+
- v1.19.11
28+
- v1.20.7
2929

3030
eventing-version:
3131
- v0.21.0
@@ -37,15 +37,15 @@ jobs:
3737
# This is attempting to make it a bit clearer what's being tested.
3838
# See: https://github.com/kubernetes-sigs/kind/releases/tag/v0.9.0
3939
include:
40-
- k8s-version: v1.18.8
41-
kind-version: v0.9.0
42-
kind-image-sha: sha256:f4bcc97a0ad6e7abaf3f643d890add7efe6ee4ab90baeb374b4f41a4c95567eb
43-
- k8s-version: v1.19.1
44-
kind-version: v0.9.0
45-
kind-image-sha: sha256:98cf5288864662e37115e362b23e4369c8c4a408f99cbc06e58ac30ddc721600
46-
- k8s-version: v1.20.0
47-
kind-version: v0.9.0
48-
kind-image-sha: sha256:b40ecf8bcb188f6a0d0f5d406089c48588b75edc112c6f635d26be5de1c89040
40+
- k8s-version: v1.18.19
41+
kind-version: v0.11.1
42+
kind-image-sha: sha256:7af1492e19b3192a79f606e43c35fb741e520d195f96399284515f077b3b622c
43+
- k8s-version: v1.19.11
44+
kind-version: v0.11.1
45+
kind-image-sha: sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729
46+
- k8s-version: v1.20.7
47+
kind-version: v0.11.0
48+
kind-image-sha: sha256:cbeaf907fc78ac97ce7b625e4bf0de16e3ea725daf6b04f930bd14c67c671ff9
4949
env:
5050
GOPATH: ${{ github.workspace }}
5151
KO_DOCKER_REPO: kind.local
@@ -73,7 +73,7 @@ jobs:
7373

7474
- name: Install Dependencies
7575
run: |
76-
curl -L https://github.com/google/ko/releases/download/v0.7.0/ko_0.7.0_Linux_x86_64.tar.gz | tar xzf - ko
76+
curl -L https://github.com/google/ko/releases/download/v0.8.3/ko_0.8.3_Linux_x86_64.tar.gz | tar xzf - ko
7777
chmod +x ./ko
7878
sudo mv ko /usr/local/bin
7979
@@ -144,7 +144,7 @@ jobs:
144144
run: |
145145
set -x
146146
147-
kubectl apply -f https://github.com/rabbitmq/messaging-topology-operator/releases/latest/download/messaging-topology-operator-with-certmanager.yaml
147+
kubectl apply -f https://github.com/rabbitmq/messaging-topology-operator/releases/download/v0.7.0/messaging-topology-operator-with-certmanager.yaml
148148
149149
- name: Install Knative Eventing
150150
run: |

.github/workflows/kind-e2e.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
fail-fast: false # Keep running if one leg fails.
1919
matrix:
2020
k8s-version:
21-
- v1.18.8
22-
- v1.19.1
23-
- v1.20.0
21+
- v1.18.19
22+
- v1.19.11
23+
- v1.20.7
2424

2525
eventing-version:
2626
- v0.19.0
@@ -35,15 +35,15 @@ jobs:
3535
# This is attempting to make it a bit clearer what's being tested.
3636
# See: https://github.com/kubernetes-sigs/kind/releases/tag/v0.9.0
3737
include:
38-
- k8s-version: v1.18.8
39-
kind-version: v0.9.0
40-
kind-image-sha: sha256:f4bcc97a0ad6e7abaf3f643d890add7efe6ee4ab90baeb374b4f41a4c95567eb
41-
- k8s-version: v1.19.1
42-
kind-version: v0.9.0
43-
kind-image-sha: sha256:98cf5288864662e37115e362b23e4369c8c4a408f99cbc06e58ac30ddc721600
44-
- k8s-version: v1.20.0
45-
kind-version: v0.9.0
46-
kind-image-sha: sha256:b40ecf8bcb188f6a0d0f5d406089c48588b75edc112c6f635d26be5de1c89040
38+
- k8s-version: v1.18.19
39+
kind-version: v0.11.1
40+
kind-image-sha: sha256:7af1492e19b3192a79f606e43c35fb741e520d195f96399284515f077b3b622c
41+
- k8s-version: v1.19.11
42+
kind-version: v0.11.1
43+
kind-image-sha: sha256:07db187ae84b4b7de440a73886f008cf903fcf5764ba8106a9fd5243d6f32729
44+
- k8s-version: v1.20.7
45+
kind-version: v0.11.0
46+
kind-image-sha: sha256:cbeaf907fc78ac97ce7b625e4bf0de16e3ea725daf6b04f930bd14c67c671ff9
4747
env:
4848
GOPATH: ${{ github.workspace }}
4949
KO_DOCKER_REPO: kind.local
@@ -68,7 +68,7 @@ jobs:
6868

6969
- name: Install Dependencies
7070
run: |
71-
curl -L https://github.com/google/ko/releases/download/v0.7.0/ko_0.7.0_Linux_x86_64.tar.gz | tar xzf - ko
71+
curl -L https://github.com/google/ko/releases/download/v0.8.3/ko_0.8.3_Linux_x86_64.tar.gz | tar xzf - ko
7272
chmod +x ./ko
7373
sudo mv ko /usr/local/bin
7474
@@ -139,7 +139,7 @@ jobs:
139139
run: |
140140
set -x
141141
142-
kubectl apply -f https://github.com/rabbitmq/messaging-topology-operator/releases/latest/download/messaging-topology-operator-with-certmanager.yaml
142+
kubectl apply -f https://github.com/rabbitmq/messaging-topology-operator/releases/download/v0.7.0/messaging-topology-operator-with-certmanager.yaml
143143
144144
- name: Install Knative Eventing
145145
run: |

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ require (
3131
k8s.io/client-go v0.20.5
3232
k8s.io/code-generator v0.20.5
3333
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd
34-
knative.dev/eventing v0.22.0
34+
knative.dev/eventing v0.22.2
3535
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3
36-
knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0
36+
knative.dev/pkg v0.0.0-20210902173607-983897f9e37f
3737
knative.dev/reconciler-test v0.0.0-20210331073522-b09f3669345a
3838
)
3939

go.sum

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,15 +1435,16 @@ k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
14351435
k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
14361436
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 h1:0T5IaWHO3sJTEmCP6mUlBvMukxPKUQWqiI/YuiBNMiQ=
14371437
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
1438-
knative.dev/eventing v0.22.0 h1:esDaddfSmiVhLKDnUCVVunSdNeHklVEz0fsqs3NupuQ=
1439-
knative.dev/eventing v0.22.0/go.mod h1:LOG7bh0eZQkbYANcnORwke6Yy6aUu62o8GeByaOFfRQ=
1438+
knative.dev/eventing v0.22.2 h1:O/qCAnMXJ4oL0Rs/aiXIfY68upl7NRkwD9RoUpKi/kU=
1439+
knative.dev/eventing v0.22.2/go.mod h1:LOG7bh0eZQkbYANcnORwke6Yy6aUu62o8GeByaOFfRQ=
14401440
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3 h1:km0Rrh0T9/wA2pivQm1hqSPVwgNgGCHC2WNn3GakZmE=
14411441
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
14421442
knative.dev/hack/schema v0.0.0-20210325223819-b6ab329907d3/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
14431443
knative.dev/pkg v0.0.0-20210329065222-9d92ea16c0d3/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
14441444
knative.dev/pkg v0.0.0-20210331062321-6317ec6066f4/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
1445-
knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0 h1:z05hcB4br0qz7JdwIoUSTXLTF+7ThuJ+R6NFfXd1Y4Q=
14461445
knative.dev/pkg v0.0.0-20210331065221-952fdd90dbb0/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
1446+
knative.dev/pkg v0.0.0-20210902173607-983897f9e37f h1:5XjG0xQQYN/Bw+7vUhLENcDOBQPCVns6v3vJcJ1SXZM=
1447+
knative.dev/pkg v0.0.0-20210902173607-983897f9e37f/go.mod h1:PD5g8hUCXq6iR3tILjmZeJBvQfXGnHMPKryq54qHJhg=
14471448
knative.dev/reconciler-test v0.0.0-20210329214021-2a67496462a4/go.mod h1:qLfJMHc0i9ENTSet/SUp/FcQm4QVfNTX8ZC//aVQN0M=
14481449
knative.dev/reconciler-test v0.0.0-20210331073522-b09f3669345a h1:lT3F7ppaQfBxvJvD++B1s6nGk3x/scYN404+qPLMKm4=
14491450
knative.dev/reconciler-test v0.0.0-20210331073522-b09f3669345a/go.mod h1:/+nBvBQ+/CJxGjpPzgKPLQc0feF9dzhcVFfhcTDtNyo=

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/knative.dev/pkg/webhook/configmaps/configmaps.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package configmaps
1818

1919
import (
20-
"bytes"
2120
"context"
2221
"encoding/json"
2322
"errors"
@@ -188,8 +187,7 @@ func (ac *reconciler) validate(ctx context.Context, req *admissionv1.AdmissionRe
188187

189188
var newObj corev1.ConfigMap
190189
if len(newBytes) != 0 {
191-
newDecoder := json.NewDecoder(bytes.NewBuffer(newBytes))
192-
if err := newDecoder.Decode(&newObj); err != nil {
190+
if err := json.Unmarshal(newBytes, &newObj); err != nil {
193191
return fmt.Errorf("cannot decode incoming new object: %w", err)
194192
}
195193
}

0 commit comments

Comments
 (0)