PO to GMP Migration Tool: Podmonitor Auth, TLS and Proxy Migration#1982
PO to GMP Migration Tool: Podmonitor Auth, TLS and Proxy Migration#1982karthunni wants to merge 14 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces helper functions and a conversion context in pkg/migrate/helpers.go to support translating Prometheus Operator configurations (such as TLS, BasicAuth, OAuth2, and Relabelings) to Google Managed Prometheus (GMP) equivalents, updating PodMonitor conversion to utilize these helpers, and adding corresponding unit tests. The review feedback recommends tracking whether target resources are cluster-scoped via an isClusterScoped field in the conversion context to correctly set namespaces on generated secret selectors. Additionally, the feedback suggests returning explicit errors instead of hardcoded placeholders for invalid or empty selectors, and safely returning nil when selectors are unspecified.
01c870a to
a230cd6
Compare
3c8d1a9 to
d4eb356
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces helper functions in pkg/migrate/helpers.go to convert Prometheus Operator configurations (such as Secrets, ConfigMaps, BasicAuth, TLS, OAuth2, and Authorization) to Google Cloud Prometheus (GMP) equivalents, generating Secret manifests when translating ConfigMaps. These helpers are integrated into the PodMonitorConverter and covered by new unit tests. Feedback on the changes highlights a critical issue where duplicate Secret manifests can be generated if multiple endpoints or fields reference the same ConfigMap, which would cause collision errors during migration.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces conversion helpers and context in pkg/migrate/helpers.go to translate Prometheus Operator configurations (such as BasicAuth, TLS, OAuth2, and Authorization) into Google Cloud Prometheus (GMP) equivalents, and updates PodMonitorConverter to support these mappings. The feedback focuses on handling empty ConfigMap and Secret selectors gracefully by returning nil when both name and key are empty, and ensuring deterministic output by sorting the generated secrets before returning them, which also requires importing the sort package.
|
/gemini review |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces conversion helper functions in pkg/migrate/helpers.go to translate Prometheus Operator configurations (such as Secrets, ConfigMaps, BasicAuth, TLS, OAuth2, and Authorization) into Google Cloud Managed Service for Prometheus (GMP) formats, and integrates them into the PodMonitor converter with accompanying tests. Feedback on the changes suggests robustly handling binaryData in ConfigMap extraction, mapping missing TLS version constraints and OAuth2 parameters, and avoiding loop variable pointer capture when handling deprecated bearer token secrets.
16dfba1 to
5491eb9
Compare
|
/gemini review |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces helper functions and a conversion context in pkg/migrate/helpers.go to support translating Prometheus Operator configurations (such as BasicAuth, TLS, OAuth2, and Authorization) into Google Cloud Prometheus Engine (GMP) equivalents, including converting ConfigMaps to Secrets. Unit tests were added to verify these helpers, and PodMonitorConverter was updated to utilize them. A review comment identified a potential collision issue where multiple PodMonitor resources sharing the same TLS ConfigMap would attempt to generate duplicate Secrets with the same name, and suggested caching the generated Secrets to prevent this.
… generated secrets
5369d22 to
7305317
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces conversion helper functions and context in pkg/migrate/helpers.go to translate Prometheus Operator configurations (such as BasicAuth, SafeTLSConfig, OAuth2, and Authorization) into Google Cloud Prometheus Engine (GMP) resources. It also updates the migration logic to accumulate and deduplicate generated resources, and integrates these helpers into pkg/migrate/podmonitor.go along with comprehensive unit tests. The review feedback suggests trimming trailing whitespace and newlines before decoding base64 data in Secrets and ConfigMaps to prevent unexpected decoding failures, and replacing hardcoded strings with defined constants (KindConfigMap and KindSecret) for consistency.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces helper functions and a conversion context to translate Prometheus Operator configurations (such as TLS, BasicAuth, OAuth2, and Relabeling rules) into Google Cloud Prometheus Engine (GMP) equivalents, while also adding deduplication logic for generated Secrets. The review feedback highlights a potential issue where strict base64 decoding of Secret data and ConfigMap binaryData fields might fail due to internal whitespaces or newlines, and suggests stripping all whitespace characters before decoding.
Adds migration logic to map Authentication, TLS, and Proxy configurations from Prometheus Operator
PodMonitorendpoints into GMPPodMonitoringequivalents.This change introduces the core extraction helpers required to consolidate nested Kubernetes
corev1.SecretKeySelectorandcorev1.ConfigMapKeySelectorreferences into GMP'smonitoringv1.SecretKeySelectorstruct.Key Changes:
BasicAuth,BearerTokenSecret,TLSConfig, andOAuth2fields within endpoint configurations.extractSecretKey,extractConfigMapKey) that inject clear<MISSING_...>placeholders and emit warnings if a referenced resource is missing from the input files.convertConfigMapToSecretSelectorto automatically migrate TLS ConfigMap references into generated Secrets, adhering to GMP's strict Secret-only TLS requirements.helpers_test.go.podmonitor_test.go.