Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move nfs csi-driver to its own repo 'csi-driver-nfs'
Signed-off-by: prateekpandey14 <prateekpandey14@gmail.com>
- Loading branch information
1 parent
64d37cf
commit d5b0215
Showing
14 changed files
with
1,586 additions
and
13 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.