From 664edb756c7341e6996bd3b4e86bd37f8001e349 Mon Sep 17 00:00:00 2001 From: Walter Medvedeo <wmedvedeo@gmail.com> Date: Fri, 6 Sep 2024 09:26:19 +0200 Subject: [PATCH 1/4] kie-kogito-serverless-operator-491: Make the Operator configure the Jobs Service Leader liveness check (#523) --- .../services/properties_services_test.go | 8 ++++++ controllers/platform/services/services.go | 2 ++ .../common/constants/platform_services.go | 27 ++++++++++--------- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/controllers/platform/services/properties_services_test.go b/controllers/platform/services/properties_services_test.go index 46ea31a44..64c1f7138 100644 --- a/controllers/platform/services/properties_services_test.go +++ b/controllers/platform/services/properties_services_test.go @@ -103,6 +103,8 @@ func generateJobServiceDeploymentDevProperties() *properties.Properties { p.Set("quarkus.http.port", "8080") p.Set("quarkus.kogito.devservices.enabled", "false") p.Set(`quarkus.smallrye-health.check."org.kie.kogito.jobs.service.messaging.http.health.knative.KSinkInjectionHealthCheck".enabled`, "false") + p.Set(`quarkus.smallrye-health.check."org.kie.kogito.jobs.service.management.JobServiceLeaderLivenessHealthCheck".enabled`, "true") + p.Set("kogito.jobs-service.management.leader-check.expiration-in-seconds", "60") p.Sort() return p } @@ -128,6 +130,8 @@ func generateJobServiceDeploymentWithPostgreSQLProperties() *properties.Properti p.Set("quarkus.kogito.devservices.enabled", "false") p.Set(`quarkus.smallrye-health.check."org.kie.kogito.jobs.service.messaging.http.health.knative.KSinkInjectionHealthCheck".enabled`, "false") p.Set("quarkus.datasource.reactive.url", "postgresql://postgres:5432/sonataflow?search_path=myschema") + p.Set(`quarkus.smallrye-health.check."org.kie.kogito.jobs.service.management.JobServiceLeaderLivenessHealthCheck".enabled`, "true") + p.Set("kogito.jobs-service.management.leader-check.expiration-in-seconds", "60") p.Sort() return p } @@ -142,6 +146,8 @@ func generateJobServiceDeploymentWithDataIndexAndEphemeralProperties() *properti p.Set("quarkus.http.port", "8080") p.Set("quarkus.kogito.devservices.enabled", "false") p.Set(`quarkus.smallrye-health.check."org.kie.kogito.jobs.service.messaging.http.health.knative.KSinkInjectionHealthCheck".enabled`, "false") + p.Set(`quarkus.smallrye-health.check."org.kie.kogito.jobs.service.management.JobServiceLeaderLivenessHealthCheck".enabled`, "true") + p.Set("kogito.jobs-service.management.leader-check.expiration-in-seconds", "60") p.Sort() return p } @@ -157,6 +163,8 @@ func generateJobServiceDeploymentWithDataIndexAndPostgreSQLProperties() *propert p.Set("quarkus.kogito.devservices.enabled", "false") p.Set(`quarkus.smallrye-health.check."org.kie.kogito.jobs.service.messaging.http.health.knative.KSinkInjectionHealthCheck".enabled`, "false") p.Set("quarkus.datasource.reactive.url", "postgresql://postgres:5432/sonataflow?search_path=myschema") + p.Set(`quarkus.smallrye-health.check."org.kie.kogito.jobs.service.management.JobServiceLeaderLivenessHealthCheck".enabled`, "true") + p.Set("kogito.jobs-service.management.leader-check.expiration-in-seconds", "60") p.Sort() return p } diff --git a/controllers/platform/services/services.go b/controllers/platform/services/services.go index f2455d8a5..dbba7221d 100644 --- a/controllers/platform/services/services.go +++ b/controllers/platform/services/services.go @@ -410,6 +410,8 @@ func (j JobServiceHandler) GenerateServiceProperties() (*properties.Properties, props := properties.NewProperties() props.Set(constants.KogitoServiceURLProperty, GenerateServiceURL(constants.KogitoServiceURLProtocol, j.platform.Namespace, j.GetServiceName())) props.Set(constants.JobServiceKafkaSmallRyeHealthProperty, "false") + props.Set(constants.JobServiceLeaderLivenessSmallRyeHealthProperty, "true") + props.Set(constants.JobServiceLeaderCheckExpirationInSeconds, constants.DefaultJobServiceLeaderCheckExpirationInSeconds) // add data source reactive URL if j.hasPostgreSQLConfigured() { p := persistence.RetrievePostgreSQLConfiguration(j.platform.Spec.Services.JobService.Persistence, j.platform.Spec.Persistence, j.GetServiceName()) diff --git a/controllers/profiles/common/constants/platform_services.go b/controllers/profiles/common/constants/platform_services.go index 4065d9e92..f28bb2eea 100644 --- a/controllers/profiles/common/constants/platform_services.go +++ b/controllers/profiles/common/constants/platform_services.go @@ -24,13 +24,15 @@ const ( ConfigMapWorkflowPropsVolumeName = "workflow-properties" - JobServiceRequestEventsURL = "mp.messaging.outgoing.kogito-job-service-job-request-events.url" - JobServiceRequestEventsConnector = "mp.messaging.outgoing.kogito-job-service-job-request-events.connector" - JobServiceStatusChangeEvents = "kogito.jobs-service.http.job-status-change-events" - JobServiceStatusChangeEventsURL = "mp.messaging.outgoing.kogito-job-service-job-status-events-http.url" - JobServiceURLProtocol = "http" - JobServiceDataSourceReactiveURL = "quarkus.datasource.reactive.url" - JobServiceJobEventsPath = "/v2/jobs/events" + JobServiceRequestEventsURL = "mp.messaging.outgoing.kogito-job-service-job-request-events.url" + JobServiceRequestEventsConnector = "mp.messaging.outgoing.kogito-job-service-job-request-events.connector" + JobServiceStatusChangeEvents = "kogito.jobs-service.http.job-status-change-events" + JobServiceStatusChangeEventsURL = "mp.messaging.outgoing.kogito-job-service-job-status-events-http.url" + JobServiceURLProtocol = "http" + JobServiceDataSourceReactiveURL = "quarkus.datasource.reactive.url" + JobServiceJobEventsPath = "/v2/jobs/events" + JobServiceLeaderCheckExpirationInSeconds = "kogito.jobs-service.management.leader-check.expiration-in-seconds" + DefaultJobServiceLeaderCheckExpirationInSeconds = "60" KogitoProcessInstancesEventsURL = "mp.messaging.outgoing.kogito-processinstances-events.url" KogitoProcessInstancesEventsEnabled = "kogito.events.processinstances.enabled" @@ -49,11 +51,12 @@ const ( // of its start health check. KogitoJobServiceHealthCheckEnabled = "kogito.jobs-service.health-enabled" // KogitoJobServiceURL configures the jobs service, this value can be used internally by the workflow. - KogitoJobServiceURL = "kogito.jobs-service.url" - KogitoServiceURLProperty = "kogito.service.url" - KogitoServiceURLProtocol = "http" - DataIndexKafkaSmallRyeHealthProperty = `quarkus.smallrye-health.check."io.quarkus.kafka.client.health.KafkaHealthCheck".enabled` - JobServiceKafkaSmallRyeHealthProperty = `quarkus.smallrye-health.check."org.kie.kogito.jobs.service.messaging.http.health.knative.KSinkInjectionHealthCheck".enabled` + KogitoJobServiceURL = "kogito.jobs-service.url" + KogitoServiceURLProperty = "kogito.service.url" + KogitoServiceURLProtocol = "http" + DataIndexKafkaSmallRyeHealthProperty = `quarkus.smallrye-health.check."io.quarkus.kafka.client.health.KafkaHealthCheck".enabled` + JobServiceKafkaSmallRyeHealthProperty = `quarkus.smallrye-health.check."org.kie.kogito.jobs.service.messaging.http.health.knative.KSinkInjectionHealthCheck".enabled` + JobServiceLeaderLivenessSmallRyeHealthProperty = `quarkus.smallrye-health.check."org.kie.kogito.jobs.service.management.JobServiceLeaderLivenessHealthCheck".enabled` DataIndexServiceName = "data-index-service" JobServiceName = "jobs-service" From 050d8ec6888a79b26ef86d74a6bb7e4178ce0f2c Mon Sep 17 00:00:00 2001 From: rhkp <87712456+rhkp@users.noreply.github.com> Date: Fri, 6 Sep 2024 05:53:47 -0400 Subject: [PATCH 2/4] Make migrateDBOnStartUp property optional (#526) --- api/v1alpha08/sonataflow_persistence_types.go | 2 ++ bundle/manifests/sonataflow.org_sonataflowplatforms.yaml | 4 ---- bundle/manifests/sonataflow.org_sonataflows.yaml | 2 -- config/crd/bases/sonataflow.org_sonataflowplatforms.yaml | 4 ---- config/crd/bases/sonataflow.org_sonataflows.yaml | 2 -- controllers/sonataflowplatform_controller_test.go | 8 ++------ operator.yaml | 6 ------ .../04-sonataflow_callbackstatetimeouts.sw.yaml | 1 - .../03-sonataflow_callbackstatetimeouts.sw.yaml | 1 - 9 files changed, 4 insertions(+), 26 deletions(-) diff --git a/api/v1alpha08/sonataflow_persistence_types.go b/api/v1alpha08/sonataflow_persistence_types.go index e32e027c9..53a5b15e5 100644 --- a/api/v1alpha08/sonataflow_persistence_types.go +++ b/api/v1alpha08/sonataflow_persistence_types.go @@ -52,6 +52,8 @@ type PersistenceOptionsSpec struct { PostgreSQL *PersistencePostgreSQL `json:"postgresql,omitempty"` // Whether to migrate database on service startup? + // +optional + // +default: false MigrateDBOnStartUp bool `json:"migrateDBOnStartUp"` } diff --git a/bundle/manifests/sonataflow.org_sonataflowplatforms.yaml b/bundle/manifests/sonataflow.org_sonataflowplatforms.yaml index f9d772261..ccc538c82 100644 --- a/bundle/manifests/sonataflow.org_sonataflowplatforms.yaml +++ b/bundle/manifests/sonataflow.org_sonataflowplatforms.yaml @@ -628,8 +628,6 @@ spec: required: - secretRef type: object - required: - - migrateDBOnStartUp type: object podTemplate: description: PodTemplate describes the deployment details @@ -8505,8 +8503,6 @@ spec: required: - secretRef type: object - required: - - migrateDBOnStartUp type: object podTemplate: description: PodTemplate describes the deployment details diff --git a/bundle/manifests/sonataflow.org_sonataflows.yaml b/bundle/manifests/sonataflow.org_sonataflows.yaml index effa0cd83..4dc1ae28b 100644 --- a/bundle/manifests/sonataflow.org_sonataflows.yaml +++ b/bundle/manifests/sonataflow.org_sonataflows.yaml @@ -2163,8 +2163,6 @@ spec: required: - secretRef type: object - required: - - migrateDBOnStartUp type: object podTemplate: description: PodTemplate describes the deployment details of this diff --git a/config/crd/bases/sonataflow.org_sonataflowplatforms.yaml b/config/crd/bases/sonataflow.org_sonataflowplatforms.yaml index c4587db75..a824a336a 100644 --- a/config/crd/bases/sonataflow.org_sonataflowplatforms.yaml +++ b/config/crd/bases/sonataflow.org_sonataflowplatforms.yaml @@ -629,8 +629,6 @@ spec: required: - secretRef type: object - required: - - migrateDBOnStartUp type: object podTemplate: description: PodTemplate describes the deployment details @@ -8506,8 +8504,6 @@ spec: required: - secretRef type: object - required: - - migrateDBOnStartUp type: object podTemplate: description: PodTemplate describes the deployment details diff --git a/config/crd/bases/sonataflow.org_sonataflows.yaml b/config/crd/bases/sonataflow.org_sonataflows.yaml index fffbbbb17..fa24f8dfc 100644 --- a/config/crd/bases/sonataflow.org_sonataflows.yaml +++ b/config/crd/bases/sonataflow.org_sonataflows.yaml @@ -2164,8 +2164,6 @@ spec: required: - secretRef type: object - required: - - migrateDBOnStartUp type: object podTemplate: description: PodTemplate describes the deployment details of this diff --git a/controllers/sonataflowplatform_controller_test.go b/controllers/sonataflowplatform_controller_test.go index 23230d8fc..90b66a8d9 100644 --- a/controllers/sonataflowplatform_controller_test.go +++ b/controllers/sonataflowplatform_controller_test.go @@ -261,14 +261,10 @@ func TestSonataFlowPlatformController(t *testing.T) { ksp.Spec = v1alpha08.SonataFlowPlatformSpec{ Services: &v1alpha08.ServicesPlatformSpec{ DataIndex: &v1alpha08.ServiceSpec{ - Persistence: &v1alpha08.PersistenceOptionsSpec{ - MigrateDBOnStartUp: false, - }, + Persistence: &v1alpha08.PersistenceOptionsSpec{}, }, JobService: &v1alpha08.ServiceSpec{ - Persistence: &v1alpha08.PersistenceOptionsSpec{ - MigrateDBOnStartUp: false, - }, + Persistence: &v1alpha08.PersistenceOptionsSpec{}, }, }, Persistence: &v1alpha08.PlatformPersistenceOptionsSpec{ diff --git a/operator.yaml b/operator.yaml index a1b679ac6..6cb2ae5fc 100644 --- a/operator.yaml +++ b/operator.yaml @@ -1120,8 +1120,6 @@ spec: required: - secretRef type: object - required: - - migrateDBOnStartUp type: object podTemplate: description: PodTemplate describes the deployment details @@ -8997,8 +8995,6 @@ spec: required: - secretRef type: object - required: - - migrateDBOnStartUp type: object podTemplate: description: PodTemplate describes the deployment details @@ -19070,8 +19066,6 @@ spec: required: - secretRef type: object - required: - - migrateDBOnStartUp type: object podTemplate: description: PodTemplate describes the deployment details of this diff --git a/test/testdata/workflow/persistence/by_service/04-sonataflow_callbackstatetimeouts.sw.yaml b/test/testdata/workflow/persistence/by_service/04-sonataflow_callbackstatetimeouts.sw.yaml index 58c8ce4c7..ec738e946 100644 --- a/test/testdata/workflow/persistence/by_service/04-sonataflow_callbackstatetimeouts.sw.yaml +++ b/test/testdata/workflow/persistence/by_service/04-sonataflow_callbackstatetimeouts.sw.yaml @@ -21,7 +21,6 @@ metadata: sonataflow.org/version: 0.0.1 spec: persistence: - migrateDBOnStartUp: false postgresql: secretRef: name: postgres-secrets diff --git a/test/testdata/workflow/persistence/from_platform_overwritten_by_service/03-sonataflow_callbackstatetimeouts.sw.yaml b/test/testdata/workflow/persistence/from_platform_overwritten_by_service/03-sonataflow_callbackstatetimeouts.sw.yaml index d39a521ed..fb696bff4 100644 --- a/test/testdata/workflow/persistence/from_platform_overwritten_by_service/03-sonataflow_callbackstatetimeouts.sw.yaml +++ b/test/testdata/workflow/persistence/from_platform_overwritten_by_service/03-sonataflow_callbackstatetimeouts.sw.yaml @@ -21,7 +21,6 @@ metadata: sonataflow.org/version: 0.0.1 spec: persistence: - migrateDBOnStartUp: false postgresql: secretRef: name: postgres-secrets From 9a08354ee881e0b8e15ccaf52ce6ccec8ff42173 Mon Sep 17 00:00:00 2001 From: Walter Medvedeo <wmedvedeo@gmail.com> Date: Fri, 6 Sep 2024 14:58:41 +0200 Subject: [PATCH 3/4] kie-kogito-serverless-operator-528: Disable partial DB Migrator work (#529) --- controllers/platform/services/services.go | 16 ++++++++++------ version/version.go | 6 +++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/controllers/platform/services/services.go b/controllers/platform/services/services.go index dbba7221d..3636b0f00 100644 --- a/controllers/platform/services/services.go +++ b/controllers/platform/services/services.go @@ -21,7 +21,6 @@ package services import ( "fmt" - "strconv" "github.com/apache/incubator-kie-kogito-serverless-operator/controllers/cfg" "github.com/apache/incubator-kie-kogito-serverless-operator/utils/kubernetes" @@ -225,10 +224,12 @@ func (d DataIndexHandler) ConfigurePersistence(containerSpec *corev1.Container) c := containerSpec.DeepCopy() c.Image = d.GetServiceImageName(constants.PersistenceTypePostgreSQL) c.Env = append(c.Env, persistence.ConfigurePostgreSQLEnv(p.PostgreSQL, d.GetServiceName(), d.platform.Namespace)...) - migrateDBOnStart := strconv.FormatBool(d.platform.Spec.Services.DataIndex.Persistence.MigrateDBOnStartUp) - // specific to DataIndex - c.Env = append(c.Env, corev1.EnvVar{Name: quarkusHibernateORMDatabaseGeneration, Value: "update"}, corev1.EnvVar{Name: quarkusFlywayMigrateAtStart, Value: migrateDBOnStart}) + // TODO upcoming work as part of the DB Migrator incorporation should continue where + // assignments like -> migrateDBOnStart := strconv.FormatBool(d.platform.Spec.Services.DataIndex.Persistence.MigrateDBOnStartUp) introduces nil pointer references, + // since Services, and services Persistence are optional references. + // specific to DataIndex + c.Env = append(c.Env, corev1.EnvVar{Name: quarkusHibernateORMDatabaseGeneration, Value: "update"}, corev1.EnvVar{Name: quarkusFlywayMigrateAtStart, Value: "true"}) return c } return containerSpec @@ -391,9 +392,12 @@ func (j JobServiceHandler) ConfigurePersistence(containerSpec *corev1.Container) c.Image = j.GetServiceImageName(constants.PersistenceTypePostgreSQL) p := persistence.RetrievePostgreSQLConfiguration(j.platform.Spec.Services.JobService.Persistence, j.platform.Spec.Persistence, j.GetServiceName()) c.Env = append(c.Env, persistence.ConfigurePostgreSQLEnv(p.PostgreSQL, j.GetServiceName(), j.platform.Namespace)...) + // TODO upcoming work as part of the DB Migrator incorporation should continue where + // assignments like -> migrateDBOnStart := strconv.FormatBool(j.platform.Spec.Services.JobService.Persistence.MigrateDBOnStartUp) introduces nil pointer references, + // since Services, and services Persistence are optional references. + // Specific to Job Service - migrateDBOnStart := strconv.FormatBool(j.platform.Spec.Services.JobService.Persistence.MigrateDBOnStartUp) - c.Env = append(c.Env, corev1.EnvVar{Name: "QUARKUS_FLYWAY_MIGRATE_AT_START", Value: migrateDBOnStart}) + c.Env = append(c.Env, corev1.EnvVar{Name: "QUARKUS_FLYWAY_MIGRATE_AT_START", Value: "true"}) c.Env = append(c.Env, corev1.EnvVar{Name: "KOGITO_JOBS_SERVICE_LOADJOBERRORSTRATEGY", Value: "FAIL_SERVICE"}) return c } diff --git a/version/version.go b/version/version.go index eb0eb353d..349e5d03b 100644 --- a/version/version.go +++ b/version/version.go @@ -31,7 +31,7 @@ const ( // When released, this version should reflect the `major.minor` version in the registry. // For example, docker.io/apache/incubator-kie-sonataflow-operator:10.0 tagVersion = "main" - serviceTagVersion = "weekly-latest" + serviceTagVersion = "main" ) // GetOperatorVersion gets the current binary version of the operator. Do not use it to compose image tags! @@ -45,8 +45,8 @@ func GetTagVersion() string { } // GetServiceTagVersion gets the current tag version for the service images. -// TODO, unify all with tagVersion="main", when "main" tag is produced for DI and JS. -// Right now, Apache community only produces "weekly-latest", and "timestamped tags" for these services. +// TODO, double check Apache community continues producing JS and DI "main" tag images. +// The "weekly-latest" tags are no longer produced. func GetServiceTagVersion() string { return serviceTagVersion } From 001728a15266366690429ed4756e48c8e07bf846 Mon Sep 17 00:00:00 2001 From: Roberto Oliveira <robertoguimaraes8@gmail.com> Date: Fri, 6 Sep 2024 09:25:30 -0400 Subject: [PATCH 4/4] [kie-issues#1465] Align with Quarkus 3.8.6 (#527) --- .../sonataflow-operator-controllers-config_v1_configmap.yaml | 4 ++-- config/manager/controllers_cfg.yaml | 4 ++-- controllers/cfg/controllers_cfg_test.go | 4 ++-- controllers/cfg/testdata/controllers-cfg-test.yaml | 4 ++-- operator.yaml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bundle/manifests/sonataflow-operator-controllers-config_v1_configmap.yaml b/bundle/manifests/sonataflow-operator-controllers-config_v1_configmap.yaml index 4d26bda68..f86776330 100644 --- a/bundle/manifests/sonataflow-operator-controllers-config_v1_configmap.yaml +++ b/bundle/manifests/sonataflow-operator-controllers-config_v1_configmap.yaml @@ -34,10 +34,10 @@ data: postgreSQLPersistenceExtensions: - groupId: io.quarkus artifactId: quarkus-jdbc-postgresql - version: 3.8.4 + version: 3.8.6 - groupId: io.quarkus artifactId: quarkus-agroal - version: 3.8.4 + version: 3.8.6 - groupId: org.kie artifactId: kie-addons-quarkus-persistence-jdbc version: 999-SNAPSHOT diff --git a/config/manager/controllers_cfg.yaml b/config/manager/controllers_cfg.yaml index f9f76a958..6a56a052b 100644 --- a/config/manager/controllers_cfg.yaml +++ b/config/manager/controllers_cfg.yaml @@ -31,10 +31,10 @@ builderConfigMapName: "sonataflow-operator-builder-config" postgreSQLPersistenceExtensions: - groupId: io.quarkus artifactId: quarkus-jdbc-postgresql - version: 3.8.4 + version: 3.8.6 - groupId: io.quarkus artifactId: quarkus-agroal - version: 3.8.4 + version: 3.8.6 - groupId: org.kie artifactId: kie-addons-quarkus-persistence-jdbc version: 999-SNAPSHOT diff --git a/controllers/cfg/controllers_cfg_test.go b/controllers/cfg/controllers_cfg_test.go index 6990f63c3..b334bda82 100644 --- a/controllers/cfg/controllers_cfg_test.go +++ b/controllers/cfg/controllers_cfg_test.go @@ -37,13 +37,13 @@ func TestInitializeControllersCfgAt_ValidFile(t *testing.T) { assert.Equal(t, GAV{ GroupId: "io.quarkus", ArtifactId: "quarkus-jdbc-postgresql", - Version: "3.8.4", + Version: "3.8.6", }, postgresExtensions[0]) assert.Equal(t, GAV{ GroupId: "io.quarkus", ArtifactId: "quarkus-agroal", - Version: "3.8.4", + Version: "3.8.6", }, postgresExtensions[1]) assert.Equal(t, GAV{ diff --git a/controllers/cfg/testdata/controllers-cfg-test.yaml b/controllers/cfg/testdata/controllers-cfg-test.yaml index dc1056b80..9bbbfef81 100644 --- a/controllers/cfg/testdata/controllers-cfg-test.yaml +++ b/controllers/cfg/testdata/controllers-cfg-test.yaml @@ -24,10 +24,10 @@ sonataFlowDevModeImageTag: "local/sonataflow-devmode:1.0.0" postgreSQLPersistenceExtensions: - groupId: io.quarkus artifactId: quarkus-jdbc-postgresql - version: 3.8.4 + version: 3.8.6 - groupId: io.quarkus artifactId: quarkus-agroal - version: 3.8.4 + version: 3.8.6 - groupId: org.kie artifactId: kie-addons-quarkus-persistence-jdbc version: 999-SNAPSHOT \ No newline at end of file diff --git a/operator.yaml b/operator.yaml index 6cb2ae5fc..dc6d67652 100644 --- a/operator.yaml +++ b/operator.yaml @@ -27053,10 +27053,10 @@ data: postgreSQLPersistenceExtensions: - groupId: io.quarkus artifactId: quarkus-jdbc-postgresql - version: 3.8.4 + version: 3.8.6 - groupId: io.quarkus artifactId: quarkus-agroal - version: 3.8.4 + version: 3.8.6 - groupId: org.kie artifactId: kie-addons-quarkus-persistence-jdbc version: 999-SNAPSHOT