Skip to content

Commit 036c134

Browse files
committed
support function with replace sink and source
1 parent c3e95f9 commit 036c134

File tree

17 files changed

+616
-120
lines changed

17 files changed

+616
-120
lines changed

api/compute/v1alpha1/function_types.go

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ type FunctionSpec struct {
6262
FilebeatImage string `json:"filebeatImage,omitempty"`
6363
// +kubebuilder:validation:Optional
6464
// +kubebuilder:pruning:PreserveUnknownFields
65-
FuncConfig *Config `json:"funcConfig,omitempty"`
65+
FuncConfig *Config `json:"funcConfig,omitempty"`
66+
// +kubebuilder:validation:Optional
67+
SourceConfig *SourceConnectorSpec `json:"sourceConfig,omitempty"`
68+
// +kubebuilder:validation:Optional
69+
SinkConfig *SinkConnectorSpec `json:"sinkConfig,omitempty"`
6670
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
6771
SecretsMap map[string]SecretRef `json:"secretsMap,omitempty"`
6872
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
@@ -152,6 +156,51 @@ type FunctionList struct {
152156
Items []Function `json:"items"`
153157
}
154158

159+
// SourceConnectorSpec describes configurable fields when a function overrides its source implementation.
160+
type SourceConnectorSpec struct {
161+
// Archive points to a nar archive containing the connector. It can reference built-in connectors using the
162+
// builtin:// scheme.
163+
// +kubebuilder:validation:Optional
164+
Archive string `json:"archive,omitempty"`
165+
// Builtin holds the resolved name of a built-in source connector.
166+
// +kubebuilder:validation:Optional
167+
Builtin string `json:"builtin,omitempty"`
168+
// ClassName is the fully qualified source implementation class.
169+
// +kubebuilder:validation:Optional
170+
ClassName string `json:"className,omitempty"`
171+
// TypeClassName overrides the expected message type.
172+
// +kubebuilder:validation:Optional
173+
TypeClassName string `json:"typeClassName,omitempty"`
174+
// Configs contains connector specific options.
175+
// +kubebuilder:validation:Optional
176+
// +kubebuilder:pruning:PreserveUnknownFields
177+
Configs *Config `json:"configs,omitempty"`
178+
}
179+
180+
// SinkConnectorSpec describes configurable fields when a function overrides its sink implementation.
181+
type SinkConnectorSpec struct {
182+
// Archive points to a nar archive containing the connector. It can reference built-in connectors using the
183+
// builtin:// scheme.
184+
// +kubebuilder:validation:Optional
185+
Archive string `json:"archive,omitempty"`
186+
// Builtin holds the resolved name of a built-in sink connector.
187+
// +kubebuilder:validation:Optional
188+
Builtin string `json:"builtin,omitempty"`
189+
// SinkType refers to the built-in sink identifier when using connectors packaged with Pulsar.
190+
// +kubebuilder:validation:Optional
191+
SinkType string `json:"sinkType,omitempty"`
192+
// ClassName is the fully qualified sink implementation class.
193+
// +kubebuilder:validation:Optional
194+
ClassName string `json:"className,omitempty"`
195+
// TypeClassName overrides the message type for the sink.
196+
// +kubebuilder:validation:Optional
197+
TypeClassName string `json:"typeClassName,omitempty"`
198+
// Configs contains connector specific options.
199+
// +kubebuilder:validation:Optional
200+
// +kubebuilder:pruning:PreserveUnknownFields
201+
Configs *Config `json:"configs,omitempty"`
202+
}
203+
155204
func init() {
156205
SchemeBuilder.Register(&Function{}, &FunctionList{})
157206
}

api/compute/v1alpha1/zz_generated.deepcopy.go

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/function-mesh-operator/charts/admission-webhook/templates/crd-compute.functionmesh.io-functionmeshes.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7590,8 +7590,21 @@ spec:
75907590
showPreciseParallelism:
75917591
type: boolean
75927592
sinkConfig:
7593+
properties:
7594+
archive:
7595+
type: string
7596+
builtin:
7597+
type: string
7598+
className:
7599+
type: string
7600+
configs:
7601+
additionalProperties: {}
7602+
type: object
7603+
sinkType:
7604+
type: string
7605+
typeClassName:
7606+
type: string
75937607
type: object
7594-
x-kubernetes-preserve-unknown-fields: true
75957608
sinkType:
75967609
type: string
75977610
statefulConfig:
@@ -11246,8 +11259,19 @@ spec:
1124611259
showPreciseParallelism:
1124711260
type: boolean
1124811261
sourceConfig:
11262+
properties:
11263+
archive:
11264+
type: string
11265+
builtin:
11266+
type: string
11267+
className:
11268+
type: string
11269+
configs:
11270+
additionalProperties: {}
11271+
type: object
11272+
typeClassName:
11273+
type: string
1124911274
type: object
11250-
x-kubernetes-preserve-unknown-fields: true
1125111275
sourceType:
1125211276
type: string
1125311277
statefulConfig:

config/crd/bases/compute.functionmesh.io_functionmeshes.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3710,8 +3710,38 @@ spec:
37103710
type: object
37113711
showPreciseParallelism:
37123712
type: boolean
3713+
sinkConfig:
3714+
properties:
3715+
archive:
3716+
type: string
3717+
builtin:
3718+
type: string
3719+
className:
3720+
type: string
3721+
configs:
3722+
type: object
3723+
x-kubernetes-preserve-unknown-fields: true
3724+
sinkType:
3725+
type: string
3726+
typeClassName:
3727+
type: string
3728+
type: object
37133729
skipToLatest:
37143730
type: boolean
3731+
sourceConfig:
3732+
properties:
3733+
archive:
3734+
type: string
3735+
builtin:
3736+
type: string
3737+
className:
3738+
type: string
3739+
configs:
3740+
type: object
3741+
x-kubernetes-preserve-unknown-fields: true
3742+
typeClassName:
3743+
type: string
3744+
type: object
37153745
statefulConfig:
37163746
properties:
37173747
pulsar:

config/crd/bases/compute.functionmesh.io_functions.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3707,8 +3707,38 @@ spec:
37073707
type: object
37083708
showPreciseParallelism:
37093709
type: boolean
3710+
sinkConfig:
3711+
properties:
3712+
archive:
3713+
type: string
3714+
builtin:
3715+
type: string
3716+
className:
3717+
type: string
3718+
configs:
3719+
type: object
3720+
x-kubernetes-preserve-unknown-fields: true
3721+
sinkType:
3722+
type: string
3723+
typeClassName:
3724+
type: string
3725+
type: object
37103726
skipToLatest:
37113727
type: boolean
3728+
sourceConfig:
3729+
properties:
3730+
archive:
3731+
type: string
3732+
builtin:
3733+
type: string
3734+
className:
3735+
type: string
3736+
configs:
3737+
type: object
3738+
x-kubernetes-preserve-unknown-fields: true
3739+
typeClassName:
3740+
type: string
3741+
type: object
37123742
statefulConfig:
37133743
properties:
37143744
pulsar:

0 commit comments

Comments
 (0)