Skip to content

Commit

Permalink
add controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
freeznet committed Jun 20, 2024
1 parent f1a9f8f commit 3ef1bd8
Show file tree
Hide file tree
Showing 14 changed files with 1,129 additions and 70 deletions.
8 changes: 1 addition & 7 deletions api/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package v1alpha1

import (
"encoding/json"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"reflect"

Expand Down Expand Up @@ -90,14 +89,9 @@ func IsPulsarResourceReady(instance reconciler.Object) bool {
meta.IsStatusConditionTrue(conditions, ConditionReady)
}

type FileRef struct {
ConfigMapRef *corev1.LocalObjectReference `json:"configMapRef"`
Key string `json:"key"`
}

type PackageContentRef struct {
// +optional
FileRef *FileRef `json:"fileRef,omitempty"`
//persistentVolumeTemplate *corev1.PersistentVolumeClaim `json:"persistentVolumeTemplate,omitempty"`

// +optional
URL string `json:"url,omitempty"`
Expand Down
16 changes: 4 additions & 12 deletions api/v1alpha1/pulsarfunction_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ type PulsarFunctionSpec struct {
// +optional
OutputTypeClassName string `json:"outputTypeClassName,omitempty"`

// Runtime is the runtime of the function
// +optional
Runtime string `json:"runtime,omitempty"`

// DeadLetterTopic is the dead letter topic of the function
// +optional
DeadLetterTopic string `json:"deadLetterTopic,omitempty"`
Expand All @@ -111,10 +107,6 @@ type PulsarFunctionSpec struct {
// +optional
SubName string `json:"subName,omitempty"`

// FQFN is the FQFN of the function
// +optional
FQFN string `json:"fqfn,omitempty"`

// Jar is the jar of the function
// +optional
Jar *PackageContentRef `json:"jar,omitempty"`
Expand All @@ -127,10 +119,6 @@ type PulsarFunctionSpec struct {
// +optional
Go *PackageContentRef `json:"go,omitempty"`

// FunctionType is the function type of the function
// +optional
FunctionType string `json:"functionType,omitempty"`

// RuntimeFlags is the runtime flags of the function
// +optional
RuntimeFlags string `json:"runtimeFlags,omitempty"`
Expand Down Expand Up @@ -209,6 +197,10 @@ type PulsarFunctionSpec struct {

// ConnectionRef is the reference to the PulsarConnection resource
ConnectionRef corev1.LocalObjectReference `json:"connectionRef"`

// +kubebuilder:validation:Enum=CleanUpAfterDeletion;KeepAfterDeletion
// +optional
LifecyclePolicy PulsarResourceLifeCyclePolicy `json:"lifecyclePolicy,omitempty"`
}

type WindowConfig struct {
Expand Down
10 changes: 8 additions & 2 deletions api/v1alpha1/pulsarpackage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ type PulsarPackageSpec struct {
// Important: Run "make" to regenerate code after modifying this file

// PackageURL is the Pulsar Package URL, in format of type://tenant/namespace/package@version
// +kubebuilder:validation:Required
PackageURL string `json:"packageURL"`

// FileRef is the reference to the PulsarPackage File content
FileRef FileRef `json:"fileRef"`
// FileURL is the download-able URL of the package from http or https protocol
// +kubebuilder:validation:Required
FileURL string `json:"fileURL"`

// ConnectionRef is the reference to the PulsarConnection resource
ConnectionRef corev1.LocalObjectReference `json:"connectionRef"`
Expand All @@ -44,6 +46,10 @@ type PulsarPackageSpec struct {

// +optional
Properties map[string]string `json:"properties,omitempty"`

// +kubebuilder:validation:Enum=CleanUpAfterDeletion;KeepAfterDeletion
// +optional
LifecyclePolicy PulsarResourceLifeCyclePolicy `json:"lifecyclePolicy,omitempty"`
}

// PulsarPackageStatus defines the observed state of PulsarPackage
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/pulsarsink_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ type PulsarSinkSpec struct {

// ConnectionRef is the reference to the PulsarConnection resource
ConnectionRef corev1.LocalObjectReference `json:"connectionRef"`

// +kubebuilder:validation:Enum=CleanUpAfterDeletion;KeepAfterDeletion
// +optional
LifecyclePolicy PulsarResourceLifeCyclePolicy `json:"lifecyclePolicy,omitempty"`
}

// PulsarSinkStatus defines the observed state of PulsarSink
Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha1/pulsarsource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ type PulsarSourceSpec struct {

// ConnectionRef is the reference to the PulsarConnection resource
ConnectionRef corev1.LocalObjectReference `json:"connectionRef"`

// +kubebuilder:validation:Enum=CleanUpAfterDeletion;KeepAfterDeletion
// +optional
LifecyclePolicy PulsarResourceLifeCyclePolicy `json:"lifecyclePolicy,omitempty"`
}

type BatchSourceConfig struct {
Expand Down
72 changes: 23 additions & 49 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Loading

0 comments on commit 3ef1bd8

Please sign in to comment.