ricardozanini commented on code in PR #367:
URL:
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/367#discussion_r1472951277
##########
controllers/profiles/common/mutate_visitors.go:
##########
@@ -105,32 +105,28 @@ func ServiceMutateVisitor(workflow
*operatorapi.SonataFlow) MutateVisitor {
}
}
-func WorkflowPropertiesMutateVisitor(ctx context.Context, catalog
discovery.ServiceCatalog,
- workflow *operatorapi.SonataFlow, platform
*operatorapi.SonataFlowPlatform) MutateVisitor {
+func UserPropertiesMutateVisitor(ctx context.Context, catalog
discovery.ServiceCatalog,
+ workflow *operatorapi.SonataFlow, platform
*operatorapi.SonataFlowPlatform, userProps *corev1.ConfigMap) MutateVisitor {
return func(object client.Object) controllerutil.MutateFn {
return func() error {
- if kubeutil.IsObjectNew(object) {
- return nil
- }
- cm := object.(*corev1.ConfigMap)
- cm.Labels = workflow.GetLabels()
- _, hasKey :=
cm.Data[workflowproj.ApplicationPropertiesFileName]
+ managedProps := object.(*corev1.ConfigMap)
+ managedProps.Labels = workflow.GetLabels()
+ _, hasKey :=
managedProps.Data[workflowproj.GetManagedPropertiesFileName(workflow)]
if !hasKey {
- cm.Data = make(map[string]string, 1)
- props, err :=
properties.ImmutableApplicationProperties(workflow, platform)
- if err != nil {
- return err
- }
-
cm.Data[workflowproj.ApplicationPropertiesFileName] = props
- return nil
+ managedProps.Data = make(map[string]string, 1)
+
managedProps.Data[workflowproj.GetManagedPropertiesFileName(workflow)] = ""
}
+ userProperties, hasKey :=
userProps.Data[workflowproj.ApplicationPropertiesFileName]
+ if !hasKey {
+ userProperties = ""
+ }
// In the future, if this needs change, instead we can
receive an AppPropertyHandler in this mutator
props, err :=
properties.NewAppPropertyHandler(workflow, platform)
if err != nil {
return err
}
- cm.Data[workflowproj.ApplicationPropertiesFileName] =
props.WithUserProperties(cm.Data[workflowproj.ApplicationPropertiesFileName]).
+
managedProps.Data[workflowproj.GetManagedPropertiesFileName(workflow)] =
props.WithUserProperties(userProperties).
Review Comment:
So the managed properties CM will have also user properties? Did I
understand this correctly? Do we need both properties in the managed CM?
##########
controllers/profiles/common/properties/discovery.go:
##########
@@ -99,6 +99,7 @@ func generateDiscoveryProperties(ctx context.Context, catalog
discovery.ServiceC
mpProperty :=
generateMicroprofileServiceCatalogProperty(plainUri)
klog.V(log.I).Infof("Generating
microprofile service catalog property %s=%s.", mpProperty, address)
result.MustSet(mpProperty, address)
+ result.MustSet(k,
"http://localhost:8080")
Review Comment:
Are we adding `localhost` to discovered endpoints? That way we may lose
track of it and we can't refresh the discovery if the service/endpoint changes.
--
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]