added repo
This commit is contained in:
@@ -0,0 +1,392 @@
|
||||
#!/bin/bash
|
||||
# Bifrost Values File Generator
|
||||
# This interactive script helps you generate a custom values.yaml file
|
||||
|
||||
set -e
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
print_info() { echo -e "${BLUE}ℹ ${NC}$1"; }
|
||||
print_success() { echo -e "${GREEN}✓ ${NC}$1"; }
|
||||
print_warning() { echo -e "${YELLOW}⚠ ${NC}$1"; }
|
||||
print_error() { echo -e "${RED}✗ ${NC}$1"; }
|
||||
|
||||
print_banner() {
|
||||
echo ""
|
||||
echo -e "${BLUE}╔═══════════════════════════════════════════╗${NC}"
|
||||
echo -e "${BLUE}║ ║${NC}"
|
||||
echo -e "${BLUE}║ Bifrost Values Generator ║${NC}"
|
||||
echo -e "${BLUE}║ ║${NC}"
|
||||
echo -e "${BLUE}╚═══════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
print_banner
|
||||
|
||||
OUTPUT_FILE="my-values.yaml"
|
||||
|
||||
# Storage configuration - per-store backend selection
|
||||
echo "1. Select backend for Config Store:"
|
||||
echo " 1) SQLite (simple, single node)"
|
||||
echo " 2) PostgreSQL (production, scalable)"
|
||||
read -p "Choice [1-2]: " config_store_choice
|
||||
|
||||
case $config_store_choice in
|
||||
1) CONFIG_STORE_TYPE="sqlite" ;;
|
||||
2) CONFIG_STORE_TYPE="postgres" ;;
|
||||
*) print_error "Invalid choice"; exit 1 ;;
|
||||
esac
|
||||
|
||||
echo ""
|
||||
echo "2. Select backend for Logs Store:"
|
||||
echo " 1) SQLite (simple, single node)"
|
||||
echo " 2) PostgreSQL (production, scalable)"
|
||||
read -p "Choice [1-2]: " logs_store_choice
|
||||
|
||||
case $logs_store_choice in
|
||||
1) LOGS_STORE_TYPE="sqlite" ;;
|
||||
2) LOGS_STORE_TYPE="postgres" ;;
|
||||
*) print_error "Invalid choice"; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Determine if PostgreSQL is needed (for either store)
|
||||
if [[ "$CONFIG_STORE_TYPE" == "postgres" ]] || [[ "$LOGS_STORE_TYPE" == "postgres" ]]; then
|
||||
NEEDS_POSTGRES="true"
|
||||
else
|
||||
NEEDS_POSTGRES="false"
|
||||
fi
|
||||
|
||||
# Determine if SQLite persistence is needed (for either store)
|
||||
if [[ "$CONFIG_STORE_TYPE" == "sqlite" ]] || [[ "$LOGS_STORE_TYPE" == "sqlite" ]]; then
|
||||
NEEDS_SQLITE_PERSISTENCE="true"
|
||||
else
|
||||
NEEDS_SQLITE_PERSISTENCE="false"
|
||||
fi
|
||||
|
||||
# Vector store
|
||||
echo ""
|
||||
echo "3. Do you need vector store for semantic caching?"
|
||||
read -p "Enable vector store? (y/n): " vector_choice
|
||||
|
||||
if [[ "$vector_choice" =~ ^[Yy]$ ]]; then
|
||||
echo " 1) Weaviate"
|
||||
echo " 2) Redis"
|
||||
echo " 3) Qdrant"
|
||||
read -p "Choice [1-3]: " vector_type_choice
|
||||
case $vector_type_choice in
|
||||
1) VECTOR_TYPE="weaviate" ;;
|
||||
2) VECTOR_TYPE="redis" ;;
|
||||
3) VECTOR_TYPE="qdrant" ;;
|
||||
*) print_error "Invalid choice"; exit 1 ;;
|
||||
esac
|
||||
VECTOR_ENABLED="true"
|
||||
else
|
||||
VECTOR_ENABLED="false"
|
||||
VECTOR_TYPE="none"
|
||||
fi
|
||||
|
||||
# Deployment type
|
||||
echo ""
|
||||
echo "4. Deployment type:"
|
||||
echo " 1) Development (1 replica, minimal resources)"
|
||||
echo " 2) Production (3+ replicas, auto-scaling)"
|
||||
read -p "Choice [1-2]: " deploy_choice
|
||||
|
||||
case $deploy_choice in
|
||||
1)
|
||||
REPLICAS="1"
|
||||
AUTOSCALING="false"
|
||||
CPU_REQUEST="250m"
|
||||
MEM_REQUEST="256Mi"
|
||||
CPU_LIMIT="1000m"
|
||||
MEM_LIMIT="1Gi"
|
||||
;;
|
||||
2)
|
||||
REPLICAS="3"
|
||||
AUTOSCALING="true"
|
||||
CPU_REQUEST="1000m"
|
||||
MEM_REQUEST="1Gi"
|
||||
CPU_LIMIT="4000m"
|
||||
MEM_LIMIT="4Gi"
|
||||
;;
|
||||
*) print_error "Invalid choice"; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Ingress
|
||||
echo ""
|
||||
read -p "5. Do you want to enable Ingress? (y/n): " ingress_choice
|
||||
if [[ "$ingress_choice" =~ ^[Yy]$ ]]; then
|
||||
INGRESS_ENABLED="true"
|
||||
read -p " Enter your domain (e.g., bifrost.yourdomain.com): " DOMAIN
|
||||
else
|
||||
INGRESS_ENABLED="false"
|
||||
DOMAIN="bifrost.local"
|
||||
fi
|
||||
|
||||
# Encryption key
|
||||
echo ""
|
||||
read -p "6. Enter encryption key (leave empty to skip): " ENCRYPTION_KEY
|
||||
|
||||
# Check if output file already exists
|
||||
if [[ -f "$OUTPUT_FILE" ]]; then
|
||||
echo ""
|
||||
print_warning "File '$OUTPUT_FILE' already exists."
|
||||
read -p "Do you want to overwrite it? (y/n): " overwrite_choice
|
||||
if [[ ! "$overwrite_choice" =~ ^[Yy]$ ]]; then
|
||||
print_info "Generation aborted. No files were modified."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Generate the file
|
||||
print_info "Generating values file..."
|
||||
|
||||
cat > "$OUTPUT_FILE" <<EOF
|
||||
# Generated Bifrost values file
|
||||
# Generated on: $(date)
|
||||
|
||||
# Deployment configuration
|
||||
replicaCount: ${REPLICAS}
|
||||
|
||||
autoscaling:
|
||||
enabled: ${AUTOSCALING}
|
||||
minReplicas: 3
|
||||
maxReplicas: 10
|
||||
targetCPUUtilizationPercentage: 70
|
||||
|
||||
resources:
|
||||
limits:
|
||||
cpu: ${CPU_LIMIT}
|
||||
memory: ${MEM_LIMIT}
|
||||
requests:
|
||||
cpu: ${CPU_REQUEST}
|
||||
memory: ${MEM_REQUEST}
|
||||
|
||||
# Storage configuration (per-store backend selection)
|
||||
storage:
|
||||
mode: sqlite # Default fallback
|
||||
EOF
|
||||
|
||||
if [[ "$NEEDS_SQLITE_PERSISTENCE" == "true" ]]; then
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
persistence:
|
||||
enabled: true
|
||||
size: 10Gi
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
configStore:
|
||||
enabled: true
|
||||
type: ${CONFIG_STORE_TYPE}
|
||||
logsStore:
|
||||
enabled: true
|
||||
type: ${LOGS_STORE_TYPE}
|
||||
|
||||
EOF
|
||||
|
||||
# PostgreSQL configuration
|
||||
if [[ "$NEEDS_POSTGRES" == "true" ]]; then
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
# PostgreSQL configuration (used by: $(
|
||||
stores=""
|
||||
[[ "$CONFIG_STORE_TYPE" == "postgres" ]] && stores="config store"
|
||||
[[ "$LOGS_STORE_TYPE" == "postgres" ]] && { [[ -n "$stores" ]] && stores="$stores, logs store" || stores="logs store"; }
|
||||
echo "$stores"
|
||||
))
|
||||
postgresql:
|
||||
enabled: true
|
||||
auth:
|
||||
username: bifrost
|
||||
password: "CHANGE_ME_SECURE_PASSWORD"
|
||||
database: bifrost
|
||||
primary:
|
||||
persistence:
|
||||
enabled: true
|
||||
size: 20Gi
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 2Gi
|
||||
requests:
|
||||
cpu: 500m
|
||||
memory: 1Gi
|
||||
|
||||
EOF
|
||||
else
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
# PostgreSQL disabled (using SQLite for all stores)
|
||||
postgresql:
|
||||
enabled: false
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Vector store configuration
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
# Vector store configuration
|
||||
vectorStore:
|
||||
enabled: ${VECTOR_ENABLED}
|
||||
type: ${VECTOR_TYPE}
|
||||
EOF
|
||||
|
||||
if [[ "$VECTOR_TYPE" == "weaviate" ]] && [[ "$VECTOR_ENABLED" == "true" ]]; then
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
weaviate:
|
||||
enabled: true
|
||||
replicas: 1
|
||||
persistence:
|
||||
enabled: true
|
||||
size: 10Gi
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 2Gi
|
||||
requests:
|
||||
cpu: 500m
|
||||
memory: 1Gi
|
||||
EOF
|
||||
elif [[ "$VECTOR_TYPE" == "redis" ]] && [[ "$VECTOR_ENABLED" == "true" ]]; then
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
redis:
|
||||
enabled: true
|
||||
auth:
|
||||
enabled: true
|
||||
password: "CHANGE_ME_REDIS_PASSWORD"
|
||||
master:
|
||||
persistence:
|
||||
enabled: true
|
||||
size: 8Gi
|
||||
resources:
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 256Mi
|
||||
EOF
|
||||
elif [[ "$VECTOR_TYPE" == "qdrant" ]] && [[ "$VECTOR_ENABLED" == "true" ]]; then
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
qdrant:
|
||||
enabled: true
|
||||
persistence:
|
||||
enabled: true
|
||||
size: 10Gi
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 2Gi
|
||||
requests:
|
||||
cpu: 500m
|
||||
memory: 1Gi
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Ingress
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
|
||||
# Ingress configuration
|
||||
ingress:
|
||||
enabled: ${INGRESS_ENABLED}
|
||||
EOF
|
||||
|
||||
if [[ "$INGRESS_ENABLED" == "true" ]]; then
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
className: "nginx"
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||
hosts:
|
||||
- host: ${DOMAIN}
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
tls:
|
||||
- secretName: bifrost-tls
|
||||
hosts:
|
||||
- ${DOMAIN}
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Bifrost configuration
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
|
||||
# Bifrost application configuration
|
||||
bifrost:
|
||||
EOF
|
||||
|
||||
if [[ -n "$ENCRYPTION_KEY" ]]; then
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
encryptionKey: "${ENCRYPTION_KEY}"
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
|
||||
client:
|
||||
enableLogging: true
|
||||
allowedOrigins:
|
||||
- "*"
|
||||
maxRequestBodySizeMb: 100
|
||||
|
||||
# Add your provider keys here
|
||||
providers: {}
|
||||
# Example:
|
||||
# openai:
|
||||
# keys:
|
||||
# - value: "sk-..."
|
||||
# weight: 1
|
||||
# anthropic:
|
||||
# keys:
|
||||
# - value: "sk-ant-..."
|
||||
# weight: 1
|
||||
|
||||
plugins:
|
||||
telemetry:
|
||||
enabled: true
|
||||
config: {}
|
||||
|
||||
logging:
|
||||
enabled: true
|
||||
config: {}
|
||||
EOF
|
||||
|
||||
if [[ "$VECTOR_ENABLED" == "true" ]]; then
|
||||
cat >> "$OUTPUT_FILE" <<EOF
|
||||
|
||||
semanticCache:
|
||||
enabled: true
|
||||
config:
|
||||
provider: "openai"
|
||||
keys:
|
||||
- "sk-..." # Add your OpenAI key for embeddings
|
||||
embeddingModel: "text-embedding-3-small"
|
||||
dimension: 1536
|
||||
threshold: 0.8
|
||||
ttl: "5m"
|
||||
EOF
|
||||
fi
|
||||
|
||||
print_success "Values file generated: $OUTPUT_FILE"
|
||||
echo ""
|
||||
print_info "Storage configuration:"
|
||||
print_info " - Config Store: ${CONFIG_STORE_TYPE}"
|
||||
print_info " - Logs Store: ${LOGS_STORE_TYPE}"
|
||||
echo ""
|
||||
print_warning "Please review and edit the generated file:"
|
||||
print_warning " - Add your provider API keys"
|
||||
if [[ "$NEEDS_POSTGRES" == "true" ]]; then
|
||||
print_warning " - Change PostgreSQL password"
|
||||
fi
|
||||
if [[ "$VECTOR_TYPE" == "redis" ]] && [[ "$VECTOR_ENABLED" == "true" ]]; then
|
||||
print_warning " - Change Redis password"
|
||||
fi
|
||||
if [[ -z "$ENCRYPTION_KEY" ]]; then
|
||||
print_warning " - Add encryption key for production"
|
||||
fi
|
||||
echo ""
|
||||
print_info "Install with: helm install bifrost ./bifrost -f $OUTPUT_FILE"
|
||||
@@ -0,0 +1,228 @@
|
||||
#!/bin/bash
|
||||
# Bifrost Helm Chart Installation Script
|
||||
# This script helps you install Bifrost with different configurations
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Print colored output
|
||||
print_info() {
|
||||
echo -e "${BLUE}ℹ ${NC}$1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}✓ ${NC}$1"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}⚠ ${NC}$1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}✗ ${NC}$1"
|
||||
}
|
||||
|
||||
# Print banner
|
||||
print_banner() {
|
||||
echo ""
|
||||
echo -e "${BLUE}╔═══════════════════════════════════════════╗${NC}"
|
||||
echo -e "${BLUE}║ ║${NC}"
|
||||
echo -e "${BLUE}║ Bifrost Helm Chart Installer ║${NC}"
|
||||
echo -e "${BLUE}║ ║${NC}"
|
||||
echo -e "${BLUE}╚═══════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Check prerequisites
|
||||
check_prerequisites() {
|
||||
print_info "Checking prerequisites..."
|
||||
|
||||
if ! command -v helm &> /dev/null; then
|
||||
print_error "Helm is not installed. Please install Helm 3.2.0 or later."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v kubectl &> /dev/null; then
|
||||
print_error "kubectl is not installed. Please install kubectl."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check kubectl connection
|
||||
if ! kubectl cluster-info &> /dev/null; then
|
||||
print_error "Cannot connect to Kubernetes cluster. Please check your kubeconfig."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_success "All prerequisites met"
|
||||
}
|
||||
|
||||
# Show menu
|
||||
show_menu() {
|
||||
echo ""
|
||||
echo "Select a deployment configuration:"
|
||||
echo ""
|
||||
echo " 1) SQLite only (simple, local development)"
|
||||
echo " 2) PostgreSQL only (production-ready database)"
|
||||
echo " 3) PostgreSQL + Weaviate (semantic caching with Weaviate)"
|
||||
echo " 4) PostgreSQL + Redis (semantic caching with Redis)"
|
||||
echo " 5) SQLite + Weaviate (local dev with semantic caching)"
|
||||
echo " 6) SQLite + Redis (local dev with Redis caching)"
|
||||
echo " 7) External PostgreSQL (use your own database)"
|
||||
echo " 8) Production HA (high-availability setup)"
|
||||
echo " 9) Custom (use your own values file)"
|
||||
echo ""
|
||||
echo " 0) Exit"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Get user input
|
||||
get_input() {
|
||||
read -p "Enter your choice [0-9]: " choice
|
||||
case $choice in
|
||||
1) CONFIG="sqlite-only" ;;
|
||||
2) CONFIG="postgres-only" ;;
|
||||
3) CONFIG="postgres-weaviate" ;;
|
||||
4) CONFIG="postgres-redis" ;;
|
||||
5) CONFIG="sqlite-weaviate" ;;
|
||||
6) CONFIG="sqlite-redis" ;;
|
||||
7) CONFIG="external-postgres" ;;
|
||||
8) CONFIG="production-ha" ;;
|
||||
9) CONFIG="custom" ;;
|
||||
0) exit 0 ;;
|
||||
*)
|
||||
print_error "Invalid choice. Please try again."
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
return 0
|
||||
}
|
||||
|
||||
# Get release name
|
||||
get_release_name() {
|
||||
read -p "Enter release name (default: bifrost): " RELEASE_NAME
|
||||
RELEASE_NAME=${RELEASE_NAME:-bifrost}
|
||||
}
|
||||
|
||||
# Get namespace
|
||||
get_namespace() {
|
||||
read -p "Enter namespace (default: default): " NAMESPACE
|
||||
NAMESPACE=${NAMESPACE:-default}
|
||||
|
||||
# Check if namespace exists
|
||||
if ! kubectl get namespace "$NAMESPACE" &> /dev/null; then
|
||||
read -p "Namespace '$NAMESPACE' does not exist. Create it? (y/n): " CREATE_NS
|
||||
if [[ "$CREATE_NS" =~ ^[Yy]$ ]]; then
|
||||
kubectl create namespace "$NAMESPACE"
|
||||
print_success "Namespace '$NAMESPACE' created"
|
||||
else
|
||||
print_error "Installation aborted"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Get custom values file
|
||||
get_custom_values() {
|
||||
read -p "Enter path to custom values file: " CUSTOM_VALUES
|
||||
if [[ ! -f "$CUSTOM_VALUES" ]]; then
|
||||
print_error "File not found: $CUSTOM_VALUES"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Install chart
|
||||
install_chart() {
|
||||
local values_file=""
|
||||
|
||||
if [[ "$CONFIG" == "custom" ]]; then
|
||||
# Validate that CUSTOM_VALUES is non-empty
|
||||
if [[ -z "$CUSTOM_VALUES" ]]; then
|
||||
print_error "Custom values file path is empty"
|
||||
exit 1
|
||||
fi
|
||||
values_file="$CUSTOM_VALUES"
|
||||
# Validate that the custom values file exists and is a regular file
|
||||
if [[ ! -f "$values_file" ]]; then
|
||||
print_error "Custom values file does not exist or is not a regular file: $values_file"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
values_file="${CHART_DIR}/values-examples/${CONFIG}.yaml"
|
||||
# Validate that the predefined values file exists
|
||||
if [[ ! -f "$values_file" ]]; then
|
||||
print_error "Values file does not exist: $values_file"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
print_info "Installing Bifrost..."
|
||||
print_info "Release: $RELEASE_NAME"
|
||||
print_info "Namespace: $NAMESPACE"
|
||||
print_info "Configuration: $CONFIG"
|
||||
echo ""
|
||||
|
||||
# Ask for confirmation
|
||||
read -p "Proceed with installation? (y/n): " CONFIRM
|
||||
if [[ ! "$CONFIRM" =~ ^[Yy]$ ]]; then
|
||||
print_warning "Installation cancelled"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Run helm install with explicit chart directory
|
||||
if helm install "$RELEASE_NAME" "$CHART_DIR" \
|
||||
--namespace "$NAMESPACE" \
|
||||
-f "$values_file" \
|
||||
--create-namespace; then
|
||||
|
||||
print_success "Bifrost installed successfully!"
|
||||
echo ""
|
||||
print_info "To check the status:"
|
||||
echo " helm status $RELEASE_NAME -n $NAMESPACE"
|
||||
echo ""
|
||||
print_info "To get the application URL:"
|
||||
echo " kubectl --namespace $NAMESPACE port-forward svc/$RELEASE_NAME 8080:8080"
|
||||
echo " Then visit: http://localhost:8080"
|
||||
echo ""
|
||||
print_info "To view logs:"
|
||||
echo " kubectl logs -l app.kubernetes.io/name=bifrost -n $NAMESPACE -f"
|
||||
echo ""
|
||||
else
|
||||
print_error "Installation failed"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
print_banner
|
||||
check_prerequisites
|
||||
|
||||
while true; do
|
||||
show_menu
|
||||
if get_input; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
get_release_name
|
||||
get_namespace
|
||||
|
||||
if [[ "$CONFIG" == "custom" ]]; then
|
||||
get_custom_values
|
||||
fi
|
||||
|
||||
# Set explicit chart directory (parent of scripts directory)
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
CHART_DIR="$SCRIPT_DIR/.."
|
||||
|
||||
install_chart
|
||||
}
|
||||
|
||||
# Run main function
|
||||
main
|
||||
@@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
# Bifrost Helm Chart Validation Script
|
||||
# This script validates the Helm chart before installation
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
print_info() {
|
||||
echo -e "${BLUE}ℹ ${NC}$1"
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}✓ ${NC}$1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}✗ ${NC}$1"
|
||||
}
|
||||
|
||||
print_banner() {
|
||||
echo ""
|
||||
echo -e "${BLUE}╔═══════════════════════════════════════════╗${NC}"
|
||||
echo -e "${BLUE}║ ║${NC}"
|
||||
echo -e "${BLUE}║ Bifrost Chart Validator ║${NC}"
|
||||
echo -e "${BLUE}║ ║${NC}"
|
||||
echo -e "${BLUE}╚═══════════════════════════════════════════╝${NC}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Set explicit chart directory (parent of scripts directory)
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
CHART_DIR="$SCRIPT_DIR/.."
|
||||
|
||||
print_banner
|
||||
|
||||
# Check if Helm is installed
|
||||
print_info "Checking Helm installation..."
|
||||
if ! command -v helm &> /dev/null; then
|
||||
print_error "Helm is not installed"
|
||||
exit 1
|
||||
fi
|
||||
print_success "Helm is installed"
|
||||
|
||||
# Lint the chart
|
||||
print_info "Linting Helm chart..."
|
||||
if helm lint "$CHART_DIR"; then
|
||||
print_success "Chart linting passed"
|
||||
else
|
||||
print_error "Chart linting failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Template the chart with default values
|
||||
print_info "Templating chart with default values..."
|
||||
if helm template test-release "$CHART_DIR" > /dev/null; then
|
||||
print_success "Default values template successful"
|
||||
else
|
||||
print_error "Default values template failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test all example configurations
|
||||
print_info "Testing example configurations..."
|
||||
for config in "$CHART_DIR"/values-examples/*.yaml; do
|
||||
config_name=$(basename "$config")
|
||||
print_info " Testing $config_name..."
|
||||
if helm template test-release "$CHART_DIR" -f "$config" > /dev/null; then
|
||||
print_success " $config_name: OK"
|
||||
else
|
||||
print_error " $config_name: FAILED"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Dry run install
|
||||
print_info "Performing dry-run installation..."
|
||||
if helm install test-release "$CHART_DIR" --dry-run --debug > /dev/null 2>&1; then
|
||||
print_success "Dry-run installation successful"
|
||||
else
|
||||
print_error "Dry-run installation failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
print_success "All validation checks passed!"
|
||||
echo ""
|
||||
print_info "Chart is ready for installation"
|
||||
Reference in New Issue
Block a user