Skip to content

Improve Operator #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ docker-push: ## Push docker image with the manager.
# - have enabled BuildKit. More info: https://docs.docker.com/develop/develop-images/build_enhancements/
# - be able to push the image to your registry (i.e. if you do not set a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
# To adequately provide solutions that are compatible with multiple platforms, you should consider using this option.
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
#PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
PLATFORMS ?= linux/arm64,linux/amd64
.PHONY: docker-buildx
docker-buildx: ## Build and push docker image for the manager for cross-platform support
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
Expand Down
20 changes: 14 additions & 6 deletions operator/api/v1alpha1/function_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1

import (
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -25,30 +26,39 @@ import (
// +kubebuilder:validation:Optional
type FunctionSpec struct {
// Display name of the function
// +kubebuilder:validation:Optional
DisplayName string `json:"displayName,omitempty"`
// Description of the function
// +kubebuilder:validation:Optional
Description string `json:"description,omitempty"`
// Package name
// +kubebuilder:validation:Required
Package string `json:"package"`
// Module name
// +kubebuilder:validation:Required
Module string `json:"module"`
// +kubebuilder:validation:Optional
SubscriptionName string `json:"subscriptionName,omitempty"`
// List of sources
// +kubebuilder:validation:Optional
Sources []SourceSpec `json:"sources,omitempty"`
// Request source
RequestSource SourceSpec `json:"requestSource,omitempty"`
// +kubebuilder:validation:Optional
RequestSource *SourceSpec `json:"requestSource,omitempty"`
// Sink specifies the sink configuration
Sink SinkSpec `json:"sink,omitempty"`
// +kubebuilder:validation:Optional
Sink *SinkSpec `json:"sink,omitempty"`
// Configurations as key-value pairs
Config map[string]string `json:"config,omitempty"`
// +kubebuilder:validation:Optional
Config map[string]v1.JSON `json:"config,omitempty"`
}

// SourceSpec defines a source or sink specification
// +kubebuilder:object:generate=true
// +kubebuilder:validation:Optional
type SourceSpec struct {
// Pulsar source specification
// +kubebuilder:validation:Optional
Pulsar *PulsarSourceSpec `json:"pulsar,omitempty"`
}

Expand All @@ -59,16 +69,14 @@ type PulsarSourceSpec struct {
// Topic name
// +kubebuilder:validation:Required
Topic string `json:"topic"`
// Subscription name
// +kubebuilder:validation:Required
SubscriptionName string `json:"subscriptionName"`
}

// SinkSpec defines a sink specification
// +kubebuilder:object:generate=true
// +kubebuilder:validation:Optional
type SinkSpec struct {
// Pulsar sink specification
// +kubebuilder:validation:Optional
Pulsar *PulsarSinkSpec `json:"pulsar,omitempty"`
}

Expand Down
31 changes: 22 additions & 9 deletions operator/api/v1alpha1/packages_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,36 @@ import (
// ConfigItem defines a configuration item for a module
type ConfigItem struct {
// DisplayName is the human-readable name of the config item
DisplayName string `json:"displayName"`
// +kubebuilder:validation:Optional
DisplayName string `json:"displayName,omitempty"`
// Description provides additional information about the config item
Description string `json:"description"`
// +kubebuilder:validation:Optional
Description string `json:"description,omitempty"`
// Type specifies the data type of the config item
Type string `json:"type"`
// +kubebuilder:validation:Optional
Type string `json:"type,omitempty"`
// Required indicates whether this config item is mandatory
Required bool `json:"required"`
// +kubebuilder:validation:Optional
Required bool `json:"required,omitempty"`
}

// Module defines a module within a package
type Module struct {
// DisplayName is the human-readable name of the module
DisplayName string `json:"displayName"`
// +kubebuilder:validation:Optional
DisplayName string `json:"displayName,omitempty"`
// Description provides additional information about the module
Description string `json:"description"`
// +kubebuilder:validation:Optional
Description string `json:"description,omitempty"`
// SourceSchema defines the input schema for the module
// +kubebuilder:validation:Optional
SourceSchema string `json:"sourceSchema,omitempty"`
// SinkSchema defines the output schema for the module
// +kubebuilder:validation:Optional
SinkSchema string `json:"sinkSchema,omitempty"`
// Config is a list of configuration items for the module
Config []ConfigItem `json:"config,omitempty"`
// +kubebuilder:validation:Optional
Config map[string]ConfigItem `json:"config,omitempty"`
}

// CloudType defines cloud function package configuration
Expand All @@ -55,17 +64,21 @@ type CloudType struct {
// FunctionType defines the function type configuration
type FunctionType struct {
// Cloud contains cloud function package configuration
// +kubebuilder:validation:Optional
Cloud *CloudType `json:"cloud,omitempty"`
}

// PackageSpec defines the desired state of Package
type PackageSpec struct {
// DisplayName is the human-readable name of the package
DisplayName string `json:"displayName"`
// +kubebuilder:validation:Optional
DisplayName string `json:"displayName,omitempty"`
// Logo is the URL or base64 encoded image for the package logo
// +kubebuilder:validation:Optional
Logo string `json:"logo,omitempty"`
// Description provides additional information about the package
Description string `json:"description"`
// +kubebuilder:validation:Optional
Description string `json:"description,omitempty"`
// FunctionType contains function type configuration
FunctionType FunctionType `json:"functionType"`
// Modules is a map of module names to their configurations
Expand Down
23 changes: 17 additions & 6 deletions operator/api/v1alpha1/zz_generated.deepcopy.go

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

1 change: 0 additions & 1 deletion operator/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ func main() {
opts.BindFlags(flag.CommandLine)
flag.Parse()

// Build Config struct (no need to set env)
config := controller.Config{
PulsarServiceURL: pulsarServiceUrl,
PulsarAuthPlugin: pulsarAuthPlugin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
properties:
config:
additionalProperties:
type: string
x-kubernetes-preserve-unknown-fields: true
description: Configurations as key-value pairs
type: object
description:
Expand All @@ -62,19 +62,15 @@ spec:
pulsar:
description: Pulsar source specification
properties:
subscriptionName:
description: Subscription name
type: string
topic:
description: Topic name
type: string
required:
- subscriptionName
- topic
type: object
type: object
sink:
description: sink
description: Sink specifies the sink configuration
properties:
pulsar:
description: Pulsar sink specification
Expand All @@ -94,18 +90,16 @@ spec:
pulsar:
description: Pulsar source specification
properties:
subscriptionName:
description: Subscription name
type: string
topic:
description: Topic name
type: string
required:
- subscriptionName
- topic
type: object
type: object
type: array
subscriptionName:
type: string
required:
- module
- package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ spec:
description: Module defines a module within a package
properties:
config:
description: Config is a list of configuration items for the
module
items:
additionalProperties:
description: ConfigItem defines a configuration item for a
module
properties:
Expand All @@ -93,13 +91,10 @@ spec:
description: Type specifies the data type of the config
item
type: string
required:
- description
- displayName
- required
- type
type: object
type: array
description: Config is a list of configuration items for the
module
type: object
description:
description: Description provides additional information about
the module
Expand All @@ -113,15 +108,10 @@ spec:
sourceSchema:
description: SourceSchema defines the input schema for the module
type: string
required:
- description
- displayName
type: object
description: Modules is a map of module names to their configurations
type: object
required:
- description
- displayName
- functionType
- modules
type: object
Expand Down
12 changes: 0 additions & 12 deletions operator/config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@ kind: ClusterRole
metadata:
name: manager-role
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
properties:
config:
additionalProperties:
type: string
x-kubernetes-preserve-unknown-fields: true
description: Configurations as key-value pairs
type: object
description:
Expand All @@ -68,19 +68,15 @@ spec:
pulsar:
description: Pulsar source specification
properties:
subscriptionName:
description: Subscription name
type: string
topic:
description: Topic name
type: string
required:
- subscriptionName
- topic
type: object
type: object
sink:
description: sink
description: Sink specifies the sink configuration
properties:
pulsar:
description: Pulsar sink specification
Expand All @@ -100,18 +96,16 @@ spec:
pulsar:
description: Pulsar source specification
properties:
subscriptionName:
description: Subscription name
type: string
topic:
description: Topic name
type: string
required:
- subscriptionName
- topic
type: object
type: object
type: array
subscriptionName:
type: string
required:
- module
- package
Expand Down
Loading
Loading