-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: Implement e2e tests for docker provider
Initial framework to run e2e tests for docker provider The tests requires the following prerequisites: make go yq kubectl kind docker A script prereqs.sh is provided to (un)install the prerequisites As part of provisioning, it creates a 2 node kind cluster and then runs the tests. Signed-off-by: Pradipta Banerjee <[email protected]>
- Loading branch information
Showing
11 changed files
with
1,050 additions
and
11 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
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,27 @@ | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
networking: | ||
disableDefaultCNI: true # disable kindnet | ||
podSubnet: 192.168.0.0/16 # set to Calico's default subnet | ||
nodes: | ||
- role: control-plane | ||
# Same image version as used for pod VM base image | ||
image: kindest/node:v1.29.4 | ||
extraMounts: | ||
# The config.json file contains the registry secrets that you might | ||
# need to pull images from a private registry or docker registry to avoid | ||
# rate limiting. | ||
- hostPath: /tmp/config.json | ||
containerPath: /var/lib/kubelet/config.json | ||
- role: worker | ||
image: kindest/node:v1.29.4 | ||
extraMounts: | ||
- hostPath: /var/run/docker.sock | ||
containerPath: /var/run/docker.sock | ||
- hostPath: /var/lib/docker | ||
containerPath: /var/lib/docker | ||
# The config.json file contains the registry secrets that you might | ||
# need to pull images from a private registry or docker registry to avoid | ||
# rate limiting. | ||
- hostPath: /tmp/config.json | ||
containerPath: /var/lib/kubelet/config.json |
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,51 @@ | ||
#!/bin/bash | ||
|
||
# Ref: https://stackoverflow.com/questions/299728/how-do-you-use-newgrp-in-a-script-then-stay-in-that-group-when-the-script-exits | ||
newgrp docker <<EOF | ||
# Accept two arguments: create and delete | ||
# create: creates a kind cluster | ||
# delete: deletes a kind cluster | ||
CLUSTER_NAME="${CLUSTER_NAME:-peer-pods}" | ||
if [ "$1" == "create" ]; then | ||
# Check if kind is installed | ||
if [ ! -x "$(command -v kind)" ]; then | ||
echo "kind is not installed" | ||
exit 0 | ||
fi | ||
echo "Check if the cluster \$CLUSTER_NAME already exists" | ||
if kind get clusters | grep -q "\$CLUSTER_NAME"; then | ||
echo "Cluster \$CLUSTER_NAME already exists" | ||
exit 0 | ||
fi | ||
# Set some sysctls | ||
# Ref: https://kind.sigs.k8s.io/docs/user/known-issues/#pod-errors-due-to-too-many-open-files | ||
sudo sysctl fs.inotify.max_user_watches=524288 | ||
sudo sysctl fs.inotify.max_user_instances=512 | ||
# Create a kind cluster | ||
echo "Creating a kind cluster" | ||
kind create cluster --name "\$CLUSTER_NAME" --config kind-config.yaml || exit 1 | ||
# Deploy calico | ||
kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.28.0/manifests/calico.yaml || exit 1 | ||
exit 0 | ||
fi | ||
if [ "$1" == "delete" ]; then | ||
# Check if kind is installed | ||
if [ ! -x "$(command -v kind)" ]; then | ||
echo "kind is not installed" | ||
exit 0 | ||
fi | ||
# Delete the kind cluster | ||
echo "Deleting the kind cluster" | ||
kind delete cluster --name "\$CLUSTER_NAME" || exit 1 | ||
exit 0 | ||
fi | ||
EOF |
Oops, something went wrong.