fix: deployment script/doc issues

fix test error

set kube-system namespace
This commit is contained in:
andyzhangx 2020-09-13 12:08:38 +00:00
parent 9bb484c55d
commit 4008fe5487
5 changed files with 14 additions and 53 deletions

View File

@ -38,8 +38,8 @@ and working NFS server (e.g. https://github.com/rootfs/nfs-ganesha-docker)
#### Deploy #### Deploy
Deploy the NFS plugin along with the `CSIDriver` info. Deploy the NFS plugin along with the `CSIDriver` info.
``` ```console
kubectl -f deploy/kubernetes create kubectl create -f deploy/kubernetes
``` ```
#### Example Nginx application #### Example Nginx application
@ -53,22 +53,22 @@ NFS server public end point and configuration. You can also provide additional
`mountOptions`, such as protocol version, in the `PersistentVolume` `spec` `mountOptions`, such as protocol version, in the `PersistentVolume` `spec`
relevant for your NFS Server. relevant for your NFS Server.
``` ```console
kubectl -f examples/kubernetes/nginx.yaml create kubectl create -f examples/kubernetes/nginx.yaml
``` ```
## Running Kubernetes End To End tests on an NFS Driver ## Running Kubernetes End To End tests on an NFS Driver
First, stand up a local cluster `ALLOW_PRIVILEGED=1 hack/local-up-cluster.sh` (from your Kubernetes repo) First, stand up a local cluster `ALLOW_PRIVILEGED=1 hack/local-up-cluster.sh` (from your Kubernetes repo)
For Fedora/RHEL clusters, the following might be required: For Fedora/RHEL clusters, the following might be required:
``` ```console
sudo chown -R $USER:$USER /var/run/kubernetes/ sudo chown -R $USER:$USER /var/run/kubernetes/
sudo chown -R $USER:$USER /var/lib/kubelet sudo chown -R $USER:$USER /var/lib/kubelet
sudo chcon -R -t svirt_sandbox_file_t /var/lib/kubelet sudo chcon -R -t svirt_sandbox_file_t /var/lib/kubelet
``` ```
If you are plannig to test using your own private image, you could either install your nfs driver using your own set of YAML files, or edit the existing YAML files to use that private image. If you are plannig to test using your own private image, you could either install your nfs driver using your own set of YAML files, or edit the existing YAML files to use that private image.
When using the [existing set of YAML files](https://github.com/kubernetes-csi/csi-driver-nfs/tree/master/deploy/kubernetes), you would edit the [csi-attacher-nfsplugin.yaml](https://github.com/kubernetes-csi/csi-driver-nfs/blob/master/deploy/kubernetes/csi-attacher-nfsplugin.yaml#L46) and [csi-nodeplugin-nfsplugin.yaml](https://github.com/kubernetes-csi/csi-driver-nfs/blob/master/deploy/kubernetes/csi-nodeplugin-nfsplugin.yaml#L45) files to include your private image instead of the default one. After editing these files, skip to step 3 of the following steps. When using the [existing set of YAML files](https://github.com/kubernetes-csi/csi-driver-nfs/tree/master/deploy/kubernetes), you would edit [csi-nfs-node.yaml](https://github.com/kubernetes-csi/csi-driver-nfs/blob/master/deploy/kubernetes/csi-nfs-node.yaml#L45) files to include your private image instead of the default one. After editing these files, skip to step 3 of the following steps.
If you already have a driver installed, skip to step 4 of the following steps. If you already have a driver installed, skip to step 4 of the following steps.

View File

@ -3,17 +3,17 @@
kind: DaemonSet kind: DaemonSet
apiVersion: apps/v1 apiVersion: apps/v1
metadata: metadata:
name: csi-nodeplugin-nfsplugin name: csi-nfs-node
namespace: kube-system
spec: spec:
selector: selector:
matchLabels: matchLabels:
app: csi-nodeplugin-nfsplugin app: csi-nfs-node
template: template:
metadata: metadata:
labels: labels:
app: csi-nodeplugin-nfsplugin app: csi-nfs-node
spec: spec:
serviceAccount: csi-nodeplugin
containers: containers:
- name: node-driver-registrar - name: node-driver-registrar
image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2 image: quay.io/k8scsi/csi-node-driver-registrar:v1.0.2

View File

@ -1,34 +0,0 @@
# 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

View File

@ -38,7 +38,7 @@ metadata:
name: nginx name: nginx
spec: spec:
containers: containers:
- image: maersk/nginx - image: nginx
name: nginx name: nginx
ports: ports:
- containerPort: 80 - containerPort: 80

View File

@ -14,7 +14,7 @@ limitations under the License.
package test package test
import ( import (
"k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/storage/testpatterns" "k8s.io/kubernetes/test/e2e/storage/testpatterns"
@ -52,14 +52,9 @@ func initNFSDriver(name string, manifests ...string) testsuites.TestDriver {
} }
} }
// InitNFSDriver initialize NFS driver for test
func InitNFSDriver() testsuites.TestDriver { func InitNFSDriver() testsuites.TestDriver {
return initNFSDriver("nfs.csi.k8s.io", "csi-nfs-node.yaml")
return initNFSDriver("nfs.csi.k8s.io",
"csi-attacher-nfsplugin.yaml",
"csi-attacher-rbac.yaml",
"csi-nodeplugin-nfsplugin.yaml",
"csi-nodeplugin-rbac.yaml")
} }
var _ testsuites.TestDriver = &nfsDriver{} var _ testsuites.TestDriver = &nfsDriver{}