This is an automated email from the ASF dual-hosted git repository.
wmedvedeo pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-serverless-operator.git
The following commit(s) were added to refs/heads/main by this push:
new 5f52a110 kie-kogito-serverless-operator-566: Make the operator
configure the binary and compress properties for the kogito events grouping in
preview and gitops workflow deployments (#567)
5f52a110 is described below
commit 5f52a110434865810e913f2c57f2aa38f464d783
Author: Walter Medvedeo <[email protected]>
AuthorDate: Wed Nov 6 17:57:12 2024 +0100
kie-kogito-serverless-operator-566: Make the operator configure the binary
and compress properties for the kogito events grouping in preview and gitops
workflow deployments (#567)
---
...w-operator-controllers-config_v1_configmap.yaml | 5 ++
config/manager/controllers_cfg.yaml | 7 ++-
internal/controller/cfg/controllers_cfg.go | 2 +
internal/controller/cfg/controllers_cfg_test.go | 2 +
.../cfg/testdata/controllers-cfg-test.yaml | 4 +-
.../profiles/common/constants/workflows.go | 2 +
.../profiles/common/properties/managed.go | 6 ++
.../profiles/common/properties/managed_test.go | 70 +++++++++++++++++++---
operator.yaml | 5 ++
9 files changed, 92 insertions(+), 11 deletions(-)
diff --git
a/bundle/manifests/sonataflow-operator-controllers-config_v1_configmap.yaml
b/bundle/manifests/sonataflow-operator-controllers-config_v1_configmap.yaml
index be219212..de07dc1d 100644
--- a/bundle/manifests/sonataflow-operator-controllers-config_v1_configmap.yaml
+++ b/bundle/manifests/sonataflow-operator-controllers-config_v1_configmap.yaml
@@ -61,6 +61,11 @@ data:
# If true, the workflow deployments will be configured to send accumulated
workflow status change events to the Data
# Index Service reducing the number of produced events. Set to false to
send individual events.
kogitoEventsGrouping: true
+ # If true, the accumulated workflow status change events will be sent in
binary mode. (reduces the evens size)
+ kogitoEventsGroupingBinary: true
+ # If true, the accumulated workflow status change events, when sent in
binary mode, will be gzipped at the cost of
+ # some performance.
+ kogitoEventsGroupingCompress: false
kind: ConfigMap
metadata:
name: sonataflow-operator-controllers-config
diff --git a/config/manager/controllers_cfg.yaml
b/config/manager/controllers_cfg.yaml
index b4d5bcf4..39ac528c 100644
--- a/config/manager/controllers_cfg.yaml
+++ b/config/manager/controllers_cfg.yaml
@@ -57,4 +57,9 @@ postgreSQLPersistenceExtensions:
version: 999-20240912-SNAPSHOT
# If true, the workflow deployments will be configured to send accumulated
workflow status change events to the Data
# Index Service reducing the number of produced events. Set to false to send
individual events.
-kogitoEventsGrouping: true
\ No newline at end of file
+kogitoEventsGrouping: true
+# If true, the accumulated workflow status change events will be sent in
binary mode. (reduces the evens size)
+kogitoEventsGroupingBinary: true
+# If true, the accumulated workflow status change events, when sent in binary
mode, will be gzipped at the cost of
+# some performance.
+kogitoEventsGroupingCompress: false
\ No newline at end of file
diff --git a/internal/controller/cfg/controllers_cfg.go
b/internal/controller/cfg/controllers_cfg.go
index 0a8e76f0..4c910106 100644
--- a/internal/controller/cfg/controllers_cfg.go
+++ b/internal/controller/cfg/controllers_cfg.go
@@ -72,6 +72,8 @@ type ControllersCfg struct {
BuilderConfigMapName string
`yaml:"builderConfigMapName,omitempty"`
PostgreSQLPersistenceExtensions []GAV
`yaml:"postgreSQLPersistenceExtensions,omitempty"`
KogitoEventsGrouping bool
`yaml:"kogitoEventsGrouping,omitempty"`
+ KogitoEventsGroupingBinary bool
`yaml:"KogitoEventsGroupingBinary,omitempty"`
+ KogitoEventsGroupingCompress bool
`yaml:"KogitoEventsGroupingCompress,omitempty"`
}
// InitializeControllersCfg initializes the platform configuration for this
instance.
diff --git a/internal/controller/cfg/controllers_cfg_test.go
b/internal/controller/cfg/controllers_cfg_test.go
index e72ea5bb..37bb8bdf 100644
--- a/internal/controller/cfg/controllers_cfg_test.go
+++ b/internal/controller/cfg/controllers_cfg_test.go
@@ -55,6 +55,8 @@ func TestInitializeControllersCfgAt_ValidFile(t *testing.T) {
Version: "999-SNAPSHOT",
}, postgresExtensions[2])
assert.True(t, cfg.KogitoEventsGrouping)
+ assert.True(t, cfg.KogitoEventsGroupingBinary)
+ assert.False(t, cfg.KogitoEventsGroupingCompress)
}
func TestInitializeControllersCfgAt_FileNotFound(t *testing.T) {
diff --git a/internal/controller/cfg/testdata/controllers-cfg-test.yaml
b/internal/controller/cfg/testdata/controllers-cfg-test.yaml
index 33babade..a1d3e9d8 100644
--- a/internal/controller/cfg/testdata/controllers-cfg-test.yaml
+++ b/internal/controller/cfg/testdata/controllers-cfg-test.yaml
@@ -35,4 +35,6 @@ postgreSQLPersistenceExtensions:
- groupId: org.kie
artifactId: kie-addons-quarkus-persistence-jdbc
version: 999-SNAPSHOT
-kogitoEventsGrouping: true
\ No newline at end of file
+kogitoEventsGrouping: true
+kogitoEventsGroupingBinary: true
+kogitoEventsGroupingCompress: false
\ No newline at end of file
diff --git a/internal/controller/profiles/common/constants/workflows.go
b/internal/controller/profiles/common/constants/workflows.go
index edb4864f..f0fca0a4 100644
--- a/internal/controller/profiles/common/constants/workflows.go
+++ b/internal/controller/profiles/common/constants/workflows.go
@@ -30,4 +30,6 @@ const (
QuarkusHttpCors = "quarkus.http.cors"
QuarkusHttpCorsOrigins = "quarkus.http.cors.origins"
KogitoEventsGrouping = "kogito.events.grouping"
+ KogitoEventsGroupingBinary =
"kogito.events.grouping.binary"
+ KogitoEventsGroupingCompress =
"kogito.events.grouping.compress"
)
diff --git a/internal/controller/profiles/common/properties/managed.go
b/internal/controller/profiles/common/properties/managed.go
index f4774765..133502f9 100644
--- a/internal/controller/profiles/common/properties/managed.go
+++ b/internal/controller/profiles/common/properties/managed.go
@@ -198,6 +198,12 @@ func NewManagedPropertyHandler(workflow
*operatorapi.SonataFlow, platform *opera
func setControllersConfigProperties(workflow *operatorapi.SonataFlow, props
*properties.Properties) {
if !profiles.IsDevProfile(workflow) &&
cfg.GetCfg().KogitoEventsGrouping {
props.Set(constants.KogitoEventsGrouping, "true")
+ if cfg.GetCfg().KogitoEventsGroupingBinary {
+ props.Set(constants.KogitoEventsGroupingBinary, "true")
+ if cfg.GetCfg().KogitoEventsGroupingCompress {
+
props.Set(constants.KogitoEventsGroupingCompress, "true")
+ }
+ }
}
}
diff --git a/internal/controller/profiles/common/properties/managed_test.go
b/internal/controller/profiles/common/properties/managed_test.go
index 0ee9293f..e8c6c5c5 100644
--- a/internal/controller/profiles/common/properties/managed_test.go
+++ b/internal/controller/profiles/common/properties/managed_test.go
@@ -317,46 +317,98 @@ func
Test_appPropertyHandler_WithServicesWithUserOverrides(t *testing.T) {
assert.Equal(t, "",
generatedProps.GetString(constants.JobServiceStatusChangeEventsURL, ""))
}
+type eventsGroupingTestSpec struct {
+ kogitoEventsGrouping bool
+ kogitoEventsGroupingBinary bool
+ kogitoEventsGroupingCompress bool
+ shouldContainEventsGrouping bool
+ shouldContainEventsGroupingBinary bool
+ shouldContainEventsGroupingCompress bool
+}
+
+func newTestSpec(eventsGrouping bool, eventsGroupingBinary bool,
eventsGroupingCompress bool,
+ shouldContainEventsGrouping bool, shouldContainEventsGroupingBinary
bool, shouldContainEventsGroupingCompress bool) *eventsGroupingTestSpec {
+ return &eventsGroupingTestSpec{
+ kogitoEventsGrouping: eventsGrouping,
+ kogitoEventsGroupingBinary: eventsGroupingBinary,
+ kogitoEventsGroupingCompress: eventsGroupingCompress,
+ shouldContainEventsGrouping:
shouldContainEventsGrouping,
+ shouldContainEventsGroupingBinary:
shouldContainEventsGroupingBinary,
+ shouldContainEventsGroupingCompress:
shouldContainEventsGroupingCompress,
+ }
+}
func Test_appPropertyHandler_KogitoEventsGroupingTrueWithDevProfile(t
*testing.T) {
- doTestManagedPropsForKogitoEventsGrouping(t, metadata.DevProfile, true,
false)
+ doTestManagedPropsForKogitoEventsGrouping(t, metadata.DevProfile,
newTestSpec(false, false, false, false, false, false))
}
func Test_appPropertyHandler_KogitoEventsGroupingTrueWithPreviewProfile(t
*testing.T) {
- doTestManagedPropsForKogitoEventsGrouping(t, metadata.PreviewProfile,
true, true)
+ doTestManagedPropsForKogitoEventsGrouping(t, metadata.PreviewProfile,
newTestSpec(true, false, false, true, false, false))
}
func Test_appPropertyHandler_KogitoEventsGroupingTrueWithGitOpsProfile(t
*testing.T) {
- doTestManagedPropsForKogitoEventsGrouping(t, metadata.GitOpsProfile,
true, true)
+ doTestManagedPropsForKogitoEventsGrouping(t, metadata.GitOpsProfile,
newTestSpec(true, false, false, true, false, false))
}
func Test_appPropertyHandler_KogitoEventsGroupingFalseWithDevProfile(t
*testing.T) {
- doTestManagedPropsForKogitoEventsGrouping(t, metadata.DevProfile,
false, false)
+ doTestManagedPropsForKogitoEventsGrouping(t, metadata.DevProfile,
newTestSpec(false, false, false, false, false, false))
}
func Test_appPropertyHandler_KogitoEventsGroupingFalseWithPreviewProfile(t
*testing.T) {
- doTestManagedPropsForKogitoEventsGrouping(t, metadata.PreviewProfile,
false, false)
+ doTestManagedPropsForKogitoEventsGrouping(t, metadata.PreviewProfile,
newTestSpec(false, false, false, false, false, false))
+}
+
+func
Test_appPropertyHandler_KogitoEventsGroupingTrueBinaryTrueCompressFalseWithPreviewProfile(t
*testing.T) {
+ doTestManagedPropsForKogitoEventsGrouping(t, metadata.PreviewProfile,
newTestSpec(true, true, false, true, true, false))
+}
+
+func
Test_appPropertyHandler_KogitoEventsGroupingTrueBinaryTrueCompressTrueWithPreviewProfile(t
*testing.T) {
+ doTestManagedPropsForKogitoEventsGrouping(t, metadata.PreviewProfile,
newTestSpec(true, true, true, true, true, true))
}
func Test_appPropertyHandler_KogitoEventsGroupingFalseWithGitOpsProfile(t
*testing.T) {
- doTestManagedPropsForKogitoEventsGrouping(t, metadata.GitOpsProfile,
false, false)
+ doTestManagedPropsForKogitoEventsGrouping(t, metadata.GitOpsProfile,
newTestSpec(false, false, false, false, false, false))
+}
+
+func
Test_appPropertyHandler_KogitoEventsGroupingTrueBinaryTrueCompressFalseWithGitOpsProfile(t
*testing.T) {
+ doTestManagedPropsForKogitoEventsGrouping(t, metadata.GitOpsProfile,
newTestSpec(true, true, false, true, true, false))
+}
+
+func
Test_appPropertyHandler_KogitoEventsGroupingTrueBinaryTrueCompressTrueWithGitOpsProfile(t
*testing.T) {
+ doTestManagedPropsForKogitoEventsGrouping(t, metadata.GitOpsProfile,
newTestSpec(true, true, true, true, true, true))
}
-func doTestManagedPropsForKogitoEventsGrouping(t *testing.T, profile
metadata.ProfileType, kogitoEventsGrouping bool, shouldContain bool) {
+func doTestManagedPropsForKogitoEventsGrouping(t *testing.T, profile
metadata.ProfileType, testSpec *eventsGroupingTestSpec) {
currentKogitoEventGroupingValue := cfg.GetCfg().KogitoEventsGrouping
- cfg.GetCfg().KogitoEventsGrouping = kogitoEventsGrouping
+ currentKogitoEventGroupingBinaryValue :=
cfg.GetCfg().KogitoEventsGroupingBinary
+ currentKogitoEventGroupingCompressValue :=
cfg.GetCfg().KogitoEventsGroupingCompress
+ cfg.GetCfg().KogitoEventsGrouping = testSpec.kogitoEventsGrouping
+ cfg.GetCfg().KogitoEventsGroupingBinary =
testSpec.kogitoEventsGroupingBinary
+ cfg.GetCfg().KogitoEventsGroupingCompress =
testSpec.kogitoEventsGroupingCompress
workflow := test.GetBaseSonataFlow("default")
setProfileInFlow(profile)(workflow)
platform := test.GetBasePlatform()
handler, err := NewManagedPropertyHandler(workflow, platform)
cfg.GetCfg().KogitoEventsGrouping = currentKogitoEventGroupingValue
+ cfg.GetCfg().KogitoEventsGroupingBinary =
currentKogitoEventGroupingBinaryValue
+ cfg.GetCfg().KogitoEventsGroupingCompress =
currentKogitoEventGroupingCompressValue
assert.NoError(t, err)
generatedProps, propsErr := properties.LoadString(handler.Build())
assert.NoError(t, propsErr)
- if shouldContain {
+ if testSpec.shouldContainEventsGrouping {
assertHasProperty(t, generatedProps, "kogito.events.grouping",
"true")
} else {
assert.NotContains(t, generatedProps.Keys(),
"kogito.events.grouping")
}
+ if testSpec.shouldContainEventsGroupingBinary {
+ assertHasProperty(t, generatedProps,
"kogito.events.grouping.binary", "true")
+ } else {
+ assert.NotContains(t, generatedProps.Keys(),
"kogito.events.grouping.binary", "true")
+ }
+ if testSpec.shouldContainEventsGroupingCompress {
+ assertHasProperty(t, generatedProps,
"kogito.events.grouping.compress", "true")
+ } else {
+ assert.NotContains(t, generatedProps.Keys(),
"kogito.events.grouping.compress", "true")
+ }
}
var _ = Describe("Platform properties", func() {
diff --git a/operator.yaml b/operator.yaml
index 278cacdb..977f7904 100644
--- a/operator.yaml
+++ b/operator.yaml
@@ -28155,6 +28155,11 @@ data:
# If true, the workflow deployments will be configured to send accumulated
workflow status change events to the Data
# Index Service reducing the number of produced events. Set to false to
send individual events.
kogitoEventsGrouping: true
+ # If true, the accumulated workflow status change events will be sent in
binary mode. (reduces the evens size)
+ kogitoEventsGroupingBinary: true
+ # If true, the accumulated workflow status change events, when sent in
binary mode, will be gzipped at the cost of
+ # some performance.
+ kogitoEventsGroupingCompress: false
kind: ConfigMap
metadata:
name: sonataflow-operator-controllers-config
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]