Testing
CI Testing with Kind
The project includes automated testing on a local Kubernetes cluster using Kind (Kubernetes in Docker). This provides a more realistic testing environment during CI runs.
What Gets Tested
The CI pipeline automatically:
- Creates a Kind cluster - A lightweight, local Kubernetes cluster
- Deploys manifests - Applies the Kustomize base manifests to the cluster
- Validates deployment - Checks that resources are created successfully
- Reports status - Shows pod status and any issues encountered
Testing Locally
You can test the manifests on your local machine using the same process as CI:
Prerequisites
Install the required tools:
# Install Kind
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
# Install kubectl (if not already installed)
# See: https://kubernetes.io/docs/tasks/tools/
# Install kustomize (if not already installed)
# See: https://kubectl.docs.kubernetes.io/installation/kustomize/
Run the Test Script
Use the provided test script to create a Kind cluster and deploy manifests:
# Run the automated test script
./scripts/test-kind-cluster.sh
# Or use Make targets
make test-kind-cluster
Manual Testing
For more control, use the individual Make targets:
# Create a Kind cluster
make kind-create
# Build and apply manifests manually
kustomize build kustomize/base/ > /tmp/manifests.yaml
kubectl apply -f kustomize/base/namespace/
kubectl apply -f /tmp/manifests.yaml
# Check status
kubectl get pods -n greenfield
kubectl get all -n greenfield
# Clean up
make kind-delete
Environment Variables
Customize the test script behavior:
# Use a custom cluster name
KIND_CLUSTER_NAME=my-test ./scripts/test-kind-cluster.sh
# Use a different namespace
NAMESPACE=my-namespace ./scripts/test-kind-cluster.sh
# Manually create and test
kind create cluster --name my-test --config scripts/kind-config.yaml
MANIFEST_FILE=$(mktemp)
kustomize build kustomize/base/ > "${MANIFEST_FILE}"
kubectl apply -f "${MANIFEST_FILE}"
rm -f "${MANIFEST_FILE}"
Troubleshooting
Some resources fail to deploy
This is expected! Resources that depend on CRDs (Custom Resource Definitions) from Istio, cert-manager, or other controllers will fail. The test focuses on validating that the base manifests are syntactically correct and can be processed by Kubernetes.
Pods are in Pending state
This is normal in a basic Kind cluster. Many services require persistent volumes or specific node configurations that aren't available in the minimal test cluster. The CI test validates that manifests can be applied, not that all services reach a Ready state.
Clean up after testing
CI Workflow
The complete CI pipeline includes:
- Kustomize Validation - Ensures base and overlays build correctly
- Helm Validation - Lints and templates Helm charts
- YAML Validation - Checks YAML syntax and formatting
- Kubeconform - Validates Kubernetes resource schemas
- Kind Cluster Test - Deploys to a real Kubernetes cluster (new!)
All tests must pass before code can be merged.