feat: opt-in ALB autocreation when pool capacity is exhausted#187
Merged
Conversation
fedemaleh
commented
Jun 8, 2026
fedemaleh
commented
Jun 8, 2026
fedemaleh
commented
Jun 8, 2026
fedemaleh
commented
Jun 8, 2026
fedemaleh
commented
Jun 8, 2026
fedemaleh
commented
Jun 8, 2026
fedemaleh
commented
Jun 8, 2026
fedemaleh
commented
Jun 8, 2026
fedemaleh
commented
Jun 8, 2026
fedemaleh
commented
Jun 8, 2026
fedemaleh
commented
Jun 8, 2026
fedemaleh
commented
Jun 10, 2026
fedemaleh
commented
Jun 10, 2026
fedemaleh
commented
Jun 10, 2026
…ocreate-alb # Conflicts: # CHANGELOG.md
fedemaleh
commented
Jun 10, 2026
fedemaleh
commented
Jun 10, 2026
fedemaleh
commented
Jun 10, 2026
fedemaleh
commented
Jun 10, 2026
fedemaleh
commented
Jun 10, 2026
sebasnallar
previously approved these changes
Jun 16, 2026
ignacioboud
previously approved these changes
Jun 16, 2026
sebasnallar
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds opt-in ALB autocreation for k8s scopes (CLIEN-807). When every declared ALB is at or above
ALB_MAX_CAPACITY, the platform provisions a new ALB via a dummy Ingress, tags it for future discovery, and uses it for the scope being created. Disabled by default.Client proposal driving this change: .claude/client-docs/autocreate-alb-spin.docx.
Design notes (worth a comment if you disagree)
resolve_balancer, after the existing least-loaded selection. When the picked ALB's rule count is>= ALB_MAX_CAPACITYandALB_AUTOCREATE_ENABLED=true, the script sourcesautocreate_alband substitutes the new ALB name. Keeps the selection logic in a single file.nullplatform:managed-by=autocreate+nullplatform:visibility=...) rather than by calling the nullplatform API to update the provider config. The repo has no existing pattern for calling the platform API from workflow scripts, and tag-based discovery makes the change self-contained. Subsequent scope creations discover the ALB viaresourcegroupstaggingapi:GetResourcesand treat it as a normal candidate. Happy to switch to an API write if you prefer; flagged as an open question in the spec.<prefix><public|private>-<6 hex chars>, prefix capped at 18 chars so the total stays under AWS's 32-char ALB limit. Prefix validated as^[a-z0-9-]+$to keep the rendered Ingress + tag values safe.describe-load-balancers --output jsoncall per 10-second poll, parses ARN and state with jq. Timeout default 300s; rejects0and non-positive values.Known limitations (deliberate, not in this PR)
build_contextis retried after a transient failure,autocreate_albre-runs with a new random name and provisions another ALB. The previous one stays tagged and reusable.k8s/docs/autocreate-alb.md.Files
k8s/scope/networking/autocreate_alb,k8s/scope/templates/ingress-dummy.yaml.tpl,k8s/scope/tests/networking/autocreate_alb.bats,k8s/docs/autocreate-alb.md.k8s/scope/networking/resolve_balancer(discovery + autocreate fallback),k8s/scope/tests/networking/resolve_balancer.bats(5 new tests + a shared mock helper),k8s/values.yaml(3 new knobs),CHANGELOG.md.Configuration
ALB_AUTOCREATE_ENABLEDfalseALB_AUTOCREATE_NAME_PREFIXnullplatform-auto-ALB_AUTOCREATE_TIMEOUT_SECONDS300state=activeNew IAM permissions
elasticloadbalancing:AddTagselasticloadbalancing:DescribeTagstag:GetResourcesTest plan
Automated (already passing locally):
bats k8s/scope/tests/networking/autocreate_alb.bats— 15 tests (name generation, ingress apply, polling, tagging, prefix + timeout validation)bats k8s/scope/tests/networking/resolve_balancer.bats— 35 tests (existing 27 plus 8 new ones covering tag discovery, autocreate trigger paths, MAX_CAPACITY validation)k8s/scope/testsregression run — 226 ok, 1 pre-existing flaky unrelated test (wait_on_balancer: external_dns success after retries, already failing onbeta)Manual (your environment):
ALB_AUTOCREATE_ENABLED=truey crear scopes con pool sano → debe usar uno existente, no autocrearALB_AUTOCREATE_ENABLED=falsela creación falla con el mensaje existente cuando el pool está llenoRefs