Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/workflows/k8s-config-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Configuration Test

on:
workflow_call:
inputs:
kustomize_version:
description: "Kustomize version to use"
required: false
type: string
default: "v5.7.1"

jobs:
test-with-custom-config:
name: Test with Custom Configuration
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Kustomize
run: |
echo "Installing Kustomize ${{ inputs.kustomize_version }}..."
# Use the official installation script for better reliability
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
sudo mv kustomize /usr/local/bin/
kustomize version

- name: Test kustomize with different overlays
run: |
echo "Testing base kustomization..."
kustomize build deploy/kubernetes > /tmp/base-manifests.yaml

echo "Validating generated resources..."

# Check if all expected resources are present
if ! grep -q "kind: Namespace" /tmp/base-manifests.yaml; then
echo "Error: Namespace not found"
exit 1
fi

if ! grep -q "kind: Deployment" /tmp/base-manifests.yaml; then
echo "Error: Deployment not found"
exit 1
fi

if ! grep -q "kind: Service" /tmp/base-manifests.yaml; then
echo "Error: Service not found"
exit 1
fi

if ! grep -q "kind: ConfigMap" /tmp/base-manifests.yaml; then
echo "Error: ConfigMap not found"
exit 1
fi

echo "✓ All expected resources are present"

- name: Verify ConfigMap generation
run: |
echo "Checking ConfigMap generation..."
kustomize build deploy/kubernetes | grep -A 20 "kind: ConfigMap"

# Verify config files are included
if ! kustomize build deploy/kubernetes | grep -q "config.yaml"; then
echo "Warning: config.yaml might not be properly included in ConfigMap"
fi

if ! kustomize build deploy/kubernetes | grep -q "tools_db.json"; then
echo "Warning: tools_db.json might not be properly included in ConfigMap"
fi

- name: Validate observability kustomization
run: |
echo "Validating observability stack kustomization..."
if [ -d "deploy/kubernetes/observability" ]; then
kustomize build deploy/kubernetes/observability > /tmp/observability-manifests.yaml
echo "✓ Observability kustomization is valid"

# Verify expected resources
for resource in "Deployment" "Service" "ConfigMap" "PersistentVolumeClaim"; do
if ! grep -q "kind: $resource" /tmp/observability-manifests.yaml; then
echo "Warning: $resource not found in observability manifests"
fi
done
else
echo "Observability directory not found, skipping..."
fi

- name: Validate AI Gateway configurations
run: |
echo "Validating AI Gateway configurations..."

# Check if ai-gateway directory exists
if [ -d "deploy/kubernetes/ai-gateway" ]; then
# Validate configuration yamls (without CRDs)
for yaml_file in deploy/kubernetes/ai-gateway/configuration/*.yaml; do
if [ -f "$yaml_file" ]; then
echo "Checking $yaml_file..."
# Basic YAML syntax check
kubectl create --dry-run=client -f "$yaml_file" || echo "Warning: Issues with $yaml_file"
fi
done

# Validate inference-pool manifests (skip CRD validation as they may not be installed)
for yaml_file in deploy/kubernetes/ai-gateway/inference-pool/*.yaml; do
if [ -f "$yaml_file" ]; then
echo "Checking $yaml_file for YAML syntax..."
# Just check if it's valid YAML
kubectl create --dry-run=client -f "$yaml_file" 2>&1 | grep -q "no matches for kind" && echo "✓ $yaml_file syntax valid (CRD not installed)" || echo "Validated $yaml_file"
fi
done

echo "✓ AI Gateway configuration validation completed"
else
echo "AI Gateway directory not found, skipping..."
fi
Loading
Loading