jordigilh commented on code in PR #372:
URL:
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/372#discussion_r1479365288
##########
controllers/platform/services/services.go:
##########
@@ -358,14 +371,26 @@ func (j JobServiceHandler)
MergeContainerSpec(containerSpec *corev1.Container) (
return c, err
}
+// hasPostgreSQLConfigured returns true when either the SonataFlow Platform
PostgreSQL CR's structure or the one in the Job service specification is not nil
+func (j JobServiceHandler) hasPostgreSQLConfigured() bool {
+ return (j.platform.Spec.Services.JobService.Persistence != nil &&
j.platform.Spec.Services.JobService.Persistence.PostgreSQL != nil) ||
+ (j.platform.Spec.Persistence != nil &&
j.platform.Spec.Persistence.PostgreSQL != nil)
+}
+
func (j JobServiceHandler) ConfigurePersistence(containerSpec
*corev1.Container) *corev1.Container {
- if j.platform.Spec.Services.JobService.Persistence != nil &&
j.platform.Spec.Services.JobService.Persistence.PostgreSql != nil {
+ if j.hasPostgreSQLConfigured() {
+ var p *operatorapi.PersistencePostgreSQL
c := containerSpec.DeepCopy()
c.Image =
j.GetServiceImageName(constants.PersistenceTypePostgreSQL)
- c.Env = append(c.Env,
persistence.ConfigurePostgreSqlEnv(j.platform.Spec.Services.JobService.Persistence.PostgreSql,
j.GetServiceName(), j.platform.Namespace)...)
+ if j.platform.Spec.Services.JobService.Persistence != nil &&
j.platform.Spec.Services.JobService.Persistence.PostgreSQL != nil {
Review Comment:
Not sure because adding it to `hasPostgreSQLConfigured()` already validates
it in line 382:
https://github.com/apache/incubator-kie-kogito-serverless-operator/blob/95b390b7469f45c3cfad661dd5d1f845757fcdc1/controllers/platform/services/services.go#L382
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]