zncdatadev / trino-operator

Operator for Trino, the distributed SQL query engine for big data
Apache License 2.0
3 stars 5 forks source link

[Feature]: Update `manager.yaml` to resolve multi operator controllers in the same cluster #111

Closed lwpk110 closed 3 months ago

lwpk110 commented 3 months ago

Duplicates

I have searched the existing issues

Summary 💡

The current configuration of the operator controller manager contains labels that cause incorrect pod references when multiple operator controller managers are present. The labels need to be updated to ensure proper identification and management of pods by different operator controllers.

:construction: track operators:

Examples 🌈

The following changes are proposed to the config/manager/manager.yaml file to correct the label issue:

diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml
index 38a0b8e..2ebb1c3 100644
--- a/config/manager/manager.yaml
+++ b/config/manager/manager.yaml
@@ -18,23 +18,25 @@ metadata:
   namespace: system
   labels:
     control-plane: controller-manager
-    app.kubernetes.io/name: deployment
+    app.kubernetes.io/name: hdfs-operator
     app.kubernetes.io/instance: controller-manager
     app.kubernetes.io/component: manager
-    app.kubernetes.io/created-by: hdfs-operator
+    app.kubernetes.io/created-by: operator-lifecycle-manager
     app.kubernetes.io/part-of: hdfs-operator
     app.kubernetes.io/managed-by: kustomize
 spec:
   selector:
     matchLabels:
-      control-plane: controller-manager
+      control-plane: hdfs-operator
+      app.kubernetes.io/name: hdfs-operator
   replicas: 1
   template:
     metadata:
       annotations:
         kubectl.kubernetes.io/default-container: manager
       labels:
-        control-plane: controller-manager
+        control-plane: hdfs-operator
+        app.kubernetes.io/name: hdfs-operator
     spec:
       # TODO(user): Uncomment the following code to configure the nodeAffinity expression

Motivation 🔦

When multiple operator controller managers are deployed in the same cluster, the current labels in the configuration file cause conflicts due to ambiguous references. Specifically, the labels control-plane: controller-manager and app.kubernetes.io/name: deployment are too generic and can lead to pods being incorrectly managed by the wrong operator controller. By updating the labels to more specific values such as control-plane: hdfs-operator and app.kubernetes.io/name: hdfs-operator, we can ensure that pods are correctly referenced and managed by the appropriate operator controller manager, thus preventing conflicts and ensuring the stability of the deployment.