Skip to content

Commit

Permalink
Merge pull request #64 from dobsonj/rebase-v5.2.6
Browse files Browse the repository at this point in the history
STOR-1571: Chore: Update ibm-vpc-block-csi-driver to the latest release
  • Loading branch information
openshift-merge-bot[bot] committed Feb 8, 2024
2 parents 9ee1226 + 5047553 commit bb1ad9b
Show file tree
Hide file tree
Showing 16 changed files with 241 additions and 120 deletions.
2 changes: 1 addition & 1 deletion cmd/main.go
Expand Up @@ -129,7 +129,7 @@ func serveMetrics() {
go func() {
http.Handle("/metrics", promhttp.Handler())
//http.Handle("/health-check", healthCheck)
err := http.ListenAndServe(*metricsAddress, nil)
err := http.ListenAndServe(*metricsAddress, nil) // #nosec G114: use default timeout.
logger.Error("Failed to start metrics service:", zap.Error(err))
}()
metrics.RegisterAll(csiConfig.CSIDriverGithubName)
Expand Down
Expand Up @@ -42,7 +42,7 @@ spec:
- name: ADDRESS
value: /csi/csi.sock
- name: DRIVER_REGISTRATION_SOCK
value: /var/lib/kubelet/csi-plugins/vpc.block.csi.ibm.io/csi.sock
value: /var/lib/kubelet/plugins/vpc.block.csi.ibm.io/csi.sock
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
Expand Down Expand Up @@ -146,7 +146,7 @@ spec:
type: Directory
- name: plugin-dir
hostPath:
path: /var/lib/kubelet/csi-plugins/vpc.block.csi.ibm.io/
path: /var/lib/kubelet/plugins/vpc.block.csi.ibm.io/
type: DirectoryOrCreate
- name: device-dir
hostPath:
Expand Down
Expand Up @@ -7,11 +7,6 @@ metadata:
labels:
app: ibm-vpc-block-csi-driver
addonmanager.kubernetes.io/mode: Reconcile
imagePullSecrets:
- name: bluemix-default-secret
- name: bluemix-default-secret-regional
- name: bluemix-default-secret-international
- name: icr-io-secret
---

kind: ClusterRole
Expand Down Expand Up @@ -65,11 +60,6 @@ kind: ServiceAccount
metadata:
name: ibm-vpc-block-controller-sa
namespace: kube-system
imagePullSecrets:
- name: bluemix-default-secret
- name: bluemix-default-secret-regional
- name: bluemix-default-secret-international
- name: icr-io-secret
---
# xref: https://github.com/kubernetes-csi/external-provisioner/blob/master/deploy/kubernetes/rbac.yaml
kind: ClusterRole
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Expand Up @@ -6,7 +6,7 @@ require (
github.com/IBM/ibm-csi-common v1.1.7
github.com/IBM/ibmcloud-volume-interface v1.2.0
github.com/IBM/ibmcloud-volume-vpc v1.1.6
github.com/IBM/secret-utils-lib v1.1.4
github.com/IBM/secret-utils-lib v1.1.7
github.com/container-storage-interface/spec v1.7.0
github.com/golang/glog v1.1.0
github.com/google/uuid v1.3.0
Expand All @@ -28,7 +28,7 @@ require (
github.com/BurntSushi/toml v1.0.0 // indirect
github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.6.7 // indirect
github.com/IBM/go-sdk-core/v5 v5.9.1 // indirect
github.com/IBM/secret-common-lib v1.1.4 // indirect
github.com/IBM/secret-common-lib v1.1.7 // indirect
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Expand Up @@ -45,10 +45,10 @@ github.com/IBM/ibmcloud-volume-interface v1.2.0 h1:9SqCaC0H6nhiXZL57FsR0n1B7rQ7C
github.com/IBM/ibmcloud-volume-interface v1.2.0/go.mod h1:646HOeq8dAKbgpr7jRehGKckhgduJyII2uN5T6RDLww=
github.com/IBM/ibmcloud-volume-vpc v1.1.6 h1:HU76slo59S6vPANtQxTDdco+Lu7EToQw7Ow28n5eZR0=
github.com/IBM/ibmcloud-volume-vpc v1.1.6/go.mod h1:+UTHGrGzjyA2VjaozhB1xOjAcJ1lsi9mFqfGsqmuCOQ=
github.com/IBM/secret-common-lib v1.1.4 h1:gKpKnaP45Y6u7VpSlFfXjjTAHpu4bz9Ofy+aR0t2RcI=
github.com/IBM/secret-common-lib v1.1.4/go.mod h1:0L/lLfwi5jwTTmNYE2246HzBIdGz0m6wu/5tXoRp/Lc=
github.com/IBM/secret-utils-lib v1.1.4 h1:8WPG9KBrLLRhGbQn34NWzrFKlyfIIaUfLeDg+iRJkes=
github.com/IBM/secret-utils-lib v1.1.4/go.mod h1:RuD7z7GrfI/RS5UmQTfY51qWTgscMy06zbQi7i433TY=
github.com/IBM/secret-common-lib v1.1.7 h1:kQVFuC0gWZ0Hubj3SnhUm/WW4dRskh+n7OGA9kabEi8=
github.com/IBM/secret-common-lib v1.1.7/go.mod h1:annHSRAV+CSb7k2JARRi0rkw7tj81OyRPFBQnMHc2pQ=
github.com/IBM/secret-utils-lib v1.1.7 h1:uxzaG/seUbllIjcC4cPnhf8o6m2AKXiE2/8onoZ0iio=
github.com/IBM/secret-utils-lib v1.1.7/go.mod h1:Gq0ZtLZDUaGaeO4Im8RT1IGJaKaHwAzcMNjvCoPAklw=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
Expand Down
44 changes: 39 additions & 5 deletions pkg/ibmcsidriver/server.go
Expand Up @@ -19,16 +19,17 @@ package ibmcsidriver

import (
"errors"
"net"
"net/url"
"os"
"sync"

csi "github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
"go.uber.org/zap"
"golang.org/x/net/context"
"google.golang.org/grpc"
"net"
"net/url"
"os"
"os/signal"
"sync"
"syscall"
)

// NonBlockingGRPCServer Defines Non blocking GRPC server interfaces
Expand Down Expand Up @@ -129,6 +130,7 @@ func (s *nonBlockingGRPCServer) Setup(endpoint string, ids csi.IdentityServer, c
if ns != nil {
csi.RegisterNodeServer(s.server, ns)
}
go removeCSISocket(addr)
return listener, nil
}

Expand Down Expand Up @@ -158,3 +160,35 @@ func logGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, h
}
return resp, err
}

func removeCSISocket(endPoint string) {
// Reference: https://github.com/kubernetes-csi/node-driver-registrar/blob/master/cmd/csi-node-driver-registrar/node_register.go#L168
sigc := make(chan os.Signal, 1)
signal.Notify(sigc, syscall.SIGTERM)
<-sigc
err := os.Remove(endPoint)
if err != nil && !os.IsNotExist(err) {
glog.Errorf("failed to remove socket: %s with error: %+v", endPoint, err)
}
/*
This is a temporary code to cleanup csi-socket created under csi-plugins directory.
This code must be removed once current supported versions are deprecated and
new major release is done.
*/
csiPluginDataPath := "/var/lib/kubelet/csi-plugins/vpc.block.csi.ibm.io/"
csiPluginLibPath := "/var/data/kubelet/csi-plugins/vpc.block.csi.ibm.io/"
directoryDelete(csiPluginDataPath)
directoryDelete(csiPluginLibPath)
os.Exit(0)

}

func directoryDelete(csiPluginSocketPath string) {
err := os.RemoveAll(csiPluginSocketPath)
if err != nil {
glog.Errorf("Error deleting path %s: %v", csiPluginSocketPath, err)
return
}
glog.Infof("Path %s deleted successfully:", csiPluginSocketPath)

}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bb1ad9b

Please sign in to comment.