New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
radosnamespace: add new CRD #9733
Conversation
5c628cc
to
44860b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits
f04b3f2
to
d921888
Compare
964bf40
to
6fe3d73
Compare
Removed DNM as my manual testing works fine. [🎩︎]mrajanna@fedora rook $]kuberc gekuberc get cephblockpoolradosnamespace -oyaml
apiVersion: v1
items:
- apiVersion: ceph.rook.io/v1
kind: CephBlockPoolRadosNamespace
metadata:
creationTimestamp: "2022-02-14T07:55:43Z"
finalizers:
- cephblockpoolradosnamespace.ceph.rook.io
generation: 1
name: namespace-a
namespace: rook-ceph
resourceVersion: "116578"
uid: f3a5dd75-4fc2-4cc1-bdd9-71eb08673cc8
spec:
blockpoolName: replicapool
status:
info:
clusterID: 80fc4f4bacc064be641633e6ed25ba7e
phase: Ready
kind: List
metadata:
resourceVersion: ""
selfLink: ""
[🎩︎]mrajanna@fedora rook $]kuberc get cm
NAME DATA AGE
kube-root-ca.crt 1 4d2h
rook-ceph-csi-config 1 4d2h
rook-ceph-csi-mapping-config 1 4d2h
rook-ceph-mon-endpoints 4 4d2h
rook-ceph-operator-config 18 4d2h
rook-ceph-pdbstatemap 2 4d2h
rook-config-override 1 4d2h
[🎩︎]mrajanna@fedora rook $]kuberc get cm rook-ceph-csi-config -oyaml
apiVersion: v1
data:
csi-cluster-config-json: '[{"clusterID":"rook-ceph","monitors":["10.104.250.35:6789"]},{"clusterID":"4df0bb6e1b7ddc0c1ea080cbe043dd1a","monitors":["10.104.250.35:6789"],"cephFS":{"subvolumeGroup":"group-a"}},{"clusterID":"80fc4f4bacc064be641633e6ed25ba7e","monitors":["10.104.250.35:6789"],"radosNamespace":"namespace-a"}]'
kind: ConfigMap
metadata:
creationTimestamp: "2022-02-10T05:13:47Z"
name: rook-ceph-csi-config
namespace: rook-ceph
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: false
controller: true
kind: Deployment
name: rook-ceph-operator
uid: 795ddb4f-33f9-4617-be83-1a3373df725e
resourceVersion: "116577"
uid: 81ce4b71-1383-4320-933e-ad5e9ac036ea
[🎩︎]mrajanna@fedora rook $]kuberc deleterc delete -f deploy/examples/radosnamespace.yaml
cephblockpoolradosnamespace.ceph.rook.io "namespace-a" deleted
[🎩︎]mrajanna@fedora rook $]kuberc delete -fget cm rook-ceph-csi-config -oyaml
apiVersion: v1
data:
csi-cluster-config-json: '[{"clusterID":"rook-ceph","monitors":["10.104.250.35:6789"]},{"clusterID":"4df0bb6e1b7ddc0c1ea080cbe043dd1a","monitors":["10.104.250.35:6789"],"cephFS":{"subvolumeGroup":"group-a"}}]'
kind: ConfigMap
metadata:
creationTimestamp: "2022-02-10T05:13:47Z"
name: rook-ceph-csi-config
namespace: rook-ceph
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: false
controller: true
kind: Deployment
name: rook-ceph-operator
uid: 795ddb4f-33f9-4617-be83-1a3373df725e
resourceVersion: "116777"
uid: 81ce4b71-1383-4320-933e-ad5e9ac036ea
|
c2a01c0
to
e2fc574
Compare
}) | ||
} | ||
|
||
func Test_buildClusterID(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not needed if we move the function to opcontroller
.commitlintrc.json
Outdated
@@ -30,6 +30,7 @@ | |||
"rgw", | |||
"security", | |||
"subvolumegroup", | |||
"radosnamespace", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if we keep it simpler for the prefix?
"radosnamespace", | |
"rados", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as the concept is related to radosnamespace in a pool can this be kept as radosnamespace only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might even just call it namespace
, this will better match the latest proposed crd name. This is just a commit prefix so shorter is fine.
Rook allows creation of Ceph BlockPool | ||
[RadosNamespaces](https://docs.ceph.com/en/latest/man/8/rbd/) through the | ||
custom resource definitions (CRDs). BlockPool Rados Namespace is an abstraction | ||
for a block pool. For more information about BlockPool and namespace refer to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for a block pool. For more information about BlockPool and namespace refer to | |
for a Ceph RADOS namespace. For more information about BlockPool and namespace refer to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an abstraction for a block pool. we can have N
number of rados namespaces in a pool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this?
for a block pool. For more information about BlockPool and namespace refer to | |
inside a block pool. For more information about BlockPool and namespace refer to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good 👍
@@ -0,0 +1,44 @@ | |||
--- | |||
title: RadosNamespace CRD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of its own topic, what if we just added a new section to ceph-pool-crd.md? This really seems like a detail related to the block pools so it doesn't need its own topic. This would be similar to the object multisite page that lists the three related CRDs for multisite. See ceph-object-multisite-crd.md.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the pattern followed when we added subvolumegroup CRD, we have a new document for subvolumegroups https://rook.io/docs/rook/v1.8/ceph-fs-subvolumegroup.html, if we expand the CRD and add more details to radosnamespace CRD or the pool CRD the file content might grow. if required I can change this and add it to pool CRD section,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the subvolumegroup doc could likewise be merged with the filesystem CRD doc. @leseb wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will wait for @leseb response or I can do a follow-up PR for both filesystem and namespace doc.
cephBlockPoolRadosNamespace := &cephv1.CephBlockPoolRadosNamespace{} | ||
if err := client.Get(r.opManagerContext, name, cephBlockPoolRadosNamespace); err != nil { | ||
if kerrors.IsNotFound(err) { | ||
logger.Debug("CephBlockPoolRadosNamespace resource not found. Ignoring since object must be deleted.") | ||
return | ||
} | ||
logger.Warningf("failed to retrieve ceph blockpool rados namespace %q to update status to %q. %v", name, status, err) | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already do this before calling updateStatus
. Can't we just pass that same object here and issue an update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be possible. @leseb any thoughts on this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The get is there to make sure we fetch the latest version of the object before updating it. I have a PR I'll rebase on top of this, to use a better pattern: #9686
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it problematic to update status on latest version even before operator reconciles it? retryOnConflict
makes it easier to try updating the same object version that the operator reconciled.
d119e82
to
90471ed
Compare
@@ -0,0 +1,44 @@ | |||
--- | |||
title: RadosNamespace CRD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
[RadosNamespaces](https://docs.ceph.com/en/latest/man/8/rbd/) through the | ||
custom resource definitions (CRDs). BlockPool Rados Namespace is an abstraction | ||
inside a block pool. For more information about BlockPool and namespace refer to | ||
the [Ceph docs](https://docs.ceph.com/en/latest/man/8/rbd/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a sentence that gives an idea why a namespace would be useful or when it should be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure will do it.
19918a4
to
e286058
Compare
if: failure() && github.event_name == 'pull_request' | ||
uses: mxschmitt/action-tmate@v3 | ||
timeout-minutes: 60 | ||
- name: checkout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you adjust your editor's auto-indentation so it doesn't change all these blocks? It's difficult to see the diff, and we don't want it changing all the time between commits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My appologies, I didn't check the latest push, Editor messed it up. fixing it.
} | ||
// Success! Let's update the status | ||
if cephCluster.Spec.External.Enable { | ||
r.updateStatus(r.client, request.NamespacedName, cephv1.ConditionConnected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have a "connected" status for the rados namespace? The cluster CR tracks if there is a connection, but this CR only creates/deletes rados namespaces, right? Seems like it's either created or not, rather than connected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And according to the check above, creating a rados namespace from an external cluster isn't supported. Shouldn't that check just return an error and fail the reconcile? Or what is the purpose in reconciling the rados namespace for an external cluster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have a "connected" status for the rados namespace? The cluster CR tracks if there is a connection, but this CR only creates/deletes rados namespaces, right? Seems like it's either created or not, rather than connected.
This is the same as the https://github.com/rook/rook/blob/master/pkg/operator/ceph/file/subvolumegroup/controller.go#L265-L272 nothing new in this one. i have seen in other places also cephv1.ConditionType
used for status.Phase, just reusing the same here also.
Or what is the purpose in reconciling the rados namespace for an external cluster?
This is requested to generate the clusterID which is required for the storageclass creation, the whole idea of supporting external cluster got added in #9694
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leseb What is the need to support subvolume groups or rados namespaces as "connected" status in external mode? It seems like nothing is reconciled in external mode, not sure what external mode is doing here. "connected" just seems like a status for the cluster CR, not other CRs like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The external condition is a bit of a hack/noop to not perform some commands and expect the producer cluster (external) to perform the operation instead.
I tend to agree that we could have avoided the "Connected" state for subvolumegrp CRD and perhaps this one but we need to decide if we keep it for this new controller or change both :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear, the controllers don't need to do anything for external clusters for the rados namespaces and subvolume groups, right? In that case I'd vote that we don't support them in external mode and just error out if they are created in an external cluster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No they do need to do something on external mode, which is updating the ceph-csi configmap to input the subvolumegroup/namespace crd name cpeh-csi should use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I see now where the configmap is updated. I think what would help is just a little code refactor like suggested above so it's more obvious.
return reconcile.Result{}, nil | ||
} | ||
|
||
if !cephCluster.Spec.External.Enable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rados namespace behaves so differently for external clusters, how about refactoring this into two methods to handle external or local? The multiple checks for external clusters is confusing to me. Or just error for external clusters as suggested below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Followed the same code pattern used for https://github.com/rook/rook/blob/master/pkg/operator/ceph/file/subvolumegroup/controller.go#L211-L271 if required to separate it out i can do it. please let me know what do you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the refactor would really help understand the code flow, something like:
if external cluster {
// call a helper method to update the configmap
return
}
// for local clusters create the namespace
// call helper method to update the configmap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. added help function and did refactoring.
ea69c49
to
af789ed
Compare
This pull request has merge conflicts that must be resolved before it can be merged. @Madhu-1 please rebase it. https://rook.io/docs/rook/latest/development-flow.html#updating-your-fork |
@Madhu-1 just a simple merge conflict to resolve... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good after the merge conflict resolves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after merge conflict resolved.
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: rook#7035 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
@travisn Resolved merge conflicts. PTAL |
radosnamespace: add new CRD (backport #9733)
THe radosnamespace CRD is already added by rook#9733, Checking the external script with the namespace created by the CRD Signed-off-by: parth-gr <paarora@redhat.com>
THe radosnamespace CRD is already added by rook#9733, Checking the external script with the namespace created by the CRD Signed-off-by: parth-gr <paarora@redhat.com>
THe radosnamespace CRD is already added by rook#9733, Checking the external script with the namespace created by the CRD Signed-off-by: parth-gr <paarora@redhat.com>
THe radosnamespace CRD is already added by rook#9733, Checking the external script with the namespace created by the CRD Signed-off-by: parth-gr <paarora@redhat.com>
THe radosnamespace CRD is already added by rook#9733, Checking the external script with the namespace created by the CRD Signed-off-by: parth-gr <paarora@redhat.com>
Description of your changes:
This introduces a new CRD to add the ability to create a rados namespace for a given ceph block pool. Typically the name of the pool is the name of the block pool created by the rook.
Signed-off-by: Madhu Rajanna madhupr007@gmail.com
Which issue is resolved by this Pull Request:
Resolves #7035
Checklist:
make codegen
) has been run to update object specifications, if necessary.