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

Syncing latest changes from devel for ceph-csi #209

Merged
merged 1 commit into from
Nov 7, 2023
Merged
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
2 changes: 0 additions & 2 deletions internal/cephfs/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ func (fs *Driver) Run(conf *util.Config) {
IS: fs.is,
CS: fs.cs,
NS: fs.ns,
// passing nil for replication server as cephFS does not support mirroring.
RS: nil,
}
server.Start(conf.Endpoint, srv)

Expand Down
5 changes: 0 additions & 5 deletions internal/csi-common/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/ceph/ceph-csi/internal/util/log"

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/csi-addons/spec/lib/go/replication"
"google.golang.org/grpc"
"k8s.io/klog/v2"
)
Expand All @@ -46,7 +45,6 @@ type Servers struct {
IS csi.IdentityServer
CS csi.ControllerServer
NS csi.NodeServer
RS replication.ControllerServer
}

// NewNonBlockingGRPCServer return non-blocking GRPC.
Expand Down Expand Up @@ -111,9 +109,6 @@ func (s *nonBlockingGRPCServer) serve(endpoint string, srv Servers) {
if srv.NS != nil {
csi.RegisterNodeServer(server, srv.NS)
}
if srv.RS != nil {
replication.RegisterControllerServer(server, srv.RS)
}

log.DefaultLog("Listening for connections on address: %#v", listener.Addr())
err = server.Serve(listener)
Expand Down
43 changes: 1 addition & 42 deletions internal/csi-common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import (
"github.com/ceph/ceph-csi/internal/util/log"

"github.com/container-storage-interface/spec/lib/go/csi"
rp "github.com/csi-addons/replication-lib-utils/protosanitizer"
"github.com/csi-addons/spec/lib/go/replication"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/kubernetes-csi/csi-lib-utils/protosanitizer"
Expand Down Expand Up @@ -93,22 +91,6 @@ func NewControllerServiceCapability(ctrlCap csi.ControllerServiceCapability_RPC_
}
}

// Add replication request names to the list when we implement more API's.
func isReplicationRequest(req interface{}) bool {
isReplicationRequest := true
switch req.(type) {
case *replication.EnableVolumeReplicationRequest:
case *replication.DisableVolumeReplicationRequest:
case *replication.PromoteVolumeRequest:
case *replication.DemoteVolumeRequest:
case *replication.ResyncVolumeRequest:
default:
isReplicationRequest = false
}

return isReplicationRequest
}

// NewMiddlewareServerOption creates a new grpc.ServerOption that configures a
// common format for log messages and other gRPC related handlers.
func NewMiddlewareServerOption(withMetrics bool) grpc.ServerOption {
Expand Down Expand Up @@ -151,19 +133,6 @@ func getReqID(req interface{}) string {

case *csi.NodeExpandVolumeRequest:
reqID = r.VolumeId

case *replication.EnableVolumeReplicationRequest:
reqID = r.VolumeId
case *replication.DisableVolumeReplicationRequest:
reqID = r.VolumeId

case *replication.PromoteVolumeRequest:
reqID = r.VolumeId
case *replication.DemoteVolumeRequest:
reqID = r.VolumeId

case *replication.ResyncVolumeRequest:
reqID = r.VolumeId
}

return reqID
Expand Down Expand Up @@ -193,18 +162,8 @@ func logGRPC(
handler grpc.UnaryHandler,
) (interface{}, error) {
log.ExtendedLog(ctx, "GRPC call: %s", info.FullMethod)
// TODO: remove the following check for next release
// refer to https://github.com/ceph/ceph-csi/issues/3314.
if isReplicationRequest(req) {
strippedMessage := protosanitizer.StripSecrets(req).String()
if !strings.Contains(strippedMessage, "***stripped***") {
strippedMessage = rp.StripReplicationSecrets(req).String()
}
log.TraceLog(ctx, "GRPC request: %s", protosanitizer.StripSecrets(req))

log.TraceLog(ctx, "GRPC request: %s", strippedMessage)
} else {
log.TraceLog(ctx, "GRPC request: %s", protosanitizer.StripSecrets(req))
}
resp, err := handler(ctx, req)
if err != nil {
klog.Errorf(log.Log(ctx, "GRPC error: %v"), err)
Expand Down