{"id":48084416,"url":"https://github.com/upbound/configuration-k8gb-bluegreen","last_synced_at":"2026-04-04T15:07:05.358Z","repository":{"id":313227041,"uuid":"1049395087","full_name":"upbound/configuration-k8gb-bluegreen","owner":"upbound","description":"Global Blue/Green Deployments with Upbound Crossplane and k8gb","archived":false,"fork":false,"pushed_at":"2026-01-30T19:06:43.000Z","size":809,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-31T11:52:58.647Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"AMPL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/upbound.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-02T23:17:45.000Z","updated_at":"2025-09-10T12:48:13.000Z","dependencies_parsed_at":"2025-09-04T18:15:37.266Z","dependency_job_id":"15e48b1f-8d56-4f4f-8ab5-08214e4d48ee","html_url":"https://github.com/upbound/configuration-k8gb-bluegreen","commit_stats":null,"previous_names":["upbound/configuration-k8gb-bluegreen"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/upbound/configuration-k8gb-bluegreen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upbound%2Fconfiguration-k8gb-bluegreen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upbound%2Fconfiguration-k8gb-bluegreen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upbound%2Fconfiguration-k8gb-bluegreen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upbound%2Fconfiguration-k8gb-bluegreen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/upbound","download_url":"https://codeload.github.com/upbound/configuration-k8gb-bluegreen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upbound%2Fconfiguration-k8gb-bluegreen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31403952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-04T15:07:04.746Z","updated_at":"2026-04-04T15:07:05.340Z","avatar_url":"https://github.com/upbound.png","language":"AMPL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Global Blue/Green Deployments with Upbound Crossplane and k8gb\n\nAn Upbound DevX configuration package that enables global blue/green deployments across geographically distributed Kubernetes clusters using k8gb. This configuration provides automatic active/passive cluster switching with Azure infrastructure and intelligent GSLB health monitoring.\n\n## Architecture\n\n### Multi-Cluster Overview\n```\n┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐\n│   Cluster A     │    │   Cluster B     │    │   Cluster C     │\n│  (Primary EU)   │    │ (Secondary US)  │    │ (Secondary CN)  │\n├─────────────────┤    ├─────────────────┤    ├─────────────────┤\n│ GlobalApp XR    │    │ GlobalApp XR    │    │ GlobalApp XR    │\n│ ├─Azure RG      │    │ ├─Azure RG      │    │ ├─Azure RG      │\n│ ├─Redis Cache   │    │ ├─Redis Cache   │    │ ├─Redis Cache   │\n│ ├─Podinfo App   │    │ ├─Podinfo App   │    │ ├─Podinfo App   │\n│ └─k8gb GSLB     │    │ └─k8gb GSLB     │    │ └─k8gb GSLB     │\n└─────────────────┘    └─────────────────┘    └─────────────────┘\n         │                       │                       │\n         └───────────────────────┼───────────────────────┘\n                                 │\n                    ┌─────────────────┐\n                    │   DNS/GSLB      │\n                    │ Traffic Routing │\n                    └─────────────────┘\n```\n\n### Global Blue/Green Health Monitoring\n![Crossplane Function Health Monitoring](docs/assets/arch.png)\n\nThe configuration uses intelligent health monitoring to automatically detect cluster health and recommend policy changes for seamless blue/green switching.\n\n### Active/Passive Cluster Policies\n![Active/Passive Cluster Policies](https://www.k8gb.io/examples/crossplane/globalapp/assets/active-passive-cluster-policies.png)\n\nAutomatic policy management enables hands-off blue/green deployments where unhealthy clusters are automatically moved to \"Observe\" mode while healthy clusters receive traffic.\n\n## Features\n\n- **Global Blue/Green**: Automatic active/passive cluster switching based on health\n- **Azure Infrastructure**: Resource Groups and Redis Cache for application state\n- **Application Deployment**: Podinfo with k8gb integration via Helm\n- **GSLB Health Monitoring**: Intelligent traffic routing and failover\n- **Upbound DevX**: Modern embedded functions with KCL-based composition logic\n- **Auto-Policy Management**: Hands-off blue/green switching with policy automation\n- **Crossplane v2**: Compatible with namespace-scoped `.m.upbound.io` resources\n\n## Prerequisites\n\n### k8gb Installation Required\n\n**Important**: k8gb must be pre-installed on your Kubernetes clusters for proper GSLB functionality. This configuration creates k8gb `Gslb` resources but does not install the k8gb operator itself.\n\n```bash\n# Install k8gb using Helm\nhelm repo add k8gb https://www.k8gb.io\nhelm install k8gb k8gb/k8gb --namespace k8gb --create-namespace\n```\n\nSee [k8gb installation guide](https://www.k8gb.io/docs/install.html) for detailed setup instructions.\n\n### Other Dependencies\n\n- **Crossplane** \u003e= v2 with v2 composition mode\n- **Azure credentials** configured as Kubernetes secrets\n- **DNS delegation** configured for k8gb domains\n- **Ingress controller** (nginx recommended)\n\n## Installation\n\n1. **Install the configuration**:\n   ```bash\n   kubectl apply -f - \u003c\u003cEOF\n   apiVersion: pkg.crossplane.io/v1\n   kind: Configuration\n   metadata:\n     name: configuration-k8gb-bluegreen\n   spec:\n     package: xpkg.upbound.io/upbound/configuration-k8gb-bluegreen:v0.1.1\n   EOF\n   ```\n\n2. **Configure Azure credentials**:\n   ```bash\n   # Create Azure service principal credentials file\n   cat \u003e azure-credentials.json \u003c\u003cEOF\n   {\n     \"clientId\": \"your-client-id\",\n     \"clientSecret\": \"your-client-secret\",\n     \"subscriptionId\": \"your-subscription-id\",\n     \"tenantId\": \"your-tenant-id\"\n   }\n   EOF\n   \n   # Create Kubernetes secret\n   kubectl create secret generic azure-creds \\\n     -n crossplane-system \\\n     --from-file=credentials=./azure-credentials.json\n   ```\n\n3. **Apply the ClusterProviderConfig**:\n   ```bash\n   kubectl apply -f examples/providerconfig-azure.yaml\n   ```\n\n## Examples\n\n### Basic GlobalApp\n\nCreate a basic global application with manual policy management:\n\n```yaml\napiVersion: example.upbound.io/v1alpha1\nkind: GlobalApp\nmetadata:\n  name: my-global-app\n  namespace: default\nspec:\n  region: \"West Europe\"\n  primaryGeoTag: \"eu\"\n  hostname: \"myapp.example.com\"\n  managementPolicies: [\"*\"]\n  autoApplyRecommendedPolicy: false\n```\n\n### Auto-Policy GlobalApp\n\nCreate a global application with automatic active/passive switching:\n\n```yaml\napiVersion: example.upbound.io/v1alpha1\nkind: GlobalApp\nmetadata:\n  name: auto-global-app  \n  namespace: default\nspec:\n  region: \"East US\"\n  primaryGeoTag: \"us\" \n  hostname: \"auto-app.example.com\"\n  managementPolicies: [\"*\"]\n  autoApplyRecommendedPolicy: true  # Automatic policy switching\n```\n\n## Configuration Parameters\n\n| Parameter | Description | Default |\n|-----------|-------------|---------|\n| `region` | Azure region for infrastructure | `\"West US\"` |\n| `primaryGeoTag` | Primary geographic tag for GSLB failover | `\"eu\"` |\n| `hostname` | Application hostname for ingress | `\"globalapp.cloud.example.com\"` |\n| `managementPolicies` | Crossplane management policies | `[\"*\"]` |\n| `autoApplyRecommendedPolicy` | Enable automatic policy switching | `false` |\n\n## Testing\n\n### Composition Tests\n\nRun the included composition tests:\n\n```bash\nup test run tests/*\n```\n\n### End-to-End Testing\n\n**Prerequisites**: k8gb must be installed and configured on all clusters.\n\n1. **Deploy test applications** across multiple clusters\n2. **Configure DNS delegation** for your test domains\n3. **Apply GlobalApp resources** in each cluster\n4. **Test failover scenarios**:\n   ```bash\n   # Check GSLB status\n   kubectl get gslb\n\n   # Test DNS resolution\n   dig your-app.example.com\n\n   # Simulate cluster failure\n   kubectl scale deployment podinfo --replicas=0\n   ```\n\n### Local Development\n\nFor local development and testing:\n\n```bash\n# Build and test locally\nup project build\nup test run tests/*\n\n# Run composition rendering tests\nup composition render apis/globalapp/composition.yaml examples/globalapp/example.yaml --xrd=apis/globalapp/definition.yaml\n```\n\n## Status Monitoring\n\nThe GlobalApp provides comprehensive status information:\n\n```bash\nkubectl get globalapp my-global-app -o yaml\n```\n\n**Status fields**:\n- `infrastructure`: Azure resource deployment status\n- `application`: Podinfo and GSLB resource status  \n- `gslb`: Health monitoring and policy recommendations\n\n## 🚀 Multi-Cluster Blue/Green Demo\n\n### Complete Local Setup\n\nSet up a full local multi-cluster environment to demonstrate blue/green deployments:\n\n#### 1. **Prepare k8gb Test Environment**\n```bash\n# Clone and set up k8gb test environment\ngit clone https://github.com/k8gb-io/k8gb\ncd k8gb\ngit checkout v0.15.0\nmake deploy-full-local-setup\n```\n\n#### 2. **Install Configuration Package**\n```bash\n# Clone this configuration\ngit clone https://github.com/upbound/configuration-k8gb-bluegreen.git\ncd configuration-k8gb-bluegreen\n\n# Switch to EU cluster (Blue environment)\nkubectl config use-context k3d-test-gslb1\nup uxp install\n\n# Install the configuration package\nkubectl apply -f examples/configuration.yaml\nkubectl get configurations\n```\n\n#### 3. **Configure Providers**\n```bash\n# Set up Azure credentials\nkubectl create secret generic azure-creds -n crossplane-system \\\n  --from-literal=credentials=\"$(cat ~/.azure/credentials.json)\"\n\n# Apply provider configurations and RBAC\nkubectl apply -f examples/providerconfig-helm.yaml\nkubectl apply -f examples/providerconfig-azure.yaml\nkubectl apply -f examples/rbac-k8gb.yaml\n```\n\n#### 4. **Deploy Blue Environment (EU - Active)**\n```bash\n# Deploy blue environment\nkubectl apply -f examples/globalapp/blue-active.yaml\n\n# Monitor deployment\ncrossplane beta trace globalapps.example.upbound.io/blue-green\nkubectl get globalapps.example.upbound.io blue-green\n\n# Check blue environment status\nkubectl get globalapps.example.upbound.io blue-green -o yaml | yq\n```\n\n#### 5. **Deploy Green Environment (US - Passive)**\n```bash\n# Switch to US cluster\nkubectl config use-context k3d-test-gslb2\nup uxp install\nkubectl apply -f examples/configuration.yaml\n\n# Set up providers (repeat provider setup from step 3)\n# ...\n\n# Deploy green environment\nkubectl apply -f examples/globalapp/green-passive.yaml\n\n# Check green environment status\nkubectl get globalapps.example.upbound.io blue-green -o yaml | yq\n```\n\n#### 6. **🔄 Test Blue/Green Failover**\n```bash\n# Simulate blue environment failure\nkubectl config use-context k3d-test-gslb1\nkubectl scale deployment podinfo-blue-green --replicas=0\n\n# Watch GSLB detect failure and policy changes\nkubectl get globalapps.example.upbound.io blue-green -o yaml | yq '.status.gslb'\n\n# Switch to green cluster - check if it's now active  \nkubectl config use-context k3d-test-gslb2\nkubectl get globalapps.example.upbound.io blue-green -o yaml | yq '.status.gslb'\n```\n\n### 📊 **Blue/Green Status Monitoring**\n\nMonitor the automatic failover process:\n\n```bash\n# View complete GlobalApp status (infrastructure, application, gslb)\nkubectl get globalapps.example.upbound.io blue-green -o yaml | yq '.status'\n\n# View just GSLB status (health, policies, active cluster)\nkubectl get globalapps.example.upbound.io blue-green -o yaml | yq '.status.gslb'\n\n# View k8gb GSLB resources directly\nkubectl get gslb -A\nkubectl describe gslb failover-ingress-blue-green\n```\n\n## Troubleshooting\n\n### Common Issues\n\n1. **k8gb not installed**: Ensure k8gb operator is running in all clusters\n2. **DNS not configured**: Configure DNS delegation for GSLB domains\n3. **Azure credentials**: Verify ClusterProviderConfig and secret configuration\n4. **Network connectivity**: Ensure clusters can communicate for health checks\n\n### Debug Commands\n\n```bash\n# Check resource status\ncrossplane beta trace globalapp.example.upbound.io/my-global-app\n\n# Check k8gb status\nkubectl get gslb -A\nkubectl describe gslb failover-ingress-blue-green\n\n# Check provider status\nkubectl get providers\nkubectl get clusterproviderconfigs\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupbound%2Fconfiguration-k8gb-bluegreen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fupbound%2Fconfiguration-k8gb-bluegreen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupbound%2Fconfiguration-k8gb-bluegreen/lists"}