Skip to content

Commit

Permalink
Merge pull request #117 from washcycle/washcycle/issue115
Browse files Browse the repository at this point in the history
Validations to Pass CSI Sanity Tests and Script
  • Loading branch information
chrislusf authored Apr 27, 2023
2 parents 3b65626 + 63378de commit d777b87
Show file tree
Hide file tree
Showing 10 changed files with 1,942 additions and 278 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.vscode
*.iml

# go
__debug_bin
26 changes: 15 additions & 11 deletions cmd/seaweedfs-csi-driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ var (
nodeID = flag.String("nodeid", "", "node id")
version = flag.Bool("version", false, "Print the version and exit.")
concurrentWriters = flag.Int("concurrentWriters", 32, "limit concurrent goroutine writers if not 0")
cacheCapacityMB = flag.Int("cacheCapacityMB", 0, "local file chunk cache capacity in MB")
cacheCapacityMB = flag.Int("cacheCapacityMB", 0, "local file chunk cache capacity in MB")
cacheDir = flag.String("cacheDir", os.TempDir(), "local cache directory for file chunks and meta data")
uidMap = flag.String("map.uid", "", "map local uid to uid on filer, comma-separated <local_uid>:<filer_uid>")
gidMap = flag.String("map.gid", "", "map local gid to gid on filer, comma-separated <local_gid>:<filer_gid>")
dataCenter = flag.String("dataCenter", "", "dataCenter this node is running in (locality-definition)")
dataLocalityStr = flag.String("dataLocality", "", "which volume-nodes pods will use for activity (one-of: 'write_preferLocalDc'). Requires used locality-definitions to be set")
dataCenter = flag.String("dataCenter", "", "dataCenter this node is running in (locality-definition)")
dataLocalityStr = flag.String("dataLocality", "", "which volume-nodes pods will use for activity (one-of: 'write_preferLocalDc'). Requires used locality-definitions to be set")
dataLocality datalocality.DataLocality
)

Expand All @@ -40,15 +40,15 @@ func main() {
}

err := convertRequiredValues()
if(err != nil){
glog.Error("Failed converting flag: ", err);
os.Exit(1);
if err != nil {
glog.Error("Failed converting flag: ", err)
os.Exit(1)
}

err = checkPreconditions()
if(err != nil){
glog.Error("Precondition failed: ", err);
os.Exit(1);
if err != nil {
glog.Error("Precondition failed: ", err)
os.Exit(1)
}

glog.Infof("connect to filer %s", *filer)
Expand All @@ -67,10 +67,10 @@ func main() {

func convertRequiredValues() error {
// Convert DataLocalityStr to DataLocality
if(*dataLocalityStr != ""){
if *dataLocalityStr != "" {
var ok bool
dataLocality, ok = datalocality.FromString(*dataLocalityStr)
if(!ok){
if !ok {
return fmt.Errorf("dataLocality invalid value")
}
}
Expand All @@ -83,5 +83,9 @@ func checkPreconditions() error {
return err
}

if len(*nodeID) == 0 {
return fmt.Errorf("driver requires node id to be set, use -nodeid=")
}

return nil
}
34 changes: 17 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,50 @@ require (
google.golang.org/grpc v1.54.0
)

require github.com/seaweedfs/seaweedfs v0.0.0-20230417045743-8ecdf958ab05

require github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd // indirect
require (
github.com/seaweedfs/seaweedfs v0.0.0-20230417045743-8ecdf958ab05
k8s.io/client-go v0.27.1
k8s.io/klog v1.0.0
k8s.io/utils v0.0.0-20230209194617-a36077c30491
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/disintegration/imaging v1.6.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-errors/errors v1.1.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/seaweedfs/goexif v2.0.0+incompatible // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/seaweedfs/goexif v1.0.3 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.15.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/viant/ptrie v0.3.0 // indirect
github.com/viant/toolbox v0.34.5 // indirect
golang.org/x/crypto v0.7.0 // indirect
github.com/viant/toolbox v0.33.2 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/image v0.6.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sys v0.7.0 // indirect
Expand All @@ -56,18 +60,14 @@ require (
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230320184635-7606e756e683 // indirect
google.golang.org/grpc/security/advancedtls v0.0.0-20230321232853-a02aae6168aa // indirect
google.golang.org/grpc/security/advancedtls v0.0.0-20220622233350-5cdb09fa29c1 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.26.3 // indirect
k8s.io/client-go v0.26.3
k8s.io/klog v1.0.0
k8s.io/apimachinery v0.27.1 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/utils v0.0.0-20230313181309-38a27ef9d749
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
Expand Down
Loading

0 comments on commit d777b87

Please sign in to comment.