Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into k8s-bump
Browse files Browse the repository at this point in the history
  • Loading branch information
dprotaso committed May 27, 2020
2 parents 6b3f107 + 32751c5 commit 5d39b3c
Show file tree
Hide file tree
Showing 209 changed files with 12,252 additions and 296 deletions.
4 changes: 2 additions & 2 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Approvers in this repo should also be added to the eventing-contrib
# approvers list.
approvers:
- evankanderson
- toc
- grantr
- Harwayne
- vaikas
Expand All @@ -15,14 +15,14 @@ approvers:
# list. To add reviewers while spreading the load among existing approvers,
# copy the approvers to the reviewers list too.
reviewers:
- evankanderson
- grantr
- Harwayne
- vaikas
- n3wscott
- matzew
- nachocano
- lionelvillard
- slinkydeveloper
# Add reviewers below
- liu-cong
- yolocs
Expand Down
7 changes: 7 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
aliases:
toc:
- evankanderson
- grantr
- markusthoemmes
- mattmoor
- tcnghia

# These aliases are for OWNERS of the various Channel implementations. These
# Are in addition to the repo level OWNERS.

Expand Down
16 changes: 6 additions & 10 deletions cmd/pong/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"flag"
"log"

cloudevents "github.com/cloudevents/sdk-go"
cloudevents "github.com/cloudevents/sdk-go/v2"
"github.com/google/uuid"
)

Expand All @@ -38,19 +38,15 @@ func init() {
flag.StringVar(&pongType, "pong", "dev.knative.pong", "Responds with this CloudEvent Type.")
}

func receive(event cloudevents.Event, resp *cloudevents.EventResponse) {
log.Printf("Received CloudEvent,\n%s", event)
func receive(event cloudevents.Event) *cloudevents.Event {
log.Printf("Received CloudEvent:\n%s", event)
if event.Type() == pingType {
pong := cloudevents.NewEvent()
pong := event.Clone()
pong.SetType(pongType)
pong.SetSource("knative.dev/eventing/cmd/pong/" + id)
if err := pong.SetData(event.Data); err != nil {
log.Printf("failed to set data on pong: %s", err)
resp.Error(400, "bad data")
return
}
resp.RespondWith(200, &pong)
return &pong
}
return nil
}

func main() {
Expand Down
13 changes: 5 additions & 8 deletions cmd/sendevent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"log"
"os"

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

"knative.dev/eventing/pkg/utils"
)
Expand Down Expand Up @@ -64,10 +64,7 @@ func main() {
source = fmt.Sprintf("http://%s", utils.GetClusterDomainName())
}

t, err := cloudevents.NewHTTPTransport(
cloudevents.WithTarget(target),
cloudevents.WithBinaryEncoding(),
)
t, err := cloudevents.NewHTTP(cloudevents.WithTarget(target))
if err != nil {
log.Printf("failed to create transport, %v", err)
os.Exit(1)
Expand All @@ -87,13 +84,13 @@ func main() {
}
event.SetType(eventType)
event.SetSource(source)
if err := event.SetData(untyped); err != nil {
if err := event.SetData(cloudevents.ApplicationJSON, untyped); err != nil {
log.Printf("failed to set data, %v", err)
os.Exit(1)
}

if _, resp, err := c.Send(context.Background(), event); err != nil {
fmt.Printf("Failed to send event to %s: %s\n", target, err)
if resp, res := c.Request(context.Background(), event); !cloudevents.IsACK(res) {
fmt.Printf("Failed to send event to %s: %s\n", target, res.Error())
os.Exit(1)
} else if resp != nil {
fmt.Printf("Got response from %s\n%s\n", target, resp)
Expand Down
46 changes: 46 additions & 0 deletions cmd/upgrade/v0.15.0/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
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 main

import (
// Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters).
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"

"context"
"fmt"
"os"

"k8s.io/client-go/kubernetes"
kubeclient "knative.dev/pkg/client/injection/kube/client"
"knative.dev/pkg/injection/sharedmain"
"knative.dev/pkg/signals"

versioned "knative.dev/eventing/pkg/client/clientset/versioned"
eventingclient "knative.dev/eventing/pkg/client/injection/client"
broker "knative.dev/eventing/pkg/upgrader/broker/v0.15.0"
)

func main() {
ctx := signals.NewContext()
cfg := sharedmain.ParseAndGetConfigOrDie()
ctx = context.WithValue(ctx, kubeclient.Key{}, kubernetes.NewForConfigOrDie(cfg))
ctx = context.WithValue(ctx, eventingclient.Key{}, versioned.NewForConfigOrDie(cfg))
if err := broker.Upgrade(ctx); err != nil {
fmt.Printf("Broker Upgrade failed with: %v\n", err)
os.Exit(1)
}
}
4 changes: 2 additions & 2 deletions config/channels/in-memory-channel/300-in-memory-channel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
- name: v1beta1
served: true
storage: false
storage: true
4 changes: 2 additions & 2 deletions config/core/resources/channel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
schema:
openAPIV3Schema:
type: object
Expand Down Expand Up @@ -136,7 +136,7 @@ spec:
x-kubernetes-preserve-unknown-fields: true
- name: v1beta1
served: true
storage: false
storage: true
schema:
openAPIV3Schema:
type: object
Expand Down
4 changes: 2 additions & 2 deletions config/core/resources/eventtype.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
- name: v1beta1
served: true
storage: false
storage: true
4 changes: 2 additions & 2 deletions config/core/resources/parallel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
- name: v1beta1
served: true
storage: false
storage: true

4 changes: 2 additions & 2 deletions config/core/resources/sequence.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
- name: v1beta1
served: true
storage: false
storage: true
4 changes: 2 additions & 2 deletions config/core/resources/subscription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
- name: v1beta1
served: true
storage: false
storage: true
4 changes: 2 additions & 2 deletions config/core/resources/trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
schema:
openAPIV3Schema:
type: object
Expand Down Expand Up @@ -118,7 +118,7 @@ spec:
x-kubernetes-preserve-unknown-fields: true
- name: v1beta1
served: true
storage: false
storage: true
schema:
openAPIV3Schema:
type: object
Expand Down
63 changes: 63 additions & 0 deletions config/post-install/v0.15.0/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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.

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: knative-eventing-post-install-job-role
labels:
eventing.knative.dev/release: devel
rules:
# Storage version upgrader needs to be able to patch CRDs.
- apiGroups:
- "apiextensions.k8s.io"
resources:
- "customresourcedefinitions"
- "customresourcedefinitions/status"
verbs:
- "get"
- "list"
- "update"
- "patch"
- "watch"
# Our own resources we care about.
- apiGroups:
- "eventing.knative.dev"
resources:
- "triggers"
- "eventtypes"
- "eventtypes/status"
verbs: &everything
- "get"
- "list"
- "create"
- "update"
- "delete"
- "patch"
- "watch"
- apiGroups:
- "messaging.knative.dev"
resources:
- "channels"
- "subscriptions"
- "inmemorychannels"
verbs: *everything

# Flow resources and statuses we care about.
- apiGroups:
- "flows.knative.dev"
resources:
- "sequences"
- "parallels"
verbs: *everything
19 changes: 19 additions & 0 deletions config/post-install/v0.15.0/dummy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
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
https://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 postinstall is a placeholder that allows us to pull in config files
// via go mod vendor.
package postinstall
39 changes: 39 additions & 0 deletions config/post-install/v0.15.0/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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.

apiVersion: v1
kind: ServiceAccount
metadata:
name: knative-eventing-post-install-job
namespace: knative-eventing
labels:
eventing.knative.dev/release: devel

---

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: knative-eventing-post-install-job-role-binding
labels:
eventing.knative.dev/release: devel
subjects:
- kind: ServiceAccount
name: knative-eventing-post-install-job
namespace: knative-eventing
roleRef:
kind: ClusterRole
name: knative-eventing-post-install-job-role
apiGroup: rbac.authorization.k8s.io

Loading

0 comments on commit 5d39b3c

Please sign in to comment.