Skip to content

feat(crd): add disableContainerDeployments flag - #683

Draft
petrsimon wants to merge 2 commits into
RedHatInsights:mainfrom
petrsimon:RHCLOUD-41034-implement-bulk-flag-disable-frontend-container-deployments
Draft

feat(crd): add disableContainerDeployments flag#683
petrsimon wants to merge 2 commits into
RedHatInsights:mainfrom
petrsimon:RHCLOUD-41034-implement-bulk-flag-disable-frontend-container-deployments

Conversation

@petrsimon

Copy link
Copy Markdown
Contributor

Summary

  • Adds disableContainerDeployments on FrontendEnvironment to skip Deployments, Services, Jobs, and ServiceMonitors for all Frontends in the environment
  • ConfigMaps and Ingress are still created; Ingress uses Spec.Service when set, otherwise falls back to the Frontend name
  • Moves cachebust/pushcache Jobs onto the resource cache so they are cleaned up when the flag is toggled on

Test plan

  • Unit: DisableContainerDeployments suite (flag from start, toggle Deploy/Service/Ingress backend, Jobs cleanup+recreate, ServiceMonitor cleanup, Spec.Service fallback, Frontend.Spec.Disabled precedence)
  • E2E: tests/e2e/disable-container-deployments (Ingress + ConfigMap present, no Deployment/Service)
  • Manual: set flag on a FrontendEnvironment and confirm workloads are removed while Ingress/ConfigMaps remain

https://issues.redhat.com/browse/RHCLOUD-41034

@petrsimon
petrsimon force-pushed the RHCLOUD-41034-implement-bulk-flag-disable-frontend-container-deployments branch from db8a03e to 841bbfb Compare August 13, 2026 10:52
@petrsimon
petrsimon marked this pull request as ready for review August 13, 2026 12:44
petrsimon and others added 2 commits August 17, 2026 14:53
Allow FrontendEnvironments to skip Deployments, Services, Jobs, and
ServiceMonitors while still creating ConfigMaps and Ingress.

RHCLOUD-41034

Co-authored-by: Cursor <cursoragent@cursor.com>
fixup! feat(crd): add disableContainerDeployments flag
@petrsimon
petrsimon force-pushed the RHCLOUD-41034-implement-bulk-flag-disable-frontend-container-deployments branch from 4476d58 to e65a9f6 Compare August 17, 2026 12:53

@karelhala karelhala left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Couple of notes on Job re-enable and the Ingress backend when the flag is on.

Comment thread controllers/reconcile.go
Comment on lines +1046 to 1048
if skipUpdate {
return r.Cache.Update(ident, j)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

skipUpdate is true for any Job that still exists and matches the current image, including one with deletionTimestamp set.

After disable toggles on, cache.Reconcile deletes these Jobs. A quick re-enable then Gets the terminating Job, Cache.Updates it unchanged (Apply skips), and the reconcile succeeds. The controller does not Owns Jobs, so when the Job is actually gone nothing enqueues the Frontend again — cachebust/pushcache never come back until some unrelated event.

The toggle test only gets past this by force-deleting Jobs and clearing finalizers first (frontend_controller_suite_test.go around the "Force-removing terminating Jobs" step).

Treat a deleting Job as not skippable so this reconcile errors and requeues:

Suggested change
if skipUpdate {
return r.Cache.Update(ident, j)
}
if skipUpdate {
if !j.GetDeletionTimestamp().IsZero() {
return fmt.Errorf("job %s is terminating, will retry", jobName)
}
return r.Cache.Update(ident, j)
}

Also worth Owns(&batchv1.Job{}) so a completed deletion retriggers even if this window is missed.

Comment thread controllers/reconcile.go
// Default to the Frontend name (operator-managed Service). When container
// deployments are disabled or no image is set, prefer Spec.Service if
// provided; otherwise keep Frontend.Name so the Ingress backend is never empty.
serviceName := nn.Name

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When the flag is on and Spec.Service is empty, the backend stays nn.Name (the Frontend name) even though this reconcile no longer creates that Service.

The e2e case does the same (chrome Ingress → chrome Service, no Service object). Is the contract “callers always set spec.service to an external Service”, “a same-named Service exists out of band”, or should we log/skip Ingress when there is nothing to point at? As written this Ingress will 502 unless something else creates that Service.

@petrsimon
petrsimon marked this pull request as draft August 20, 2026 06:43
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.

2 participants