//! PostgreSQL Cluster Deployment Example (Rhai) //! //! This script shows how to deploy a PostgreSQL cluster using Rhai scripting //! with the KubernetesManager convenience methods. print("=== PostgreSQL Cluster Deployment ==="); // Create Kubernetes manager for the database namespace print("Creating Kubernetes manager for 'database' namespace..."); let km = kubernetes_manager_new("database"); print("āœ“ Kubernetes manager created"); // Create PostgreSQL cluster using the convenience method print("\nDeploying PostgreSQL cluster..."); try { // Deploy PostgreSQL using the convenience method let result = deploy_application(km, "postgres-cluster", "postgres:15", 2, 5432, #{ "app": "postgres-cluster", "type": "database", "engine": "postgresql" }); print("āœ“ " + result); print("\nāœ… PostgreSQL cluster deployed successfully!"); print("\nšŸ“‹ Connection Information:"); print(" Host: postgres-cluster.database.svc.cluster.local"); print(" Port: 5432"); print(" Database: postgres (default)"); print(" Username: postgres (default)"); print("\nšŸ”§ To connect from another pod:"); print(" psql -h postgres-cluster.database.svc.cluster.local -U postgres"); print("\nšŸ’” Next steps:"); print(" • Set POSTGRES_PASSWORD environment variable"); print(" • Configure persistent storage"); print(" • Set up backup and monitoring"); } catch(e) { print("āŒ Failed to deploy PostgreSQL cluster: " + e); } print("\n=== Deployment Complete ===");