Skip to content

Commit

Permalink
upgrade to latest dependencies
Browse files Browse the repository at this point in the history
bumping knative.dev/eventing ebe99e6...366ff26:
  > 366ff26 IntegrationSink: rek-test templating support for bool annotations (# 8342)
  > 7176ce6 Add IntegrationSink CRD  (# 8304)
  > 5ad7dab feat: add RequestReply types and CRD (# 8337)
  > 7f313d7 fix: rename `job-sink` to `job_sink` (# 8335)
  > 4f6535a chore: correct comments (# 8336)

Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation committed Nov 25, 2024
1 parent d080f7f commit ddd3b7f
Show file tree
Hide file tree
Showing 32 changed files with 1,862 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
k8s.io/api v0.30.3
k8s.io/apimachinery v0.30.3
k8s.io/client-go v0.30.3
knative.dev/eventing v0.43.1-0.20241119173100-ebe99e655146
knative.dev/eventing v0.43.1-0.20241125081805-366ff26b10d6
knative.dev/hack v0.0.0-20241106013728-b7995315deb5
knative.dev/pkg v0.0.0-20241118074447-a7fd9b10bb9f
knative.dev/serving v0.43.1-0.20241119121959-3e45e8f8392b
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@ k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8 h1:1Wof1cGQgA5pqgo8MxKPtf
k8s.io/kube-openapi v0.0.0-20240808142205-8e686545bdb8/go.mod h1:Os6V6dZwLNii3vxFpxcNaTmH8LJJBkOTg1N0tOA0fvA=
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A=
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
knative.dev/eventing v0.43.1-0.20241119173100-ebe99e655146 h1:ySpPjfPIvpqR+QtEGSbEjMJ8J6dyZTt7G89Tr0kj5L4=
knative.dev/eventing v0.43.1-0.20241119173100-ebe99e655146/go.mod h1:RxMFtxk903ZoxyS140MPdLLePTzBdeaGkVmBTB52t04=
knative.dev/eventing v0.43.1-0.20241125081805-366ff26b10d6 h1:/8Cq+ZgwU4Fb4MWVQ1jggNGA8wedH6agbgyhfkEDLbk=
knative.dev/eventing v0.43.1-0.20241125081805-366ff26b10d6/go.mod h1:RxMFtxk903ZoxyS140MPdLLePTzBdeaGkVmBTB52t04=
knative.dev/hack v0.0.0-20241106013728-b7995315deb5 h1:CfU5+6B+ylBd7mSGpvRqpzZV8H5ZQLGUwVygFzbE+1o=
knative.dev/hack v0.0.0-20241106013728-b7995315deb5/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY=
knative.dev/networking v0.0.0-20241118075147-929a5d5f19d0 h1:3vj6wR95isnuqgjQzcclyrzaodv5Jvjc7xq4Bv0yde8=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&EventPolicy{},
&EventPolicyList{},
&RequestReply{},
&RequestReplyList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
Expand Down
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 v1alpha1

import (
"context"
"fmt"

"knative.dev/pkg/apis"
)

// ConvertTo implements apis.Convertible
func (ep *RequestReply) ConvertTo(ctx context.Context, obj apis.Convertible) error {
return fmt.Errorf("v1alpha1 is the highest known version, got: %T", obj)
}

// ConvertFrom implements apis.Convertible
func (ep *RequestReply) ConvertFrom(ctx context.Context, obj apis.Convertible) error {
return fmt.Errorf("v1alpha1 is the highest known version, got: %T", obj)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
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 v1alpha1

import (
"context"

"k8s.io/utils/ptr"
"knative.dev/pkg/apis"
)

func (rr *RequestReply) SetDefaults(ctx context.Context) {
ctx = apis.WithinParent(ctx, rr.ObjectMeta)
rr.Spec.SetDefaults(ctx)
}

func (rrs *RequestReplySpec) SetDefaults(ctx context.Context) {
if rrs.Timeout == nil || *rrs.Timeout == "" {
rrs.Timeout = ptr.To("30s")
}

if rrs.CorrelationAttribute == "" {
rrs.CorrelationAttribute = "correlationid"
}

if rrs.ReplyAttribute == "" {
rrs.ReplyAttribute = "replyid"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
Copyright 2024 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 (
"knative.dev/pkg/apis"
v1 "knative.dev/pkg/apis/duck/v1"
)

var requestReplyCondSet = apis.NewLivingConditionSet(RequestReplyConditionIngress, RequestReplyConditionTriggers, RequestReplyConditionAddressable, RequestReplyConditionEventPoliciesReady)

const (
RequestReplyConditionReady = apis.ConditionReady
RequestReplyConditionIngress apis.ConditionType = "IngressReady"
RequestReplyConditionTriggers apis.ConditionType = "TriggersReady"
RequestReplyConditionAddressable apis.ConditionType = "Addressable"
RequestReplyConditionEventPoliciesReady apis.ConditionType = "EventPoliciesReady"
)

// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface.
func (*RequestReply) GetConditionSet() apis.ConditionSet {
return requestReplyCondSet
}

func (*RequestReplyStatus) GetConditionSet() apis.ConditionSet {
return requestReplyCondSet
}

// GetCondition returns the condition currently associated with the given type, or nil.
func (rr *RequestReplyStatus) GetCondition(t apis.ConditionType) *apis.Condition {
return requestReplyCondSet.Manage(rr).GetCondition(t)
}

// IsReady returns true if the resource is ready overall.
func (rr *RequestReplyStatus) IsReady() bool {
return rr.GetTopLevelCondition().IsTrue()
}

// GetTopLevelCondition returns the top level Condition.
func (rr *RequestReplyStatus) GetTopLevelCondition() *apis.Condition {
return requestReplyCondSet.Manage(rr).GetTopLevelCondition()
}

// InitializeConditions sets relevant unset conditions to Unknown state.
func (rr *RequestReplyStatus) InitializeConditions() {
requestReplyCondSet.Manage(rr).InitializeConditions()
}

func (rr *RequestReplyStatus) SetAddress(address *v1.Addressable) {
rr.AddressStatus = v1.AddressStatus{
Address: address,
}

if address != nil && address.URL != nil {
rr.GetConditionSet().Manage(rr).MarkTrue(RequestReplyConditionAddressable)
rr.AddressStatus.Address.Name = &address.URL.Scheme
} else {
rr.GetConditionSet().Manage(rr).MarkFalse(RequestReplyConditionAddressable, "nil URL", "URL is nil")
}
}

func (rr *RequestReplyStatus) MarkTriggersReady() {
rr.GetConditionSet().Manage(rr).MarkTrue(RequestReplyConditionTriggers)
}

func (rr *RequestReplyStatus) MarkTriggersNotReadyWithReason(reason, messageFormat string, messageA ...interface{}) {
rr.GetConditionSet().Manage(rr).MarkUnknown(RequestReplyConditionTriggers, reason, messageFormat, messageA...)
}

func (rr *RequestReplyStatus) MarkIngressReady() {
rr.GetConditionSet().Manage(rr).MarkTrue(RequestReplyConditionIngress)
}

func (rr *RequestReplyStatus) MarkIngressNotReadyWithReason(reason, messageFormat string, messageA ...interface{}) {
rr.GetConditionSet().Manage(rr).MarkUnknown(RequestReplyConditionIngress, reason, messageFormat, messageA...)
}

func (rr *RequestReplyStatus) MarkEventPoliciesTrue() {
rr.GetConditionSet().Manage(rr).MarkTrue(RequestReplyConditionEventPoliciesReady)
}

func (rr *RequestReplyStatus) MarkEventPoliciesTrueWithReason(reason, messageFormat string, messageA ...interface{}) {
rr.GetConditionSet().Manage(rr).MarkTrueWithReason(RequestReplyConditionEventPoliciesReady, reason, messageFormat, messageA...)
}

func (rr *RequestReplyStatus) MarkEventPoliciesFailed(reason, messageFormat string, messageA ...interface{}) {
rr.GetConditionSet().Manage(rr).MarkFalse(RequestReplyConditionEventPoliciesReady, reason, messageFormat, messageA...)
}

func (rr *RequestReplyStatus) MarkEventPoliciesUnknown(reason, messageFormat string, messageA ...interface{}) {
rr.GetConditionSet().Manage(rr).MarkUnknown(RequestReplyConditionEventPoliciesReady, reason, messageFormat, messageA...)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
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 v1alpha1

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

"knative.dev/pkg/apis"
duckv1 "knative.dev/pkg/apis/duck/v1"
"knative.dev/pkg/kmeta"

eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1"
)

// +genclient
// +genreconciler
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// RequestRepluy represents synchronous interface to sending and receiving events from a Broker.
type RequestReply struct {
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`

// Spec defines the desired state of the EventPolicy.
Spec RequestReplySpec `json:"spec,omitempty"`

// Status represents the current state of the EventPolicy.
// This data may be out of date.
// +optional
Status RequestReplyStatus `json:"status,omitempty"`
}

var (
// Check that EventPolicy can be validated, can be defaulted, and has immutable fields.
_ apis.Validatable = (*RequestReply)(nil)
_ apis.Defaultable = (*RequestReply)(nil)

// Check that EventPolicy can return its spec untyped.
_ apis.HasSpec = (*RequestReply)(nil)

_ runtime.Object = (*RequestReply)(nil)

// Check that we can create OwnerReferences to an EventPolicy.
_ kmeta.OwnerRefable = (*RequestReply)(nil)

// Check that the type conforms to the duck Knative Resource shape.
_ duckv1.KRShaped = (*RequestReply)(nil)
)

type RequestReplySpec struct {
// BrokerRef contains the reference to the broker the RequestReply sends events to.
BrokerRef duckv1.KReference `json:"brokerRef"`

CorrelationAttribute string `json:"correlationAttribute"`

ReplyAttribute string `json:"replyAttribute"`

Timeout *string `json:"timeout,omitempty"`

Delivery *eventingduckv1.DeliverySpec `json:"delivery,omitempty"`

Secrets []string `json:"secrets"`
}

// RequestReplyStatus represents the current state of a RequestReply.
type RequestReplyStatus struct {
// inherits duck/v1 Status, which currently provides:
// * ObservedGeneration - the 'Generation' of the Service that was last processed by the controller.
// * Conditions - the latest available observations of a resource's current state.
duckv1.Status `json:",inline"`

// AddressStatus is the part where the RequestReply fulfills the Addressable contract.
// It exposes the endpoint as an URI to get events delivered.
// +optional
duckv1.AddressStatus `json:",inline"`

// AppliedEventPoliciesStatus contains the list of EventPolicies which apply to this Broker.
// +optional
eventingduckv1.AppliedEventPoliciesStatus `json:",inline"`
}

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

// RequestReplyList is a collection of RequestReplies.
type RequestReplyList struct {
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []RequestReply `json:"items"`
}

// GetGroupVersionKind returns GroupVersionKind for EventPolicy
func (rr *RequestReply) GetGroupVersionKind() schema.GroupVersionKind {
return SchemeGroupVersion.WithKind("RequestReply")
}

// GetUntypedSpec returns the spec of the EventPolicy.
func (rr *RequestReply) GetUntypedSpec() interface{} {
return rr.Spec
}

// GetStatus retrieves the status of the EventPolicy. Implements the KRShaped interface.
func (rr *RequestReply) GetStatus() *duckv1.Status {
return &rr.Status.Status
}
Loading

0 comments on commit ddd3b7f

Please sign in to comment.