This repository has been archived by the owner on Jun 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[master] Auto-update dependencies (#1353)
Produced via: `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh` /assign grantr ian-mi nachocano /cc grantr ian-mi nachocano
- Loading branch information
Showing
82 changed files
with
6,835 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
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 v1 is the v1 version of the API. | ||
// +k8s:deepcopy-gen=package | ||
// +groupName=flows.knative.dev | ||
package v1 |
34 changes: 34 additions & 0 deletions
34
vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_conversion.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
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 v1 | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"knative.dev/pkg/apis" | ||
) | ||
|
||
// ConvertTo implements apis.Convertible | ||
func (source *Parallel) ConvertTo(ctx context.Context, sink apis.Convertible) error { | ||
return fmt.Errorf("v1 is the highest known version, got: %T", sink) | ||
} | ||
|
||
// ConvertFrom implements apis.Convertible | ||
func (sink *Parallel) ConvertFrom(ctx context.Context, source apis.Convertible) error { | ||
return fmt.Errorf("v1 is the highest known version, got: %T", source) | ||
} |
56 changes: 56 additions & 0 deletions
56
vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_defaults.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* 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 v1 | ||
|
||
import ( | ||
"context" | ||
|
||
"knative.dev/eventing/pkg/apis/messaging/config" | ||
messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" | ||
"knative.dev/pkg/apis" | ||
) | ||
|
||
func (p *Parallel) SetDefaults(ctx context.Context) { | ||
withNS := apis.WithinParent(ctx, p.ObjectMeta) | ||
if p != nil && p.Spec.ChannelTemplate == nil { | ||
cfg := config.FromContextOrDefaults(ctx) | ||
c, err := cfg.ChannelDefaults.GetChannelConfig(apis.ParentMeta(ctx).Namespace) | ||
|
||
if err == nil { | ||
p.Spec.ChannelTemplate = &messagingv1.ChannelTemplateSpec{ | ||
TypeMeta: c.TypeMeta, | ||
Spec: c.Spec, | ||
} | ||
} | ||
} | ||
p.Spec.SetDefaults(withNS) | ||
} | ||
|
||
func (ps *ParallelSpec) SetDefaults(ctx context.Context) { | ||
for _, branch := range ps.Branches { | ||
if branch.Filter != nil { | ||
branch.Filter.SetDefaults(ctx) | ||
} | ||
branch.Subscriber.SetDefaults(ctx) | ||
if branch.Reply != nil { | ||
branch.Reply.SetDefaults(ctx) | ||
} | ||
} | ||
if ps.Reply != nil { | ||
ps.Reply.SetDefaults(ctx) | ||
} | ||
} |
205 changes: 205 additions & 0 deletions
205
vendor/knative.dev/eventing/pkg/apis/flows/v1/parallel_lifecycle.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
/* | ||
* 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 v1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
duckv1 "knative.dev/eventing/pkg/apis/duck/v1" | ||
messagingv1 "knative.dev/eventing/pkg/apis/messaging/v1" | ||
"knative.dev/pkg/apis" | ||
pkgduckv1 "knative.dev/pkg/apis/duck/v1" | ||
) | ||
|
||
var pCondSet = apis.NewLivingConditionSet(ParallelConditionReady, ParallelConditionChannelsReady, ParallelConditionSubscriptionsReady, ParallelConditionAddressable) | ||
|
||
const ( | ||
// ParallelConditionReady has status True when all subconditions below have been set to True. | ||
ParallelConditionReady = apis.ConditionReady | ||
|
||
// ParallelConditionChannelsReady has status True when all the channels created as part of | ||
// this parallel are ready. | ||
ParallelConditionChannelsReady apis.ConditionType = "ChannelsReady" | ||
|
||
// ParallelConditionSubscriptionsReady has status True when all the subscriptions created as part of | ||
// this parallel are ready. | ||
ParallelConditionSubscriptionsReady apis.ConditionType = "SubscriptionsReady" | ||
|
||
// ParallelConditionAddressable has status true when this Parallel meets | ||
// the Addressable contract and has a non-empty hostname. | ||
ParallelConditionAddressable apis.ConditionType = "Addressable" | ||
) | ||
|
||
// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface. | ||
func (*Parallel) GetConditionSet() apis.ConditionSet { | ||
return pCondSet | ||
} | ||
|
||
// GetGroupVersionKind returns GroupVersionKind for Parallel | ||
func (*Parallel) GetGroupVersionKind() schema.GroupVersionKind { | ||
return SchemeGroupVersion.WithKind("Parallel") | ||
} | ||
|
||
// GetUntypedSpec returns the spec of the Parallel. | ||
func (p *Parallel) GetUntypedSpec() interface{} { | ||
return p.Spec | ||
} | ||
|
||
// GetCondition returns the condition currently associated with the given type, or nil. | ||
func (ps *ParallelStatus) GetCondition(t apis.ConditionType) *apis.Condition { | ||
return pCondSet.Manage(ps).GetCondition(t) | ||
} | ||
|
||
// IsReady returns true if the resource is ready overall. | ||
func (ps *ParallelStatus) IsReady() bool { | ||
return pCondSet.Manage(ps).IsHappy() | ||
} | ||
|
||
// InitializeConditions sets relevant unset conditions to Unknown state. | ||
func (ps *ParallelStatus) InitializeConditions() { | ||
pCondSet.Manage(ps).InitializeConditions() | ||
} | ||
|
||
// PropagateSubscriptionStatuses sets the ParallelConditionSubscriptionsReady based on | ||
// the status of the incoming subscriptions. | ||
func (ps *ParallelStatus) PropagateSubscriptionStatuses(filterSubscriptions []*messagingv1.Subscription, subscriptions []*messagingv1.Subscription) { | ||
if ps.BranchStatuses == nil { | ||
ps.BranchStatuses = make([]ParallelBranchStatus, len(subscriptions)) | ||
} | ||
allReady := true | ||
// If there are no subscriptions, treat that as a False branch. Could go either way, but this seems right. | ||
if len(subscriptions) == 0 { | ||
allReady = false | ||
} | ||
|
||
for i, s := range subscriptions { | ||
ps.BranchStatuses[i].SubscriptionStatus = ParallelSubscriptionStatus{ | ||
Subscription: corev1.ObjectReference{ | ||
APIVersion: s.APIVersion, | ||
Kind: s.Kind, | ||
Name: s.Name, | ||
Namespace: s.Namespace, | ||
}, | ||
} | ||
|
||
readyCondition := s.Status.GetTopLevelCondition() | ||
if readyCondition != nil { | ||
ps.BranchStatuses[i].SubscriptionStatus.ReadyCondition = *readyCondition | ||
if readyCondition.Status != corev1.ConditionTrue { | ||
allReady = false | ||
} | ||
} else { | ||
allReady = false | ||
} | ||
|
||
fs := filterSubscriptions[i] | ||
ps.BranchStatuses[i].FilterSubscriptionStatus = ParallelSubscriptionStatus{ | ||
Subscription: corev1.ObjectReference{ | ||
APIVersion: fs.APIVersion, | ||
Kind: fs.Kind, | ||
Name: fs.Name, | ||
Namespace: fs.Namespace, | ||
}, | ||
} | ||
readyCondition = fs.Status.GetCondition(messagingv1.SubscriptionConditionReady) | ||
if readyCondition != nil { | ||
ps.BranchStatuses[i].FilterSubscriptionStatus.ReadyCondition = *readyCondition | ||
if readyCondition.Status != corev1.ConditionTrue { | ||
allReady = false | ||
} | ||
} else { | ||
allReady = false | ||
} | ||
|
||
} | ||
if allReady { | ||
pCondSet.Manage(ps).MarkTrue(ParallelConditionSubscriptionsReady) | ||
} else { | ||
ps.MarkSubscriptionsNotReady("SubscriptionsNotReady", "Subscriptions are not ready yet, or there are none") | ||
} | ||
} | ||
|
||
// PropagateChannelStatuses sets the ChannelStatuses and ParallelConditionChannelsReady based on the | ||
// status of the incoming channels. | ||
func (ps *ParallelStatus) PropagateChannelStatuses(ingressChannel *duckv1.Channelable, channels []*duckv1.Channelable) { | ||
if ps.BranchStatuses == nil { | ||
ps.BranchStatuses = make([]ParallelBranchStatus, len(channels)) | ||
} | ||
allReady := true | ||
|
||
ps.IngressChannelStatus.Channel = corev1.ObjectReference{ | ||
APIVersion: ingressChannel.APIVersion, | ||
Kind: ingressChannel.Kind, | ||
Name: ingressChannel.Name, | ||
Namespace: ingressChannel.Namespace, | ||
} | ||
|
||
address := ingressChannel.Status.AddressStatus.Address | ||
if address != nil { | ||
ps.IngressChannelStatus.ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionTrue} | ||
} else { | ||
ps.IngressChannelStatus.ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionFalse, Reason: "NotAddressable", Message: "Channel is not addressable"} | ||
allReady = false | ||
} | ||
ps.setAddress(address) | ||
|
||
for i, c := range channels { | ||
ps.BranchStatuses[i].FilterChannelStatus = ParallelChannelStatus{ | ||
Channel: corev1.ObjectReference{ | ||
APIVersion: c.APIVersion, | ||
Kind: c.Kind, | ||
Name: c.Name, | ||
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 { | ||
ps.BranchStatuses[i].FilterChannelStatus.ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionTrue} | ||
} else { | ||
ps.BranchStatuses[i].FilterChannelStatus.ReadyCondition = apis.Condition{Type: apis.ConditionReady, Status: corev1.ConditionFalse, Reason: "NotAddressable", Message: "Channel is not addressable"} | ||
allReady = false | ||
} | ||
} | ||
if allReady { | ||
pCondSet.Manage(ps).MarkTrue(ParallelConditionChannelsReady) | ||
} else { | ||
ps.MarkChannelsNotReady("ChannelsNotReady", "Channels are not ready yet, or there are none") | ||
} | ||
} | ||
|
||
func (ps *ParallelStatus) MarkChannelsNotReady(reason, messageFormat string, messageA ...interface{}) { | ||
pCondSet.Manage(ps).MarkFalse(ParallelConditionChannelsReady, reason, messageFormat, messageA...) | ||
} | ||
|
||
func (ps *ParallelStatus) MarkSubscriptionsNotReady(reason, messageFormat string, messageA ...interface{}) { | ||
pCondSet.Manage(ps).MarkFalse(ParallelConditionSubscriptionsReady, reason, messageFormat, messageA...) | ||
} | ||
|
||
func (ps *ParallelStatus) MarkAddressableNotReady(reason, messageFormat string, messageA ...interface{}) { | ||
pCondSet.Manage(ps).MarkFalse(ParallelConditionAddressable, reason, messageFormat, messageA...) | ||
} | ||
|
||
func (ps *ParallelStatus) setAddress(address *pkgduckv1.Addressable) { | ||
ps.Address = address | ||
if address == nil { | ||
pCondSet.Manage(ps).MarkFalse(ParallelConditionAddressable, "emptyAddress", "addressable is nil") | ||
} else { | ||
pCondSet.Manage(ps).MarkTrue(ParallelConditionAddressable) | ||
} | ||
} |
Oops, something went wrong.