tchughesiv commented on code in PR #345: URL: https://github.com/apache/incubator-kie-kogito-serverless-operator/pull/345#discussion_r1457884919
########## api/v1alpha08/sonataflowclusterplatform_types.go: ########## @@ -0,0 +1,101 @@ +// 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 v1alpha08 + +import ( + "github.com/apache/incubator-kie-kogito-serverless-operator/api" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + // SonataFlowClusterPlatformKind is the Kind name of the SonataFlowClusterPlatform CR + SonataFlowClusterPlatformKind string = "SonataFlowClusterPlatform" + PlatformNotFoundReason string = "PlatformNotFound" +) + +// SonataFlowClusterPlatformSpec defines the desired state of SonataFlowClusterPlatform +type SonataFlowClusterPlatformSpec struct { + // PlatformRef defines which existing SonataFlowPlatform's services should be used cluster-wide. + PlatformRef SonataFlowPlatformRef `json:"platformRef"` +} + +// SonataFlowPlatformRef defines which existing SonataFlowPlatform should be used cluster-wide +type SonataFlowPlatformRef struct { + // Name of the SonataFlowPlatform + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Platform_Name" + Name string `json:"name"` Review Comment: This is definitely an interesting thought, and is technically doable (and clean), but i would still lean more towards keeping this as an explicit reference to a specific platform object. As an administrator i would rather control, with absolute certainty, which platform instance is being used for cluster-wide services. If we were to remove this `Name` field, and, for example, the active `SonataFlowPlatform` were to be deleted from the referenced namespace, a duplicated platform could take its place... which some might think of as a nice feature, but could also be very problematic depending on how differently its spec is configured. This may come down to preference... and you could argue it either way. I lean toward leaving this required field in place. I just envision future production scenarios where this reference to an exact platform instance becomes an asset to admins. They could also be notified in the `SonataFlowClusterPlatform.status` that the referenced platform is gone, so they can take appropriate action. Without the `Name` field, should another platform take over, the admins may not become aware for quite some time. @ricardozanini thoughts? current design - ```yaml apiVersion: sonataflow.org/v1alpha08 kind: SonataFlowClusterPlatform metadata: name: cluster-platform spec: platformRef: name: sonataflow-platform namespace: central-platform-ns ``` @jordigilh is suggesting we move to something like this - ```yaml apiVersion: sonataflow.org/v1alpha08 kind: SonataFlowClusterPlatform metadata: name: cluster-platform spec: platformRef: namespace: central-platform-ns ``` or this - ```yaml apiVersion: sonataflow.org/v1alpha08 kind: SonataFlowClusterPlatform metadata: name: cluster-platform spec: platformNamespace: central-platform-ns ``` -- 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]
