Skip to content

Commit

Permalink
Merge pull request #34 from e4jet/master
Browse files Browse the repository at this point in the history
Migrate repository to resemble other go projects
  • Loading branch information
e4jet authored May 17, 2018
2 parents ba064b8 + d168423 commit cef5aa0
Show file tree
Hide file tree
Showing 45 changed files with 145 additions and 110 deletions.
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
/bin/*
/src/github.com/*

.vscode/*
.vscode

src/nimblestorage/cmd/dory/dory
src/nimblestorage/vendor/*
cmd/dory/dory
vendor/*

dory
dory.sha256sum
doryd
doryd.sha256sum
68 changes: 28 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,12 @@
VERSION = 1.1.0

# Where our code lives
PKG_PATH = src/nimblestorage/pkg/
CMD_PATH = src/nimblestorage/cmd/
PKG_PATH = ./common/
CMD_PATH = ./cmd/

# This is the last 8 char of the commit id we're building from
COMMIT = $(shell git rev-parse HEAD| cut -b-8)

# This adds this repo as an entry in the GOPATH. This allows us to have a local
# GOPATH that contains the go tooling so we don't have to download
# it again each time we build.
ifndef $(GOPATH)
GOPATH = ${PWD}
else
GOPATH = $(GOPATH=$$GOPATH:{PWD} && echo $$GOPATH)
endif

# The version of make for OSX doesn't allow us to export, so
# we add these variables to the env in each invocation.
GOENV = GOPATH=$(GOPATH) PATH=$$PATH:$(GOPATH)/bin
Expand All @@ -51,7 +42,7 @@ LD_FLAGS = '-X main.Version=$(VERSION) -X main.Commit=$(COMMIT)'
LINTER_FLAGS = --vendor --disable-all --enable=vet --enable=vetshadow --enable=golint --enable=ineffassign --enable=goconst --enable=deadcode --enable=dupl --enable=varcheck --enable=gocyclo --enable=misspell

# list of packages
PACKAGE_LIST = $(shell export $(GOENV) && go list ./$(PKG_PATH)...)
PACKAGE_LIST = $(shell export $(GOENV) && go list ./$(PKG_PATH)...| grep -v vendor)
# list of commands
COMMAND_LIST = $(shell export $(GOENV) && go list ./$(CMD_PATH)...)

Expand All @@ -63,11 +54,11 @@ A3 = $(shell printf "»»»")
.PHONY: help
help:
@echo "Targets:"
@echo " gettools - Download and install go tooling required to build."
@echo " tools - Download and install go tooling required to build."
@echo " vendor - Download dependancies."
@echo " lint - Static analysis of source code. Note that this must pass in order to build."
@echo " test - Run unit tests."
@echo " clean - Remove bin and pkg."
@echo " clean - Remove binaries."
@echo " debug - Display make's view of the world."
@echo " dory - Build dory (FlexVolume driver)."
@echo " doryd - Build doryd (Provisioner)."
Expand All @@ -84,7 +75,7 @@ debug:
@echo " BUILD_ENV: $(BUILD_ENV)"
@echo " GOENV: $(GOENV)"

gettools: ; $(info $(A1) gettools)
tools: ; $(info $(A1) tools)
@echo "$(A2) get gometalinter"
export $(GOENV) && go get -u github.com/alecthomas/gometalinter
@echo "$(A2) install gometalinter"
Expand All @@ -93,10 +84,9 @@ gettools: ; $(info $(A1) gettools)
export $(GOENV) && go get -u github.com/Masterminds/glide
export $(GOENV) && go install github.com/Masterminds/glide

.PHONY: vendor
vendor: gettools; $(info $(A1) vendor)
vendor: tools; $(info $(A1) vendor)
@echo "$(A2) glide install"
export $(GOENV) && cd src/nimblestorage && glide install
export $(GOENV) && glide install

.PHONY: lint
lint: ; $(info $(A1) lint)
Expand All @@ -107,39 +97,37 @@ lint: ; $(info $(A1) lint)

.PHONY: clean
clean: ; $(info $(A1) clean)
@echo "$(A2) remove bin"
@rm -rf bin
@echo "$(A2) remove pkg"
@rm -rf pkg

bin: ; $(info $(A1) mkdir bin)
@mkdir bin

pkg: ; $(info $(A1) mkdir pkg)
@mkdir pkg

@echo "$(A2) remove dory"
@rm -f dory
@rm -f dory.sha256sum
@echo "$(A2) remove doryd"
@rm -f doryd
@rm -f doryd.sha256sum

.PHONY: test
test: ; $(info $(A1) test)
@echo "$(A2) Package unit tests"
for pkg in $(PACKAGE_LIST); do echo "»»» Testing $$pkg:" && export $(GOENV) $(TEST_ENV) && go test -cover ./src/$$pkg/; done
for pkg in $(PACKAGE_LIST); do echo "»»» Testing $$pkg:" && export $(GOENV) $(TEST_ENV) && go test -cover $$pkg; done
@echo "$(A2) Command unit tests"
for cmd in $(COMMAND_LIST); do echo "»»» Testing $$cmd:" && export $(GOENV) $(TEST_ENV) && go test -cover ./src/$$cmd/; done
for cmd in $(COMMAND_LIST); do echo "»»» Testing $$cmd:" && export $(GOENV) $(TEST_ENV) && go test -cover $$cmd; done

dory: bin pkg lint; $(info $(A1) dory)
dory: lint; $(info $(A1) dory)
@echo "$(A2) build dory"
cd bin && export $(GOENV) $(BUILD_ENV) && go build -ldflags $(LD_FLAGS) ../$(CMD_PATH)dory/dory.go
export $(GOENV) $(BUILD_ENV) && go build -ldflags $(LD_FLAGS) $(CMD_PATH)dory/dory.go
@echo "$(A2) sha256sum dory"
sha256sum bin/dory > bin/dory.sha256sum
@cat bin/dory.sha256sum
sha256sum dory > dory.sha256sum
@cat dory.sha256sum

doryd: bin pkg lint; $(info $(A1) dory)
doryd: lint; $(info $(A1) dory)
@echo "$(A2) build doryd"
cd bin && export $(GOENV) $(BUILD_ENV) && go build -ldflags $(LD_FLAGS) ../$(CMD_PATH)doryd/doryd.go
export $(GOENV) $(BUILD_ENV) && go build -ldflags $(LD_FLAGS) $(CMD_PATH)doryd/doryd.go
@echo "$(A2) sha256sum doryd"
sha256sum bin/doryd > bin/doryd.sha256sum
@cat bin/doryd.sha256sum
sha256sum doryd > doryd.sha256sum
@cat doryd.sha256sum

.PHONY: doryd_docker
doryd_docker: doryd; $(info $(A1) doryd_docker)
@echo "$(A2) rm current doryd image"
-docker image rm kube-storage-controller:edge
@echo "$(A2) build doryd image"
-docker build -t kube-storage-controller:edge -f src/nimblestorage/cmd/doryd/Dockerfile .
docker build -t kube-storage-controller:edge -f ./build/docker/doryd/Dockerfile .
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Kubernetes Flexvolume Driver and StorageClass Provisioner for Docker Volume Plugins
Repository for Dory and Doryd: The FlexVolume driver and StorageClass provisioner for Kubernetes using *any* Docker Volume API compatible plugin. This is [Open Source Software](LICENSE) from [HPE DEV](https://developer.hpe.com).

# Dory
Repository for Dory and Doryd: The [FlexVolume](https://kubernetes.io/docs/concepts/storage/volumes/#out-of-tree-volume-plugins) driver and [Dynamic Volume Provisioner](https://kubernetes.io/docs/concepts/storage/dynamic-provisioning/) for Kubernetes using *any* Docker Volume API compatible plugin. This is [Open Source Software](LICENSE) from [HPE DEV](https://developer.hpe.com).

## Dory

Dory is a driver for the [Kubernetes FlexVolume](https://github.com/kubernetes/community/blob/master/contributors/devel/flexvolume.md) Volume type. This driver translates Flexvolume requests to [Docker Volume Plugin](https://docs.docker.com/engine/extend/plugins_volume/) requests. This allows the administrator to leverage [existing legacy Docker Volume Plugins](https://docs.docker.com/engine/extend/legacy_plugins/) or [existing managed Docker Volume Plugins](https://store.docker.com/search?category=volume&q=&type=plugin) in a Kubernetes cluster. Managed plugins require Docker 1.13. Dory provides the ability to 'just in time' provision storage as well as have the orchestrator automatically attach/mount and detach/unmount Persistent Volumes.

* Dory [documentation](docs/dory/README.md)
* Binary releases:
* [Master](http://dl.bintray.com/hpe-storage/dory/dory-master) (latest)
* [1.0](http://dl.bintray.com/hpe-storage/dory/dory-1.0)

# Doryd
## Doryd

Doryd is a implementation of the [Out-of-tree provisioner](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/storage/volume-provisioning.md) that dynamically provisions persistent storage using the [Docker Volume Plugin API](https://docs.docker.com/engine/extend/plugins_volume/).

* Doryd [documentation](docs/doryd/README.md)
Expand All @@ -18,20 +21,24 @@ Doryd is a implementation of the [Out-of-tree provisioner](https://github.com/ku
* Container image:
* [doryd](https://hub.docker.com/r/nimblestorage/doryd/)

# Plugins
## Plugins

To better help end-users navigate around the storage landcape we've composed a page to help keep track of what Docker Volume plugins are known to work well and some record keeping on issues/gotchas with the specific plugin.

* [Plugins known to work](docs/plugins/README.md)

# Project
## Project

Why is the project called Dory? Because [Dory speaks whale](https://www.google.com/search?q=Dory+speaks+whale).

What about the [Container Storage Interface](https://github.com/container-storage-interface/)? The CSI is certainly the future for container storage. Dory provides a stop gap while the CSI specification is ratified, orchestrators begin supporting it, and implementations begin to surface.

# Thanks
## Thanks

Thank you to [Chakravarthy Nelluri](https://github.com/chakri-nelluri) for all his work on [Flexvolume](https://github.com/kubernetes/kubernetes/commit/fa76de79e5d1670b8e6add30f0159c833534a298#diff-af00671c74d885ce20891c24516198e8) which has made this 'out of tree' work possible.

Thank you to [Michael Mattsson](https://community.hpe.com/t5/user/viewprofilepage/user-id/1879662), TME extraordinaire, for his help testing and for writing a [blog post](https://community.hpe.com/t5/HPE-Nimble-Storage-Tech-Blog/Tech-Preview-Bringing-Nimble-Storage-to-Kubernetes-and-OpenShift/ba-p/6986748) about what we were up to.

# Licensing
## Licensing

Dory and Doryd is licensed under the Apache License, Version 2.0. Please see [LICENSE](LICENSE) for the full license text.
2 changes: 1 addition & 1 deletion build/docker/doryd/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:latest
ADD [ "bin/doryd", "/usr/local/bin/doryd" ]
ADD [ "doryd", "/usr/local/bin/doryd" ]
ENTRYPOINT [ "doryd" ]
CMD [ "/etc/kubernetes/admin.conf", "dev.hpe.com" ]
8 changes: 4 additions & 4 deletions src/nimblestorage/cmd/dory/dory.go → cmd/dory/dory.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ package main

import (
"fmt"
"nimblestorage/pkg/docker/dockervol"
"nimblestorage/pkg/jconfig"
flexvol "nimblestorage/pkg/k8s/flexvol"
"nimblestorage/pkg/util"
"github.com/hpe-storage/dory/common/docker/dockervol"
"github.com/hpe-storage/dory/common/jconfig"
flexvol "github.com/hpe-storage/dory/common/k8s/flexvol"
"github.com/hpe-storage/dory/common/util"
"os"
"path/filepath"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/nimblestorage/cmd/doryd/doryd.go → cmd/doryd/doryd.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ package main

import (
"fmt"
"github.com/hpe-storage/dory/common/k8s/provisioner"
"github.com/hpe-storage/dory/common/util"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"nimblestorage/pkg/k8s/provisioner"
"nimblestorage/pkg/util"
"os"
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package chain

import (
"fmt"
"nimblestorage/pkg/util"
"github.com/hpe-storage/dory/common/util"
"testing"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/hpe-storage/dory/common/util"
"io"
"net"
"net/http"
"nimblestorage/pkg/util"
"strings"
"time"
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ limitations under the License.
package dockerlt

import (
"nimblestorage/pkg/connectivity"
"nimblestorage/pkg/util"
"github.com/hpe-storage/dory/common/connectivity"
"github.com/hpe-storage/dory/common/util"
)

const (
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package dockervol

import (
"fmt"
"nimblestorage/pkg/connectivity"
"nimblestorage/pkg/docker/dockerlt"
"nimblestorage/pkg/util"
"github.com/hpe-storage/dory/common/connectivity"
"github.com/hpe-storage/dory/common/docker/dockerlt"
"github.com/hpe-storage/dory/common/util"
"strings"
"time"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package flexvol
import (
"encoding/json"
"fmt"
"nimblestorage/pkg/docker/dockervol"
"nimblestorage/pkg/linux"
"nimblestorage/pkg/util"
"github.com/hpe-storage/dory/common/docker/dockervol"
"github.com/hpe-storage/dory/common/linux"
"github.com/hpe-storage/dory/common/util"
"os"
"path/filepath"
"regexp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package flexvol

import (
"fmt"
"nimblestorage/pkg/util"
"github.com/hpe-storage/dory/common/util"
)

// Handle the conversion of flexvol commands and args to docker volume
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ package provisioner

import (
"fmt"
"github.com/hpe-storage/dory/common/util"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
api_v1 "k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/cache"
"nimblestorage/pkg/util"
"strings"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ package provisioner

import (
"fmt"
"github.com/hpe-storage/dory/common/util"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/kubernetes"
storage_v1 "k8s.io/client-go/pkg/apis/storage/v1"
storage_v1beta1 "k8s.io/client-go/pkg/apis/storage/v1beta1"
"k8s.io/client-go/tools/cache"
"nimblestorage/pkg/util"
)

func (p *Provisioner) listAllClasses(options meta_v1.ListOptions) (runtime.Object, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package provisioner

import (
"fmt"
"github.com/hpe-storage/dory/common/chain"
"github.com/hpe-storage/dory/common/util"
api_v1 "k8s.io/client-go/pkg/api/v1"
"nimblestorage/pkg/chain"
"nimblestorage/pkg/util"
"reflect"
"time"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ package provisioner

import (
"fmt"
"github.com/hpe-storage/dory/common/chain"
"github.com/hpe-storage/dory/common/docker/dockervol"
"github.com/hpe-storage/dory/common/jconfig"
"github.com/hpe-storage/dory/common/util"
uuid "github.com/satori/go.uuid"
resource_v1 "k8s.io/apimachinery/pkg/api/resource"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -31,10 +35,6 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"math/rand"
"nimblestorage/pkg/chain"
"nimblestorage/pkg/docker/dockervol"
"nimblestorage/pkg/jconfig"
"nimblestorage/pkg/util"
"reflect"
"strings"
"sync"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package provisioner

import (
"github.com/hpe-storage/dory/common/docker/dockervol"
resource_v1 "k8s.io/apimachinery/pkg/api/resource"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
api_v1 "k8s.io/client-go/pkg/api/v1"
storage_v1 "k8s.io/client-go/pkg/apis/storage/v1"
rest "k8s.io/client-go/rest"
"nimblestorage/pkg/docker/dockervol"
"testing"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package provisioner

import (
"fmt"
"github.com/hpe-storage/dory/common/util"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
Expand All @@ -26,7 +27,6 @@ import (
"k8s.io/client-go/pkg/api/v1/ref"
storage_v1 "k8s.io/client-go/pkg/apis/storage/v1"
"k8s.io/client-go/tools/cache"
"nimblestorage/pkg/util"
"strings"
)

Expand Down
Loading

0 comments on commit cef5aa0

Please sign in to comment.