Skip to content

Commit ddc4896

Browse files
authored
regions fixes (#5246)
* fix: improve rollbacks This addresses a few things. The most obvious one is lowering the freshness of some frontline caches to make rollbacks faster. I also moved the entire deployment workflow to a virtual object, keyed by workspace id. The reason is that we had some potential races and this is the pragmatic fix for right now. I could've done it per app too, but I actually think limiting concurrency in the beginning is not a bad thing. afterall, we're paying for all of these resources. * feat: scaling and region tables * fix: replace AVAILABLE_REGIONS env var with clusterRegions table query * fix: update instances mutation to use appScalingSettings table * fix: update CPU mutation to use appScalingSettings table * fix: update memory mutation to use appScalingSettings table * fix: update regions mutation to use appScalingSettings and clusterRegions tables * fix: revert cpu/memory mutations back to appRuntimeSettings * feat: rename app_scaling_settings to app_regional_settings, add horizontal_autoscaling_policies table * feat: replace regionConfig with appRegionalSettings across dashboard * fix: remove AVAILABLE_REGIONS from .env.example * feat: add migration script for region_config to app_regional_settings * feat: add Heartbeat RPC to ClusterService proto * feat: add heartbeat loop to krane agent Krane now sends periodic heartbeats to the control plane every 30s, reporting its region and platform. Also adds Platform config field, fixes duplicate r.Recover()/r.DeferCtx calls, and updates mock client. * feat: implement Heartbeat RPC handler and rename cluster_regions to regions - Add Heartbeat handler on ctrl that upserts regions and clusters tables - Rename cluster_regions table to regions for clarity - Remove AvailableRegions config from ctrl api/worker - Deploy workflow now fails with terminal error if no regions configured - Certificate bootstrap queries regions from DB instead of config - Add SQL queries: UpsertRegion, FindRegionByNameAndPlatform, ListRegions, UpsertCluster * feat: deploy workflow reads from appRegionalSettings, add region_id to deployment_topology - Deploy handler now reads regions from app_regional_settings table instead of deprecated regionConfig on app_runtime_settings - Fails with terminal error if no regions are configured - Added region_id column to deployment_topology table - Added FindAppRegionalSettingsByAppAndEnv SQL query with regions join - Updated integration harness to create regions before topologies * fix: display region names in UI, add local region support - Join regions table when fetching regional settings to get region name - Use region name (not ID) for display in runtime settings - Add "local" flag code to sentinel node types and REGION_INFO * feat: add X-Krane-Platform header, app_id to ApplySentinel, and appId labels - Add X-Krane-Platform header alongside X-Krane-Region in the krane interceptor so ctrl can identify regions by (name, platform) pair - All ctrl RPC handlers now validate both region and platform from headers - Add app_id field to ApplySentinel proto message - Add AppID label to all sentinel sub-resources (Service, PDB, gossip Service, CiliumNetworkPolicy) for consistency with deployment labels - Remove hardcoded region list from sentinel config validation (regions are now dynamic from DB) - Add platform field to sentinel config * fix: step conflict * fix: rabbit * fix: frontline uses correct platform/region * feat: add running state * fix: relation key * fix: unique key
1 parent c37a7e6 commit ddc4896

File tree

102 files changed

+1544
-376
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1544
-376
lines changed

dev/config/ctrl-api.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ instance_id = "ctrl-api-dev"
22
region = "local"
33
http_port = 7091
44
auth_token = "your-local-dev-key"
5-
available_regions = ["local.dev"]
65
default_domain = "unkey.local"
76
cname_domain = "unkey.local"
87

dev/config/krane.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
region = "local.dev"
1+
region = "local"
2+
platform = "dev"
23

34
[control_plane]
45
url = "http://ctrl-api:7091"

dev/k8s/manifests/ctrl-api.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ data:
1212
region = "local"
1313
http_port = 7091
1414
auth_token = "your-local-dev-key"
15-
available_regions = ["local.dev"]
1615
default_domain = "unkey.local"
1716
cname_domain = "unkey.local"
1817

dev/k8s/manifests/ctrl-worker.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ data:
1414
cname_domain = "unkey.local"
1515
build_platform = "linux/arm64"
1616
sentinel_image = "unkey/sentinel:latest"
17-
available_regions = ["local.dev"]
1817
1918
[database]
2019
primary = "unkey:password@tcp(mysql:3306)/unkey?parseTime=true&interpolateParams=true"

dev/k8s/manifests/frontline.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ metadata:
66
namespace: unkey
77
data:
88
unkey.toml: |
9-
region = "local.dev"
9+
platform = "dev"
10+
region = "local"
1011
challenge_port = 7070
1112
http_port = 7443
1213
apex_domain = "unkey.local"

dev/k8s/manifests/krane.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ metadata:
88
component: krane
99
data:
1010
unkey.toml: |
11-
region = "local.dev"
11+
region = "local"
12+
platform = "dev"
1213
1314
[control]
1415
url = "http://ctrl-api:7091"

docs/engineering/architecture/services/control-plane/api/configuration.mdx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ Rotation is manual today. There is no built-in rotation mechanism.
4040

4141
TODO: Replace with JWT-based auth once `auth.unkey.cloud` is in place.
4242

43-
<ResponseField name="available_regions" type="string[]">
44-
Regions available for deployments.
45-
</ResponseField>
43+
4644

4745
<ResponseField name="default_domain" type="string">
4846
Base domain for wildcard certificates.
@@ -117,7 +115,6 @@ prometheus_port = 9090
117115
region = "${UNKEY_REGION}"
118116
instance_id = "${POD_NAME}"
119117
auth_token = "${UNKEY_AUTH_TOKEN}"
120-
available_regions = ["eu-central-1.aws", "us-east-1.aws", "us-west-2.aws"]
121118
default_domain = "${UNKEY_DEFAULT_DOMAIN}"
122119
regional_domain = "${UNKEY_REGIONAL_DOMAIN}"
123120
cname_domain = "${UNKEY_CNAME_DOMAIN}"

docs/engineering/architecture/services/control-plane/worker/configuration.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ These fields must be set for production deployments.
3838
| `default_domain` | string | `unkey.app` | Used for sentinel bootstrapping.
3939
| `build_platform` | string | `linux/amd64` | Build platform, format `linux/{arch}`.
4040
| `sentinel_image` | string | `ghcr.io/unkeyed/unkey:local` | Sentinel image override.
41-
| `available_regions` | list | - | Regions allowed for deployments.
4241
| `acme` | object | - | ACME config for cert issuance.
4342
| `depot` | object | - | Depot.dev config for builds.
4443
| `registry` | object | - | Registry credentials for builds.
@@ -126,7 +125,6 @@ instance_id = "${POD_NAME}"
126125
default_domain = "${UNKEY_DEFAULT_DOMAIN}"
127126
build_platform = "linux/amd64"
128127
sentinel_image = "ghcr.io/unkeyed/unkey:v2.0.77"
129-
available_regions = ["eu-central-1.aws", "us-east-1.aws"]
130128
cname_domain = "${UNKEY_CNAME_DOMAIN}"
131129

132130
[database]

gen/proto/ctrl/v1/cluster.pb.go

Lines changed: 154 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/proto/ctrl/v1/ctrlv1connect/cluster.connect.go

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)