mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-02-21 18:09:30 +00:00
Merge pull request #107 from ceph/devel
Sync downstream devel from upstream devel
This commit is contained in:
commit
705193244e
@ -112,6 +112,7 @@ charts and their default values.
|
|||||||
| `provisioner.skipForceFlatten` | Skip image flattening if kernel support mapping of rbd images which has the deep-flatten feature | `false` |
|
| `provisioner.skipForceFlatten` | Skip image flattening if kernel support mapping of rbd images which has the deep-flatten feature | `false` |
|
||||||
| `provisioner.timeout` | GRPC timeout for waiting for creation or deletion of a volume | `60s` |
|
| `provisioner.timeout` | GRPC timeout for waiting for creation or deletion of a volume | `60s` |
|
||||||
| `provisioner.clustername` | Cluster name to set on the RBD image | "" |
|
| `provisioner.clustername` | Cluster name to set on the RBD image | "" |
|
||||||
|
| `provisioner.setmetadata` | Set metadata on volume | `true` |
|
||||||
| `provisioner.priorityClassName` | Set user created priorityclassName for csi provisioner pods. Default is `system-cluster-critical` which is less priority than `system-node-critical` | `system-cluster-critical` |
|
| `provisioner.priorityClassName` | Set user created priorityclassName for csi provisioner pods. Default is `system-cluster-critical` which is less priority than `system-node-critical` | `system-cluster-critical` |
|
||||||
| `provisioner.profiling.enabled` | Specifies whether profiling should be enabled | `false` |
|
| `provisioner.profiling.enabled` | Specifies whether profiling should be enabled | `false` |
|
||||||
| `provisioner.provisioner.image.repository` | Specifies the csi-provisioner image repository URL | `registry.k8s.io/sig-storage/csi-provisioner` |
|
| `provisioner.provisioner.image.repository` | Specifies the csi-provisioner image repository URL | `registry.k8s.io/sig-storage/csi-provisioner` |
|
||||||
|
@ -155,6 +155,7 @@ spec:
|
|||||||
{{- if .Values.provisioner.clustername }}
|
{{- if .Values.provisioner.clustername }}
|
||||||
- "--clustername={{ .Values.provisioner.clustername }}"
|
- "--clustername={{ .Values.provisioner.clustername }}"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
- "--setmetadata={{ .Values.provisioner.setmetadata }}"
|
||||||
env:
|
env:
|
||||||
- name: POD_IP
|
- name: POD_IP
|
||||||
valueFrom:
|
valueFrom:
|
||||||
@ -205,6 +206,7 @@ spec:
|
|||||||
{{- if .Values.provisioner.clustername }}
|
{{- if .Values.provisioner.clustername }}
|
||||||
- "--clustername={{ .Values.provisioner.clustername }}"
|
- "--clustername={{ .Values.provisioner.clustername }}"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
- "--setmetadata={{ .Values.provisioner.setmetadata }}"
|
||||||
env:
|
env:
|
||||||
- name: DRIVER_NAMESPACE
|
- name: DRIVER_NAMESPACE
|
||||||
valueFrom:
|
valueFrom:
|
||||||
|
@ -210,6 +210,9 @@ provisioner:
|
|||||||
pullPolicy: IfNotPresent
|
pullPolicy: IfNotPresent
|
||||||
resources: {}
|
resources: {}
|
||||||
|
|
||||||
|
# set metadata on volume
|
||||||
|
setmetadata: true
|
||||||
|
|
||||||
attacher:
|
attacher:
|
||||||
name: attacher
|
name: attacher
|
||||||
enabled: true
|
enabled: true
|
||||||
|
@ -69,6 +69,7 @@ func init() {
|
|||||||
flag.StringVar(&conf.PluginPath, "pluginpath", defaultPluginPath, "plugin path")
|
flag.StringVar(&conf.PluginPath, "pluginpath", defaultPluginPath, "plugin path")
|
||||||
flag.StringVar(&conf.StagingPath, "stagingpath", defaultStagingPath, "staging path")
|
flag.StringVar(&conf.StagingPath, "stagingpath", defaultStagingPath, "staging path")
|
||||||
flag.StringVar(&conf.ClusterName, "clustername", "", "name of the cluster")
|
flag.StringVar(&conf.ClusterName, "clustername", "", "name of the cluster")
|
||||||
|
flag.BoolVar(&conf.SetMetadata, "setmetadata", false, "set metadata on the volume")
|
||||||
flag.StringVar(&conf.InstanceID, "instanceid", "", "Unique ID distinguishing this instance of Ceph CSI among other"+
|
flag.StringVar(&conf.InstanceID, "instanceid", "", "Unique ID distinguishing this instance of Ceph CSI among other"+
|
||||||
" instances, when sharing Ceph clusters across CSI instances for provisioning")
|
" instances, when sharing Ceph clusters across CSI instances for provisioning")
|
||||||
flag.IntVar(&conf.PidLimit, "pidlimit", 0, "the PID limit to configure through cgroups")
|
flag.IntVar(&conf.PidLimit, "pidlimit", 0, "the PID limit to configure through cgroups")
|
||||||
@ -251,6 +252,7 @@ func main() {
|
|||||||
DriverName: dname,
|
DriverName: dname,
|
||||||
Namespace: conf.DriverNamespace,
|
Namespace: conf.DriverNamespace,
|
||||||
ClusterName: conf.ClusterName,
|
ClusterName: conf.ClusterName,
|
||||||
|
SetMetadata: conf.SetMetadata,
|
||||||
}
|
}
|
||||||
// initialize all controllers before starting.
|
// initialize all controllers before starting.
|
||||||
initControllers()
|
initControllers()
|
||||||
|
@ -131,6 +131,7 @@ spec:
|
|||||||
- "--rbdhardmaxclonedepth=8"
|
- "--rbdhardmaxclonedepth=8"
|
||||||
- "--rbdsoftmaxclonedepth=4"
|
- "--rbdsoftmaxclonedepth=4"
|
||||||
- "--enableprofiling=false"
|
- "--enableprofiling=false"
|
||||||
|
- "--setmetadata=true"
|
||||||
env:
|
env:
|
||||||
- name: POD_IP
|
- name: POD_IP
|
||||||
valueFrom:
|
valueFrom:
|
||||||
@ -180,6 +181,7 @@ spec:
|
|||||||
- "--v=5"
|
- "--v=5"
|
||||||
- "--drivername=rbd.csi.ceph.com"
|
- "--drivername=rbd.csi.ceph.com"
|
||||||
- "--drivernamespace=$(DRIVER_NAMESPACE)"
|
- "--drivernamespace=$(DRIVER_NAMESPACE)"
|
||||||
|
- "--setmetadata=true"
|
||||||
env:
|
env:
|
||||||
- name: DRIVER_NAMESPACE
|
- name: DRIVER_NAMESPACE
|
||||||
valueFrom:
|
valueFrom:
|
||||||
|
@ -47,6 +47,7 @@ make image-cephcsi
|
|||||||
| `--rbdsoftmaxclonedepth` | `4` | Soft limit for maximum number of nested volume clones that are taken before a flatten occurs |
|
| `--rbdsoftmaxclonedepth` | `4` | Soft limit for maximum number of nested volume clones that are taken before a flatten occurs |
|
||||||
| `--skipforceflatten` | `false` | skip image flattening on kernel < 5.2 which support mapping of rbd images which has the deep-flatten feature |
|
| `--skipforceflatten` | `false` | skip image flattening on kernel < 5.2 which support mapping of rbd images which has the deep-flatten feature |
|
||||||
| `--maxsnapshotsonimage` | `450` | Maximum number of snapshots allowed on rbd image without flattening |
|
| `--maxsnapshotsonimage` | `450` | Maximum number of snapshots allowed on rbd image without flattening |
|
||||||
|
| `--setmetadata` | `false` | Set metadata on volume |
|
||||||
|
|
||||||
**Available volume parameters:**
|
**Available volume parameters:**
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ var (
|
|||||||
snapshotPath = rbdExamplePath + "snapshot.yaml"
|
snapshotPath = rbdExamplePath + "snapshot.yaml"
|
||||||
deployFSAppPath = e2eTemplatesPath + "rbd-fs-deployment.yaml"
|
deployFSAppPath = e2eTemplatesPath + "rbd-fs-deployment.yaml"
|
||||||
deployBlockAppPath = e2eTemplatesPath + "rbd-block-deployment.yaml"
|
deployBlockAppPath = e2eTemplatesPath + "rbd-block-deployment.yaml"
|
||||||
defaultCloneCount = 10
|
defaultCloneCount = 3 // TODO: set to 10 once issues#2327 is fixed
|
||||||
|
|
||||||
nbdMapOptions = "nbd:debug-rbd=20"
|
nbdMapOptions = "nbd:debug-rbd=20"
|
||||||
e2eDefaultCephLogStrategy = "preserve"
|
e2eDefaultCephLogStrategy = "preserve"
|
||||||
|
@ -38,6 +38,7 @@ type Config struct {
|
|||||||
DriverName string
|
DriverName string
|
||||||
Namespace string
|
Namespace string
|
||||||
ClusterName string
|
ClusterName string
|
||||||
|
SetMetadata bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ControllerList holds the list of managers need to be started.
|
// ControllerList holds the list of managers need to be started.
|
||||||
|
@ -52,11 +52,11 @@ var (
|
|||||||
// Init will add the ReconcilePersistentVolume to the list.
|
// Init will add the ReconcilePersistentVolume to the list.
|
||||||
func Init() {
|
func Init() {
|
||||||
// add ReconcilePersistentVolume to the list
|
// add ReconcilePersistentVolume to the list
|
||||||
ctrl.ControllerList = append(ctrl.ControllerList, ReconcilePersistentVolume{})
|
ctrl.ControllerList = append(ctrl.ControllerList, &ReconcilePersistentVolume{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add adds the newPVReconciler.
|
// Add adds the newPVReconciler.
|
||||||
func (r ReconcilePersistentVolume) Add(mgr manager.Manager, config ctrl.Config) error {
|
func (r *ReconcilePersistentVolume) Add(mgr manager.Manager, config ctrl.Config) error {
|
||||||
return add(mgr, newPVReconciler(mgr, config))
|
return add(mgr, newPVReconciler(mgr, config))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ func checkStaticVolume(pv *corev1.PersistentVolume) bool {
|
|||||||
|
|
||||||
// reconcilePV will extract the image details from the pv spec and regenerates
|
// reconcilePV will extract the image details from the pv spec and regenerates
|
||||||
// the omap data.
|
// the omap data.
|
||||||
func (r ReconcilePersistentVolume) reconcilePV(ctx context.Context, obj runtime.Object) error {
|
func (r *ReconcilePersistentVolume) reconcilePV(ctx context.Context, obj runtime.Object) error {
|
||||||
pv, ok := obj.(*corev1.PersistentVolume)
|
pv, ok := obj.(*corev1.PersistentVolume)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
@ -185,6 +185,7 @@ func (r ReconcilePersistentVolume) reconcilePV(ctx context.Context, obj runtime.
|
|||||||
requestName,
|
requestName,
|
||||||
pvcNamespace,
|
pvcNamespace,
|
||||||
r.config.ClusterName,
|
r.config.ClusterName,
|
||||||
|
r.config.SetMetadata,
|
||||||
cr)
|
cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ErrorLogMsg("failed to regenerate journal %s", err)
|
log.ErrorLogMsg("failed to regenerate journal %s", err)
|
||||||
|
@ -55,6 +55,9 @@ type ControllerServer struct {
|
|||||||
|
|
||||||
// Cluster name
|
// Cluster name
|
||||||
ClusterName string
|
ClusterName string
|
||||||
|
|
||||||
|
// Set metadata on volume
|
||||||
|
SetMetadata bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *ControllerServer) validateVolumeReq(ctx context.Context, req *csi.CreateVolumeRequest) error {
|
func (cs *ControllerServer) validateVolumeReq(ctx context.Context, req *csi.CreateVolumeRequest) error {
|
||||||
@ -173,7 +176,10 @@ func (cs *ControllerServer) parseVolCreateRequest(
|
|||||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set cluster name on volume
|
||||||
rbdVol.ClusterName = cs.ClusterName
|
rbdVol.ClusterName = cs.ClusterName
|
||||||
|
// set metadata on volume
|
||||||
|
rbdVol.EnableMetadata = cs.SetMetadata
|
||||||
|
|
||||||
// if the KMS is of type VaultToken, additional metadata is needed
|
// if the KMS is of type VaultToken, additional metadata is needed
|
||||||
// depending on the tenant, the KMS can be configured with other
|
// depending on the tenant, the KMS can be configured with other
|
||||||
@ -1061,6 +1067,7 @@ func (cs *ControllerServer) CreateSnapshot(
|
|||||||
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
rbdVol.EnableMetadata = cs.SetMetadata
|
||||||
|
|
||||||
// Check if source volume was created with required image features for snaps
|
// Check if source volume was created with required image features for snaps
|
||||||
if !rbdVol.hasSnapshotFeature() {
|
if !rbdVol.hasSnapshotFeature() {
|
||||||
|
@ -162,6 +162,7 @@ func (r *Driver) Run(conf *util.Config) {
|
|||||||
if conf.IsControllerServer {
|
if conf.IsControllerServer {
|
||||||
r.cs = NewControllerServer(r.cd)
|
r.cs = NewControllerServer(r.cd)
|
||||||
r.cs.ClusterName = conf.ClusterName
|
r.cs.ClusterName = conf.ClusterName
|
||||||
|
r.cs.SetMetadata = conf.SetMetadata
|
||||||
r.rs = NewReplicationServer(r.cs)
|
r.rs = NewReplicationServer(r.cs)
|
||||||
}
|
}
|
||||||
if !conf.IsControllerServer && !conf.IsNodeServer {
|
if !conf.IsControllerServer && !conf.IsNodeServer {
|
||||||
|
@ -543,6 +543,7 @@ func RegenerateJournal(
|
|||||||
requestName,
|
requestName,
|
||||||
owner,
|
owner,
|
||||||
clusterName string,
|
clusterName string,
|
||||||
|
setMetadata bool,
|
||||||
cr *util.Credentials,
|
cr *util.Credentials,
|
||||||
) (string, error) {
|
) (string, error) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
@ -557,6 +558,7 @@ func RegenerateJournal(
|
|||||||
rbdVol = &rbdVolume{}
|
rbdVol = &rbdVolume{}
|
||||||
rbdVol.VolID = volumeID
|
rbdVol.VolID = volumeID
|
||||||
rbdVol.ClusterName = clusterName
|
rbdVol.ClusterName = clusterName
|
||||||
|
rbdVol.EnableMetadata = setMetadata
|
||||||
|
|
||||||
err = vi.DecomposeCSIID(rbdVol.VolID)
|
err = vi.DecomposeCSIID(rbdVol.VolID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -95,16 +95,7 @@ type rbdImage struct {
|
|||||||
ImageID string
|
ImageID string
|
||||||
// VolID is the volume ID that is exchanged with CSI drivers,
|
// VolID is the volume ID that is exchanged with CSI drivers,
|
||||||
// identifying this rbd image
|
// identifying this rbd image
|
||||||
VolID string `json:"volID"`
|
VolID string `json:"volID"`
|
||||||
|
|
||||||
// VolSize is the size of the RBD image backing this rbdImage.
|
|
||||||
VolSize int64
|
|
||||||
|
|
||||||
// image striping configurations.
|
|
||||||
StripeCount uint64
|
|
||||||
StripeUnit uint64
|
|
||||||
ObjectSize uint64
|
|
||||||
|
|
||||||
Monitors string
|
Monitors string
|
||||||
// JournalPool is the ceph pool in which the CSI Journal/CSI snapshot Journal is
|
// JournalPool is the ceph pool in which the CSI Journal/CSI snapshot Journal is
|
||||||
// stored
|
// stored
|
||||||
@ -121,29 +112,36 @@ type rbdImage struct {
|
|||||||
// config maps in v1.0.0
|
// config maps in v1.0.0
|
||||||
RequestName string
|
RequestName string
|
||||||
NamePrefix string
|
NamePrefix string
|
||||||
|
|
||||||
// ParentName represents the parent image name of the image.
|
// ParentName represents the parent image name of the image.
|
||||||
ParentName string
|
ParentName string
|
||||||
// Parent Pool is the pool that contains the parent image.
|
// Parent Pool is the pool that contains the parent image.
|
||||||
ParentPool string
|
ParentPool string
|
||||||
ImageFeatureSet librbd.FeatureSet
|
|
||||||
// Primary represent if the image is primary or not.
|
|
||||||
Primary bool
|
|
||||||
|
|
||||||
// Cluster name
|
// Cluster name
|
||||||
ClusterName string
|
ClusterName string
|
||||||
|
|
||||||
// encryption provides access to optional VolumeEncryption functions
|
|
||||||
encryption *util.VolumeEncryption
|
|
||||||
// Owner is the creator (tenant, Kubernetes Namespace) of the volume
|
// Owner is the creator (tenant, Kubernetes Namespace) of the volume
|
||||||
Owner string
|
Owner string
|
||||||
|
|
||||||
CreatedAt *timestamp.Timestamp
|
// VolSize is the size of the RBD image backing this rbdImage.
|
||||||
|
VolSize int64
|
||||||
|
|
||||||
|
// image striping configurations.
|
||||||
|
StripeCount uint64
|
||||||
|
StripeUnit uint64
|
||||||
|
ObjectSize uint64
|
||||||
|
|
||||||
|
ImageFeatureSet librbd.FeatureSet
|
||||||
|
// encryption provides access to optional VolumeEncryption functions
|
||||||
|
encryption *util.VolumeEncryption
|
||||||
|
CreatedAt *timestamp.Timestamp
|
||||||
// conn is a connection to the Ceph cluster obtained from a ConnPool
|
// conn is a connection to the Ceph cluster obtained from a ConnPool
|
||||||
conn *util.ClusterConnection
|
conn *util.ClusterConnection
|
||||||
// an opened IOContext, call .openIoctx() before using
|
// an opened IOContext, call .openIoctx() before using
|
||||||
ioctx *rados.IOContext
|
ioctx *rados.IOContext
|
||||||
|
|
||||||
|
// Primary represent if the image is primary or not.
|
||||||
|
Primary bool
|
||||||
|
// Set metadata on volume
|
||||||
|
EnableMetadata bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// rbdVolume represents a CSI volume and its RBD image specifics.
|
// rbdVolume represents a CSI volume and its RBD image specifics.
|
||||||
@ -2061,6 +2059,10 @@ func genVolFromVolIDWithMigration(
|
|||||||
|
|
||||||
// setAllMetadata set all the metadata from arg parameters on RBD image.
|
// setAllMetadata set all the metadata from arg parameters on RBD image.
|
||||||
func (rv *rbdVolume) setAllMetadata(parameters map[string]string) error {
|
func (rv *rbdVolume) setAllMetadata(parameters map[string]string) error {
|
||||||
|
if !rv.EnableMetadata {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
for k, v := range parameters {
|
for k, v := range parameters {
|
||||||
err := rv.SetMetadata(k, v)
|
err := rv.SetMetadata(k, v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -2081,6 +2083,10 @@ func (rv *rbdVolume) setAllMetadata(parameters map[string]string) error {
|
|||||||
|
|
||||||
// unsetAllMetadata unset all the metadata from arg keys on RBD image.
|
// unsetAllMetadata unset all the metadata from arg keys on RBD image.
|
||||||
func (rv *rbdVolume) unsetAllMetadata(keys []string) error {
|
func (rv *rbdVolume) unsetAllMetadata(keys []string) error {
|
||||||
|
if !rv.EnableMetadata {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
err := rv.RemoveMetadata(key)
|
err := rv.RemoveMetadata(key)
|
||||||
// TODO: replace string comparison with errno.
|
// TODO: replace string comparison with errno.
|
||||||
|
@ -101,6 +101,8 @@ type Config struct {
|
|||||||
// cephfs related flags
|
// 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
|
||||||
|
|
||||||
|
SetMetadata bool // set metadata on the volume
|
||||||
|
|
||||||
// RbdHardMaxCloneDepth is the hard limit for maximum number of nested volume clones that are taken before a flatten
|
// RbdHardMaxCloneDepth is the hard limit for maximum number of nested volume clones that are taken before a flatten
|
||||||
// occurs
|
// occurs
|
||||||
RbdHardMaxCloneDepth uint
|
RbdHardMaxCloneDepth uint
|
||||||
|
Loading…
Reference in New Issue
Block a user