-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bumping knative.dev/eventing 5ad7dab...366ff26: > 366ff26 IntegrationSink: rek-test templating support for bool annotations (# 8342) > 7176ce6 Add IntegrationSink CRD (# 8304) Signed-off-by: Knative Automation <[email protected]>
- Loading branch information
1 parent
c5e5285
commit d93de2c
Showing
15 changed files
with
758 additions
and
4 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
36 changes: 36 additions & 0 deletions
36
vendor/knative.dev/eventing/pkg/apis/sinks/v1alpha1/integration_sink_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,36 @@ | ||
/* | ||
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 ( | ||
"context" | ||
"fmt" | ||
|
||
"knative.dev/pkg/apis" | ||
) | ||
|
||
// ConvertTo implements apis.Convertible | ||
// Converts source from v1alpha1.IntegrationSink into a higher version. | ||
func (sink *IntegrationSink) ConvertTo(ctx context.Context, obj apis.Convertible) error { | ||
return fmt.Errorf("v1alpha1 is the highest known version, got: %T", sink) | ||
} | ||
|
||
// ConvertFrom implements apis.Convertible | ||
// Converts source from a higher version into v1beta2.IntegrationSink | ||
func (sink *IntegrationSink) ConvertFrom(ctx context.Context, obj apis.Convertible) error { | ||
return fmt.Errorf("v1alpha1 is the highest known version, got: %T", sink) | ||
} |
26 changes: 26 additions & 0 deletions
26
vendor/knative.dev/eventing/pkg/apis/sinks/v1alpha1/integration_sink_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,26 @@ | ||
/* | ||
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" | ||
|
||
func (sink *IntegrationSink) SetDefaults(ctx context.Context) { | ||
sink.Spec.SetDefaults(ctx) | ||
} | ||
|
||
func (sink *IntegrationSinkSpec) SetDefaults(ctx context.Context) { | ||
} |
123 changes: 123 additions & 0 deletions
123
vendor/knative.dev/eventing/pkg/apis/sinks/v1alpha1/integration_sink_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,123 @@ | ||
/* | ||
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 ( | ||
appsv1 "k8s.io/api/apps/v1" | ||
corev1 "k8s.io/api/core/v1" | ||
"knative.dev/pkg/apis" | ||
duckv1 "knative.dev/pkg/apis/duck/v1" | ||
) | ||
|
||
const ( | ||
// IntegrationSinkConditionReady has status True when the IntegrationSink is ready to send events. | ||
IntegrationSinkConditionReady = apis.ConditionReady | ||
|
||
IntegrationSinkConditionAddressable apis.ConditionType = "Addressable" | ||
|
||
// IntegrationSinkConditionDeploymentReady has status True when the IntegrationSink has been configured with a deployment. | ||
IntegrationSinkConditionDeploymentReady apis.ConditionType = "DeploymentReady" | ||
|
||
// IntegrationSinkConditionEventPoliciesReady has status True when all the applying EventPolicies for this | ||
// IntegrationSink are ready. | ||
IntegrationSinkConditionEventPoliciesReady apis.ConditionType = "EventPoliciesReady" | ||
) | ||
|
||
var IntegrationSinkCondSet = apis.NewLivingConditionSet( | ||
IntegrationSinkConditionAddressable, | ||
IntegrationSinkConditionDeploymentReady, | ||
IntegrationSinkConditionEventPoliciesReady, | ||
) | ||
|
||
// GetConditionSet retrieves the condition set for this resource. Implements the KRShaped interface. | ||
func (*IntegrationSink) GetConditionSet() apis.ConditionSet { | ||
return IntegrationSinkCondSet | ||
} | ||
|
||
// GetCondition returns the condition currently associated with the given type, or nil. | ||
func (s *IntegrationSinkStatus) GetCondition(t apis.ConditionType) *apis.Condition { | ||
return IntegrationSinkCondSet.Manage(s).GetCondition(t) | ||
} | ||
|
||
// GetTopLevelCondition returns the top level Condition. | ||
func (ps *IntegrationSinkStatus) GetTopLevelCondition() *apis.Condition { | ||
return IntegrationSinkCondSet.Manage(ps).GetTopLevelCondition() | ||
} | ||
|
||
// IsReady returns true if the resource is ready overall. | ||
func (s *IntegrationSinkStatus) IsReady() bool { | ||
return IntegrationSinkCondSet.Manage(s).IsHappy() | ||
} | ||
|
||
// InitializeConditions sets relevant unset conditions to Unknown state. | ||
func (s *IntegrationSinkStatus) InitializeConditions() { | ||
IntegrationSinkCondSet.Manage(s).InitializeConditions() | ||
} | ||
|
||
// MarkAddressableReady marks the Addressable condition to True. | ||
func (s *IntegrationSinkStatus) MarkAddressableReady() { | ||
IntegrationSinkCondSet.Manage(s).MarkTrue(IntegrationSinkConditionAddressable) | ||
} | ||
|
||
// MarkEventPoliciesFailed marks the EventPoliciesReady condition to False with the given reason and message. | ||
func (s *IntegrationSinkStatus) MarkEventPoliciesFailed(reason, messageFormat string, messageA ...interface{}) { | ||
IntegrationSinkCondSet.Manage(s).MarkFalse(IntegrationSinkConditionEventPoliciesReady, reason, messageFormat, messageA...) | ||
} | ||
|
||
// MarkEventPoliciesUnknown marks the EventPoliciesReady condition to Unknown with the given reason and message. | ||
func (s *IntegrationSinkStatus) MarkEventPoliciesUnknown(reason, messageFormat string, messageA ...interface{}) { | ||
IntegrationSinkCondSet.Manage(s).MarkUnknown(IntegrationSinkConditionEventPoliciesReady, reason, messageFormat, messageA...) | ||
} | ||
|
||
// MarkEventPoliciesTrue marks the EventPoliciesReady condition to True. | ||
func (s *IntegrationSinkStatus) MarkEventPoliciesTrue() { | ||
IntegrationSinkCondSet.Manage(s).MarkTrue(IntegrationSinkConditionEventPoliciesReady) | ||
} | ||
|
||
// MarkEventPoliciesTrueWithReason marks the EventPoliciesReady condition to True with the given reason and message. | ||
func (s *IntegrationSinkStatus) MarkEventPoliciesTrueWithReason(reason, messageFormat string, messageA ...interface{}) { | ||
IntegrationSinkCondSet.Manage(s).MarkTrueWithReason(IntegrationSinkConditionEventPoliciesReady, reason, messageFormat, messageA...) | ||
} | ||
|
||
func (s *IntegrationSinkStatus) PropagateDeploymentStatus(d *appsv1.DeploymentStatus) { | ||
deploymentAvailableFound := false | ||
for _, cond := range d.Conditions { | ||
if cond.Type == appsv1.DeploymentAvailable { | ||
deploymentAvailableFound = true | ||
if cond.Status == corev1.ConditionTrue { | ||
IntegrationSinkCondSet.Manage(s).MarkTrue(IntegrationSinkConditionDeploymentReady) | ||
} else if cond.Status == corev1.ConditionFalse { | ||
IntegrationSinkCondSet.Manage(s).MarkFalse(IntegrationSinkConditionDeploymentReady, cond.Reason, cond.Message) | ||
} else if cond.Status == corev1.ConditionUnknown { | ||
IntegrationSinkCondSet.Manage(s).MarkUnknown(IntegrationSinkConditionDeploymentReady, cond.Reason, cond.Message) | ||
} | ||
} | ||
} | ||
if !deploymentAvailableFound { | ||
IntegrationSinkCondSet.Manage(s).MarkUnknown(IntegrationSinkConditionDeploymentReady, "DeploymentUnavailable", "The Deployment '%s' is unavailable.", d) | ||
} | ||
} | ||
|
||
func (s *IntegrationSinkStatus) SetAddress(address *duckv1.Addressable) { | ||
s.Address = address | ||
if address == nil || address.URL.IsEmpty() { | ||
IntegrationSinkCondSet.Manage(s).MarkFalse(IntegrationSinkConditionAddressable, "EmptyHostname", "hostname is the empty string") | ||
} else { | ||
IntegrationSinkCondSet.Manage(s).MarkTrue(IntegrationSinkConditionAddressable) | ||
|
||
} | ||
} |
117 changes: 117 additions & 0 deletions
117
vendor/knative.dev/eventing/pkg/apis/sinks/v1alpha1/integration_sink_types.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,117 @@ | ||
/* | ||
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 ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"knative.dev/eventing/pkg/apis/common/integration/v1alpha1" | ||
eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1" | ||
"knative.dev/pkg/apis" | ||
duckv1 "knative.dev/pkg/apis/duck/v1" | ||
"knative.dev/pkg/kmeta" | ||
) | ||
|
||
// +genclient | ||
// +genreconciler | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
// +k8s:defaulter-gen=true | ||
|
||
// IntegrationSink is the Schema for the IntegrationSink API. | ||
type IntegrationSink struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec IntegrationSinkSpec `json:"spec,omitempty"` | ||
Status IntegrationSinkStatus `json:"status,omitempty"` | ||
} | ||
|
||
// Check the interfaces that JobSink should be implementing. | ||
var ( | ||
_ runtime.Object = (*IntegrationSink)(nil) | ||
_ kmeta.OwnerRefable = (*IntegrationSink)(nil) | ||
_ apis.Validatable = (*IntegrationSink)(nil) | ||
_ apis.Defaultable = (*IntegrationSink)(nil) | ||
_ apis.HasSpec = (*IntegrationSink)(nil) | ||
_ duckv1.KRShaped = (*IntegrationSink)(nil) | ||
_ apis.Convertible = (*JobSink)(nil) | ||
) | ||
|
||
type IntegrationSinkSpec struct { | ||
Aws *Aws `json:"aws,omitempty"` // AWS source configuration | ||
Log *Log `json:"log,omitempty"` // Log sink configuration | ||
} | ||
|
||
type Log struct { | ||
LoggerName string `json:"loggerName,omitempty" default:"log-sink"` // Name of the logging category to use | ||
Level string `json:"level,omitempty" default:"INFO"` // Logging level to use | ||
LogMask bool `json:"logMask,omitempty" default:"false"` // Mask sensitive information in the log | ||
Marker string `json:"marker,omitempty"` // An optional Marker name to use | ||
Multiline bool `json:"multiline,omitempty" default:"false"` // If enabled, outputs each information on a newline | ||
ShowAllProperties bool `json:"showAllProperties,omitempty" default:"false"` // Show all of the exchange properties (both internal and custom) | ||
ShowBody bool `json:"showBody,omitempty" default:"true"` // Show the message body | ||
ShowBodyType bool `json:"showBodyType,omitempty" default:"true"` // Show the body Java type | ||
ShowExchangePattern bool `json:"showExchangePattern,omitempty" default:"true"` // Show the Message Exchange Pattern (MEP) | ||
ShowHeaders bool `json:"showHeaders,omitempty" default:"false"` // Show the headers received | ||
ShowProperties bool `json:"showProperties,omitempty" default:"false"` // Show the exchange properties (only custom) | ||
ShowStreams bool `json:"showStreams,omitempty" default:"false"` // Show the stream bodies | ||
ShowCachedStreams bool `json:"showCachedStreams,omitempty" default:"true"` // Show cached stream bodies | ||
} | ||
|
||
type Aws struct { | ||
S3 *v1alpha1.AWSS3 `json:"s3,omitempty"` // S3 source configuration | ||
SQS *v1alpha1.AWSSQS `json:"sqs,omitempty"` // SQS source configuration | ||
Auth *v1alpha1.Auth `json:"auth,omitempty"` | ||
} | ||
|
||
type IntegrationSinkStatus struct { | ||
duckv1.Status `json:",inline"` | ||
|
||
// AddressStatus is the part where the JobSink 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 JobSink | ||
// +optional | ||
eventingduckv1.AppliedEventPoliciesStatus `json:",inline"` | ||
} | ||
|
||
// GetGroupVersionKind returns the GroupVersionKind. | ||
func (*IntegrationSink) GetGroupVersionKind() schema.GroupVersionKind { | ||
return SchemeGroupVersion.WithKind("IntegrationSink") | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// IntegrationSinkList contains a list of IntegrationSink | ||
type IntegrationSinkList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []IntegrationSink `json:"items"` | ||
} | ||
|
||
// GetUntypedSpec returns the spec of the IntegrationSink. | ||
func (c *IntegrationSink) GetUntypedSpec() interface{} { | ||
return c.Spec | ||
} | ||
|
||
// GetStatus retrieves the status of the IntegrationSink. Implements the KRShaped interface. | ||
func (c *IntegrationSink) GetStatus() *duckv1.Status { | ||
return &c.Status.Status | ||
} |
Oops, something went wrong.