Merge pull request #12075 from sp98/obc-watcher

core: Skip OBC controllers based on env variable
This commit is contained in:
Travis Nielsen
2023-04-24 10:28:12 -06:00
committed by GitHub
3 changed files with 16 additions and 0 deletions
@@ -18,6 +18,7 @@ package bucket
import (
"context"
"os"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -31,6 +32,7 @@ import (
"github.com/rook/rook/pkg/clusterd"
cephclient "github.com/rook/rook/pkg/daemon/ceph/client"
opcontroller "github.com/rook/rook/pkg/operator/ceph/controller"
"github.com/rook/rook/pkg/operator/ceph/object"
v1 "k8s.io/api/core/v1"
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -53,6 +55,10 @@ type ReconcileBucket struct {
// Add creates a new Ceph CSI Controller and adds it to the Manager. The Manager will set fields on the Controller
// and Start it when the Manager is Started.
func Add(mgr manager.Manager, context *clusterd.Context, opManagerContext context.Context, opConfig opcontroller.OperatorConfig) error {
if os.Getenv(object.DisableOBCEnvVar) == "true" {
logger.Info("skip running Object Bucket controller")
return nil
}
return add(opManagerContext, mgr, newReconciler(mgr, context, opManagerContext, opConfig))
}
+3
View File
@@ -53,6 +53,9 @@ import (
const (
controllerName = "ceph-object-controller"
// DisableOBCEnvVar environment variable, if set to "true", will skip watching Object Bucket and Notification resources.
// This variable can be added to container spec of the `rook-ceph-operator` deployment.
DisableOBCEnvVar = "ROOK_DISABLE_OBJECT_BUCKET_CLAIM"
)
var waitForRequeueIfObjectStoreNotReady = reconcile.Result{Requeue: true, RequeueAfter: 10 * time.Second}
@@ -19,6 +19,7 @@ package notification
import (
"context"
"os"
"time"
"github.com/coreos/pkg/capnslog"
@@ -28,6 +29,7 @@ import (
"github.com/rook/rook/pkg/clusterd"
cephclient "github.com/rook/rook/pkg/daemon/ceph/client"
opcontroller "github.com/rook/rook/pkg/operator/ceph/controller"
"github.com/rook/rook/pkg/operator/ceph/object"
"github.com/rook/rook/pkg/operator/ceph/object/bucket"
"github.com/rook/rook/pkg/operator/ceph/object/topic"
"github.com/rook/rook/pkg/operator/ceph/reporting"
@@ -67,6 +69,11 @@ type ReconcileNotifications struct {
// Add creates a new CephBucketNotification controller and a new ObjectBucketClaim Controller and adds it to the Manager.
// The Manager will set fields on the Controller and start it when the Manager is started.
func Add(mgr manager.Manager, context *clusterd.Context, opManagerContext context.Context, opConfig opcontroller.OperatorConfig) error {
if os.Getenv(object.DisableOBCEnvVar) == "true" {
logger.Info("skip running Object Bucket Notification controller")
return nil
}
if err := addNotificationReconciler(mgr, &ReconcileNotifications{
client: mgr.GetClient(),
context: context,