Skip to content
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

Support storing cephfs omap in a different namespace in rados under same filesystem metadata pool #4652

Draft
wants to merge 4 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ spec:
- "--endpoint=$(CSI_ENDPOINT)"
- "--v={{ .Values.logLevel }}"
- "--drivername=$(DRIVER_NAME)"
{{- if .Values.instanceID }}
- "--instanceid={{ .Values.instanceID }}"
{{- end }}
Comment on lines +61 to +63
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zerotens
Can you please open another for instanceID change ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rakshith-R
I made an extra PR for this.

#4666

{{- if .Values.radosNamespaceCephFS }}
- "--radosnamespacecephfs={{ .Values.radosNamespaceCephFS }}"
{{- end }}
{{- if .Values.nodeplugin.profiling.enabled }}
- "--enableprofiling={{ .Values.nodeplugin.profiling.enabled }}"
{{- end }}
Expand Down
6 changes: 6 additions & 0 deletions charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ spec:
- "--endpoint=$(CSI_ENDPOINT)"
- "--v={{ .Values.logLevel }}"
- "--drivername=$(DRIVER_NAME)"
{{- if .Values.instanceID }}
- "--instanceid={{ .Values.instanceID }}"
{{- end }}
{{- if .Values.radosNamespaceCephFS }}
- "--radosnamespacecephfs={{ .Values.radosNamespaceCephFS }}"
{{- end }}
{{- if .Values.provisioner.profiling.enabled }}
- "--enableprofiling={{ .Values.provisioner.profiling.enabled }}"
{{- end }}
Expand Down
5 changes: 5 additions & 0 deletions charts/ceph-csi-cephfs/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -368,3 +368,8 @@ configMapName: ceph-csi-config
externallyManagedConfigmap: false
# Name of the configmap used for ceph.conf
cephConfConfigMapName: ceph-config
# CephFS RadosNamespace used to store CSI specific objects and keys.
# radosNamespaceCephFS: csi
# Unique ID distinguishing this instance of Ceph CSI among other instances,
# when sharing Ceph clusters across CSI instances for provisioning
# instanceID: default
3 changes: 3 additions & 0 deletions charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ spec:
{{- if .Values.topology.enabled }}
- "--domainlabels={{ .Values.topology.domainLabels | join "," }}"
{{- end }}
{{- if .Values.instanceID }}
- "--instanceid={{ .Values.instanceID }}"
{{- end }}
{{- if .Values.nodeplugin.profiling.enabled }}
- "--enableprofiling={{ .Values.nodeplugin.profiling.enabled }}"
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions charts/ceph-csi-rbd/templates/provisioner-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ spec:
{{- if .Values.provisioner.skipForceFlatten }}
- "--skipforceflatten={{ .Values.provisioner.skipForceFlatten }}"
{{- end }}
{{- if .Values.instanceID }}
- "--instanceid={{ .Values.instanceID }}"
{{- end }}
{{- if .Values.provisioner.profiling.enabled }}
- "--enableprofiling={{ .Values.provisioner.profiling.enabled }}"
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions charts/ceph-csi-rbd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -552,3 +552,6 @@ externallyManagedConfigmap: false
cephConfConfigMapName: ceph-config
# Name of the configmap used for encryption kms configuration
kmsConfigMapName: ceph-csi-encryption-kms-config
# Unique ID distinguishing this instance of Ceph CSI among other instances,
# when sharing Ceph clusters across CSI instances for provisioning
# instanceID: default
5 changes: 5 additions & 0 deletions cmd/cephcsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ func init() {
"kernelmountoptions",
"",
"Comma separated string of mount options accepted by cephfs kernel mounter")
flag.StringVar(
&conf.RadosNamespaceCephFS,
"radosnamespacecephfs",
"",
"CephFS RadosNamespace used to store CSI specific objects and keys.")
flag.StringVar(
&conf.FuseMountOptions,
"fusemountoptions",
Expand Down
1 change: 1 addition & 0 deletions docs/deploy-cephfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ make image-cephcsi
| `--domainlabels` | _empty_ | Kubernetes node labels to use as CSI domain labels for topology aware provisioning, should be a comma separated value (ex:= "failure-domain/region,failure-domain/zone") |
| `--enable-read-affinity` | `false` | enable read affinity |
| `--crush-location-labels`| _empty_ | Kubernetes node labels that determine the CRUSH location the node belongs to, separated by ','.<br>`Note: These labels will be replaced if crush location labels are defined in the ceph-csi-config ConfigMap for the specific cluster.` |
| `--radosnamespacecephfs`| "csi" | CephFS RadosNamespace used to store CSI specific objects and keys. |

**NOTE:** The parameter `-forcecephkernelclient` enables the Kernel
CephFS mounter on kernels < 4.17.
Expand Down
5 changes: 5 additions & 0 deletions internal/cephfs/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ func (fs *Driver) Run(conf *util.Config) {
CSIInstanceID = conf.InstanceID
}

// Use passed in radosNamespace, if provided for storing CSI specific objects and keys.
if conf.RadosNamespaceCephFS != "" {
fsutil.RadosNamespace = conf.RadosNamespaceCephFS
}

if conf.IsNodeServer && k8s.RunsOnKubernetes() {
nodeLabels, err = k8s.GetNodeLabels(conf.NodeID)
if err != nil {
Expand Down
6 changes: 2 additions & 4 deletions internal/cephfs/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ package util
// VolumeID string representation.
type VolumeID string

const (
// RadosNamespace to store CSI specific objects and keys.
RadosNamespace = "csi"
)
// RadosNamespace to store CSI specific objects and keys.
var RadosNamespace = "csi"
12 changes: 12 additions & 0 deletions internal/nfs/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package driver

import (
"github.com/ceph/ceph-csi/internal/cephfs"
fsutil "github.com/ceph/ceph-csi/internal/cephfs/util"
csicommon "github.com/ceph/ceph-csi/internal/csi-common"
"github.com/ceph/ceph-csi/internal/nfs/controller"
"github.com/ceph/ceph-csi/internal/nfs/identity"
Expand Down Expand Up @@ -44,6 +46,16 @@ func (fs *Driver) Run(conf *util.Config) {
log.FatalLogMsg("failed to initialize CSI driver")
}

// Use passed in instance ID, if provided for omap suffix naming
if conf.InstanceID != "" {
cephfs.CSIInstanceID = conf.InstanceID
}

// Use passed in radosNamespace, if provided for storing CSI specific objects and keys.
if conf.RadosNamespaceCephFS != "" {
fsutil.RadosNamespace = conf.RadosNamespaceCephFS
}

if conf.IsControllerServer || !conf.IsNodeServer {
cd.AddControllerServiceCapabilities([]csi.ControllerServiceCapability_RPC_Type{
csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME,
Expand Down
3 changes: 2 additions & 1 deletion internal/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ type Config struct {
SkipForceFlatten bool

// cephfs related flags
ForceKernelCephFS bool // force to use the ceph kernel client even if the kernel is < 4.17
ForceKernelCephFS bool // force to use the ceph kernel client even if the kernel is < 4.17
RadosNamespaceCephFS string // RadosNamespace used to store CSI specific objects and keys

SetMetadata bool // set metadata on the volume

Expand Down
Loading