PO to GMP Migration Tool: Add Draft Generation with TODO Annotations for Errors - #2061
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to inject sequential TODO annotations and safety guardrails (gmp.googleapis.com/migration-review-required: "true") into migrated resources when configuration issues are encountered, and updates the migration report to track these action items. The review feedback highlights several violations of migration rules where the code falls back to default values or placeholders (such as for invalid proxy URLs, invalid scrape intervals, or unresolvable Service ports) instead of returning a fatal error. Malformed configurations that would lead to failed scrapes must result in errors rather than falling back to defaults or logging warnings.
bwplotka
left a comment
There was a problem hiding this comment.
Looks like a reasonable approach if you can make it a pattern for all errors/warnings (e.g. we don't forget about something).
Not sure about blocking scrape logic - it feels odd, but it is one of the least bad options if we assume people or agents will apply without looking
a88cc48 to
460df7d
Compare
Reconsidered potential options and decided to take the following approach: On a default CLI call (i.e no flags), we output the manifests without TODO items, while noting in the stderr output summary: (such that users can safely blindly apply) When the |
6026b22 to
3c4fdac
Compare
This PR enhances the Prometheus Operator to GMP migration tool by implementing graceful draft generation for conversion errors instead of aborting the entire migration. The converter produces manifests with TODO annotations, placeholder values, and a safety guardrail label.
TODO_MISSING_KEY_<KEY>_IN_<KIND>_<NAME>andTODO_SET_SECRET_NAMEplaceholders with[ERROR]TODO annotations instead of returning hard errors."30s"with[ERROR]TODOs to preserve schema validity.port: "TODO_SET_PORT"when an endpoint omits bothportandtargetPort.port: "TODO_RESOLVE_PORT_<PORT>"with[WARNING]TODOs.ServiceMonitor:ServiceMonitorhas no matching backingServicein the inputs, generates a draftPodMonitoringwithselector: {app: "TODO_SET_POD_SELECTOR"}andport: "TODO_RESOLVE_PORT".gmp.googleapis.com/migration-review-required: "true"intospec.selector.matchLabelswhenever[ERROR]TODO items are present, preventing unintentional scraping until user review.