ceph: convert the CephCluster controller to the controller-runtime
This is the final conversion to controller-runtime conversion. This time the CephCluster CRD has been converted to use the controller-runtime library. The controller incorporates all the previous watchers too, so the Node and hot-plug configmap are been watched too. Only the operator setting configmap is not being watcher since it's not related to the CephCluster CRD. Not only the patch converts to controller-runtime but also tries to re-organize the tree of the repo to actually make the code more readable and have better functions/methods/tests separations. Closes: https://github.com/rook/rook/issues/4939 Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
1 parent
008670bc79
commit
f27fd207ce
55 files changed
+2635
-1848
No files matched your search
@@ -22,9 +22,10 @@ import (
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
"github.com/rook/rook/pkg/daemon/ceph/agent/flexvolume/attachment"
|
||||
operator "github.com/rook/rook/pkg/operator/ceph"
|
||||
cluster "github.com/rook/rook/pkg/operator/ceph/cluster"
|
||||
"github.com/rook/rook/pkg/operator/ceph/cluster/mon"
|
||||
"github.com/rook/rook/pkg/operator/ceph/csi"
|
||||
"github.com/rook/rook/pkg/operator/ceph/disruption"
|
||||
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
"github.com/rook/rook/pkg/util/flags"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -55,7 +56,7 @@ func init() {
|
||||
operatorCmd.Flags().StringVar(&csi.CephFSProvisionerSTSTemplatePath, "csi-cephfs-provisioner-sts-template-path", csi.DefaultCephFSProvisionerSTSTemplatePath, "path to ceph-csi cephfs provisioner statefulset template")
|
||||
operatorCmd.Flags().StringVar(&csi.CephFSProvisionerDepTemplatePath, "csi-cephfs-provisioner-dep-template-path", csi.DefaultCephFSProvisionerDepTemplatePath, "path to ceph-csi cephfs provisioner deployment template")
|
||||
|
||||
operatorCmd.Flags().BoolVar(&disruption.EnableMachineDisruptionBudget, "enable-machine-disruption-budget", false, "enable fencing controllers")
|
||||
operatorCmd.Flags().BoolVar(&cluster.EnableMachineDisruptionBudget, "enable-machine-disruption-budget", false, "enable fencing controllers")
|
||||
|
||||
flags.SetFlagsFromEnv(operatorCmd.Flags(), rook.RookEnvVarPrefix)
|
||||
flags.SetLoggingFlags(operatorCmd.Flags())
|
||||
@@ -68,7 +69,7 @@ func startOperator(cmd *cobra.Command, args []string) error {
|
||||
|
||||
rook.LogStartupInfo(operatorCmd.Flags())
|
||||
|
||||
logger.Infof("starting operator")
|
||||
logger.Info("starting Rook-Ceph operator")
|
||||
context := createContext()
|
||||
context.NetworkInfo = clusterd.NetworkInfo{}
|
||||
context.ConfigDir = k8sutil.DataDir
|
||||
@@ -82,7 +83,7 @@ func startOperator(cmd *cobra.Command, args []string) error {
|
||||
op := operator.New(context, volumeAttachment, rookImage, serviceAccountName)
|
||||
err = op.Run()
|
||||
if err != nil {
|
||||
rook.TerminateFatal(errors.Wrapf(err, "failed to run operator\n"))
|
||||
rook.TerminateFatal(errors.Wrap(err, "failed to run operator\n"))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -26,10 +26,10 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rook/rook/cmd/rook/rook"
|
||||
osddaemon "github.com/rook/rook/pkg/daemon/ceph/osd"
|
||||
"github.com/rook/rook/pkg/operator/ceph/cluster"
|
||||
"github.com/rook/rook/pkg/operator/ceph/cluster/mon"
|
||||
oposd "github.com/rook/rook/pkg/operator/ceph/cluster/osd"
|
||||
osdcfg "github.com/rook/rook/pkg/operator/ceph/cluster/osd/config"
|
||||
opcontroller "github.com/rook/rook/pkg/operator/ceph/controller"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
"github.com/rook/rook/pkg/util/flags"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -209,7 +209,7 @@ func prepareOSD(cmd *cobra.Command, args []string) error {
|
||||
logger.Infof("crush location of osd: %s", crushLocation)
|
||||
|
||||
forceFormat := false
|
||||
ownerRef := cluster.ClusterOwnerRef(clusterInfo.Name, ownerRefID)
|
||||
ownerRef := opcontroller.ClusterOwnerRef(clusterInfo.Name, ownerRefID)
|
||||
kv := k8sutil.NewConfigMapKVStore(clusterInfo.Name, context.Clientset, ownerRef)
|
||||
agent := osddaemon.NewAgent(context, dataDevices, cfg.metadataDevice, forceFormat,
|
||||
cfg.storeConfig, &clusterInfo, cfg.nodeName, kv, cfg.pvcBacked)
|
||||
|
||||
Reference in new issue
Block a user