ricardozanini commented on code in PR #540:
URL:
https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/540#discussion_r1795560403
##########
api/v1alpha08/sonataflowplatform_types.go:
##########
@@ -63,6 +63,10 @@ type SonataFlowPlatformSpec struct {
// These properties MAY NOT be propagated to a
SonataFlowClusterPlatform since PropertyVarSource can only refer local context
sources.
// +optional
Properties *PropertyPlatformSpec `json:"properties,omitempty"`
+ // MonitoringEnabled indicates whether prometheus service monitors
should be created for metrics scraping
+ // +optional
+ // +default: false
+ MonitoringEnabled bool `json:"monitoringEnabled"`
Review Comment:
Rather, let's change this slightly to support adding more attributes in the
future.
Create a `Monitoring` struct so we can have an `Enabled` attribute. Doing
this way leaves room to add more attributes in the future if needed:
```go
type PlatformMonitoringOptionsSpec struct {
Enabled bool
}
```
##########
internal/controller/profiles/common/object_creators.go:
##########
@@ -272,6 +278,29 @@ func ServiceCreator(workflow *operatorapi.SonataFlow)
(client.Object, error) {
return service, nil
}
+// KnativeMetricsServiceCreator is an objectCreator for a kubernetes service
for exposing prometheus metrics for serverless workflows.
+// It maps the default HTTP port (80) to the target Java application webserver
on port 8080.
+func KnativeMetricsServiceCreator(workflow *operatorapi.SonataFlow)
(client.Object, error) {
+ lbl := workflowproj.GetMergedLabels(workflow)
+ service := &corev1.Service{
+ ObjectMeta: metav1.ObjectMeta{
+ Name: fmt.Sprintf("%s-metrics", workflow.Name), //
default service name is already used by knaitve service
Review Comment:
```suggestion
Name: fmt.Sprintf("%s-metrics", workflow.Name), //
default service name is already used by knative service
```
##########
internal/controller/profiles/common/mutate_visitors.go:
##########
@@ -174,7 +174,13 @@ func ServiceMutateVisitor(workflow
*operatorapi.SonataFlow) MutateVisitor {
if kubeutil.IsObjectNew(object) {
return nil
}
- original, err := ServiceCreator(workflow)
+ var original client.Object
+ var err error
+ if workflow.IsKnativeDeployment() {
Review Comment:
Instead, you should add this conditional to the MutateVisitor creator.
--
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]