Skip to content

Commit

Permalink
Update deps (#907)
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
  • Loading branch information
slinkydeveloper committed May 18, 2021
1 parent 245ba16 commit c20eded
Show file tree
Hide file tree
Showing 10 changed files with 326 additions and 39 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ require (
k8s.io/apiserver v0.19.7
k8s.io/client-go v0.19.7
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009
knative.dev/eventing v0.22.1-0.20210511131446-68934518c68f
knative.dev/eventing v0.23.0
knative.dev/hack v0.0.0-20210428122153-93ad9129c268
knative.dev/pkg v0.0.0-20210510175900-4564797bf3b7
knative.dev/reconciler-test v0.0.0-20210506205310-ed3c37806817
knative.dev/reconciler-test v0.0.0-20210512062647-d5adf72546be
)
12 changes: 4 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1261,19 +1261,15 @@ k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H
k8s.io/utils v0.0.0-20200729134348-d5654de09c73/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
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/eventing v0.22.1-0.20210511131446-68934518c68f h1:3bYpG0sg4qjVilSFOlt5BBGR0czbeU4ApkxtEdilOB8=
knative.dev/eventing v0.22.1-0.20210511131446-68934518c68f/go.mod h1:V2vHWE8p2p6sokoNVXafQLiWGJ7hQpw0IzI+w5RqOaA=
knative.dev/hack v0.0.0-20210325223819-b6ab329907d3/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/eventing v0.23.0 h1:0L1bVpll8kjdZNZ0FgNi4T0pPo4MmmDb6UJ06I9yHoM=
knative.dev/eventing v0.23.0/go.mod h1:vGob3H6BTseZP+/dA5ze89gM+iNHlB2Cez8FFI7A9KM=
knative.dev/hack v0.0.0-20210428122153-93ad9129c268 h1:lBIj9Epd9UQ55NEaHzAdY/UZbuaegCdGPKVC2+Z68Q0=
knative.dev/hack v0.0.0-20210428122153-93ad9129c268/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/hack/schema v0.0.0-20210428122153-93ad9129c268/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
knative.dev/pkg v0.0.0-20210420053235-1afd04993622/go.mod h1:UtcSLHy2XIz5blWoPTA40F87zk4O7erxkCwv+7Tsmws=
knative.dev/pkg v0.0.0-20210428141353-878c85083565/go.mod h1:fIl4l4OmZodkElyaHoT0LCF5wT+3+P/kinawQ4XlLtE=
knative.dev/pkg v0.0.0-20210510175900-4564797bf3b7 h1:i4P8emOPrLctmbaPHp5eRIOqz+XTOkit7KgZeS+onKs=
knative.dev/pkg v0.0.0-20210510175900-4564797bf3b7/go.mod h1:fIl4l4OmZodkElyaHoT0LCF5wT+3+P/kinawQ4XlLtE=
knative.dev/reconciler-test v0.0.0-20210428195854-3db87491edb3/go.mod h1:yZihS1XoBt7oxU6Jq+U2hMKmUvfKFEaj3vMqOMBt/tI=
knative.dev/reconciler-test v0.0.0-20210506205310-ed3c37806817 h1:St9fyMUnKmumy+5jlawD/lfdBSnAVY/8bgoqOUdfFHs=
knative.dev/reconciler-test v0.0.0-20210506205310-ed3c37806817/go.mod h1:pUozU+xgCWG9eH+4bYBXM0zWPl8lwvan34gCi/ZDP8o=
knative.dev/reconciler-test v0.0.0-20210512062647-d5adf72546be h1:auIvV9JfTCZ/wROftfLy9JGOK2tyZtE9M0DR2nOFOOk=
knative.dev/reconciler-test v0.0.0-20210512062647-d5adf72546be/go.mod h1:ZHvzjwe5aUnWDx+u5y9EPaZ++5PM9Yapp/IvBDiS+Yk=
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=
Expand Down
9 changes: 5 additions & 4 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \

group "Update deps post-codegen"

# Our GH Actions env doesn't have protoc.
# Our GH Actions env doesn't have protoc, nor Java.
# For more details: https://github.com/knative-sandbox/eventing-kafka-broker/pull/847#issuecomment-828562570
# Also: https://github.com/knative-sandbox/knobots/runs/2609020026?check_suite_focus=true#step:6:291
if ! ${GITHUB_ACTIONS:-false}; then
${REPO_ROOT_DIR}/hack/generate-proto.sh
fi

# Update Java third party file
mvn --file ${REPO_ROOT_DIR}/data-plane/pom.xml -Dlicense.outputDirectory=. license:aggregate-add-third-party
# Update Java third party file
mvn --file ${REPO_ROOT_DIR}/data-plane/pom.xml -Dlicense.outputDirectory=. license:aggregate-add-third-party
fi

${REPO_ROOT_DIR}/hack/update-deps.sh
34 changes: 18 additions & 16 deletions vendor/knative.dev/eventing/pkg/apis/flows/v1/sequence_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ func (ss *SequenceStatus) PropagateChannelStatuses(channels []*eventingduckv1.Ch

}
for i, c := range channels {
// Mark the Sequence address as the Address of the first channel.
if i == 0 {
ss.setAddress(c.Status.Address)
}

ss.ChannelStatuses[i] = SequenceChannelStatus{
Channel: corev1.ObjectReference{
APIVersion: c.APIVersion,
Expand All @@ -130,20 +135,16 @@ func (ss *SequenceStatus) PropagateChannelStatuses(channels []*eventingduckv1.Ch
Namespace: c.Namespace,
},
}
// TODO: Once the addressable has a real status to dig through, use that here instead of
// addressable, because it might be addressable but not ready.
address := c.Status.AddressStatus.Address
if address != nil {
ss.ChannelStatuses[i].ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionTrue}

if ready := c.Status.GetCondition(apis.ConditionReady); ready != nil {
ss.ChannelStatuses[i].ReadyCondition = *ready
if !ready.IsTrue() {
allReady = false
}
} else {
ss.ChannelStatuses[i].ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionFalse, Reason: "NotAddressable", Message: "Channel is not addressable"}
ss.ChannelStatuses[i].ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionUnknown, Reason: "NoReady", Message: "Channel does not have Ready condition"}
allReady = false
}

// Mark the Sequence address as the Address of the first channel.
if i == 0 {
ss.setAddress(address)
}
}
if allReady {
sCondSet.Manage(ss).MarkTrue(SequenceConditionChannelsReady)
Expand All @@ -153,22 +154,23 @@ func (ss *SequenceStatus) PropagateChannelStatuses(channels []*eventingduckv1.Ch
}

func (ss *SequenceStatus) MarkChannelsNotReady(reason, messageFormat string, messageA ...interface{}) {
sCondSet.Manage(ss).MarkFalse(SequenceConditionChannelsReady, reason, messageFormat, messageA...)
sCondSet.Manage(ss).MarkUnknown(SequenceConditionChannelsReady, reason, messageFormat, messageA...)
}

func (ss *SequenceStatus) MarkSubscriptionsNotReady(reason, messageFormat string, messageA ...interface{}) {
sCondSet.Manage(ss).MarkFalse(SequenceConditionSubscriptionsReady, reason, messageFormat, messageA...)
sCondSet.Manage(ss).MarkUnknown(SequenceConditionSubscriptionsReady, reason, messageFormat, messageA...)
}

func (ss *SequenceStatus) MarkAddressableNotReady(reason, messageFormat string, messageA ...interface{}) {
sCondSet.Manage(ss).MarkFalse(SequenceConditionAddressable, reason, messageFormat, messageA...)
sCondSet.Manage(ss).MarkUnknown(SequenceConditionAddressable, reason, messageFormat, messageA...)
}

func (ss *SequenceStatus) setAddress(address *duckv1.Addressable) {
if address == nil || address.URL == nil {
sCondSet.Manage(ss).MarkFalse(SequenceConditionAddressable, "emptyAddress", "addressable is nil")
ss.Address = duckv1.Addressable{}
sCondSet.Manage(ss).MarkUnknown(SequenceConditionAddressable, "emptyAddress", "addressable is nil")
} else {
ss.AddressStatus.Address = &duckv1.Addressable{URL: address.URL}
ss.Address = duckv1.Addressable{URL: address.URL}
sCondSet.Manage(ss).MarkTrue(SequenceConditionAddressable)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ type SequenceStatus struct {
// Matches the Spec.Steps array in the order.
ChannelStatuses []SequenceChannelStatus `json:"channelStatuses"`

// AddressStatus is the starting point to this Sequence. Sending to this
// Address is the starting point to this Sequence. Sending to this
// will target the first subscriber.
// It generally has the form {channel}.{namespace}.svc.{cluster domain name}
duckv1.AddressStatus `json:",inline"`
// +optional
Address duckv1.Addressable `json:"address,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
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 helpers

import (
"context"
"fmt"
"testing"

cloudevents "github.com/cloudevents/sdk-go/v2"
. "github.com/cloudevents/sdk-go/v2/test"
"github.com/google/uuid"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

testlib "knative.dev/eventing/test/lib"
"knative.dev/eventing/test/lib/recordevents"
"knative.dev/eventing/test/lib/resources"
)

// ChannelChainTestHelper is the helper function for channel_chain_test
// Deprecated, use reconciler-test based tests.
func ChannelChainTestHelper(
ctx context.Context,
t *testing.T,
subscriptionVersion SubscriptionVersion,
channelTestRunner testlib.ComponentsTestRunner,
options ...testlib.SetupClientOption) {
const (
senderName = "e2e-channelchain-sender"
recordEventsPodName = "e2e-channelchain-recordevents-pod"
)
channelNames := []string{"e2e-channelchain1", "e2e-channelchain2"}
// subscriptionNames1 corresponds to Subscriptions on channelNames[0]
subscriptionNames1 := []string{"e2e-channelchain-subs11", "e2e-channelchain-subs12"}
// subscriptionNames2 corresponds to Subscriptions on channelNames[1]
subscriptionNames2 := []string{"e2e-channelchain-subs21"}
eventSource := fmt.Sprintf("http://%s.svc/", senderName)

channelTestRunner.RunTests(t, testlib.FeatureBasic, func(st *testing.T, channel metav1.TypeMeta) {
client := testlib.Setup(st, true, options...)
defer testlib.TearDown(client)

// create channels
client.CreateChannelsOrFail(channelNames, &channel)
client.WaitForResourcesReadyOrFail(&channel)

// create loggerPod and expose it as a service
eventTracker, _ := recordevents.StartEventRecordOrFail(ctx, client, recordEventsPodName)
// create subscription to subscribe the channel, and forward the received events to the logger service
switch subscriptionVersion {
case SubscriptionV1:
// create subscriptions that subscribe the first channel, and reply events directly to the second channel
client.CreateSubscriptionsOrFail(
subscriptionNames1,
channelNames[0],
&channel,
resources.WithReplyForSubscription(channelNames[1], &channel),
)
// create subscriptions that subscribe the second channel, and call the logging service
client.CreateSubscriptionsOrFail(
subscriptionNames2,
channelNames[1],
&channel,
resources.WithSubscriberForSubscription(recordEventsPodName),
)
default:
t.Fatalf("Invalid subscription version")
}
// wait for all test resources to be ready, so that we can start sending events
client.WaitForAllTestResourcesReadyOrFail(ctx)

// send CloudEvent to the first channel
event := cloudevents.NewEvent()
event.SetID("test")
event.SetSource(eventSource)
event.SetType(testlib.DefaultEventType)

body := fmt.Sprintf(`{"msg":"TestSingleEvent %s"}`, uuid.New().String())
if err := event.SetData(cloudevents.ApplicationJSON, []byte(body)); err != nil {
st.Fatalf("Cannot set the payload of the event: %s", err.Error())
}

client.SendEventToAddressable(ctx, senderName, channelNames[0], &channel, event)

// verify the logger service receives the event
eventTracker.AssertAtLeast(len(subscriptionNames1)*len(subscriptionNames2), recordevents.MatchEvent(
HasSource(eventSource),
HasData([]byte(body)),
))
})
}
Loading

0 comments on commit c20eded

Please sign in to comment.