Skip to content

feat: add AppK8sClient for KService lifecycle management#7166

Open
AdilFayyaz wants to merge 8 commits intov2from
adil/apps-kservice-lifecycle
Open

feat: add AppK8sClient for KService lifecycle management#7166
AdilFayyaz wants to merge 8 commits intov2from
adil/apps-kservice-lifecycle

Conversation

@AdilFayyaz
Copy link
Copy Markdown

@AdilFayyaz AdilFayyaz commented Apr 7, 2026

Depends on: #7161

Why are the changes needed?

The App Service needs a K8s client to manage the full lifecycle of Knative KService CRDs — the single source of truth for app spec and status. This PR lays the infrastructure foundation and implements the core client.

What changes were proposed in this pull request?

  • Implement AppK8sClient in app/internal/k8s/app_client.go with full AppK8sClientInterface: Deploy (create/update KService with spec-SHA change detection), Stop (max-scale=0), Delete (remove KService), GetStatus (map KService conditions → proto), List, GetReplicas, DeleteReplica, and Watch (fan K8s watch events → WatchResponse channel)
  • Moved the config from actions to app/

How was this patch tested?

  • go test ./app/internal/k8s/... -count=1 — 14 unit tests using controller-runtime fake client covering all interface methods
  • go build ./... — full repo build passes
  • Key cases covered: idempotent deploy (spec-SHA skip), stop vs delete semantics, not-found handling, pod status mapping, watch event type routing (Added/Modified/Deleted/Error/Bookmark)

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 AdilFayyaz self-assigned this Apr 7, 2026
@AdilFayyaz AdilFayyaz added added Merged changes that add new functionality flyte2 labels Apr 7, 2026
@AdilFayyaz AdilFayyaz requested a review from pingsutw April 7, 2026 21:54
Base automatically changed from adil/apps-knative-infra to v2 April 7, 2026 22:03
@AdilFayyaz AdilFayyaz force-pushed the adil/apps-kservice-lifecycle branch from ef9cf97 to 2e383a4 Compare April 7, 2026 22:21
@pingsutw pingsutw added this to the V2 GA milestone Apr 8, 2026
}

// Populate current replica count and K8s namespace metadata.
status.CurrentReplicas = uint32(len(ksvc.Status.Traffic))
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.

I think we should get the replica from kservingv1.Revision

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I can pull it from the latest revision, but would there ever be a case that we have multiple revisions running at the same time? Each would then have it's own active pods

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>
@AdilFayyaz AdilFayyaz force-pushed the adil/apps-kservice-lifecycle branch from 13e45a2 to dc89b35 Compare April 8, 2026 17:57
Signed-off-by: M. Adil Fayyaz <62440954+AdilFayyaz@users.noreply.github.com>
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