#!/bin/bash
check_kubernetes_yaml() {
    if ls *.yaml 1> /dev/null 2>&1; then
        if [[ -f Chart.yaml ]]; then
            echo "Helm"
            return 0
        fi
        if [[ -f kustomization.yaml ]]; then
            echo "Kust"
            return 0
        fi
        for file in $(ls *.yaml); do
            if [ -f "$file" ] && grep -q -E '^(apiVersion|kind):' "$file"; then
                echo "k8s"
                return 0
            fi
            done
    else
        echo ""
        return 0
    fi
}

check_kubernetes_yaml
