Urbalurba Infrastructure Rules Guide
File: docs/rules-readme.md
Purpose: Central entry point for all infrastructure rules and standards
Target Audience: Developers, DevOps engineers, and anyone working with the Urbalurba platform
Last Updated: September 21, 2024
π Overviewβ
This is the central starting point for understanding all rules, standards, and best practices when working with the Urbalurba infrastructure platform. The rules are organized into specialized guides covering different aspects of the platform.
π Rule Categoriesβ
Infrastructure Provisioning Rulesβ
Comprehensive rules for deploying and managing infrastructure on Kubernetes using the Urbalurba platform patterns:
- Shell Script + Ansible Patterns: Separation of orchestration and implementation
- Cluster Testing Standards: kubectl run patterns for reliable service verification
- Progress Feedback Requirements: User experience during long-running operations
- Task Organization: Sequential numbering and proper structure
- Error Handling: Quiet success, verbose failure patterns
- Helm Repository Management: Consistent chart deployment practices
When to use: Infrastructure deployment, service provisioning, cluster setup automation
Automated Kubernetes Deployment Rulesβ
βΈοΈ Automated Kubernetes Deployment Rules Guide
Mandatory patterns and standards for the automated deployment system in provision-host/kubernetes:
- Directory Structure: Numbered categories for dependency management
- Script Requirements: Parameter handling, status tracking, error resilience
- Active/Inactive Management: Using not-in-use folders for optional services
- Dependency Order: Ensuring prerequisites are met through proper numbering
- Namespace Standards: Consistent namespace usage across services
- Testing Requirements: Health checks and deployment verification
When to use: Adding new applications, creating deployment scripts, managing service dependencies
Ingress and Networking Rulesβ
π¦ Ingress Rules Guide
Detailed standards for configuring ingress and networking using Traefik in the Kubernetes cluster:
- Traefik IngressRoute Standards: CRD usage patterns and API versions
- Multi-Domain Routing: HostRegexp patterns for flexible domain handling
- Authentication Integration: Authentik middleware configuration
- DNS Architecture: Dual-context routing for localhost and external domains
- Security Patterns: CSP middleware and forward auth configurations
When to use: Service exposure, domain routing, authentication setup, external access
Secrets Management Rulesβ
π Secrets Management Rules Guide
Comprehensive rules for the modular secrets management system ensuring security and maintainability:
- Template + Gitignore Pattern: Separation of base templates from actual secrets
- Variable Substitution Standards: Centralized configuration with
${VARIABLE}patterns - Security Verification: Git safety checks and validation requirements
- Service Integration: Proper namespace organization and secret structure
- Rotation Procedures: Safe secret rotation and emergency response protocols
- Cross-System Dependencies: Integration with provisioning, ingress, and git workflows
When to use: All secrets management, configuration updates, service deployments requiring credentials
Git Workflow and Development Rulesβ
Professional Git workflow standards for maintaining code quality and enabling collaboration:
- Feature Branch Workflow: Branch strategy and naming conventions
- Pull Request Requirements: Mandatory PR process with detailed descriptions
- Code Review Standards: Quality criteria and review processes
- Commit Message Standards: Clear, descriptive commit practices
- Branch Management: Creation, merging, and cleanup procedures
- Emergency Procedures: Hotfix and rollback processes
When to use: All code contributions, feature development, bug fixes, documentation updates
Development Workflow Rulesβ
π» Development Workflow Rules Guide
Standards for working with the urbalurba-infrastructure codebase, covering file operations, command execution, and project conventions:
- Path Conventions: Relative paths from repository root for consistency
- Workflow Types: Claude Code AI vs. human developer workflows
- File Operations: Read, write, edit patterns for different contexts
- Command Execution: Mac host vs. provision-host container operations
- Kubernetes Operations: kubectl commands and resource management
- Testing Patterns: Verification and validation approaches
When to use: Daily development work, AI assistant operations, file management, command execution
Naming Conventions Rulesβ
π·οΈ Naming Conventions Rules Guide
Standardized naming patterns for files, manifests, scripts, and resources across the infrastructure:
- Manifest Numbering: Sequential numbering scheme (000-999) by service category
- File Naming: Consistent patterns for YAML, scripts, and documentation
- Resource Naming: Kubernetes resources, namespaces, and labels
- Script Naming: Shell scripts and Ansible playbooks conventions
- Service Categories: Numbered ranges for different infrastructure layers
When to use: Creating new manifests, scripts, services, or any infrastructure resources
Documentation Standardsβ
π Documentation Standards Guide
Comprehensive guide for writing consistent, high-quality documentation across the infrastructure:
- Documentation Structure: Standardized sections and formatting
- Metadata Headers: File, purpose, audience, last updated fields
- Writing Style: Clarity, conciseness, and technical accuracy
- Examples and Code Blocks: Proper formatting and syntax highlighting
- Cross-References: Linking between related documentation
- Update Requirements: Keeping documentation synchronized with code
When to use: Writing or updating any documentation files, README files, or inline comments
π― Quick Referenceβ
For New Developersβ
- Start with: Git Workflow Rules - Learn development workflow and collaboration
- Then read: Development Workflow Rules - Learn daily development practices
- Next: Naming Conventions Rules - Learn file and resource naming
- Then: Documentation Standards - Learn documentation practices
- Next: Secrets Management Rules - Learn secure secrets handling
- Then: Provisioning Rules - Learn infrastructure deployment patterns
- Finally: Ingress Rules - Understand service exposure
For Development Workβ
- Making code changes: Follow Git Workflow Rules
- Daily development: Follow Development Workflow Rules
- Naming files/resources: Follow Naming Conventions Rules
- Writing documentation: Follow Documentation Standards
- Managing secrets: Follow Secrets Management Rules
- Deploying services: Follow Provisioning Rules
- Exposing services: Follow Ingress Rules
For Troubleshootingβ
- Deployment issues: Check Rule 3 in Provisioning Rules for cluster testing patterns
- Access issues: Check DNS resolution in Ingress Rules
π§ Rule Enforcementβ
Automated Validationβ
- CI/CD pipelines should validate compliance with these rules
- Use the patterns documented in each guide as templates
Manual Reviewβ
- All pull requests must demonstrate rule compliance
- Peer reviews should verify adherence to documented patterns
- No exceptions without documented justification
π Related Documentationβ
- π Networking Overview:
docs/networking-readme.md- High-level cluster networking - ποΈ Infrastructure Guide:
docs/infrastructure-readme.md- Overall platform architecture - π€ AI Environment:
docs/package-ai-environment-management.md- AI-specific patterns
π Contributing to Rulesβ
When to Add New Rulesβ
- Recurring anti-patterns are discovered
- New deployment patterns are established
- Infrastructure standards evolve
Rule Documentation Standardsβ
- Each rule must include examples (both β correct and β incorrect)
- Background explanation of why the rule exists
- Clear enforcement criteria
- Links to working examples in the codebase
Update Processβ
- Propose rule changes via pull request
- Update relevant rule guide (Provisioning or Ingress)
- Update this central guide if categories change
- Ensure all existing code complies with new rules
π‘ Remember: These rules exist to ensure reliable, maintainable, and scalable infrastructure. They represent lessons learned from real deployment challenges and should be followed consistently across all Urbalurba infrastructure work.