-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds NFS CSI plugin integration test (#7)
The Helm chart depends on a few other CSI components. We have rocks for these, and we'll be using them in the helm chart as well. The test will also check the Pod probes to make sure that the service is up, without waiting for Kubernetes to do the check. The test will also spawn a NFS server, and create an NGINX Pod requiring a NFS volume.
- Loading branch information
1 parent
1a520e2
commit 6292e06
Showing
4 changed files
with
210 additions
and
3 deletions.
There are no files selected for viewing
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,5 @@ | ||
# | ||
# Copyright 2024 Canonical, Ltd. | ||
# | ||
|
||
pytest_plugins = ["k8s_test_harness.plugin"] |
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,62 @@ | ||
# from: https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/nfs-provisioner/nfs-server.yaml | ||
--- | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: nfs-server | ||
namespace: default | ||
labels: | ||
app: nfs-server | ||
spec: | ||
type: ClusterIP # use "LoadBalancer" to get a public ip | ||
selector: | ||
app: nfs-server | ||
ports: | ||
- name: tcp-2049 | ||
port: 2049 | ||
protocol: TCP | ||
- name: udp-111 | ||
port: 111 | ||
protocol: UDP | ||
--- | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: nfs-server | ||
namespace: default | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: nfs-server | ||
template: | ||
metadata: | ||
name: nfs-server | ||
labels: | ||
app: nfs-server | ||
spec: | ||
nodeSelector: | ||
"kubernetes.io/os": linux | ||
containers: | ||
- name: nfs-server | ||
image: itsthenetwork/nfs-server-alpine:latest | ||
env: | ||
- name: SHARED_DIRECTORY | ||
value: "/exports" | ||
volumeMounts: | ||
- mountPath: /exports | ||
name: nfs-vol | ||
securityContext: | ||
privileged: true | ||
ports: | ||
- name: tcp-2049 | ||
containerPort: 2049 | ||
protocol: TCP | ||
- name: udp-111 | ||
containerPort: 111 | ||
protocol: UDP | ||
volumes: | ||
- name: nfs-vol | ||
hostPath: | ||
path: /nfs-vol # modify this to specify another path to store nfs share data | ||
type: DirectoryOrCreate |
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,60 @@ | ||
# from: https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/nfs-provisioner/nginx-pod.yaml | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
annotations: | ||
pv.kubernetes.io/provisioned-by: nfs.csi.k8s.io | ||
name: pv-nginx | ||
namespace: default | ||
spec: | ||
capacity: | ||
storage: 10Gi | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Delete | ||
mountOptions: | ||
- nfsvers=4.1 | ||
csi: | ||
driver: nfs.csi.k8s.io | ||
# volumeHandle format: {nfs-server-address}#{sub-dir-name}#{share-name} | ||
# make sure this value is unique for every share in the cluster | ||
volumeHandle: nfs-server.default.svc.cluster.local/share## | ||
volumeAttributes: | ||
server: nfs-server.default.svc.cluster.local | ||
share: / | ||
--- | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: pvc-nginx | ||
namespace: default | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
volumeName: pv-nginx | ||
storageClassName: "" | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-nfs-example | ||
namespace: default | ||
spec: | ||
containers: | ||
- image: nginx | ||
name: nginx | ||
ports: | ||
- containerPort: 80 | ||
protocol: TCP | ||
volumeMounts: | ||
- mountPath: /var/www | ||
name: pvc-nginx | ||
readOnly: false | ||
volumes: | ||
- name: pvc-nginx | ||
persistentVolumeClaim: | ||
claimName: pvc-nginx |