From fbd63fd29fcfeec19b4f8a6db4196c6ed4439b98 Mon Sep 17 00:00:00 2001 From: Nasar Khan Date: Mon, 23 Oct 2023 16:48:32 -0400 Subject: [PATCH] move kafka.go to its own package --- .../v1alpha1/helpers/miq-components/{ => kafka}/kafka.go | 2 +- .../internal/controller/manageiq_controller.go | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) rename manageiq-operator/api/v1alpha1/helpers/miq-components/{ => kafka}/kafka.go (99%) diff --git a/manageiq-operator/api/v1alpha1/helpers/miq-components/kafka.go b/manageiq-operator/api/v1alpha1/helpers/miq-components/kafka/kafka.go similarity index 99% rename from manageiq-operator/api/v1alpha1/helpers/miq-components/kafka.go rename to manageiq-operator/api/v1alpha1/helpers/miq-components/kafka/kafka.go index 88949a3f..fba0e227 100644 --- a/manageiq-operator/api/v1alpha1/helpers/miq-components/kafka.go +++ b/manageiq-operator/api/v1alpha1/helpers/miq-components/kafka/kafka.go @@ -1,4 +1,4 @@ -package miqtools +package miqkafka import ( miqv1alpha1 "github.com/ManageIQ/manageiq-pods/manageiq-operator/api/v1alpha1" diff --git a/manageiq-operator/internal/controller/manageiq_controller.go b/manageiq-operator/internal/controller/manageiq_controller.go index bbb26060..0e6b1e4d 100644 --- a/manageiq-operator/internal/controller/manageiq_controller.go +++ b/manageiq-operator/internal/controller/manageiq_controller.go @@ -35,6 +35,7 @@ import ( miqv1alpha1 "github.com/ManageIQ/manageiq-pods/manageiq-operator/api/v1alpha1" cr_migration "github.com/ManageIQ/manageiq-pods/manageiq-operator/api/v1alpha1/helpers/cr_migration" + miqkafka "github.com/ManageIQ/manageiq-pods/manageiq-operator/api/v1alpha1/helpers/miq-components/kafka" miqtool "github.com/ManageIQ/manageiq-pods/manageiq-operator/api/v1alpha1/helpers/miq-components" apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -524,21 +525,21 @@ func (r *ManageIQReconciler) generatePostgresqlResources(cr *miqv1alpha1.ManageI } func (r *ManageIQReconciler) generateKafkaResources(cr *miqv1alpha1.ManageIQ) error { - kafkaSubscription, mutateFunc := miqtool.KafkaInstall(cr, r.Scheme) + kafkaSubscription, mutateFunc := miqkafka.KafkaInstall(cr, r.Scheme) if result, err := controllerutil.CreateOrUpdate(context.TODO(), r.Client, kafkaSubscription, mutateFunc); err != nil { return err } else if result != controllerutil.OperationResultNone { logger.Info("Kafka Subscription has been reconciled", "result", result) } - kafkaClusterCR, mutateFunc := miqtool.KafkaCluster(cr, r.Scheme) + kafkaClusterCR, mutateFunc := miqkafka.KafkaCluster(cr, r.Scheme) if result, err := controllerutil.CreateOrUpdate(context.TODO(), r.Client, kafkaClusterCR, mutateFunc); err != nil { return err } else if result != controllerutil.OperationResultNone { logger.Info("Kafka Cluster has been reconciled", "result", result) } - kafkaUserCR, mutateFunc := miqtool.KafkaUser(cr, r.Scheme) + kafkaUserCR, mutateFunc := miqkafka.KafkaUser(cr, r.Scheme) if result, err := controllerutil.CreateOrUpdate(context.TODO(), r.Client, kafkaUserCR, mutateFunc); err != nil { return err } else if result != controllerutil.OperationResultNone { @@ -547,7 +548,7 @@ func (r *ManageIQReconciler) generateKafkaResources(cr *miqv1alpha1.ManageIQ) er topics := []string{"messaging-health-check", "manageiq.ems", "manageiq.ems-events", "manageiq.ems-inventory", "manageiq.metrics"} for i := 0; i < len(topics); i++ { - kafkaTopicCR, mutateFunc := miqtool.KafkaTopic(cr, r.Scheme, topics[i]) + kafkaTopicCR, mutateFunc := miqkafka.KafkaTopic(cr, r.Scheme, topics[i]) if result, err := controllerutil.CreateOrUpdate(context.TODO(), r.Client, kafkaTopicCR, mutateFunc); err != nil { return err } else if result != controllerutil.OperationResultNone {