mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-24 23:30:20 +00:00
rbd: expose the GroupControllerService
When the GroupSnapGetInfo go-ceph function is supported by librbd, the Group Controller Servive and VolumeGroupSnapshot capabilities can be exposed to the Container Orchestrator. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
e34dceff27
commit
ec1e7a4ee0
@ -25,6 +25,7 @@ import (
|
|||||||
csiaddons "github.com/ceph/ceph-csi/internal/csi-addons/server"
|
csiaddons "github.com/ceph/ceph-csi/internal/csi-addons/server"
|
||||||
csicommon "github.com/ceph/ceph-csi/internal/csi-common"
|
csicommon "github.com/ceph/ceph-csi/internal/csi-common"
|
||||||
"github.com/ceph/ceph-csi/internal/rbd"
|
"github.com/ceph/ceph-csi/internal/rbd"
|
||||||
|
"github.com/ceph/ceph-csi/internal/rbd/features"
|
||||||
"github.com/ceph/ceph-csi/internal/util"
|
"github.com/ceph/ceph-csi/internal/util"
|
||||||
"github.com/ceph/ceph-csi/internal/util/k8s"
|
"github.com/ceph/ceph-csi/internal/util/k8s"
|
||||||
"github.com/ceph/ceph-csi/internal/util/log"
|
"github.com/ceph/ceph-csi/internal/util/log"
|
||||||
@ -123,6 +124,19 @@ func (r *Driver) Run(conf *util.Config) {
|
|||||||
csi.VolumeCapability_AccessMode_SINGLE_NODE_SINGLE_WRITER,
|
csi.VolumeCapability_AccessMode_SINGLE_NODE_SINGLE_WRITER,
|
||||||
csi.VolumeCapability_AccessMode_SINGLE_NODE_MULTI_WRITER,
|
csi.VolumeCapability_AccessMode_SINGLE_NODE_MULTI_WRITER,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// GroupSnapGetInfo is used within the VolumeGroupSnapshot implementation
|
||||||
|
vgsSupported, vgsErr := features.SupportsGroupSnapGetInfo()
|
||||||
|
if vgsSupported {
|
||||||
|
r.cd.AddGroupControllerServiceCapabilities([]csi.GroupControllerServiceCapability_RPC_Type{
|
||||||
|
csi.GroupControllerServiceCapability_RPC_CREATE_DELETE_GET_VOLUME_GROUP_SNAPSHOT,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
log.DefaultLog("not enabling VolumeGroupSnapshot service capability")
|
||||||
|
}
|
||||||
|
if vgsErr != nil {
|
||||||
|
log.ErrorLogMsg("failed detecting VolumeGroupSnapshot support: %v", vgsErr)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if k8s.RunsOnKubernetes() && conf.IsNodeServer {
|
if k8s.RunsOnKubernetes() && conf.IsNodeServer {
|
||||||
@ -178,6 +192,7 @@ func (r *Driver) Run(conf *util.Config) {
|
|||||||
IS: r.ids,
|
IS: r.ids,
|
||||||
CS: r.cs,
|
CS: r.cs,
|
||||||
NS: r.ns,
|
NS: r.ns,
|
||||||
|
GS: r.cs,
|
||||||
}
|
}
|
||||||
s.Start(conf.Endpoint, srv, csicommon.MiddlewareServerOptionConfig{
|
s.Start(conf.Endpoint, srv, csicommon.MiddlewareServerOptionConfig{
|
||||||
LogSlowOpInterval: conf.LogSlowOpInterval,
|
LogSlowOpInterval: conf.LogSlowOpInterval,
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
csicommon "github.com/ceph/ceph-csi/internal/csi-common"
|
csicommon "github.com/ceph/ceph-csi/internal/csi-common"
|
||||||
|
"github.com/ceph/ceph-csi/internal/rbd/features"
|
||||||
|
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
)
|
)
|
||||||
@ -35,29 +36,44 @@ func (is *IdentityServer) GetPluginCapabilities(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *csi.GetPluginCapabilitiesRequest,
|
req *csi.GetPluginCapabilitiesRequest,
|
||||||
) (*csi.GetPluginCapabilitiesResponse, error) {
|
) (*csi.GetPluginCapabilitiesResponse, error) {
|
||||||
return &csi.GetPluginCapabilitiesResponse{
|
caps := []*csi.PluginCapability{
|
||||||
Capabilities: []*csi.PluginCapability{
|
{
|
||||||
{
|
Type: &csi.PluginCapability_Service_{
|
||||||
Type: &csi.PluginCapability_Service_{
|
Service: &csi.PluginCapability_Service{
|
||||||
Service: &csi.PluginCapability_Service{
|
Type: csi.PluginCapability_Service_CONTROLLER_SERVICE,
|
||||||
Type: csi.PluginCapability_Service_CONTROLLER_SERVICE,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Type: &csi.PluginCapability_VolumeExpansion_{
|
|
||||||
VolumeExpansion: &csi.PluginCapability_VolumeExpansion{
|
|
||||||
Type: csi.PluginCapability_VolumeExpansion_ONLINE,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Type: &csi.PluginCapability_Service_{
|
|
||||||
Service: &csi.PluginCapability_Service{
|
|
||||||
Type: csi.PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Type: &csi.PluginCapability_VolumeExpansion_{
|
||||||
|
VolumeExpansion: &csi.PluginCapability_VolumeExpansion{
|
||||||
|
Type: csi.PluginCapability_VolumeExpansion_ONLINE,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: &csi.PluginCapability_Service_{
|
||||||
|
Service: &csi.PluginCapability_Service{
|
||||||
|
Type: csi.PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupSnapGetInfo is used within the VolumeGroupSnapshot implementation
|
||||||
|
vgsSupported, err := features.SupportsGroupSnapGetInfo()
|
||||||
|
if err == nil && vgsSupported {
|
||||||
|
gcs := csi.PluginCapability{
|
||||||
|
Type: &csi.PluginCapability_Service_{
|
||||||
|
Service: &csi.PluginCapability_Service{
|
||||||
|
Type: csi.PluginCapability_Service_GROUP_CONTROLLER_SERVICE,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
caps = append(caps, &gcs)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &csi.GetPluginCapabilitiesResponse{
|
||||||
|
Capabilities: caps,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user