Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Commit

Permalink
Update knative.dev/eventing. (#728)
Browse files Browse the repository at this point in the history
* Update knative.dev/eventing.

* Use TypeMeta rather than a string.

* update-deps.sh

* Update knative.dev/eventing.
  • Loading branch information
Harwayne authored and knative-prow-robot committed Nov 16, 2019
1 parent 6d1a908 commit 25c4ff2
Show file tree
Hide file tree
Showing 39 changed files with 347 additions and 82 deletions.
7 changes: 3 additions & 4 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ required = [

[[constraint]]
name = "knative.dev/eventing"
branch = "master"
branch = "release-0.10"

[[constraint]]
name="sigs.k8s.io/controller-runtime"
Expand Down
14 changes: 11 additions & 3 deletions test/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,26 @@ limitations under the License.
package test

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/eventing/test/base/resources"
"knative.dev/eventing/test/common"
)

// ChannelFeatureMap saves the channel-features mapping.
// Each pair means the channel support the list of features.
var ChannelFeatureMap = map[string][]common.Feature{
KafkaChannelKind: {
var ChannelFeatureMap = map[metav1.TypeMeta][]common.Feature{
metav1.TypeMeta{
APIVersion: resources.MessagingAPIVersion,
Kind: KafkaChannelKind,
}: {
common.FeatureBasic,
common.FeatureRedelivery,
common.FeaturePersistence,
},
NatssChannelKind: {
metav1.TypeMeta{
APIVersion: resources.MessagingAPIVersion,
Kind: NatssChannelKind,
}: {
common.FeatureBasic,
common.FeatureRedelivery,
common.FeaturePersistence,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,6 @@ function kafka_teardown() {

initialize $@ --skip-istio-addon

go_test_e2e -timeout=20m -parallel=12 ./test/e2e -channels=NatssChannel || fail_test
go_test_e2e -timeout=20m -parallel=12 ./test/e2e -channels=messaging.knative.dev/v1alpha1:NatssChannel || fail_test

success
5 changes: 0 additions & 5 deletions test/e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,10 @@ import (
"knative.dev/eventing/test/common"
)

var setup = common.Setup
var tearDown = common.TearDown
var getChannelTypeMeta = common.GetChannelTypeMeta
var channels eventingTest.Channels
var channelTestRunner common.ChannelTestRunner

func TestMain(m *testing.M) {
eventingTest.InitializeEventingFlags()
channels = eventingTest.EventingFlags.Channels
channelTestRunner = common.ChannelTestRunner{
ChannelFeatureMap: test.ChannelFeatureMap,
ChannelsToTest: eventingTest.EventingFlags.Channels,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ limitations under the License.

package v1alpha1

import "k8s.io/apimachinery/pkg/runtime"
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ChannelTemplateSpec struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
duckv1 "knative.dev/pkg/apis/duck/v1"
"knative.dev/pkg/apis/duck/v1alpha1"
duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1"
apisv1alpha1 "knative.dev/pkg/apis/v1alpha1"
)

// +genclient
Expand All @@ -46,6 +47,10 @@ type Channelable struct {
// ChannelableSpec contains Spec of the Channelable object
type ChannelableSpec struct {
SubscribableTypeSpec `json:",inline"`

// DeliverySpec contains options controlling the event delivery
// +optional
Delivery *DeliverySpec `json:"delivery,omitempty"`
}

// ChannelableStatus contains the Status of a Channelable object.
Expand All @@ -58,6 +63,9 @@ type ChannelableStatus struct {
v1alpha1.AddressStatus `json:",inline"`
// Subscribers is populated with the statuses of each of the Channelable's subscribers.
SubscribableTypeStatus `json:",inline"`
// ErrorChannel is set by the channel when it supports native error handling via a channel
// +optional
ErrorChannel *corev1.ObjectReference `json:"errorChannel,omitempty"`
}

var (
Expand All @@ -82,6 +90,23 @@ func (c *Channelable) Populate() {
ReplyURI: "sink2",
}},
}
retry := int32(5)
linear := BackoffPolicyLinear
delay := "5s"
c.Spec.Delivery = &DeliverySpec{
DeadLetterSink: &apisv1alpha1.Destination{
Ref: &corev1.ObjectReference{
Name: "aname",
},
URI: &apis.URL{
Scheme: "http",
Host: "test-error-domain",
},
},
Retry: &retry,
BackoffPolicy: &linear,
BackoffDelay: &delay,
}
c.Status = ChannelableStatus{
AddressStatus: v1alpha1.AddressStatus{
Address: &v1alpha1.Addressable{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
Copyright 2019 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 v1alpha1

import (
corev1 "k8s.io/api/core/v1"
apisv1alpha1 "knative.dev/pkg/apis/v1alpha1"
)

// DeliverySpec contains the delivery options for event senders,
// such as channelable and source.
type DeliverySpec struct {
// DeadLetterSink is the sink receiving event that couldn't be sent to
// a destination.
// +optional
DeadLetterSink *apisv1alpha1.Destination `json:"deadLetterSink,omitempty"`

// Retry is the minimum number of retries the sender should attempt when
// sending an event before moving it to the dead letter sink.
// +optional
Retry *int32 `json:"retry,omitempty"`

// BackoffPolicy is the retry backoff policy (linear, exponential)
// +optional
BackoffPolicy *BackoffPolicyType `json:"backoffPolicy,omitempty"`

// BackoffDelay is the delay before retrying.
// More information on Duration format: https://www.ietf.org/rfc/rfc3339.txt
//
// For linear policy, backoff delay is the time interval between retries.
// For exponential policy , backoff delay is backoffDelay*2^<numberOfRetries>
// +optional
BackoffDelay *string
}

// BackoffPolicyType is the type for backoff policies
type BackoffPolicyType string

const (
// Linear backoff policy
BackoffPolicyLinear BackoffPolicyType = "linear"

// Exponential backoff policy
BackoffPolicyExponential BackoffPolicyType = "exponential"
)

// DeliveryStatus contains the Status of an object supporting delivery options.
type DeliveryStatus struct {
// DeadLetterChannel is the reference to the native, platform specific channel
// where failed events are sent to.
// +optional
DeadLetterChannel *corev1.ObjectReference `json:"deadLetterChannel,omitempty"`
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 25c4ff2

Please sign in to comment.