Public release of katbox
This commit is contained in:
commit
4c764e09a4
46 changed files with 4646 additions and 0 deletions
4
hack/README.md
Normal file
4
hack/README.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
## Running end to end tests
|
||||
* Start [kubernetes in docker (kind) ](https://kind.sigs.k8s.io/) cluster
|
||||
* Run e2e-tests.sh from anywhere withing the git repo
|
78
hack/e2e-tests.sh
Normal file
78
hack/e2e-tests.sh
Normal file
|
@ -0,0 +1,78 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2020 PayPal.
|
||||
#
|
||||
# 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.
|
||||
|
||||
GIT_PROJECT_ROOT="$(git rev-parse --show-toplevel)"
|
||||
|
||||
pushd "$GIT_PROJECT_ROOT" || exit
|
||||
|
||||
# Build latest katbox
|
||||
docker build . -t quay.io/katbox/katboxplugin:latest
|
||||
|
||||
# Load latest katbox on to kind
|
||||
kind load docker-image quay.io/katbox/katboxplugin:latest
|
||||
|
||||
# Pull sidecar containers on to local machine
|
||||
docker pull quay.io/k8scsi/livenessprobe:v1.1.0
|
||||
docker pull quay.io/k8scsi/csi-node-driver-registrar:v1.3.0
|
||||
docker pull busybox:1.32.0
|
||||
|
||||
# Load sidecar containers
|
||||
kind load docker-image quay.io/k8scsi/livenessprobe:v1.1.0
|
||||
kind load docker-image quay.io/k8scsi/csi-node-driver-registrar:v1.3.0
|
||||
kind load docker-image busybox:1.32.0
|
||||
|
||||
# Deploy katbox onto kind
|
||||
kubectl apply -f deploy/latest/katbox/csi-katbox-plugin.yaml,deploy/latest/katbox/csi-katbox-driverinfo.yaml
|
||||
|
||||
# Run a sample application
|
||||
kubectl apply -f examples/csi-app-inline.yaml
|
||||
|
||||
# Wait for sample app to be ready
|
||||
kubectl wait --for=condition=Ready pod/my-csi-app-inline
|
||||
|
||||
# Confirm that data has been printed on to the correct volume
|
||||
sleep 10
|
||||
|
||||
OUTPUT=$(kubectl exec pod/my-csi-app-inline -- sh -c "cat /data/test")
|
||||
PODUID=$(kubectl get pod my-csi-app-inline -o jsonpath='{.metadata.uid}')
|
||||
MOUNTDIR="/var/lib/kubelet/pods/$PODUID/volumes/kubernetes.io~csi/my-csi-volume/"
|
||||
VOLID=$(kubectl exec --filename deploy/latest/katbox/csi-katbox-plugin.yaml -c katbox -- sh -c "cat $MOUNTDIR/vol_data.json" | jq -r .volumeHandle)
|
||||
|
||||
echo "Volume ID: $VOLID"
|
||||
echo "Mounted at: $MOUNTDIR"
|
||||
|
||||
sleep 10
|
||||
|
||||
if [ -z "$OUTPUT" ]; then
|
||||
echo "FAILURE: No data found in test output";
|
||||
fi
|
||||
|
||||
# Delete example app
|
||||
kubectl delete -f examples/csi-app-inline.yaml
|
||||
|
||||
# Make sure mount point is gone
|
||||
kubectl exec --filename deploy/latest/katbox/csi-katbox-plugin.yaml -c katbox -- sh -c "if [ -d ""$MOUNTDIR"" ]; then echo 'Error: Mount point still exists'; else echo ''; fi"
|
||||
|
||||
# Make sure folder allocated by katbox was deleted after 1 minutes
|
||||
echo "Sleeping for 60 seconds to test if folder allocated by katbox was deleted"
|
||||
sleep 60
|
||||
|
||||
kubectl exec --filename deploy/latest/katbox/csi-katbox-plugin.yaml -c katbox -- sh -c "if [ -d ""/csi-data-dir/$VOLID"" ]; then echo 'Error: Mount point still exists'; else echo ''; fi"
|
||||
|
||||
# Delete katbox daemon set
|
||||
kubectl delete -f deploy/latest/katbox/csi-katbox-plugin.yaml
|
||||
|
||||
popd || exit
|
13
hack/img2minikube.sh
Executable file
13
hack/img2minikube.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
TMPDIR=$(mktemp -d)
|
||||
|
||||
pushd "$TMPDIR" || exit
|
||||
|
||||
docker save -o image.dockerimg $1
|
||||
|
||||
scp -i ~/.minikube/machines/minikube/id_rsa image.dockerimg docker@"$(minikube ip)":~/image.dockerimg
|
||||
|
||||
ssh -i ~/.minikube/machines/minikube/id_rsa docker@"$(minikube ip)" 'docker load -i ~/image.dockerimg'
|
||||
|
||||
popd || exit
|
8
hack/kind-multi.yml
Normal file
8
hack/kind-multi.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
# a cluster with 3 control-plane nodes and 3 workers
|
||||
kind: Cluster
|
||||
apiVersion: kind.x-k8s.io/v1alpha4
|
||||
nodes:
|
||||
- role: control-plane
|
||||
- role: worker
|
||||
- role: worker
|
||||
- role: worker
|
Loading…
Add table
Add a link
Reference in a new issue