Skip to content

Add flyte.app.Subdomain for deploy-time subdomain resolution - #1526

Merged
cosmicBboy merged 2 commits into
mainfrom
worktree-app-subdomain
Sep 3, 2026
Merged

Add flyte.app.Subdomain for deploy-time subdomain resolution#1526
cosmicBboy merged 2 commits into
mainfrom
worktree-app-subdomain

Conversation

@cosmicBboy

Copy link
Copy Markdown
Collaborator

Summary

Adds a new flyte.app.Subdomain class that lets app authors declare a subdomain whose final value is resolved at deploy time, when the deployment project/domain are known.

  • Subdomain.from_app_name(app_name, project_domain_suffix="hash")
    • "hash" (default): subdomain is {app_name}-{hash}, where the hash is the first 8 hex chars of sha256 of "{project}-{domain}" — short, and stable per project/domain.
    • "default": subdomain is {app_name}-{project}-{domain}.
  • Subdomain.from_function(fn): fn receives the AppEnvironment being deployed and the deployment SerializationContext (project, domain, org, version, ...) and returns the subdomain string, giving users full control. The return value is validated to be a non-empty string.
  • Domain.subdomain now accepts str | Subdomain | None.
  • Resolution happens in translate_app_env_to_idl: Subdomain instances are resolved via resolve(app_env, serialization_context) before being written into the IngressConfig; plain strings pass through unchanged.

Example

import flyte.app

# my-app-f7628a67 (hash of "{project}-{domain}")
flyte.app.Domain(subdomain=flyte.app.Subdomain.from_app_name("my-app"))

# my-app-my-project-development
flyte.app.Domain(subdomain=flyte.app.Subdomain.from_app_name("my-app", project_domain_suffix="default"))

# fully custom
flyte.app.Domain(subdomain=flyte.app.Subdomain.from_function(
    lambda app_env, ctx: f"{app_env.name}-{ctx.org}"
))

Test plan

  • New unit tests in tests/flyte/app/test_types.py: both constructors, suffix/arg validation, hash stability per project/domain, missing project/domain errors.
  • Parametrized end-to-end serde tests in tests/flyte/app/runtime/test_app_serde.py verifying the resolved subdomain lands in the ingress config.
  • Full app serde suite passes (60 tests); pre-commit fmt/mypy/ty pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KVnRzHRUANmCg7ZsLH6Fah

Subdomain.from_app_name(app_name, project_domain_suffix="hash"|"default")
produces {app_name}-{hash-of-project-domain} or {app_name}-{project}-{domain},
and Subdomain.from_function(fn) lets users compute the subdomain from the
AppEnvironment and the deployment SerializationContext. Domain.subdomain now
accepts a str or a Subdomain, resolved during app serialization.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KVnRzHRUANmCg7ZsLH6Fah
@cosmicBboy
cosmicBboy marked this pull request as ready for review September 3, 2026 19:11
@cosmicBboy
cosmicBboy merged commit a62f7db into main Sep 3, 2026
63 checks passed
@cosmicBboy
cosmicBboy deleted the worktree-app-subdomain branch September 3, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant