diff --git a/Gopkg.lock b/Gopkg.lock new file mode 100644 index 00000000..6753c04b --- /dev/null +++ b/Gopkg.lock @@ -0,0 +1,813 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + branch = "master" + digest = "1:707ebe952a8b3d00b343c01536c79c73771d100f63ec6babeaed5c79e2b8a8dd" + name = "github.com/beorn7/perks" + packages = ["quantile"] + pruneopts = "NUT" + revision = "3a771d992973f24aa725d07868b467d1ddfceafb" + +[[projects]] + digest = "1:94ffc0947c337d618b6ff5ed9abaddc1217b090c1b3a1ae4739b35b7b25851d5" + name = "github.com/container-storage-interface/spec" + packages = ["lib/go/csi"] + pruneopts = "NUT" + revision = "ed0bb0e1557548aa028307f48728767cfe8f6345" + version = "v1.0.0" + +[[projects]] + digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec" + name = "github.com/davecgh/go-spew" + packages = ["spew"] + pruneopts = "NUT" + revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73" + version = "v1.1.1" + +[[projects]] + digest = "1:4189ee6a3844f555124d9d2656fe7af02fca961c2a9bad9074789df13a0c62e0" + name = "github.com/docker/distribution" + packages = [ + "digestset", + "reference", + ] + pruneopts = "NUT" + revision = "5db89f0ca68677abc5eefce8f2a0a772c98ba52d" + +[[projects]] + digest = "1:8679b8a64f3613e9749c5640c3535c83399b8e69f67ce54d91dc73f6d77373af" + name = "github.com/gogo/protobuf" + packages = [ + "proto", + "sortkeys", + ] + pruneopts = "NUT" + revision = "636bf0302bc95575d69441b25a2603156ffdddf1" + version = "v1.1.1" + +[[projects]] + branch = "master" + digest = "1:e2b86e41f3d669fc36b50d31d32d22c8ac656c75aa5ea89717ce7177e134ff2a" + name = "github.com/golang/glog" + packages = ["."] + pruneopts = "NUT" + revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" + +[[projects]] + branch = "master" + digest = "1:3fb07f8e222402962fa190eb060608b34eddfb64562a18e2167df2de0ece85d8" + name = "github.com/golang/groupcache" + packages = ["lru"] + pruneopts = "NUT" + revision = "c65c006176ff7ff98bb916961c7abbc6b0afc0aa" + +[[projects]] + digest = "1:bff0ce7c8e3d6357fa5a8549bbe4bdb620bddc13c11ae569aa7248ea92e2139f" + name = "github.com/golang/protobuf" + packages = [ + "descriptor", + "proto", + "protoc-gen-go/descriptor", + "ptypes", + "ptypes/any", + "ptypes/duration", + "ptypes/timestamp", + "ptypes/wrappers", + ] + pruneopts = "NUT" + revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5" + version = "v1.2.0" + +[[projects]] + branch = "master" + digest = "1:05f95ffdfcf651bdb0f05b40b69e7f5663047f8da75c72d58728acb59b5cc107" + name = "github.com/google/btree" + packages = ["."] + pruneopts = "NUT" + revision = "4030bb1f1f0c35b30ca7009e9ebd06849dd45306" + +[[projects]] + branch = "master" + digest = "1:52c5834e2bebac9030c97cc0798ac11c3aa8a39f098aeb419f142533da6cd3cc" + name = "github.com/google/gofuzz" + packages = ["."] + pruneopts = "NUT" + revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1" + +[[projects]] + digest = "1:06a7dadb7b760767341ffb6c8d377238d68a1226f2b21b5d497d2e3f6ecf6b4e" + name = "github.com/googleapis/gnostic" + packages = [ + "OpenAPIv2", + "compiler", + "extensions", + ] + pruneopts = "NUT" + revision = "7c663266750e7d82587642f65e60bc4083f1f84e" + version = "v0.2.0" + +[[projects]] + branch = "master" + digest = "1:7fdf3223c7372d1ced0b98bf53457c5e89d89aecbad9a77ba9fcc6e01f9e5621" + name = "github.com/gregjones/httpcache" + packages = [ + ".", + "diskcache", + ] + pruneopts = "NUT" + revision = "c63ab54fda8f77302f8d414e19933f2b6026a089" + +[[projects]] + digest = "1:b42cde0e1f3c816dd57f57f7bbcf05ca40263ad96f168714c130c611fc0856a6" + name = "github.com/hashicorp/golang-lru" + packages = [ + ".", + "simplelru", + ] + pruneopts = "NUT" + revision = "20f1fb78b0740ba8c3cb143a61e86ba5c8669768" + version = "v0.5.0" + +[[projects]] + digest = "1:406338ad39ab2e37b7f4452906442a3dbf0eb3379dd1f06aafb5c07e769a5fbb" + name = "github.com/inconshreveable/mousetrap" + packages = ["."] + pruneopts = "NUT" + revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75" + version = "v1.0" + +[[projects]] + digest = "1:8e36686e8b139f8fe240c1d5cf3a145bc675c22ff8e707857cdd3ae17b00d728" + name = "github.com/json-iterator/go" + packages = ["."] + pruneopts = "NUT" + revision = "1624edc4454b8682399def8740d46db5e4362ba4" + version = "v1.1.5" + +[[projects]] + digest = "1:2b060bb1a39127e592baf9ab62ec1e94100dc22107f915183f3cd1f6d1cd579a" + name = "github.com/kubernetes-csi/csi-lib-utils" + packages = ["protosanitizer"] + pruneopts = "NUT" + revision = "5853414e1d4771302e0df10d1870c444c2135799" + version = "v0.2.0" + +[[projects]] + digest = "1:0bde3fb932a1aa4e12bc43ef91157fcda27dd0fc5d9f309647544ceaec075f48" + name = "github.com/kubernetes-csi/drivers" + packages = ["pkg/csi-common"] + pruneopts = "NUT" + revision = "8a4ae6feb47cf7ae29b3dab9e3dc3d1ff796fbf2" + version = "v1.0.2" + +[[projects]] + digest = "1:5985ef4caf91ece5d54817c11ea25f182697534f8ae6521eadcd628c142ac4b6" + name = "github.com/matttproud/golang_protobuf_extensions" + packages = ["pbutil"] + pruneopts = "NUT" + revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c" + version = "v1.0.1" + +[[projects]] + digest = "1:2f42fa12d6911c7b7659738758631bec870b7e9b4c6be5444f963cdcfccc191f" + name = "github.com/modern-go/concurrent" + packages = ["."] + pruneopts = "NUT" + revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94" + version = "1.0.3" + +[[projects]] + digest = "1:c6aca19413b13dc59c220ad7430329e2ec454cc310bc6d8de2c7e2b93c18a0f6" + name = "github.com/modern-go/reflect2" + packages = ["."] + pruneopts = "NUT" + revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd" + version = "1.0.1" + +[[projects]] + digest = "1:e0cc8395ea893c898ff5eb0850f4d9851c1f57c78c232304a026379a47a552d0" + name = "github.com/opencontainers/go-digest" + packages = ["."] + pruneopts = "NUT" + revision = "279bed98673dd5bef374d3b6e4b09e2af76183bf" + version = "v1.0.0-rc1" + +[[projects]] + branch = "master" + digest = "1:3bf17a6e6eaa6ad24152148a631d18662f7212e21637c2699bff3369b7f00fa2" + name = "github.com/petar/GoLLRB" + packages = ["llrb"] + pruneopts = "NUT" + revision = "53be0d36a84c2a886ca057d34b6aa4468df9ccb4" + +[[projects]] + digest = "1:6c6d91dc326ed6778783cff869c49fb2f61303cdd2ebbcf90abe53505793f3b6" + name = "github.com/peterbourgon/diskv" + packages = ["."] + pruneopts = "NUT" + revision = "5f041e8faa004a95c88a202771f4cc3e991971e6" + version = "v2.0.1" + +[[projects]] + digest = "1:893285692476c11ae691503b82c2f2b72f4838305dc0f4d83ea3d9287e5e3a51" + name = "github.com/prometheus/client_golang" + packages = [ + "prometheus", + "prometheus/internal", + ] + pruneopts = "NUT" + revision = "abad2d1bd44235a26707c172eab6bca5bf2dbad3" + version = "v0.9.1" + +[[projects]] + branch = "master" + digest = "1:2d5cd61daa5565187e1d96bae64dbbc6080dacf741448e9629c64fd93203b0d4" + name = "github.com/prometheus/client_model" + packages = ["go"] + pruneopts = "NUT" + revision = "5c3871d89910bfb32f5fcab2aa4b9ec68e65a99f" + +[[projects]] + branch = "master" + digest = "1:06375f3b602de9c99fa99b8484f0e949fd5273e6e9c6592b5a0dd4cd9085f3ea" + name = "github.com/prometheus/common" + packages = [ + "expfmt", + "internal/bitbucket.org/ww/goautoneg", + "model", + ] + pruneopts = "NUT" + revision = "41aa239b4cce3c56ab88fc366ae8b0a6423fa239" + +[[projects]] + branch = "master" + digest = "1:102dea0c03a915acfc634b7c67f2662012b5483b56d9025e33f5188e112759b6" + name = "github.com/prometheus/procfs" + packages = [ + ".", + "internal/util", + "nfs", + "xfs", + ] + pruneopts = "NUT" + revision = "185b4288413d2a0dd0806f78c90dde719829e5ae" + +[[projects]] + digest = "1:343d44e06621142ab09ae0c76c1799104cdfddd3ffb445d78b1adf8dc3ffaf3d" + name = "github.com/spf13/cobra" + packages = ["."] + pruneopts = "NUT" + revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385" + version = "v0.0.3" + +[[projects]] + digest = "1:9d8420bbf131d1618bde6530af37c3799340d3762cc47210c1d9532a4c3a2779" + name = "github.com/spf13/pflag" + packages = ["."] + pruneopts = "NUT" + revision = "298182f68c66c05229eb03ac171abe6e309ee79a" + version = "v1.0.3" + +[[projects]] + branch = "master" + digest = "1:8e241498e35f550e5192ee6b1f6ff2c0a7ffe81feff9541d297facffe1383979" + name = "golang.org/x/crypto" + packages = [ + "ed25519", + "ed25519/internal/edwards25519", + "pbkdf2", + "ssh/terminal", + ] + pruneopts = "NUT" + revision = "3d3f9f413869b949e48070b5bc593aa22cc2b8f2" + +[[projects]] + branch = "master" + digest = "1:82c792687e3b34cbc9c2ccc0bc10fe29d5011e85f6482d2737043bfb4a6160c3" + name = "golang.org/x/net" + packages = [ + "context", + "context/ctxhttp", + "http/httpguts", + "http2", + "http2/hpack", + "idna", + "internal/timeseries", + "trace", + ] + pruneopts = "NUT" + revision = "88d92db4c548972d942ac2a3531a8a9a34c82ca6" + +[[projects]] + branch = "master" + digest = "1:208fa2a5bef7c22d8b50ec312ef469b2abaa5afeb9e04fe4d27bf28952bceab7" + name = "golang.org/x/oauth2" + packages = [ + ".", + "internal", + ] + pruneopts = "NUT" + revision = "f42d05182288abf10faef86d16c0d07b8d40ea2d" + +[[projects]] + branch = "master" + digest = "1:6eac76de26138eb5049ffa3f3a8d4cf394cf626812b7d9b31308301e24bc9840" + name = "golang.org/x/sys" + packages = [ + "unix", + "windows", + ] + pruneopts = "NUT" + revision = "66b7b1311ac80bbafcd2daeef9a5e6e2cd1e2399" + +[[projects]] + digest = "1:e7071ed636b5422cc51c0e3a6cebc229d6c9fffc528814b519a980641422d619" + name = "golang.org/x/text" + packages = [ + "collate", + "collate/build", + "internal/colltab", + "internal/gen", + "internal/tag", + "internal/triegen", + "internal/ucd", + "language", + "secure/bidirule", + "transform", + "unicode/bidi", + "unicode/cldr", + "unicode/norm", + "unicode/rangetable", + ] + pruneopts = "NUT" + revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" + version = "v0.3.0" + +[[projects]] + branch = "master" + digest = "1:9fdc2b55e8e0fafe4b41884091e51e77344f7dc511c5acedcfd98200003bff90" + name = "golang.org/x/time" + packages = ["rate"] + pruneopts = "NUT" + revision = "85acf8d2951cb2a3bde7632f9ff273ef0379bcbd" + +[[projects]] + digest = "1:655acbef8faad33db29b6a35655341fb4a594e87e56635f05a3e70ed0bd7bd95" + name = "google.golang.org/appengine" + packages = [ + "internal", + "internal/base", + "internal/datastore", + "internal/log", + "internal/remote_api", + "internal/urlfetch", + "urlfetch", + ] + pruneopts = "NUT" + revision = "4a4468ece617fc8205e99368fa2200e9d1fad421" + version = "v1.3.0" + +[[projects]] + branch = "master" + digest = "1:56b0bca90b7e5d1facf5fbdacba23e4e0ce069d25381b8e2f70ef1e7ebfb9c1a" + name = "google.golang.org/genproto" + packages = ["googleapis/rpc/status"] + pruneopts = "NUT" + revision = "b5d43981345bdb2c233eb4bf3277847b48c6fdc6" + +[[projects]] + digest = "1:2f91d3e11b666570f8c923912f1cc8cf2f0c6b7371b2687ee67a8f73f08c6272" + name = "google.golang.org/grpc" + packages = [ + ".", + "balancer", + "balancer/base", + "balancer/roundrobin", + "codes", + "connectivity", + "credentials", + "encoding", + "encoding/proto", + "grpclog", + "internal", + "internal/backoff", + "internal/channelz", + "internal/envconfig", + "internal/grpcrand", + "internal/transport", + "keepalive", + "metadata", + "naming", + "peer", + "resolver", + "resolver/dns", + "resolver/passthrough", + "stats", + "status", + "tap", + ] + pruneopts = "NUT" + revision = "2e463a05d100327ca47ac218281906921038fd95" + version = "v1.16.0" + +[[projects]] + digest = "1:2d1fbdc6777e5408cabeb02bf336305e724b925ff4546ded0fa8715a7267922a" + name = "gopkg.in/inf.v0" + packages = ["."] + pruneopts = "NUT" + revision = "d2d2541c53f18d2a059457998ce2876cc8e67cbf" + version = "v0.9.1" + +[[projects]] + digest = "1:812f9446bc99ebd1c66c55fa456ff7843f7105d22f11f0a2098bced37e9c6d32" + name = "gopkg.in/square/go-jose.v2" + packages = [ + ".", + "cipher", + "json", + "jwt", + ] + pruneopts = "NUT" + revision = "ef984e69dd356202fd4e4910d4d9c24468bdf0b8" + version = "v2.1.9" + +[[projects]] + digest = "1:7c95b35057a0ff2e19f707173cc1a947fa43a6eb5c4d300d196ece0334046082" + name = "gopkg.in/yaml.v2" + packages = ["."] + pruneopts = "NUT" + revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183" + version = "v2.2.1" + +[[projects]] + digest = "1:c6b0cfc418f5e8bb9169d78f1024cb1c9f3e61c9a76235134d26d3f28ecdf27b" + name = "k8s.io/api" + packages = [ + "admissionregistration/v1alpha1", + "admissionregistration/v1beta1", + "apps/v1", + "apps/v1beta1", + "apps/v1beta2", + "authentication/v1", + "authentication/v1beta1", + "authorization/v1", + "authorization/v1beta1", + "autoscaling/v1", + "autoscaling/v2beta1", + "autoscaling/v2beta2", + "batch/v1", + "batch/v1beta1", + "batch/v2alpha1", + "certificates/v1beta1", + "coordination/v1beta1", + "core/v1", + "events/v1beta1", + "extensions/v1beta1", + "networking/v1", + "policy/v1beta1", + "rbac/v1", + "rbac/v1alpha1", + "rbac/v1beta1", + "scheduling/v1alpha1", + "scheduling/v1beta1", + "settings/v1alpha1", + "storage/v1", + "storage/v1alpha1", + "storage/v1beta1", + ] + pruneopts = "NUT" + revision = "fd83cbc87e7632ccd8bbab63d2b673d4e0c631cc" + version = "kubernetes-1.12.0" + +[[projects]] + digest = "1:aff2ac035da399e2ccd6d58a0c484f87a52c82868b652397727c2ce1a3aba7f0" + name = "k8s.io/apiextensions-apiserver" + packages = ["pkg/features"] + pruneopts = "NUT" + revision = "1748dfb29e8a4432b78514bc88a1b07937a9805a" + version = "kubernetes-1.12.0" + +[[projects]] + branch = "master" + digest = "1:9f522809581fab07c2383edb5f41929145350f8b9d4a64c40751f08e7cf6db62" + name = "k8s.io/apimachinery" + packages = [ + "pkg/api/equality", + "pkg/api/errors", + "pkg/api/meta", + "pkg/api/resource", + "pkg/api/validation", + "pkg/apis/meta/internalversion", + "pkg/apis/meta/v1", + "pkg/apis/meta/v1/unstructured", + "pkg/apis/meta/v1/validation", + "pkg/apis/meta/v1beta1", + "pkg/conversion", + "pkg/conversion/queryparams", + "pkg/fields", + "pkg/labels", + "pkg/runtime", + "pkg/runtime/schema", + "pkg/runtime/serializer", + "pkg/runtime/serializer/json", + "pkg/runtime/serializer/protobuf", + "pkg/runtime/serializer/recognizer", + "pkg/runtime/serializer/streaming", + "pkg/runtime/serializer/versioning", + "pkg/selection", + "pkg/types", + "pkg/util/cache", + "pkg/util/clock", + "pkg/util/diff", + "pkg/util/errors", + "pkg/util/framer", + "pkg/util/intstr", + "pkg/util/json", + "pkg/util/mergepatch", + "pkg/util/naming", + "pkg/util/net", + "pkg/util/rand", + "pkg/util/runtime", + "pkg/util/sets", + "pkg/util/strategicpatch", + "pkg/util/validation", + "pkg/util/validation/field", + "pkg/util/wait", + "pkg/util/yaml", + "pkg/version", + "pkg/watch", + "third_party/forked/golang/json", + "third_party/forked/golang/reflect", + ] + pruneopts = "NUT" + revision = "2a7c9300402896b3c073f2f47df85527c94f83a0" + +[[projects]] + digest = "1:8285cd6d67d73b472edef0dc1f1efe9222fee6e139297ff12fa14c736a10805c" + name = "k8s.io/apiserver" + packages = [ + "pkg/authentication/authenticator", + "pkg/authentication/serviceaccount", + "pkg/authentication/user", + "pkg/features", + "pkg/util/feature", + ] + pruneopts = "NUT" + revision = "e85ad7b666fef0476185731329f4cff1536efff8" + version = "kubernetes-1.12.0" + +[[projects]] + digest = "1:bd3606a851e3f8ec9575d59508378727124d5399e2404706da4a8ef9ab03bdfe" + name = "k8s.io/client-go" + packages = [ + "discovery", + "informers", + "informers/admissionregistration", + "informers/admissionregistration/v1alpha1", + "informers/admissionregistration/v1beta1", + "informers/apps", + "informers/apps/v1", + "informers/apps/v1beta1", + "informers/apps/v1beta2", + "informers/autoscaling", + "informers/autoscaling/v1", + "informers/autoscaling/v2beta1", + "informers/autoscaling/v2beta2", + "informers/batch", + "informers/batch/v1", + "informers/batch/v1beta1", + "informers/batch/v2alpha1", + "informers/certificates", + "informers/certificates/v1beta1", + "informers/coordination", + "informers/coordination/v1beta1", + "informers/core", + "informers/core/v1", + "informers/events", + "informers/events/v1beta1", + "informers/extensions", + "informers/extensions/v1beta1", + "informers/internalinterfaces", + "informers/networking", + "informers/networking/v1", + "informers/policy", + "informers/policy/v1beta1", + "informers/rbac", + "informers/rbac/v1", + "informers/rbac/v1alpha1", + "informers/rbac/v1beta1", + "informers/scheduling", + "informers/scheduling/v1alpha1", + "informers/scheduling/v1beta1", + "informers/settings", + "informers/settings/v1alpha1", + "informers/storage", + "informers/storage/v1", + "informers/storage/v1alpha1", + "informers/storage/v1beta1", + "kubernetes", + "kubernetes/scheme", + "kubernetes/typed/admissionregistration/v1alpha1", + "kubernetes/typed/admissionregistration/v1beta1", + "kubernetes/typed/apps/v1", + "kubernetes/typed/apps/v1beta1", + "kubernetes/typed/apps/v1beta2", + "kubernetes/typed/authentication/v1", + "kubernetes/typed/authentication/v1beta1", + "kubernetes/typed/authorization/v1", + "kubernetes/typed/authorization/v1beta1", + "kubernetes/typed/autoscaling/v1", + "kubernetes/typed/autoscaling/v2beta1", + "kubernetes/typed/autoscaling/v2beta2", + "kubernetes/typed/batch/v1", + "kubernetes/typed/batch/v1beta1", + "kubernetes/typed/batch/v2alpha1", + "kubernetes/typed/certificates/v1beta1", + "kubernetes/typed/coordination/v1beta1", + "kubernetes/typed/core/v1", + "kubernetes/typed/events/v1beta1", + "kubernetes/typed/extensions/v1beta1", + "kubernetes/typed/networking/v1", + "kubernetes/typed/policy/v1beta1", + "kubernetes/typed/rbac/v1", + "kubernetes/typed/rbac/v1alpha1", + "kubernetes/typed/rbac/v1beta1", + "kubernetes/typed/scheduling/v1alpha1", + "kubernetes/typed/scheduling/v1beta1", + "kubernetes/typed/settings/v1alpha1", + "kubernetes/typed/storage/v1", + "kubernetes/typed/storage/v1alpha1", + "kubernetes/typed/storage/v1beta1", + "listers/admissionregistration/v1alpha1", + "listers/admissionregistration/v1beta1", + "listers/apps/v1", + "listers/apps/v1beta1", + "listers/apps/v1beta2", + "listers/autoscaling/v1", + "listers/autoscaling/v2beta1", + "listers/autoscaling/v2beta2", + "listers/batch/v1", + "listers/batch/v1beta1", + "listers/batch/v2alpha1", + "listers/certificates/v1beta1", + "listers/coordination/v1beta1", + "listers/core/v1", + "listers/events/v1beta1", + "listers/extensions/v1beta1", + "listers/networking/v1", + "listers/policy/v1beta1", + "listers/rbac/v1", + "listers/rbac/v1alpha1", + "listers/rbac/v1beta1", + "listers/scheduling/v1alpha1", + "listers/scheduling/v1beta1", + "listers/settings/v1alpha1", + "listers/storage/v1", + "listers/storage/v1alpha1", + "listers/storage/v1beta1", + "pkg/apis/clientauthentication", + "pkg/apis/clientauthentication/v1alpha1", + "pkg/apis/clientauthentication/v1beta1", + "pkg/version", + "plugin/pkg/client/auth/exec", + "rest", + "rest/watch", + "tools/cache", + "tools/clientcmd/api", + "tools/metrics", + "tools/pager", + "tools/record", + "tools/reference", + "tools/watch", + "transport", + "util/buffer", + "util/cert", + "util/connrotation", + "util/flowcontrol", + "util/integer", + "util/retry", + ] + pruneopts = "NUT" + revision = "1638f8970cefaa404ff3a62950f88b08292b2696" + version = "v9.0.0" + +[[projects]] + branch = "master" + digest = "1:b078acbe747521a8f9a602942e7356ec45feb9b8c29c84971b15aebddd991094" + name = "k8s.io/csi-api" + packages = [ + "pkg/apis/csi/v1alpha1", + "pkg/client/clientset/versioned", + "pkg/client/clientset/versioned/scheme", + "pkg/client/clientset/versioned/typed/csi/v1alpha1", + ] + pruneopts = "NUT" + revision = "3ace7a84ffef58a17488dcefe2432bbeb74a5c7b" + +[[projects]] + digest = "1:9cc257b3c9ff6a0158c9c661ab6eebda1fe8a4a4453cd5c4044dc9a2ebfb992b" + name = "k8s.io/klog" + packages = ["."] + pruneopts = "NUT" + revision = "a5bc97fbc634d635061f3146511332c7e313a55a" + version = "v0.1.0" + +[[projects]] + branch = "master" + digest = "1:03a96603922fc1f6895ae083e1e16d943b55ef0656b56965351bd87e7d90485f" + name = "k8s.io/kube-openapi" + packages = ["pkg/util/proto"] + pruneopts = "NUT" + revision = "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d" + +[[projects]] + digest = "1:7f17bd412353cc172599a20460b87e2d1754df793ff4e7b04dc4c71a48cdc139" + name = "k8s.io/kubernetes" + packages = [ + "pkg/api/legacyscheme", + "pkg/api/service", + "pkg/api/v1/pod", + "pkg/apis/autoscaling", + "pkg/apis/core", + "pkg/apis/core/helper", + "pkg/apis/core/install", + "pkg/apis/core/pods", + "pkg/apis/core/v1", + "pkg/apis/core/v1/helper", + "pkg/apis/core/validation", + "pkg/apis/extensions", + "pkg/apis/networking", + "pkg/apis/policy", + "pkg/apis/scheduling", + "pkg/capabilities", + "pkg/cloudprovider", + "pkg/controller", + "pkg/features", + "pkg/fieldpath", + "pkg/kubelet/apis", + "pkg/kubelet/types", + "pkg/master/ports", + "pkg/scheduler/algorithm", + "pkg/scheduler/algorithm/priorities/util", + "pkg/scheduler/api", + "pkg/scheduler/cache", + "pkg/scheduler/util", + "pkg/security/apparmor", + "pkg/serviceaccount", + "pkg/util/file", + "pkg/util/hash", + "pkg/util/io", + "pkg/util/mount", + "pkg/util/net/sets", + "pkg/util/node", + "pkg/util/nsenter", + "pkg/util/parsers", + "pkg/util/strings", + "pkg/util/taints", + "pkg/volume", + "pkg/volume/util", + "pkg/volume/util/fs", + "pkg/volume/util/recyclerclient", + "pkg/volume/util/types", + "pkg/volume/util/volumepathhandler", + ] + pruneopts = "NUT" + revision = "17c77c7898218073f14c8d573582e8d2313dc740" + version = "v1.12.2" + +[[projects]] + branch = "master" + digest = "1:4e5556b62a171bd76c81d44df3f46cf7ed6cc44efd16bb56eb3d0d4d784d4b45" + name = "k8s.io/utils" + packages = [ + "exec", + "pointer", + ] + pruneopts = "NUT" + revision = "1bd4f387aa67de2eec07a362c10bc8bd7fe74237" + +[[projects]] + digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c" + name = "sigs.k8s.io/yaml" + packages = ["."] + pruneopts = "NUT" + revision = "fd68e9863619f6ec2fdd8625fe1f02e7c877e480" + version = "v1.1.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + input-imports = [ + "github.com/container-storage-interface/spec/lib/go/csi", + "github.com/golang/glog", + "github.com/kubernetes-csi/drivers/pkg/csi-common", + "github.com/spf13/cobra", + "golang.org/x/net/context", + "google.golang.org/grpc/codes", + "google.golang.org/grpc/status", + "k8s.io/kubernetes/pkg/util/mount", + "k8s.io/kubernetes/pkg/volume/util", + ] + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml new file mode 100644 index 00000000..cc2d487a --- /dev/null +++ b/Gopkg.toml @@ -0,0 +1,78 @@ + +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" + +[[constraint]] + name = "github.com/container-storage-interface/spec" + version = "1.0.0" + +[[constraint]] + name = "github.com/kubernetes-csi/drivers" + version = "v1.0.2" + +[[constraint]] + branch = "master" + name = "github.com/golang/glog" + +[[constraint]] + branch = "master" + name = "golang.org/x/net" + +[[constraint]] + name = "google.golang.org/grpc" + version = "1.10.0" + +[[constraint]] + name = "k8s.io/kubernetes" + version = "v1.12.0" + +[[override]] + name = "k8s.io/kubernetes" + version = "v1.12.0" + +[[override]] + version = "kubernetes-1.12.0" + name = "k8s.io/api" + +[[override]] + version = "kubernetes-1.12.0" + name = "k8s.io/apiserver" + +[[override]] + version = "kubernetes-1.12.0" + name = "k8s.io/apiextensions-apiserver" + +[[override]] + name = "github.com/golang/protobuf" + version = "v1.1.0" + +[[override]] + name = "github.com/json-iterator/go" + version = "1.1.4" + +[[override]] + name = "gopkg.in/square/go-jose.v2" + version = "2.1.7" + +[prune] + non-go = true + go-tests = true + unused-packages = true diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..249fe2fd --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +# Copyright 2017 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +REGISTRY_NAME=quay.io/k8scsi +IMAGE_NAME=nfsplugin +IMAGE_VERSION=canary +IMAGE_TAG=$(REGISTRY_NAME)/$(IMAGE_NAME):$(IMAGE_VERSION) +REV=$(shell git describe --long --tags --dirty) + +.PHONY: all nfs clean nfs-container push + +test: + go test github.com/kubernetes-csi/csi-driver-nfs/pkg/... -cover + go vet github.com/kubernetes-csi/csi-driver-nfs/pkg/... + +nfs: + if [ ! -d ./vendor ]; then dep ensure -vendor-only; fi + CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o _output/nfsplugin ./app/ + +nfs-container: nfs + docker build -t $(IMAGE_TAG) -f ./app/Dockerfile . + +push: nfs-container + docker push $(IMAGE_TAG) + +clean: + go clean -r -x + -rm -rf _output diff --git a/README.md b/README.md index 9431b7bb..27050bef 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,70 @@ -# Kubernetes Template Project +# CSI NFS driver -The Kubernetes Template Project is a template for starting new projects in the GitHub organizations owned by Kubernetes. All Kubernetes projects, at minimum, must have the following files: +## Kubernetes +### Requirements -- a `README.md` outlining the project goals, sponsoring sig, and community contact information -- an `OWNERS` with the project leads listed as approvers ([docs on `OWNERS` files][owners]) -- a `CONTRIBUTING.md` outlining how to contribute to the project -- an unmodified copy of `code-of-conduct.md` from this repo, which outlines community behavior and the consequences of breaking the code -- a `LICENSE` which must be Apache 2.0 for code projects, or [Creative Commons 4.0] for documentation repositories, without any custom content -- a `SECURITY_CONTACTS` with the contact points for the Product Security Team - to reach out to for triaging and handling of incoming issues. They must agree to abide by the - [Embargo Policy](https://github.com/kubernetes/sig-release/blob/master/security-release-process-documentation/security-release-process.md#embargo-policy) - and will be removed and replaced if they violate that agreement. +The folllowing feature gates and runtime config have to be enabled to deploy the driver + +``` +FEATURE_GATES=CSIPersistentVolume=true,MountPropagation=true +RUNTIME_CONFIG="storage.k8s.io/v1alpha1=true" +``` + +Mountprogpation requries support for privileged containers. So, make sure privileged containers are enabled in the cluster. + +### Example local-up-cluster.sh + +```ALLOW_PRIVILEGED=true FEATURE_GATES=CSIPersistentVolume=true,MountPropagation=true RUNTIME_CONFIG="storage.k8s.io/v1alpha1=true" LOG_LEVEL=5 hack/local-up-cluster.sh``` + +### Deploy + +```kubectl -f deploy/kubernetes create``` + +### Example Nginx application +Please update the NFS Server & share information in nginx.yaml file. + +```kubectl -f examples/kubernetes/nginx.yaml create``` + +## Using CSC tool + +### Build nfsplugin +``` +$ make nfs +``` + +### Start NFS driver +``` +$ sudo ./_output/nfsplugin --endpoint tcp://127.0.0.1:10000 --nodeid CSINode -v=5 +``` + +## Test +Get ```csc``` tool from https://github.com/rexray/gocsi/tree/master/csc + +#### Get plugin info +``` +$ csc identity plugin-info --endpoint tcp://127.0.0.1:10000 +"NFS" "0.1.0" +``` + +#### NodePublish a volume +``` +$ export NFS_SERVER="Your Server IP (Ex: 10.10.10.10)" +$ export NFS_SHARE="Your NFS share" +$ csc node publish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs --attrib server=$NFS_SERVER --attrib share=$NFS_SHARE nfstestvol +nfstestvol +``` + +#### NodeUnpublish a volume +``` +$ csc node unpublish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs nfstestvol +nfstestvol +``` + +#### Get NodeID +``` +$ csc node get-id --endpoint tcp://127.0.0.1:10000 +CSINode +``` ## Community, discussion, contribution, and support @@ -18,8 +72,9 @@ Learn how to engage with the Kubernetes community on the [community page](http:/ You can reach the maintainers of this project at: -- [Slack](http://slack.k8s.io/) -- [Mailing List](https://groups.google.com/forum/#!forum/kubernetes-dev) +- [Slack channel](https://kubernetes.slack.com/messages/sig-storage) +- [Mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-storage) + ### Code of conduct diff --git a/app/Dockerfile b/app/Dockerfile new file mode 100644 index 00000000..8306ca37 --- /dev/null +++ b/app/Dockerfile @@ -0,0 +1,8 @@ +FROM centos:7.4.1708 + +# Copy nfsplugin from build _output directory +COPY nfsplugin /nfsplugin + +RUN yum -y install nfs-utils && yum -y install epel-release && yum -y install jq && yum clean all + +ENTRYPOINT ["/nfsplugin"] diff --git a/app/main.go b/app/main.go new file mode 100644 index 00000000..e3865479 --- /dev/null +++ b/app/main.go @@ -0,0 +1,70 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +import ( + "flag" + "fmt" + "os" + + "github.com/spf13/cobra" + + "github.com/kubernetes-csi/csi-driver-nfs/pkg/nfs" +) + +var ( + endpoint string + nodeID string +) + +func init() { + flag.Set("logtostderr", "true") +} + +func main() { + + flag.CommandLine.Parse([]string{}) + + cmd := &cobra.Command{ + Use: "NFS", + Short: "CSI based NFS driver", + Run: func(cmd *cobra.Command, args []string) { + handle() + }, + } + + cmd.Flags().AddGoFlagSet(flag.CommandLine) + + cmd.PersistentFlags().StringVar(&nodeID, "nodeid", "", "node id") + cmd.MarkPersistentFlagRequired("nodeid") + + cmd.PersistentFlags().StringVar(&endpoint, "endpoint", "", "CSI endpoint") + cmd.MarkPersistentFlagRequired("endpoint") + + cmd.ParseFlags(os.Args[1:]) + if err := cmd.Execute(); err != nil { + fmt.Fprintf(os.Stderr, "%s", err.Error()) + os.Exit(1) + } + + os.Exit(0) +} + +func handle() { + d := nfs.NewDriver(nodeID, endpoint) + d.Run() +} diff --git a/deploy/kubernetes/csi-attacher-nfsplugin.yaml b/deploy/kubernetes/csi-attacher-nfsplugin.yaml new file mode 100644 index 00000000..c8165fe8 --- /dev/null +++ b/deploy/kubernetes/csi-attacher-nfsplugin.yaml @@ -0,0 +1,64 @@ +# This YAML file contains attacher & csi driver API objects that are necessary +# to run external CSI attacher for nfs + +kind: Service +apiVersion: v1 +metadata: + name: csi-attacher-nfsplugin + labels: + app: csi-attacher-nfsplugin +spec: + selector: + app: csi-attacher-nfsplugin + ports: + - name: dummy + port: 12345 + +--- +kind: StatefulSet +apiVersion: apps/v1beta1 +metadata: + name: csi-attacher-nfsplugin +spec: + serviceName: "csi-attacher" + replicas: 1 + template: + metadata: + labels: + app: csi-attacher-nfsplugin + spec: + serviceAccount: csi-attacher + containers: + - name: csi-attacher + image: quay.io/k8scsi/csi-attacher:v0.3.0 + args: + - "--v=5" + - "--csi-address=$(ADDRESS)" + env: + - name: ADDRESS + value: /var/lib/csi/sockets/pluginproxy/csi.sock + imagePullPolicy: "IfNotPresent" + volumeMounts: + - name: socket-dir + mountPath: /var/lib/csi/sockets/pluginproxy/ + + - name: nfs + image: quay.io/k8scsi/nfsplugin:v0.3.0 + args : + - "--nodeid=$(NODE_ID)" + - "--endpoint=$(CSI_ENDPOINT)" + env: + - name: NODE_ID + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: CSI_ENDPOINT + value: unix://plugin/csi.sock + imagePullPolicy: "IfNotPresent" + volumeMounts: + - name: socket-dir + mountPath: /plugin + volumes: + - name: socket-dir + emptyDir: + diff --git a/deploy/kubernetes/csi-attacher-rbac.yaml b/deploy/kubernetes/csi-attacher-rbac.yaml new file mode 100644 index 00000000..975fdd67 --- /dev/null +++ b/deploy/kubernetes/csi-attacher-rbac.yaml @@ -0,0 +1,37 @@ +# This YAML file contains RBAC API objects that are necessary to run external +# CSI attacher for nfs flex adapter + +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-attacher + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: external-attacher-runner +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["storage.k8s.io"] + resources: ["volumeattachments"] + verbs: ["get", "list", "watch", "update"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-attacher-role +subjects: + - kind: ServiceAccount + name: csi-attacher + namespace: default +roleRef: + kind: ClusterRole + name: external-attacher-runner + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml b/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml new file mode 100644 index 00000000..457e6f27 --- /dev/null +++ b/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml @@ -0,0 +1,66 @@ +# This YAML file contains driver-registrar & csi driver nodeplugin API objects +# that are necessary to run CSI nodeplugin for nfs +kind: DaemonSet +apiVersion: apps/v1beta2 +metadata: + name: csi-nodeplugin-nfsplugin +spec: + selector: + matchLabels: + app: csi-nodeplugin-nfsplugin + template: + metadata: + labels: + app: csi-nodeplugin-nfsplugin + spec: + serviceAccount: csi-nodeplugin + hostNetwork: true + containers: + - name: driver-registrar + image: quay.io/k8scsi/driver-registrar:v0.3.0 + args: + - "--v=5" + - "--csi-address=$(ADDRESS)" + env: + - name: ADDRESS + value: /plugin/csi.sock + - name: KUBE_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + volumeMounts: + - name: plugin-dir + mountPath: /plugin + - name: nfs + securityContext: + privileged: true + capabilities: + add: ["SYS_ADMIN"] + allowPrivilegeEscalation: true + image: quay.io/k8scsi/nfsplugin:v0.3.0 + args : + - "--nodeid=$(NODE_ID)" + - "--endpoint=$(CSI_ENDPOINT)" + env: + - name: NODE_ID + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: CSI_ENDPOINT + value: unix://plugin/csi.sock + imagePullPolicy: "IfNotPresent" + volumeMounts: + - name: plugin-dir + mountPath: /plugin + - name: pods-mount-dir + mountPath: /var/lib/kubelet/pods + mountPropagation: "Bidirectional" + volumes: + - name: plugin-dir + hostPath: + path: /var/lib/kubelet/plugins/csi-nfsplugin + type: DirectoryOrCreate + - name: pods-mount-dir + hostPath: + path: /var/lib/kubelet/pods + type: Directory diff --git a/deploy/kubernetes/csi-nodeplugin-rbac.yaml b/deploy/kubernetes/csi-nodeplugin-rbac.yaml new file mode 100644 index 00000000..530e067b --- /dev/null +++ b/deploy/kubernetes/csi-nodeplugin-rbac.yaml @@ -0,0 +1,34 @@ +# This YAML defines all API objects to create RBAC roles for CSI node plugin +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-nodeplugin + +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-nodeplugin +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["volumeattachments"] + verbs: ["get", "list", "watch", "update"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-nodeplugin +subjects: + - kind: ServiceAccount + name: csi-nodeplugin + namespace: default +roleRef: + kind: ClusterRole + name: csi-nodeplugin + apiGroup: rbac.authorization.k8s.io diff --git a/examples/kubernetes/nginx.yaml b/examples/kubernetes/nginx.yaml new file mode 100644 index 00000000..8048e9cd --- /dev/null +++ b/examples/kubernetes/nginx.yaml @@ -0,0 +1,53 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: data-nfsplugin + labels: + name: data-nfsplugin +spec: + accessModes: + - ReadWriteMany + capacity: + storage: 100Gi + csi: + driver: csi-nfsplugin + volumeHandle: data-id + volumeAttributes: + server: 127.0.0.1 + share: /export +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: data-nfsplugin +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 100Gi + selector: + matchExpressions: + - key: name + operator: In + values: ["data-nfsplugin"] +--- +apiVersion: v1 +kind: Pod +metadata: + name: nginx +spec: + containers: + - image: maersk/nginx + imagePullPolicy: Always + name: nginx + ports: + - containerPort: 80 + protocol: TCP + volumeMounts: + - mountPath: /var/www + name: data-nfsplugin + volumes: + - name: data-nfsplugin + persistentVolumeClaim: + claimName: data-nfsplugin diff --git a/pkg/nfs/README.md b/pkg/nfs/README.md new file mode 100644 index 00000000..744eb270 --- /dev/null +++ b/pkg/nfs/README.md @@ -0,0 +1,69 @@ +# CSI NFS driver + + +## Kubernetes +### Requirements + +The folllowing feature gates and runtime config have to be enabled to deploy the driver + +``` +FEATURE_GATES=CSIPersistentVolume=true,MountPropagation=true +RUNTIME_CONFIG="storage.k8s.io/v1alpha1=true" +``` + +Mountprogpation requries support for privileged containers. So, make sure privileged containers are enabled in the cluster. + +### Example local-up-cluster.sh + +```ALLOW_PRIVILEGED=true FEATURE_GATES=CSIPersistentVolume=true,MountPropagation=true RUNTIME_CONFIG="storage.k8s.io/v1alpha1=true" LOG_LEVEL=5 hack/local-up-cluster.sh``` + +### Deploy + +```kubectl -f deploy/kubernetes create``` + +### Example Nginx application +Please update the NFS Server & share information in nginx.yaml file. + +```kubectl -f examples/kubernetes/nginx.yaml create``` + +## Using CSC tool + +### Build nfsplugin +``` +$ make nfs +``` + +### Start NFS driver +``` +$ sudo ./_output/nfsplugin --endpoint tcp://127.0.0.1:10000 --nodeid CSINode -v=5 +``` + +## Test +Get ```csc``` tool from https://github.com/rexray/gocsi/tree/master/csc + +#### Get plugin info +``` +$ csc identity plugin-info --endpoint tcp://127.0.0.1:10000 +"NFS" "0.1.0" +``` + +#### NodePublish a volume +``` +$ export NFS_SERVER="Your Server IP (Ex: 10.10.10.10)" +$ export NFS_SHARE="Your NFS share" +$ csc node publish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs --attrib server=$NFS_SERVER --attrib share=$NFS_SHARE nfstestvol +nfstestvol +``` + +#### NodeUnpublish a volume +``` +$ csc node unpublish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/nfs nfstestvol +nfstestvol +``` + +#### Get NodeID +``` +$ csc node get-id --endpoint tcp://127.0.0.1:10000 +CSINode +``` + diff --git a/pkg/nfs/driver.go b/pkg/nfs/driver.go new file mode 100644 index 00000000..f65c3132 --- /dev/null +++ b/pkg/nfs/driver.go @@ -0,0 +1,78 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package nfs + +import ( + "github.com/container-storage-interface/spec/lib/go/csi" + "github.com/golang/glog" + + csicommon "github.com/kubernetes-csi/drivers/pkg/csi-common" +) + +type driver struct { + csiDriver *csicommon.CSIDriver + endpoint string + + ids *csicommon.DefaultIdentityServer + ns *nodeServer + + cap []*csi.VolumeCapability_AccessMode + cscap []*csi.ControllerServiceCapability +} + +const ( + driverName = "csi-nfsplugin" +) + +var ( + version = "1.0.0-rc2" +) + +func NewDriver(nodeID, endpoint string) *driver { + glog.Infof("Driver: %v version: %v", driverName, version) + + d := &driver{} + + d.endpoint = endpoint + + csiDriver := csicommon.NewCSIDriver(driverName, version, nodeID) + csiDriver.AddVolumeCapabilityAccessModes([]csi.VolumeCapability_AccessMode_Mode{csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER}) + // NFS plugin does not support ControllerServiceCapability now. + // If support is added, it should set to appropriate + // ControllerServiceCapability RPC types. + csiDriver.AddControllerServiceCapabilities([]csi.ControllerServiceCapability_RPC_Type{csi.ControllerServiceCapability_RPC_UNKNOWN}) + + d.csiDriver = csiDriver + + return d +} + +func NewNodeServer(d *driver) *nodeServer { + return &nodeServer{ + DefaultNodeServer: csicommon.NewDefaultNodeServer(d.csiDriver), + } +} + +func (d *driver) Run() { + s := csicommon.NewNonBlockingGRPCServer() + s.Start(d.endpoint, + csicommon.NewDefaultIdentityServer(d.csiDriver), + // NFS plugin has not implemented ControllerServer. + nil, + NewNodeServer(d)) + s.Wait() +} diff --git a/pkg/nfs/nodeserver.go b/pkg/nfs/nodeserver.go new file mode 100644 index 00000000..36ced455 --- /dev/null +++ b/pkg/nfs/nodeserver.go @@ -0,0 +1,109 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package nfs + +import ( + "fmt" + "os" + "strings" + + "github.com/container-storage-interface/spec/lib/go/csi" + "golang.org/x/net/context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "k8s.io/kubernetes/pkg/util/mount" + "k8s.io/kubernetes/pkg/volume/util" + + "github.com/kubernetes-csi/drivers/pkg/csi-common" +) + +type nodeServer struct { + *csicommon.DefaultNodeServer +} + +func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) { + targetPath := req.GetTargetPath() + notMnt, err := mount.New("").IsLikelyNotMountPoint(targetPath) + if err != nil { + if os.IsNotExist(err) { + if err := os.MkdirAll(targetPath, 0750); err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + notMnt = true + } else { + return nil, status.Error(codes.Internal, err.Error()) + } + } + + if !notMnt { + return &csi.NodePublishVolumeResponse{}, nil + } + + mo := req.GetVolumeCapability().GetMount().GetMountFlags() + if req.GetReadonly() { + mo = append(mo, "ro") + } + + s := req.GetVolumeContext()["server"] + ep := req.GetVolumeContext()["share"] + source := fmt.Sprintf("%s:%s", s, ep) + + mounter := mount.New("") + err = mounter.Mount(source, targetPath, "nfs", mo) + if err != nil { + if os.IsPermission(err) { + return nil, status.Error(codes.PermissionDenied, err.Error()) + } + if strings.Contains(err.Error(), "invalid argument") { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + return nil, status.Error(codes.Internal, err.Error()) + } + + return &csi.NodePublishVolumeResponse{}, nil +} + +func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) { + targetPath := req.GetTargetPath() + notMnt, err := mount.New("").IsLikelyNotMountPoint(targetPath) + + if err != nil { + if os.IsNotExist(err) { + return nil, status.Error(codes.NotFound, "Targetpath not found") + } else { + return nil, status.Error(codes.Internal, err.Error()) + } + } + if notMnt { + return nil, status.Error(codes.NotFound, "Volume not mounted") + } + + err = util.UnmountPath(req.GetTargetPath(), mount.New("")) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &csi.NodeUnpublishVolumeResponse{}, nil +} + +func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) { + return &csi.NodeUnstageVolumeResponse{}, nil +} + +func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) { + return &csi.NodeStageVolumeResponse{}, nil +}