Skip to content

Commit

Permalink
Merge pull request #324 from ialidzhikov/cleanup/unused
Browse files Browse the repository at this point in the history
Clean up unused vars, funcs and types
  • Loading branch information
k8s-ci-robot authored Aug 11, 2021
2 parents 9f270db + a787602 commit c4cfca3
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 38 deletions.
7 changes: 0 additions & 7 deletions cmd/csi-attacher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ const (

// Default timeout of short CSI calls like GetPluginInfo
csiTimeout = time.Second

leaderElectionTypeLeases = "leases"
)

// Command line flags
Expand Down Expand Up @@ -82,11 +80,6 @@ var (
version = "unknown"
)

type leaderElection interface {
Run() error
WithNamespace(namespace string)
}

func main() {
klog.InitFlags(nil)
flag.Set("logtostderr", "true")
Expand Down
11 changes: 0 additions & 11 deletions pkg/attacher/attacher.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ import (
"context"

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/kubernetes-csi/csi-lib-utils/protosanitizer"

"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"k8s.io/klog/v2"
)

// Attacher implements attach/detach operations against a remote CSI driver.
Expand Down Expand Up @@ -85,15 +83,6 @@ func (a *attacher) Detach(ctx context.Context, volumeID string, nodeID string, s
return err
}

func logGRPC(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
klog.V(5).Infof("GRPC call: %s", method)
klog.V(5).Infof("GRPC request: %s", protosanitizer.StripSecrets(req))
err := invoker(ctx, method, req, reply, cc, opts...)
klog.V(5).Infof("GRPC response: %s", protosanitizer.StripSecrets(reply))
klog.V(5).Infof("GRPC error: %v", err)
return err
}

// isFinished returns true if given error represents final error of an
// operation. That means the operation has failed completely and cannot be in
// progress. It returns false, if the error represents some transient error
Expand Down
4 changes: 0 additions & 4 deletions pkg/attacher/attacher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ import (
"google.golang.org/grpc/status"
)

const (
driverName = "foo/bar"
)

type pbMatcher struct {
x proto.Message
}
Expand Down
9 changes: 0 additions & 9 deletions pkg/controller/csi_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,6 @@ func (h *csiHandler) prepareVANodeID(va *storage.VolumeAttachment, nodeID string
return clone, true
}

func (h *csiHandler) saveVA(va *storage.VolumeAttachment, patch []byte) (*storage.VolumeAttachment, error) {
newVA, err := h.client.StorageV1().VolumeAttachments().Patch(context.TODO(), va.Name, types.MergePatchType, patch, metav1.PatchOptions{})
if err != nil {
return va, err
}
klog.V(4).Infof("VolumeAttachment %q updated with finalizer and/or NodeID annotation", va.Name)
return newVA, nil
}

func (h *csiHandler) addPVFinalizer(pv *v1.PersistentVolume) (*v1.PersistentVolume, error) {
finalizerName := GetFinalizerName(h.attacherName)
for _, f := range pv.Finalizers {
Expand Down
5 changes: 2 additions & 3 deletions pkg/controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ func markAsDetached(client kubernetes.Interface, va *storage.VolumeAttachment) (
}

const (
defaultFSType = "ext4"
csiVolAttribsAnnotationKey = "csi.volume.kubernetes.io/volume-attributes"
vaNodeIDAnnotation = "csi.alpha.kubernetes.io/node-id"
defaultFSType = "ext4"
vaNodeIDAnnotation = "csi.alpha.kubernetes.io/node-id"
)

// SanitizeDriverName sanitizes provided driver name.
Expand Down
4 changes: 0 additions & 4 deletions pkg/controller/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import (
v1 "k8s.io/api/core/v1"
)

const (
driverName = "foo/bar"
)

func createBlockCapability(mode csi.VolumeCapability_AccessMode_Mode) *csi.VolumeCapability {
return &csi.VolumeCapability{
AccessType: &csi.VolumeCapability_Block{
Expand Down

0 comments on commit c4cfca3

Please sign in to comment.