Add Kubernetes integration tests for EasyHAProxy examples
- Introduced a suite of pytest-based integration tests for Kubernetes using `kind`. - Automated local installation of dependencies (`kind`, `kubectl`, and `helm`) when missing. - Implemented fixtures for Kubernetes resource management and TLS secrets. - Added end-to-end tests for HTTP and HTTPS ingress functionality.
This commit is contained in:
parent
5767e55dea
commit
90b01b1f13
18 changed files with 2978 additions and 24 deletions
39
examples/kubernetes/teardown-cluster.sh
Executable file
39
examples/kubernetes/teardown-cluster.sh
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Colors for output
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
CLUSTER_NAME="easyhaproxy-test"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
BIN_DIR="${SCRIPT_DIR}/.kind"
|
||||
KIND_BIN="${BIN_DIR}/kind"
|
||||
|
||||
# Check if kind binary exists
|
||||
if [ ! -f "${KIND_BIN}" ]; then
|
||||
# Try to use system kind
|
||||
if command -v kind &> /dev/null; then
|
||||
KIND_BIN="kind"
|
||||
else
|
||||
echo -e "${RED}✗ kind binary not found. Cannot delete cluster.${NC}"
|
||||
echo " Cluster may not exist or kind is not installed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if cluster exists
|
||||
if ! ${KIND_BIN} get clusters 2>/dev/null | grep -q "^${CLUSTER_NAME}$"; then
|
||||
echo -e "${BLUE}Cluster '${CLUSTER_NAME}' does not exist. Nothing to delete.${NC}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}Deleting kind cluster '${CLUSTER_NAME}'...${NC}"
|
||||
|
||||
if ${KIND_BIN} delete cluster --name "${CLUSTER_NAME}"; then
|
||||
echo -e "${GREEN}✓ Cluster deleted successfully${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ Failed to delete cluster${NC}"
|
||||
exit 1
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue