-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
docs: document how to have StorageClass consume Rados Namespace #14173
Conversation
@@ -0,0 +1,8 @@ | |||
apiVersion: ceph.rook.io/v1 |
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 only "test.yaml" files needed are basically for pools to use replica 1, or when some other component needs to define a single daemon. Since there is nothing related to replica 1 in this file, let's revert this file.
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
@@ -0,0 +1,66 @@ | |||
apiVersion: ceph.rook.io/v1 |
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.
Let's rename this file without the "test" suffix. I think no need to commit a test version of this file. It won't be common to use during development. Normally the "test" file are only used during development.
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
spec: | ||
# The name of the CephBlockPool CR where the namespace is created. | ||
blockPoolName: replicapool | ||
|
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.
nit: remove blank line
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
Documentation/CRDs/Block-Storage/ceph-block-pool-rados-namespace-crd.md
Outdated
Show resolved
Hide resolved
Documentation/CRDs/Block-Storage/ceph-block-pool-rados-namespace-crd.md
Outdated
Show resolved
Hide resolved
Documentation/CRDs/Block-Storage/ceph-block-pool-rados-namespace-crd.md
Outdated
Show resolved
Hide resolved
Documentation/CRDs/Block-Storage/ceph-block-pool-rados-namespace-crd.md
Outdated
Show resolved
Hide resolved
919c271
to
10890c7
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.
Just a few more suggestions on whitespace and comments
Documentation/CRDs/Block-Storage/ceph-block-pool-rados-namespace-crd.md
Outdated
Show resolved
Hide resolved
failureDomain: osd | ||
replicated: | ||
size: 3 | ||
# Disallow setting pool with replica 1, this could lead to data loss without recovery. |
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.
This comment is not accurate since we changed back to a replica 3 pool. For simplicity of the example, how about just remove the comments from the CephBlockPool? They can see comments in other pool examples if needed.
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.
# normally, clusterID is the kubernetes namespace where the rook cluster is running | ||
# But putting the ClusterID of a CephBlockPoolRadosNamespace CR here instead | ||
# will let the storageClass consume that Rados namespace. | ||
clusterID: 80fc4f4bacc064be641633e6ed25ba7e |
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 this be always same for this example setup, if not we should not hardcode 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.
best I know yes, it will be the same (being a hash of the blockpool name etc). this is why I put it into the example file.
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.
Okay that's great, seems constant
clusterID := fmt.Sprintf("%s-%s-block-%s", cephBlockPoolRadosNamespace.Namespace, cephBlockPoolRadosNamespace.Spec.BlockPoolName, getRadosNamespaceName(cephBlockPoolRadosNamespace)) |
I'm not sure why we decided to have a hash, instead we can always use the full name. Or request a new field from csi for enrolling radosnamesapce
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.
@parth-gr the line you are copying is missing the surrounding context.
rook/pkg/operator/ceph/pool/radosnamespace/controller.go
Lines 361 to 364 in 517b1bf
func buildClusterID(cephBlockPoolRadosNamespace *cephv1.CephBlockPoolRadosNamespace) string { | |
clusterID := fmt.Sprintf("%s-%s-block-%s", cephBlockPoolRadosNamespace.Namespace, cephBlockPoolRadosNamespace.Spec.BlockPoolName, getRadosNamespaceName(cephBlockPoolRadosNamespace)) | |
return k8sutil.Hash(clusterID) | |
} |
Notice that the function here (buildClusterID()
) returns Hash(clusterID)
. Thus, the ID is the hashed form of the name.
I believe Hash()
was used because it ensures that the ID doesn't exceed the allowed number of characters for naming.
Extract the clusterID from the CephBlockPoolRadosNamespace CR: | ||
|
||
```shell | ||
$ kubectl -n rook-ceph get cephblockpoolradosnamespace -o yaml |
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 we provide the direct cmd
$KUBECTL -n "$NAMESPACE" get cephblockpoolradosnamespace.ceph.rook.io/"$RADOS_NAMESPACE" -o jsonpath='{.status.info.clusterID}'
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.
@parth-gr wrote:
can we provide the direct cmd
$KUBECTL -n "$NAMESPACE" get cephblockpoolradosnamespace.ceph.rook.io/"$RADOS_NAMESPACE" -o jsonpath='{.status.info.clusterID}'
good idea! I will play with it a bit but it is currently unclear to me how/where the variables $KUBECTL
, $NAMESPACE
, etc are expected to be set.
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.
you can directly use kubectl
and namespace as rook-ceph
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.
you can directly use
kubectl
and namespace asrook-ceph
Makes sense, thanks! I will try an possibly update it this way.
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.
@parth-gr , I tried this:
kubectl -n rook-ceph get cephblockpoolradosnamespaces.ceph.rook.io/namespace-a -o jsonpath='{status.info.ClusterID}'
but only got garbage as output.
I also tried to find a command to use jsonpath
to directly get the namespace name (in this case namespace-a
, but no success yet.
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.
lets catch up and check, if it doesn't works
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.
@parth-gr more details about the error I am facing:
$ kubectl -n rook-ceph get cephblockpoolradosnamespaces.ceph.rook.io/namespace-a -o jsonpath='{status.info.ClusterID}'
error: error executing jsonpath "{status.info.ClusterID}": Error executing template: unrecognized identifier status. Printing more information for debugging the template:
template was:
{status.info.ClusterID}
object given to jsonpath engine was:
map[string]interface {}{"apiVersion":"ceph.rook.io/v1", "kind":"CephBlockPoolRadosNamespace", "metadata":map[string]interface {}{"creationTimestamp":"2024-05-07T14:27:11Z", "finalizers":[]interface {}{"cephblockpoolradosnamespace.ceph.rook.io"}, "generation":1, "managedFields":[]interface {}{map[string]interface {}{"apiVersion":"ceph.rook.io/v1", "fieldsType":"FieldsV1", "fieldsV1":map[string]interface {}{"f:spec":map[string]interface {}{".":map[string]interface {}{}, "f:blockPoolName":map[string]interface {}{}}}, "manager":"kubectl-create", "operation":"Update", "time":"2024-05-07T14:27:11Z"}, map[string]interface {}{"apiVersion":"ceph.rook.io/v1", "fieldsType":"FieldsV1", "fieldsV1":map[string]interface {}{"f:metadata":map[string]interface {}{"f:finalizers":map[string]interface {}{".":map[string]interface {}{}, "v:\"cephblockpoolradosnamespace.ceph.rook.io\"":map[string]interface {}{}}}}, "manager":"rook", "operation":"Update", "time":"2024-05-07T14:27:11Z"}, map[string]interface {}{"apiVersion":"ceph.rook.io/v1", "fieldsType":"FieldsV1", "fieldsV1":map[string]interface {}{"f:status":map[string]interface {}{".":map[string]interface {}{}, "f:info":map[string]interface {}{".":map[string]interface {}{}, "f:clusterID":map[string]interface {}{}}, "f:phase":map[string]interface {}{}}}, "manager":"rook", "operation":"Update", "subresource":"status", "time":"2024-05-08T12:34:52Z"}}, "name":"namespace-a", "namespace":"rook-ceph", "resourceVersion":"28365", "uid":"fcae1125-b349-4260-b9da-d46f795128ce"}, "spec":map[string]interface {}{"blockPoolName":"replicapool"}, "status":map[string]interface {}{"info":map[string]interface {}{"clusterID":"80fc4f4bacc064be641633e6ed25ba7e"}, "phase":"Failure"}}
$
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 should be a small c
not the capital one for clusterID
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.
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.
@parth-gr , I tried this:
kubectl -n rook-ceph get cephblockpoolradosnamespaces.ceph.rook.io/namespace-a -o jsonpath='{status.info.ClusterID}'
but only got garbage as output.
I also tried to find a command to use
jsonpath
to directly get the namespace name (in this casenamespace-a
, but no success yet.
@parth-gr now I managed to produce a working command and updated the doc accordingly :)
Documentation/CRDs/Block-Storage/ceph-block-pool-rados-namespace-crd.md
Outdated
Show resolved
Hide resolved
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: rook-ceph-block |
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 we name this something else as we already have this name for RBD storageclass created for blockpool
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.
@Madhu-1 wrote:
can we name this something else as we already have this name for RBD storageclass created for blockpool
sure. what do you suggest? How about rook-ceph-block-rados-ns
?
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 we name this something else as we already have this name for RBD storageclass created for blockpool
sure. what do you suggest? How about
rook-ceph-block-rados-ns
?
@Madhu-1 fwiw, I used this name in the doc now.
Extract the clusterID from the CephBlockPoolRadosNamespace CR: | ||
|
||
```shell | ||
$ kubectl -n rook-ceph get cephblockpoolradosnamespace -o yaml |
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 should be a small c
not the capital one for clusterID
@@ -0,0 +1,64 @@ | |||
apiVersion: ceph.rook.io/v1 |
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 only concern of this new storageclass is that we need to take care of updating this as well if we add/remove any new fields for rbd specific option for rbd storageclass , this is kind of a maintenance burden we will get :(
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 share this concern. Though I'm on the fence about whether to keep the example. At the end of the day, though, I think the only truly unique thing here is rados namespace and storageclass's clusterID
. I think the documentation is sufficiently clear enough that users shouldn't require an example manifest to understand, and maybe it would be best to remove this so it doesn't grow stale over time.
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.
@BlaineEXE wrote:
I share this concern. Though I'm on the fence about whether to keep the example. At the end of the day, though, I think the only truly unique thing here is rados namespace and storageclass's
clusterID
. I think the documentation is sufficiently clear enough that users shouldn't require an example manifest to understand, and maybe it would be best to remove this so it doesn't grow stale over time.
Agreed. I can remove the example manifest from the PR.
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.
@BlaineEXE example manifest is now removed.
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 do think the full example manifests are worth the maintenance burden for common scenarios. But I'm fine skipping this example for now since it's less common.
31d26d8
to
08bc131
Compare
``` | ||
|
||
In this example, replace `namespace-a` by the actual name of the radosnamespace | ||
created before |
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.
missing part of the sentence?
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.
There is no period at the end of what I presume to be a full sentence. I think that is the source of the confusion.
117cc48
to
614c7ea
Compare
|
||
Extract the clusterID from the CephBlockPoolRadosNamespace CR: | ||
|
||
```shell |
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.
shell
is used for shell scripts. console
is for console/terminal commands and output.
Also, there is no need to indent this one space from the left.
```shell | |
```console |
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.
@BlaineEXE wrote :
shell
is used for shell scripts.console
is for console/terminal commands and output.Also, there is no need to indent this one space from the left.
done (manually.
f04620a
to
d8accad
Compare
Now set the `clusterID` retrieved from the previous step into the `clusterID` of the storage class. | ||
Example: |
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.
Is it your intent to have "Example:" on a new line? If so, by markdown syntax rules, there needs to be an empty line between "Now set..." and "Example:". Otherwise, "Example:" will appear at the end of the previous sentence when rendered.
I usually use VSCodes "markdown preview" feature when writing docs so I can be sure the basic rendering shows what I intend.
d8accad
to
e984345
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.
LGTM after commits are squashed!
closes: rook#13214 Co-authored-by: Travis Nielsen <tnielsen@redhat.com> Co-authored-by: Blaine Gardner <b.blaine.gardner@gmail.com> Signed-off-by: Michael Adam <obnox@samba.org>
cd9cce5
to
8e7ac95
Compare
@travisn wrote:
done. squashed now. |
docs: document how to have StorageClass consume Rados Namespace (backport #14173)
description
This change expands the documentation to describe how to create a storageclass that consumes a
CephBlockPoolRadodNamespace
.Issue resolved by this Pull Request:
Resolves #13214
Checklist: