Skip to content

feat: implement AppService control plane proxy with TTL cache#7176

Open
AdilFayyaz wants to merge 15 commits intov2from
adil/apps-app-service
Open

feat: implement AppService control plane proxy with TTL cache#7176
AdilFayyaz wants to merge 15 commits intov2from
adil/apps-app-service

Conversation

@AdilFayyaz
Copy link
Copy Markdown

@AdilFayyaz AdilFayyaz commented Apr 9, 2026

Depends on: #7175

Why are the changes needed?

The control plane needs a stable API surface for app management without making direct K8s calls. AppService proxies to InternalAppService (data plane) and adds a TTL cache to reduce cross-plane RPC calls on hot Get paths.

What changes were proposed in this pull request?

  • Added app/service/AppService — cache-aside proxy over InternalAppService; Get reads from cache, mutations invalidate, Watch is a streaming passthrough
  • Added app/setup.go — mounts AppService on the control plane mux; in unified mode routes to /internal on the same mux with no network hop
  • Restructured config: app/internal/config/InternalAppConfig (data plane) and app/config/AppConfig (control plane, holds CacheTTL + InternalAppServiceURL)
  • Removed AppService stub and wiring from runs/ — no longer needed there

How was this patch tested?

  • go test ./app/service/... — 8 unit tests covering cache hit, miss, TTL expiry, invalidation on Create/Update/Delete, List always forwarding, and Watch stream proxying
  • go test ./app/internal/service/... — covers InternalAppService RPCs including DesiredState branching, pagination, and Watch initial snapshot
  • go test ./app/... — all packages pass

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

AdilFayyaz and others added 15 commits April 8, 2026 10:57
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
@AdilFayyaz AdilFayyaz self-assigned this Apr 9, 2026
@AdilFayyaz AdilFayyaz added added Merged changes that add new functionality flyte2 labels Apr 9, 2026
@AdilFayyaz AdilFayyaz changed the title feat: implement AppService control plane proxy with TTL cach feat: implement AppService control plane proxy with TTL cache Apr 9, 2026
Comment thread runs/setup.go
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/actions/actionsconnect"
flyteappconnect "github.com/flyteorg/flyte/v2/gen/go/flyteidl2/app/appconnect"
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/auth/authconnect"
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/auth/authconnect"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/auth/authconnect"
"github.com/flyteorg/flyte/v2/gen/go/flyteidl2/auth/authconnect"

Comment thread runs/setup.go
logger.Infof(ctx, "Mounted AppService at %s", appPath)

triggerSvc := service.NewTriggerService()
triggerSvc := service.NewTriggerService()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
triggerSvc := service.NewTriggerService()
triggerSvc := service.NewTriggerService()

Comment on lines +137 to +147
func newAppCache(ttl time.Duration) *appCache {
return &appCache{
items: make(map[string]*cacheEntry),
ttl: ttl,
}
}

// get returns the cached App for key, or (nil, false) if missing or expired.
func (c *appCache) get(key string) (*flyteapp.App, bool) {
if c.ttl == 0 {
return nil, false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the lru cache from github.com/hashicorp/golang-lru/v2/expirable? it has ttl and we use it in cloud too

@AdilFayyaz AdilFayyaz force-pushed the adil/apps-internal-service branch from 80d58ad to bfeafe3 Compare April 17, 2026 20:25
Base automatically changed from adil/apps-internal-service to v2 April 17, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

added Merged changes that add new functionality flyte2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants