namespace: add new CRD

This introduces a new CRD to add the ability
to create rados namespace for a given
ceph block pool. Typically the name of the pool
is the name of the blockpool created by rook.

Closes: #7035

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit b0fc7c9b92)
This commit is contained in:
Madhu Rajanna authored and mergify-bot committed 2022-04-05 13:33:54 +00:00
1 parent 1a5ed03ee5
commit baa2c90568
33 files changed
+1857 -2

No files matched your search

+27
View File
@@ -19,6 +19,7 @@ package controller
import (
"context"
"encoding/json"
"fmt"
"os"
"reflect"
"strings"
@@ -409,6 +410,32 @@ func WatchControllerPredicate() predicate.Funcs {
return true
}
logger.Debugf("no change in CR %q", objNew.Name)
case *cephv1.CephBlockPoolRadosNamespace:
objNew := e.ObjectNew.(*cephv1.CephBlockPoolRadosNamespace)
namespacedName := fmt.Sprintf("%s/%s", objNew.Namespace, objNew.Name)
logger.Debugf("update event on CephBlockPoolRadosNamespace %q CR", namespacedName)
// If the labels "do_not_reconcile" is set on the object, let's not reconcile that request
IsDoNotReconcile := IsDoNotReconcile(objNew.GetLabels())
if IsDoNotReconcile {
logger.Debugf("object %q matched on update but %q label is set, doing nothing", namespacedName, DoNotReconcileLabelName)
return false
}
diff := cmp.Diff(objOld.Spec, objNew.Spec, resourceQtyComparer)
if diff != "" {
logger.Infof("CephBlockPoolRadosNamespace CR has changed for %q. diff=%s", namespacedName, diff)
return true
} else if objectToBeDeleted(objOld, objNew) {
logger.Debugf("CephBlockPoolRadosNamespace CR %q is going be deleted", namespacedName)
return true
} else if objOld.GetGeneration() != objNew.GetGeneration() {
logger.Debugf("skipping CephBlockPoolRadosNamespace resource %q update with unchanged spec", namespacedName)
}
// Handling upgrades
isUpgrade := isUpgrade(objOld.GetLabels(), objNew.GetLabels())
if isUpgrade {
return true
}
}
return false
},