kustomization.yaml#

# Title: Kustomization Configuration for MLOps Weather Forecasting Platform
#
# Purpose: Serves as the central Kustomize configuration file for orchestrating Kubernetes
#          manifest transformations and deployments. Ensures consistent, reproducible
#          infrastructure across development, staging, and production environments.
#
# Owner: Development Team (MLOps Weather Forecasting Platform)
# Source: https://github.com/roadlake/weather_ml
# Last-Reviewed: 2025-08-24
# Depends-On: ../.env, postgres-deployment.yaml, docker-compose.yml
# Change-Log:
#   - 2025-08-24: Updated file header following YAML comment standards
#   - 2024-XX-XX: Initial configuration for Kubernetes deployments
#
# Links:
#   - Project: https://github.com/roadlake/weather_ml
#   - Kustomize: https://kustomize.io/
#   - Kubernetes: https://kubernetes.io/
#
# Why This Architecture:
#   - Infrastructure as Code: Declarative specifications ensure reproducible deployments
#   - Complements Docker Compose: Enables seamless transition from local dev to production
#   - Production-Ready: Supports k3d for lightweight Kubernetes testing and scaling
#   - Security-First: Secrets generated from .env files prevent credential exposure

# =============================================================================
# Kubernetes API and Resource Configuration
# =============================================================================

# WHY: Use v1beta1 API for stable Kustomization features while maintaining compatibility
# with current Kubernetes versions. This API version provides all necessary functionality
# for manifest transformation and resource orchestration.
apiVersion: kustomize.config.k8s.io/v1beta1

# WHY: Explicitly defines this YAML as a Kustomization configuration file, which enables
# Kustomize to process and transform the specified Kubernetes resources declaratively.
kind: Kustomization

# =============================================================================
# Base Kubernetes Manifests
# WHY: Declares the fundamental Kubernetes resources that form the foundation of the
# weather platform deployment. Each manifest file contains production-ready specifications
# for specific components, ensuring consistent infrastructure across all environments.
# =============================================================================
resources:
  - postgres-deployment.yaml  # PostgreSQL database stateful service with persistent storage and health checks

# =============================================================================
# Resource Generation Configuration
# WHY: Controls how Kustomize automatically generates additional Kubernetes resources
# such as Secrets and ConfigMaps. Disabling name suffix hashing ensures consistent
# resource naming across deployments, which is critical for CI/CD pipelines and
# automated operations where predictable resource names are required.
# =============================================================================
generatorOptions:
  disableNameSuffixHash: true  # Ensures deterministic naming for generated resources to maintain CI/CD reliability

# =============================================================================
# Environment-Based Secret Management
# WHY: Externalizes sensitive configuration (database credentials, API keys) to environment
# files rather than hardcoding them in manifests. This approach prevents credential leakage
# in version control while enabling environment-specific configurations. The .env file
# is explicitly excluded from version control through .gitignore to maintain security.
# =============================================================================
secretGenerator:
  - name: postgres-secrets  # Standard naming convention for PostgreSQL authentication secrets
    envs:
      - ../.env  # References centralized environment configuration for credential management