wmedvede commented on code in PR #287: URL: https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/287#discussion_r1381583161
########## controllers/platform/services.go: ########## @@ -0,0 +1,368 @@ +// Copyright 2023 Red Hat, Inc. and/or its affiliates +// +// Licensed 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 platform + +import ( + "context" + "strconv" + + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/klog/v2" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + + operatorapi "github.com/apache/incubator-kie-kogito-serverless-operator/api/v1alpha08" + "github.com/apache/incubator-kie-kogito-serverless-operator/container-builder/client" + "github.com/apache/incubator-kie-kogito-serverless-operator/controllers/profiles/common" + "github.com/apache/incubator-kie-kogito-serverless-operator/log" + "github.com/apache/incubator-kie-kogito-serverless-operator/utils" + kubeutil "github.com/apache/incubator-kie-kogito-serverless-operator/utils/kubernetes" + "github.com/apache/incubator-kie-kogito-serverless-operator/workflowproj" + "github.com/imdario/mergo" +) + +// NewServiceAction returns an action that deploys the services. +func NewServiceAction() Action { + return &serviceAction{} +} + +type serviceAction struct { + baseAction +} + +func (action *serviceAction) Name() string { + return "service" +} + +func (action *serviceAction) CanHandle(platform *operatorapi.SonataFlowPlatform) bool { + return platform.Status.IsReady() +} + +func (action *serviceAction) Handle(ctx context.Context, platform *operatorapi.SonataFlowPlatform) (*operatorapi.SonataFlowPlatform, error) { + // Refresh applied configuration + if err := ConfigureDefaults(ctx, action.client, platform, false); err != nil { + return nil, err + } + + if err := createDataIndexComponents(ctx, action.client, platform); err != nil { + return nil, err + } + + return platform, nil +} + +func createDataIndexComponents(ctx context.Context, client client.Client, platform *operatorapi.SonataFlowPlatform) error { + if platform.Spec.Services.DataIndex != nil { + if err := createDataIndexConfigMap(ctx, client, platform); err != nil { Review Comment: silly question, so a ConfigMap will be created for the data-index right? so we have that, some properties like: quarkus.smallrye-health.check.\"io.quarkus.kafka.client.health.KafkaHealthCheck\".enabled=false are set in the config map, and other as env variables, e.g. QUARKUS_HTTP_PORT = 8080 np, the question is, as a user, if I need to tune my data-index installation, IDK, to configure the log level, or any other param. Can I use this ConfigMap that will be created, or instead I should add proper env varibles in my ServicesPodTemplateSpec -> Container *ContainerSpec ? -- 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]
