jianrongzhang89 commented on code in PR #540: URL: https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/540#discussion_r1805033230
########## internal/controller/monitoring/monitoring.go: ########## @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package monitoring + +import ( + operatorapi "github.com/apache/incubator-kie-kogito-serverless-operator/api/v1alpha08" + "github.com/apache/incubator-kie-kogito-serverless-operator/utils" + "k8s.io/client-go/rest" +) + +const ( + prometheusGroup = "monitoring.coreos.com" +) + +func GetPrometheusAvailability(cfg *rest.Config) (bool, error) { Review Comment: @wmedvede my understanding: the Prometheus operator can only be installed per namespace and this means that the Prometheus server instance must be located in that namespace. It is the Prometheus CR itself determines which namespaces Prometheus can scrape metrics from and it can be configured to support all namespaces in the cluster, or only for a set of the namespaces -- this is up to the admin who installs Prometheus CR. It is possible that there may have multiple Prometheus server instances deployed in one cluster under different namespaces and with different configuration. Therefore, it will be tricky for the SonataFlow operator to determine whether a namespace is enabled for Prometheus (and for which instances of Prometheus). Here we took a simple approach, and GetPrometheusAvailability() simply checks whether the Prometheus CRD is deployed in the cluster, and it does not check which Prometheus instances are used and which namespaces are applicable. Making GetPrometheusAvailability() namespace sensitive will bring a lot more complexity to the SonataFlow Operator (eg, adding information about Prometheus instance in to the platform spec). My suggestion is keep it simple for this release, and we can see whether such enhancement is needed in the future. @ricardozanini @wmedvede please let me know what you think. -- 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]
