Skip to content

Keep new Prometheus cluster integration in sync with app

What does this MR do?

This is the next step of the Prometheus cluster application deprecation. It is the "double-write" phase of a table data migration, with the cluster application as the source of truth, and all changes mirrored by the cluster integration.

Once this is live on GitLab.com, we can perform a data migration to backfill the cluster integrations and start using them as the source of truth for the "enabled" status for the in-cluster prometheus functionality.

See #327655 (closed)

Manual QA

  • Installed Prometheus in a k3d cluster through GitLab's UI
  • Had alert manager trigger some alerts with the existing token
    • alerts still trigger
  • Ran cluster.application_prometheus.delete to delete the app without callbacks, so the integration remained active
  • Triggered some more alerts
    • alerts still trigger
  • Visited metrics dashboard
    • metrics still display

Screenshots (strongly suggested)

After cluster.application_prometheus.delete:

Metrics Alerts
Screenshot_2021-05-03_at_22.15.36 Screenshot_2021-05-03_at_20.39.49

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Migration output

➜  gitlab git:(add-alert-manager-token-to-prometheus-cluster-integration) ✗ bin/rails db:migrate
== 20210430034712 AddAlertManagerTokenToClustersIntegrationPrometheus: migrating 
-- change_table(:clusters_integration_prometheus)
   -> 0.0042s
== 20210430034712 AddAlertManagerTokenToClustersIntegrationPrometheus: migrated (0.0042s) 

➜  gitlab git:(add-alert-manager-token-to-prometheus-cluster-integration) ✗ bin/rails db:rollback
== 20210430034712 AddAlertManagerTokenToClustersIntegrationPrometheus: reverting 
-- remove_column(:clusters_integration_prometheus, :encrypted_alert_manager_token_iv, :text, {})
   -> 0.0022s
-- remove_column(:clusters_integration_prometheus, :encrypted_alert_manager_token, :text, {})
   -> 0.0008s
== 20210430034712 AddAlertManagerTokenToClustersIntegrationPrometheus: reverted (0.0049s) 
Edited by Hordur Freyr Yngvason

Merge request reports