|
| 1 | +name: Configuration Test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + kustomize_version: |
| 7 | + description: "Kustomize version to use" |
| 8 | + required: false |
| 9 | + type: string |
| 10 | + default: "v5.7.1" |
| 11 | + |
| 12 | +jobs: |
| 13 | + test-with-custom-config: |
| 14 | + name: Test with Custom Configuration |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Install Kustomize |
| 22 | + run: | |
| 23 | + echo "Installing Kustomize ${{ inputs.kustomize_version }}..." |
| 24 | + # Use the official installation script for better reliability |
| 25 | + curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash |
| 26 | + sudo mv kustomize /usr/local/bin/ |
| 27 | + kustomize version |
| 28 | +
|
| 29 | + - name: Test kustomize with different overlays |
| 30 | + run: | |
| 31 | + echo "Testing base kustomization..." |
| 32 | + kustomize build deploy/kubernetes > /tmp/base-manifests.yaml |
| 33 | +
|
| 34 | + echo "Validating generated resources..." |
| 35 | +
|
| 36 | + # Check if all expected resources are present |
| 37 | + if ! grep -q "kind: Namespace" /tmp/base-manifests.yaml; then |
| 38 | + echo "Error: Namespace not found" |
| 39 | + exit 1 |
| 40 | + fi |
| 41 | +
|
| 42 | + if ! grep -q "kind: Deployment" /tmp/base-manifests.yaml; then |
| 43 | + echo "Error: Deployment not found" |
| 44 | + exit 1 |
| 45 | + fi |
| 46 | +
|
| 47 | + if ! grep -q "kind: Service" /tmp/base-manifests.yaml; then |
| 48 | + echo "Error: Service not found" |
| 49 | + exit 1 |
| 50 | + fi |
| 51 | +
|
| 52 | + if ! grep -q "kind: ConfigMap" /tmp/base-manifests.yaml; then |
| 53 | + echo "Error: ConfigMap not found" |
| 54 | + exit 1 |
| 55 | + fi |
| 56 | +
|
| 57 | + echo "✓ All expected resources are present" |
| 58 | +
|
| 59 | + - name: Verify ConfigMap generation |
| 60 | + run: | |
| 61 | + echo "Checking ConfigMap generation..." |
| 62 | + kustomize build deploy/kubernetes | grep -A 20 "kind: ConfigMap" |
| 63 | +
|
| 64 | + # Verify config files are included |
| 65 | + if ! kustomize build deploy/kubernetes | grep -q "config.yaml"; then |
| 66 | + echo "Warning: config.yaml might not be properly included in ConfigMap" |
| 67 | + fi |
| 68 | +
|
| 69 | + if ! kustomize build deploy/kubernetes | grep -q "tools_db.json"; then |
| 70 | + echo "Warning: tools_db.json might not be properly included in ConfigMap" |
| 71 | + fi |
| 72 | +
|
| 73 | + - name: Validate observability kustomization |
| 74 | + run: | |
| 75 | + echo "Validating observability stack kustomization..." |
| 76 | + if [ -d "deploy/kubernetes/observability" ]; then |
| 77 | + kustomize build deploy/kubernetes/observability > /tmp/observability-manifests.yaml |
| 78 | + echo "✓ Observability kustomization is valid" |
| 79 | + |
| 80 | + # Verify expected resources |
| 81 | + for resource in "Deployment" "Service" "ConfigMap" "PersistentVolumeClaim"; do |
| 82 | + if ! grep -q "kind: $resource" /tmp/observability-manifests.yaml; then |
| 83 | + echo "Warning: $resource not found in observability manifests" |
| 84 | + fi |
| 85 | + done |
| 86 | + else |
| 87 | + echo "Observability directory not found, skipping..." |
| 88 | + fi |
| 89 | +
|
| 90 | + - name: Validate AI Gateway configurations |
| 91 | + run: | |
| 92 | + echo "Validating AI Gateway configurations..." |
| 93 | +
|
| 94 | + # Check if ai-gateway directory exists |
| 95 | + if [ -d "deploy/kubernetes/ai-gateway" ]; then |
| 96 | + # Validate configuration yamls (without CRDs) |
| 97 | + for yaml_file in deploy/kubernetes/ai-gateway/configuration/*.yaml; do |
| 98 | + if [ -f "$yaml_file" ]; then |
| 99 | + echo "Checking $yaml_file..." |
| 100 | + # Basic YAML syntax check |
| 101 | + kubectl create --dry-run=client -f "$yaml_file" || echo "Warning: Issues with $yaml_file" |
| 102 | + fi |
| 103 | + done |
| 104 | + |
| 105 | + # Validate inference-pool manifests (skip CRD validation as they may not be installed) |
| 106 | + for yaml_file in deploy/kubernetes/ai-gateway/inference-pool/*.yaml; do |
| 107 | + if [ -f "$yaml_file" ]; then |
| 108 | + echo "Checking $yaml_file for YAML syntax..." |
| 109 | + # Just check if it's valid YAML |
| 110 | + 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" |
| 111 | + fi |
| 112 | + done |
| 113 | + |
| 114 | + echo "✓ AI Gateway configuration validation completed" |
| 115 | + else |
| 116 | + echo "AI Gateway directory not found, skipping..." |
| 117 | + fi |
0 commit comments