Skip to content

Commit

Permalink
[issue-368] knative integration with DataIndex and JobService
Browse files Browse the repository at this point in the history
  • Loading branch information
jianrongzhang89 committed May 21, 2024
1 parent 8a45b19 commit 3c95aac
Show file tree
Hide file tree
Showing 42 changed files with 1,893 additions and 182 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ Dockerfile
/.idea/
/.vscode/
/target/
/__debug*
database/

e2e-test-report.xml
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ docker-buildx: generate ## Build and push docker image for the manager for cross
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- docker buildx create --name project-v3-builder
docker buildx use project-v3-builder
- docker buildx build --build-arg SOURCE_DATE_EPOCH=$(shell git log -1 --pretty=%ct) --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross
- docker buildx build --build-arg SOURCE_DATE_EPOCH=$(shell git log -1 --pretty=%ct) --push . --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross
- docker buildx rm project-v3-builder
rm Dockerfile.cross

Expand Down Expand Up @@ -297,12 +297,16 @@ ifneq ($(origin CATALOG_BASE_IMG), undefined)
FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG)
endif

PLATFORM ?= linux/amd64

# Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'.
# This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see:
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
.PHONY: catalog-build
catalog-build: opm ## Build a catalog image.
$(OPM) index add --container-tool $(BUILDER) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
$(OPM) index add --container-tool $(BUILDER) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) --generate -d ./index.Dockerfile
$(BUILDER) build --platform $(PLATFORM) -f ./index.Dockerfile -t $(CATALOG_IMG) .
rm ./index.Dockerfile

# Push the catalog image.
.PHONY: catalog-push
Expand Down
2 changes: 2 additions & 0 deletions api/condition_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const (
SucceedConditionType ConditionType = "Succeed"
// BuiltConditionType describes the condition of a resource that needs to be build.
BuiltConditionType ConditionType = "Built"
// DeployedConditionType describes the condition of a resource that needs to be deployed.
DeployedConditionType ConditionType = "Deployed"
)

const (
Expand Down
12 changes: 12 additions & 0 deletions api/v1alpha08/sonataflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ type SonataFlowSpec struct {
// Sink describes the sinkBinding details of this SonataFlow instance.
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="sink"
Sink *duckv1.Destination `json:"sink,omitempty"`
// Sources describes the list of sources used to create triggers for events consumed by this SonataFlow instance.
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="sources"
Sources []SonataFlowSourceSpec `json:"sources,omitempty"`
}

// SonataFlowSourceSpec defines the desired state of a source used for trigger creation
// +k8s:openapi-gen=true
type SonataFlowSourceSpec struct {
// Defines the eventType to filter the events
EventType string `json:"eventType"`
// Defines the broker used
duckv1.Destination `json:",inline"`
}

// SonataFlowStatus defines the observed state of SonataFlow
Expand Down
31 changes: 29 additions & 2 deletions api/v1alpha08/sonataflowplatform_services_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,41 @@

package v1alpha08

import (
duckv1 "knative.dev/pkg/apis/duck/v1"
)

// ServicesPlatformSpec describes the desired service configuration for workflows without the `sonataflow.org/profile: dev` annotation.
type ServicesPlatformSpec struct {
// Deploys the Data Index service for use by workflows without the `sonataflow.org/profile: dev` annotation.
// +optional
DataIndex *ServiceSpec `json:"dataIndex,omitempty"`
DataIndex *DataIndexServiceSpec `json:"dataIndex,omitempty"`
// Deploys the Job service for use by workflows without the `sonataflow.org/profile: dev` annotation.
// +optional
JobService *ServiceSpec `json:"jobService,omitempty"`
JobService *JobServiceServiceSpec `json:"jobService,omitempty"`
}

// DataIndexServiceSpec defines the desired state of Dataindex service
// +k8s:openapi-gen=true
type DataIndexServiceSpec struct {
// Defines the common spec of a platform service
ServiceSpec `json:",inline"`
// Defines the source where the Dataindex receives events from
// +optional
Source *duckv1.Destination `json:"source,omitempty"`
}

// JobServiceServiceSpec defines the desired state of Jobservice service
// +k8s:openapi-gen=true
type JobServiceServiceSpec struct {
// Defines the common spec of a platform service
ServiceSpec `json:",inline"`
// Defines the sink where the Jobservice sends events to
// +optional
Sink *duckv1.Destination `json:"sink,omitempty"`
// Defines the source where the Jobservice receives events from
// +optional
Source *duckv1.Destination `json:"source,omitempty"`
}

// ServiceSpec defines the desired state of a platform service
Expand Down
13 changes: 13 additions & 0 deletions api/v1alpha08/sonataflowplatform_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package v1alpha08

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
duckv1 "knative.dev/pkg/apis/duck/v1"

"github.com/apache/incubator-kie-kogito-serverless-operator/api"
)
Expand All @@ -47,6 +48,9 @@ type SonataFlowPlatformSpec struct {
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Services"
Services *ServicesPlatformSpec `json:"services,omitempty"`
// Eventing describes the information required for Knative Eventing integration in the platform.
// +optional
Eventing *PlatformEventingSpec `json:"eventing,omitempty"`
// Persistence defines the platform persistence configuration. When this field is set,
// the configuration is used as the persistence for platform services and SonataFlow instances
// that don't provide one of their own.
Expand All @@ -61,6 +65,15 @@ type SonataFlowPlatformSpec struct {
Properties *PropertyPlatformSpec `json:"properties,omitempty"`
}

// PlatformEventingSpec specifies the Knative Eventing integration details in the platform.
// +k8s:openapi-gen=true
type PlatformEventingSpec struct {
// Broker to communicate with workflow deployment. It can be the default broker when the workflow, Dataindex, or Jobservice does not have a sink or source specified.
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="broker"
Broker *duckv1.Destination `json:"broker,omitempty"`
}

// PlatformCluster is the kind of orchestration cluster the platform is installed into
// +kubebuilder:validation:Enum=kubernetes;openshift
type PlatformCluster string
Expand Down
102 changes: 96 additions & 6 deletions api/v1alpha08/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ spec:
no build required)
displayName: DevMode
path: devMode
- description: Broker to communicate with workflow deployment. It can be the
default broker when the workflow, Dataindex, or Jobservice does not have
a sink or source specified.
displayName: broker
path: eventing.broker
- description: 'Services attributes for deploying supporting applications like
Data Index & Job Service. Only workflows without the `sonataflow.org/profile:
dev` annotation will be configured to use these service(s). Setting this
Expand Down Expand Up @@ -318,6 +323,10 @@ spec:
- description: Sink describes the sinkBinding details of this SonataFlow instance.
displayName: sink
path: sink
- description: Sources describes the list of sources used to create triggers
for events consumed by this SonataFlow instance.
displayName: sources
path: sources
statusDescriptors:
- description: Address is used as a part of Addressable interface (status.address.url)
for knative
Expand Down
Loading

0 comments on commit 3c95aac

Please sign in to comment.