feat: log deprecation warning for HTTPScaledObject#1595
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
Adds a one-time (per resource, per operator pod lifetime) deprecation warning for HTTPScaledObject reconciliations to encourage migration to InterceptorRoute + ScaledObject, improving user visibility ahead of planned removal.
Changes:
- Introduces a per-reconciler in-memory cache (
sync.Map) to track whichHTTPScaledObjects have already been warned. - Logs an INFO-level message prefixed with
WARNING:once per resource to avoid spamming on every reconcile.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fedosin
left a comment
There was a problem hiding this comment.
Minor nit: the deprecation warning is placed before the deletion-timestamp check, so an HTTPScaledObject that's actively being finalized will still trigger the warning (once). Consider moving it after the deletion guard — no point warning about migration for an object the user is already removing:
if httpso.GetDeletionTimestamp() != nil {
return ctrl.Result{}, finalizeScaledObject(ctx, logger, r.Client, httpso)
}
// TODO(v1): remove before v1 release
if _, alreadyWarned := r.deprecationWarned.LoadOrStore(req.String(), true); !alreadyWarned {
logger.Info("WARNING: HTTPScaledObject is deprecated and will be removed in a future release, migrate to InterceptorRoute + ScaledObject: https://keda.sh/http-add-on/0.14/operations/migrate-httpscaledobject-to-interceptorroute/")
}Users still on HTTPScaledObject need visibility that it will be removed. A one-time warning per resource (per pod lifetime) nudges migration without spamming logs on every reconcile. Signed-off-by: Vincent Link <vlink@redhat.com>
4fbaaa6 to
c7809de
Compare
|
Good idea @Fedosin , fixed it 👍 |
Users still on HTTPScaledObject need visibility that it will be removed. A one-time warning per resource (per pod lifetime) nudges migration without spamming logs on every reconcile.
Waits for the docs to be merged, URL should be stable. The current logging tools allow only INFO or ERROR - thus the strange warning log.
Example (see the line before the last):
Checklist
See #1501