Skip to content

Commit b4af4af

Browse files
Enable bucket access poilcy for vpc clusters (#56)
* code changes to incorporate whitelisting ips for vpc clusters * Add UT and respective mock packages * review comments addressed * add pvc name in the logger
1 parent 8d09f41 commit b4af4af

19 files changed

Lines changed: 2403 additions & 41 deletions

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ BUILD_DATE="$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")"
2828
# endif
2929
#endif
3030
VERSION := latest
31+
export GO111MODULE=on
3132

3233
.PHONY: all
3334
all: deps fmt vet test
@@ -41,7 +42,8 @@ driver: deps builddriver
4142
.PHONY: deps
4243
deps:
4344
echo "Installing dependencies ..."
44-
glide install --strip-vendor
45+
#glide install --strip-vendor
46+
go mod vendor
4547
go get github.com/pierrre/gotestcover
4648

4749
.PHONY: fmt

OPENSOURCE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ golang.org/x/crypto,81e90905daefcd6fd217b62423c0908922eadb30
4444
golang.org/x/net,1c05540f6879653db88113bc4a2b70aec4bd491f
4545
golang.org/x/sys,a2e06a18b0d52d8cb2010e04b372a1965d8e3439
4646
golang.org/x/text,b19bf474d317b857955b12035d2c5acb57ce8b01
47+
google.golang.org/grpc,v1.27.0
4748
gopkg.in/go-playground/validator.v8,5f1438d3fca68893a817e4a66806cea46a9e4ebf
4849
gopkg.in/inf.v0,3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
4950
gopkg.in/natefinch/lumberjack.v2,a96e63847dc3c67d17befa69c303767e2f84e54f

cmd/provisioner/main.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ import (
1515
"strings"
1616
"time"
1717

18+
ibmprovider "github.com/IBM/ibmcloud-object-storage-plugin/ibm-provider/provider"
1819
s3fsprovisioner "github.com/IBM/ibmcloud-object-storage-plugin/provisioner"
1920
"github.com/IBM/ibmcloud-object-storage-plugin/utils/backend"
2021
cfg "github.com/IBM/ibmcloud-object-storage-plugin/utils/config"
22+
grpcClient "github.com/IBM/ibmcloud-object-storage-plugin/utils/grpc-client"
2123
log "github.com/IBM/ibmcloud-object-storage-plugin/utils/logger"
2224
"github.com/IBM/ibmcloud-object-storage-plugin/utils/uuid"
2325
"github.com/kubernetes-sigs/sig-storage-lib-external-provisioner/controller"
@@ -82,6 +84,18 @@ func main() {
8284
if err != nil {
8385
logger.Info("Failed to set flag:", zap.Error(err))
8486
}
87+
88+
s3fsprovisioner.SockEndpoint = flag.String(
89+
"endpoint",
90+
"/ibmprovider/provider.sock",
91+
"Provider endpoint",
92+
)
93+
94+
s3fsprovisioner.ConfigBucketAccessPolicy = flag.Bool(
95+
"bucketAccessPolicy",
96+
false,
97+
"set 'true' to configure bucket access policy",
98+
)
8599
flag.Parse()
86100

87101
// Enable debug trace
@@ -121,6 +135,9 @@ func main() {
121135

122136
s3fsProvisioner := &s3fsprovisioner.IBMS3fsProvisioner{
123137
Backend: &backend.COSSessionFactory{},
138+
GRPCBackend: &grpcClient.ConnObjFactory{},
139+
AccessPolicy: &backend.UpdateAPFactory{},
140+
IBMProvider: &ibmprovider.IBMProviderClntFactory{},
124141
Logger: logger,
125142
Client: clientset,
126143
UUIDGenerator: uuid.NewCryptoGenerator(),

driver/driver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const (
4040
SecretSecretKey = "secret-key"
4141
// SecretAPIKey is the key name for the IBM API Key (IAM Authentication)
4242
SecretAPIKey = "api-key"
43-
//SecretAllowedNS is the key name for the Allowed Namespace
43+
// SecretAllowedNS is the key name for the Allowed Namespace
4444
SecretAllowedNS = "allowed_ns"
4545
// SecretServiceInstanceID is the key name for the service instance ID (IAM Authentication)
4646
SecretServiceInstanceID = "service-instance-id"

go.mod

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
module github.com/IBM/ibmcloud-object-storage-plugin
2+
3+
go 1.13
4+
5+
require (
6+
github.com/BurntSushi/toml v0.3.1
7+
github.com/IBM/go-sdk-core/v3 v3.3.1
8+
github.com/IBM/ibm-cos-sdk-go v1.3.2
9+
github.com/IBM/ibm-cos-sdk-go-config v1.0.0
10+
github.com/coreos/go-systemd v0.0.0-00010101000000-000000000000 // indirect
11+
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
12+
github.com/godbus/dbus v4.1.0+incompatible // indirect
13+
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
14+
github.com/golang/protobuf v1.4.2
15+
github.com/google/btree v1.0.0 // indirect
16+
github.com/googleapis/gnostic v0.4.0 // indirect
17+
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
18+
github.com/hashicorp/golang-lru v0.5.4 // indirect
19+
github.com/imdario/mergo v0.3.9 // indirect
20+
github.com/jessevdk/go-flags v1.4.0
21+
github.com/kubernetes-sigs/sig-storage-lib-external-provisioner v2.2.0+incompatible
22+
github.com/miekg/dns v1.1.30 // indirect
23+
github.com/mitchellh/mapstructure v1.3.2 // indirect
24+
github.com/pborman/uuid v1.2.0 // indirect
25+
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
26+
github.com/pierrre/gotestcover v0.0.0-20160517101806-924dca7d15f0 // indirect
27+
github.com/pkg/errors v0.9.1 // indirect
28+
github.com/prometheus/client_golang v1.7.1 // indirect
29+
github.com/satori/go.uuid v1.2.0
30+
github.com/spf13/pflag v1.0.5 // indirect
31+
github.com/stretchr/testify v1.6.1
32+
go.uber.org/zap v1.15.0
33+
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 // indirect
34+
golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect
35+
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect
36+
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
37+
google.golang.org/appengine v1.6.6 // indirect
38+
google.golang.org/grpc v1.27.0
39+
google.golang.org/protobuf v1.23.0
40+
gopkg.in/inf.v0 v0.9.1 // indirect
41+
gopkg.in/natefinch/lumberjack.v2 v2.0.0
42+
gopkg.in/yaml.v2 v2.3.0 // indirect
43+
k8s.io/api v0.0.0-20190222213804-5cb15d344471
44+
k8s.io/apimachinery v0.0.0-20190221213512-86fb29eff628
45+
k8s.io/client-go v0.0.0-20190228174230-b40b2a5939e4
46+
k8s.io/klog v1.0.0 // indirect
47+
k8s.io/klog/v2 v2.3.0 // indirect
48+
k8s.io/kube-openapi v0.0.0-20200615155156-dffdd1682719 // indirect
49+
k8s.io/kubernetes v1.13.4 // indirect
50+
k8s.io/utils v0.0.0-20200619165400-6e3d28b6ed19 // indirect
51+
sigs.k8s.io/yaml v1.2.0 // indirect
52+
)
53+
54+
replace (
55+
github.com/coreos/go-systemd => github.com/coreos/go-systemd/v22 v22.1.0
56+
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.4.0
57+
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20181109181836-c59034cc13d5
58+
)

0 commit comments

Comments
 (0)