-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Introduce CloudEvents to KEDA (#4968)
Co-authored-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Co-authored-by: Zbynek Roubalik <zroubalik@gmail.com> Co-authored-by: Josef Karasek <karasek.jose@gmail.com> Co-authored-by: Jan Wozniak <wozniak.jan@gmail.com>
- Loading branch information
1 parent
ae04e3c
commit 5f741ed
Showing
118 changed files
with
10,578 additions
and
10 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,85 @@ | ||
/* | ||
Copyright 2023 The KEDA 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" | ||
|
||
v1alpha1 "github.com/kedacore/keda/v2/apis/keda/v1alpha1" | ||
) | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// CloudEventSource defines how a KEDA event will be sent to event sink | ||
// +kubebuilder:resource:path=cloudeventsources,scope=Namespaced | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:printcolumn:name="Active",type="string",JSONPath=".status.conditions[?(@.type==\"Active\")].status" | ||
type CloudEventSource struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec CloudEventSourceSpec `json:"spec"` | ||
Status CloudEventSourceStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// CloudEventSourceList is a list of CloudEventSource resources | ||
type CloudEventSourceList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata"` | ||
Items []CloudEventSource `json:"items"` | ||
} | ||
|
||
// CloudEventSourceSpec defines the spec of CloudEventSource | ||
type CloudEventSourceSpec struct { | ||
// +optional | ||
ClusterName string `json:"clusterName,omitempty"` | ||
|
||
Destination Destination `json:"destination"` | ||
} | ||
|
||
// CloudEventSourceStatus defines the observed state of CloudEventSource | ||
// +optional | ||
type CloudEventSourceStatus struct { | ||
// +optional | ||
Conditions v1alpha1.Conditions `json:"conditions,omitempty"` | ||
} | ||
|
||
// Destination defines the various ways to emit events | ||
type Destination struct { | ||
// +optional | ||
HTTP *CloudEventHTTP `json:"http"` | ||
} | ||
|
||
type CloudEventHTTP struct { | ||
URI string `json:"uri"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&CloudEventSource{}, &CloudEventSourceList{}) | ||
} | ||
|
||
// GenerateIdentifier returns identifier for the object in for "kind.namespace.name" | ||
func (t *CloudEventSource) GenerateIdentifier() string { | ||
return v1alpha1.GenerateIdentifier("CloudEventSource", t.Namespace, t.Name) | ||
} | ||
|
||
// GetCloudEventSourceInitializedConditions returns CloudEventSource Conditions initialized to the default -> Status: Unknown | ||
func GetCloudEventSourceInitializedConditions() *v1alpha1.Conditions { | ||
return &v1alpha1.Conditions{{Type: v1alpha1.ConditionActive, Status: metav1.ConditionUnknown}} | ||
} |
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,28 @@ | ||
/* | ||
Copyright 2023 The KEDA 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 | ||
|
||
const ( | ||
// CloudEventSourceConditionActiveReason defines the active condition reason for CloudEventSource | ||
CloudEventSourceConditionActiveReason = "CloudEventSourceActive" | ||
// CloudEventSourceConditionFailedReason defines the failed condition reason for CloudEventSource | ||
CloudEventSourceConditionFailedReason = "CloudEventSourceFailed" | ||
// CloudEventSourceConditionActiveMessage defines the active condition message for CloudEventSource | ||
CloudEventSourceConditionActiveMessage = "Is configured to send events to the configured destination" | ||
// CloudEventSourceConditionFailedMessage defines the failed condition message for CloudEventSource | ||
CloudEventSourceConditionFailedMessage = "Failed to send events to the configured destination" | ||
) |
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 2023 The KEDA 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 contains API Schema definitions for the eventing v1alpha1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=eventing.keda.sh | ||
package v1alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: "eventing.keda.sh", Version: "v1alpha1"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.