Skip to content
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

Sync main branch with Apache main branch #69

Merged
merged 4 commits into from
Sep 6, 2024
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
2 changes: 2 additions & 0 deletions api/v1alpha08/sonataflow_persistence_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions bundle/manifests/sonataflow.org_sonataflowplatforms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,6 @@ spec:
required:
- secretRef
type: object
required:
- migrateDBOnStartUp
type: object
podTemplate:
description: PodTemplate describes the deployment details
Expand Down Expand Up @@ -8505,8 +8503,6 @@ spec:
required:
- secretRef
type: object
required:
- migrateDBOnStartUp
type: object
podTemplate:
description: PodTemplate describes the deployment details
Expand Down
2 changes: 0 additions & 2 deletions bundle/manifests/sonataflow.org_sonataflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2163,8 +2163,6 @@ spec:
required:
- secretRef
type: object
required:
- migrateDBOnStartUp
type: object
podTemplate:
description: PodTemplate describes the deployment details of this
Expand Down
4 changes: 0 additions & 4 deletions config/crd/bases/sonataflow.org_sonataflowplatforms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,6 @@ spec:
required:
- secretRef
type: object
required:
- migrateDBOnStartUp
type: object
podTemplate:
description: PodTemplate describes the deployment details
Expand Down Expand Up @@ -8506,8 +8504,6 @@ spec:
required:
- secretRef
type: object
required:
- migrateDBOnStartUp
type: object
podTemplate:
description: PodTemplate describes the deployment details
Expand Down
2 changes: 0 additions & 2 deletions config/crd/bases/sonataflow.org_sonataflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2164,8 +2164,6 @@ spec:
required:
- secretRef
type: object
required:
- migrateDBOnStartUp
type: object
podTemplate:
description: PodTemplate describes the deployment details of this
Expand Down
4 changes: 2 additions & 2 deletions config/manager/controllers_cfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions controllers/cfg/controllers_cfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions controllers/cfg/testdata/controllers-cfg-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions controllers/platform/services/properties_services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down
18 changes: 12 additions & 6 deletions controllers/platform/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -410,6 +414,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())
Expand Down
27 changes: 15 additions & 12 deletions controllers/profiles/common/constants/platform_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
8 changes: 2 additions & 6 deletions controllers/sonataflowplatform_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
10 changes: 2 additions & 8 deletions operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1120,8 +1120,6 @@ spec:
required:
- secretRef
type: object
required:
- migrateDBOnStartUp
type: object
podTemplate:
description: PodTemplate describes the deployment details
Expand Down Expand Up @@ -8997,8 +8995,6 @@ spec:
required:
- secretRef
type: object
required:
- migrateDBOnStartUp
type: object
podTemplate:
description: PodTemplate describes the deployment details
Expand Down Expand Up @@ -19070,8 +19066,6 @@ spec:
required:
- secretRef
type: object
required:
- migrateDBOnStartUp
type: object
podTemplate:
description: PodTemplate describes the deployment details of this
Expand Down Expand Up @@ -27059,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ metadata:
sonataflow.org/version: 0.0.1
spec:
persistence:
migrateDBOnStartUp: false
postgresql:
secretRef:
name: postgres-secrets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ metadata:
sonataflow.org/version: 0.0.1
spec:
persistence:
migrateDBOnStartUp: false
postgresql:
secretRef:
name: postgres-secrets
Expand Down
6 changes: 3 additions & 3 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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
}
Loading