Composing resource specifications for declarative method
Learn how to compose a resource specification file for creating SMB clusters and shares by using the declarative method.
In addition to the familiar imperative way to create SMB clusters and shares, the SMB manager module supports configuration by using declarative resource specifications. You can write the resource specifications in either JSON or YAML.
This method uses the command ceph smb apply to process resource
descriptions specified in YAML or JSON, similar to service specifications for Ceph
orchestration with cephadm, by using SMB specific resource types.
To create an SMB cluster and SMB share:
- Create a resource file. This file can be either a YAML or JSON file.
-
Apply the resource description specified in the resource file.
A resource specification is made up of one or more Ceph SMB resource descriptions that are
written in either JSON or YAML formats. You can specify more than one resource if the resources are
contained within one of the following:
- JSON or YAML list.
- JSON or YAML object containing the key resources with a corresponding list value that contains the resources.
- YAML based simple list
- resource_type: ceph.smb.cluster cluster_id: rhumba # ... other fields skipped for brevity ... - resource_type: ceph.smb.cluster cluster_id: salsa # ... other fields skipped for brevity ... - resource_type: ceph.smb.share cluster_id: salsa share_id: foo - JSON based simple list
[ {"resource_type": "ceph.smb.cluster", "cluster_id": "rhumba", "...": "... other fields skipped for brevity ..." }, {"resource_type": "ceph.smb.cluster", "cluster_id": "salsa", "...": "... other fields skipped for brevity ..." }, {"resource_type": "ceph.smb.share", "cluster_id": "salsa", "share_id": "foo", "...": "... other fields skipped for brevity ..." } ] - YAML based resource list:
resources: - resource_type: ceph.smb.cluster cluster_id: rhumba # ... other fields skipped for brevity ... - resource_type: ceph.smb.cluster cluster_id: salsa # ... other fields skipped for brevity ... - resource_type: ceph.smb.share cluster_id: salsa share_id: foo - JSON based resource list:
{ "resources": [ {"resource_type": "ceph.smb.cluster", "cluster_id": "rhumba", "...": "... other fields skipped for brevity ..." }, {"resource_type": "ceph.smb.cluster", "cluster_id": "salsa", "...": "... other fields skipped for brevity ..." }, {"resource_type": "ceph.smb.share", "cluster_id": "salsa", "share_id": "foo", "...": "... other fields skipped for brevity ..." } ] } - YAML resource list that consists of multiple documents:
--- resource_type: ceph.smb.cluster cluster_id: rhumba # ... other fields skipped for brevity ... --- resource_type: ceph.smb.cluster cluster_id: salsa # ... other fields skipped for brevity ... --- resource_type: ceph.smb.share cluster_id: salsa share_id: foo