<#7343 fix: stop Knative apps privately + keep UI ...
# flyte-github
a
#7343 fix: stop Knative apps privately + keep UI state accurate after stop/start Pull request opened by AdilFayyaz Why are the changes needed? Users expect “Stop App” to (1) scale the app down to zero and (2) make the public ingress inaccessible. The prior approach relied on
autoscaling.knative.dev/max-scale: "0"
as a stop signal, but in Knative that value represents “unlimited” upper bound, so it didn’t reliably enforce the intended stop semantics. Separately, the UI polls/Get calls can briefly show stale “stopped” state during stop→start transitions because the control plane can cache transitional responses while the data plane is still converging. What changes were proposed in this pull request? • Replaced the incorrect max-scale=0 stop semantics with Knative-native behavior: • Stop() labels the Knative Service
networking.knative.dev/visibility=cluster-local
so it is not published to the external gateway (public ingress becomes inaccessible). • Stop() marks the Service with
flyte.org/app-stopped=true
as the control-plane source of truth for STOPPED state. • Stop() sets
autoscaling.knative.dev/min-scale="0"
and
autoscaling.knative.dev/initial-scale="0"
to converge cleanly to zero pods. • Stop() deletes the latest ready Revision so existing pods terminate immediately (no waiting for the stable window). • Deploy() (“Start”) clears the stopped/private labels so the service becomes externally routable again. • Status mapping now treats STOPPED based on
flyte.org/app-stopped
(not max-scale). Devbox / cluster configuration • Enabled
config-autoscaler.allow-zero-initial-scale="true"
in devbox-bundled kustomize overlays and rendered manifests. • Updated
docker/devbox-bundled/Makefile
setup-knative to also patch config-autoscaler so the “manual install” path matches the bundled manifests behavior. UI correctness / control-plane behavior • Added a small TTL cache in the control-plane AppService for Get responses to reduce cross-plane chatter, while explicitly avoiding caching “transitional” stop/start windows (desired state running, but status still stopped) so the UI doesn’t get stuck showing STOPPED after clicking Start. How was this patch tested? • Unit tests: • go test ./app/internal/k8s • go test ./app/service • Manual verification (devbox / cluster): • Create app → confirm public URL reachable. • Stop app → confirm pods scale to 0 and public URL is not reachable (service is cluster-local). • Start app → confirm visibility label cleared, service becomes publicly reachable again, and UI transitions to ACTIVE without being stuck in STOPPED due to caching. 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 Stack If you do use
git town
to manage PR Stacks, the stack relevant to this PR will show below. Otherwise, you can ignore this section. Docs link flyteorg/flyte