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

[9.101.x-prod] SRVLOGIC-390: Adjust cors configuration for the dev profile deploymens, and JS and DI deployments #79

Merged
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
19 changes: 1 addition & 18 deletions controllers/platform/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,6 @@ func (d DataIndexHandler) GetEnvironmentVariables() []corev1.EnvVar {
Name: "KOGITO_DATA_INDEX_QUARKUS_PROFILE",
Value: "http-events-support",
},
{
Name: "QUARKUS_HTTP_CORS",
Value: "true",
},
{
Name: "QUARKUS_HTTP_CORS_ORIGINS",
Value: "/.*/",
},
}
}

Expand Down Expand Up @@ -346,16 +338,7 @@ func (j JobServiceHandler) GetLocalServiceBaseUrl() string {
}

func (j JobServiceHandler) GetEnvironmentVariables() []corev1.EnvVar {
return []corev1.EnvVar{
{
Name: "QUARKUS_HTTP_CORS",
Value: "true",
},
{
Name: "QUARKUS_HTTP_CORS_ORIGINS",
Value: "/.*/",
},
}
return []corev1.EnvVar{}
}

func (j JobServiceHandler) GetPodResourceRequirements() corev1.ResourceRequirements {
Expand Down
1 change: 1 addition & 0 deletions controllers/profiles/common/constants/workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ const (
KnativeHealthEnabled = "org.kie.kogito.addons.knative.eventing.health-enabled"
KnativeInjectedEnvVar = "${K_SINK}"
KnativeEventingBrokerDefault = "default"
QuarkusDevUICorsEnabled = "quarkus.dev-ui.cors.enabled"
)
8 changes: 8 additions & 0 deletions controllers/profiles/common/properties/managed.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"context"
"fmt"

"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/profiles"
"github.com/apache/incubator-kie-kogito-serverless-operator/controllers/profiles/common/persistence"

"github.com/apache/incubator-kie-kogito-serverless-operator/utils"
Expand Down Expand Up @@ -148,6 +149,9 @@ func NewManagedPropertyHandler(workflow *operatorapi.SonataFlow, platform *opera
platform: platform,
}
props := properties.NewProperties()
if profiles.IsDevProfile(workflow) {
setDevProfileProperties(props)
}
props.Set(constants.KogitoUserTasksEventsEnabled, "false")
if platform != nil {
p, err := resolvePlatformWorkflowProperties(platform)
Expand Down Expand Up @@ -183,6 +187,10 @@ func NewManagedPropertyHandler(workflow *operatorapi.SonataFlow, platform *opera
return handler.withKogitoServiceUrl(), nil
}

func setDevProfileProperties(props *properties.Properties) {
props.Set(fmt.Sprintf("%%dev.%s", constants.QuarkusDevUICorsEnabled), "false")
}

// ApplicationManagedProperties immutable default application properties that can be used with any workflow based on Quarkus.
// Alias for NewManagedPropertyHandler(workflow).Build()
func ApplicationManagedProperties(workflow *operatorapi.SonataFlow, platform *operatorapi.SonataFlowPlatform) (string, error) {
Expand Down
Loading
Loading