Skip to content

Commit b131834

Browse files
zetaabchrigl
andauthored
[cinder-csi-plugin] Remove downstream from probe (kubernetes#1904) (kubernetes#1906)
Remove all sorts of downstream dependency on cinder from probe. Probe is the one called by the liveness sidecar to determine the health of the csi plugin. Including downstream services in a health check can result in unfortunate behavior in cluster. For example, over and over restarts of daemonsets/deployments just because the downstream api is not available at the moment... e.g. because of a maintenance. On the other hand, just because the downstream api is available doesn't tell us anything about whether or not the downstream works as expected. Therefore there are facilities in place that reports errors when they happen all over the place. Co-authored-by: Christoph Glaubitz <[email protected]>
1 parent 33b473b commit b131834

File tree

5 files changed

+0
-29
lines changed

5 files changed

+0
-29
lines changed

pkg/csi/cinder/identityserver.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"golang.org/x/net/context"
2222
"google.golang.org/grpc/codes"
2323
"google.golang.org/grpc/status"
24-
"k8s.io/cloud-provider-openstack/pkg/csi/cinder/openstack"
2524
"k8s.io/klog/v2"
2625
)
2726

@@ -47,15 +46,6 @@ func (ids *identityServer) GetPluginInfo(ctx context.Context, req *csi.GetPlugin
4746
}
4847

4948
func (ids *identityServer) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error) {
50-
oProvider, err := openstack.GetOpenStackProvider()
51-
if err != nil {
52-
klog.Errorf("Failed to GetOpenStackProvider: %v", err)
53-
return nil, status.Error(codes.FailedPrecondition, "Failed to retrieve openstack provider")
54-
}
55-
if err := oProvider.CheckBlockStorageAPI(); err != nil {
56-
klog.Errorf("Failed to query blockstorage API: %v", err)
57-
return nil, status.Error(codes.FailedPrecondition, "Failed to communicate with OpenStack BlockStorage API")
58-
}
5949
return &csi.ProbeResponse{}, nil
6050
}
6151

pkg/csi/cinder/openstack/openstack.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ func AddExtraFlags(fs *pflag.FlagSet) {
4141
}
4242

4343
type IOpenStack interface {
44-
CheckBlockStorageAPI() error
4544
CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourcevolID string, tags *map[string]string) (*volumes.Volume, error)
4645
DeleteVolume(volumeID string) error
4746
AttachVolume(instanceID, volumeID string) (string, error)

pkg/csi/cinder/openstack/openstack_mock.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,6 @@ func (_m *OpenStackMock) GetVolume(volumeID string) (*volumes.Volume, error) {
116116
return &fakeVol1, nil
117117
}
118118

119-
// CheckBlockStorageAPI
120-
func (_m *OpenStackMock) CheckBlockStorageAPI() error {
121-
return nil
122-
}
123-
124119
// DetachVolume provides a mock function with given fields: instanceID, volumeID
125120
func (_m *OpenStackMock) DetachVolume(instanceID string, volumeID string) error {
126121
ret := _m.Called(instanceID, volumeID)

pkg/csi/cinder/openstack/openstack_volumes.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"time"
2323

2424
"github.com/gophercloud/gophercloud/openstack"
25-
"github.com/gophercloud/gophercloud/openstack/blockstorage/apiversions"
2625
volumeexpand "github.com/gophercloud/gophercloud/openstack/blockstorage/extensions/volumeactions"
2726
"github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes"
2827
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/volumeattach"
@@ -50,14 +49,6 @@ const (
5049

5150
var volumeErrorStates = [...]string{"error", "error_extending", "error_deleting"}
5251

53-
func (os *OpenStack) CheckBlockStorageAPI() error {
54-
_, err := apiversions.List(os.blockstorage).AllPages()
55-
if err != nil {
56-
return err
57-
}
58-
return nil
59-
}
60-
6152
// CreateVolume creates a volume of given size
6253
func (os *OpenStack) CreateVolume(name string, size int, vtype, availability string, snapshotID string, sourcevolID string, tags *map[string]string) (*volumes.Volume, error) {
6354

tests/sanity/cinder/fakecloud.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ func (cloud *cloud) DeleteVolume(volumeID string) error {
5656
return nil
5757
}
5858

59-
func (cloud *cloud) CheckBlockStorageAPI() error {
60-
return nil
61-
}
62-
6359
func (cloud *cloud) AttachVolume(instanceID, volumeID string) (string, error) {
6460
// update the volume with attachement
6561

0 commit comments

Comments
 (0)