Skip to content

Add modsecurity_enabled to ingress applications

What does this MR do?

Add new clusters_applications_ingress.modsecurity_enabled column for storing user preference on installing modsecurity WAF alongside their ingress controller.

Column to be used in follow-up MR !21966 (merged)

Migration

== 20191217212348 AddModsecurityEnabledToIngressApplication: migrating =========
-- transaction_open?()
   -> 0.0000s
-- execute("SET statement_timeout TO 0")
   -> 0.0648s
-- transaction()
-- add_column(:clusters_applications_ingress, :modsecurity_enabled, :boolean)
   -> 0.0065s
-- change_column_default(:clusters_applications_ingress, :modsecurity_enabled, false)
   -> 0.0054s
   -> 0.0131s
-- columns(:clusters_applications_ingress)
   -> 0.0010s
-- transaction_open?()
   -> 0.0000s
-- exec_query("SELECT COUNT(*) AS count FROM \"clusters_applications_ingress\"")
   -> 0.0025s
-- change_column_null(:clusters_applications_ingress, :modsecurity_enabled, false)
   -> 0.0006s
-- execute("RESET ALL")
   -> 0.0003s
== 20191217212348 AddModsecurityEnabledToIngressApplication: migrated (0.0829s)

Database checklist

When adding migrations:

  • Updated db/schema.rb
  • Added a down method so the migration can be reverted
  • Added the output of the migration(s) to the MR body
  • [-] Added tests for the migration in spec/migrations if necessary (e.g. when migrating data)
  • [-] Added rollback procedure. Include either a rollback procedure or description how to rollback changes

When adding or modifying queries to improve performance:

  • Included data that shows the performance improvement, preferably in the form of a benchmark
  • Included the output of EXPLAIN (ANALYZE, BUFFERS) of the relevant queries

When adding foreign keys to existing tables:

  • Included a migration to remove orphaned rows in the source table before adding the foreign key
  • Removed any instances of dependent: ... that may no longer be necessary

When adding tables:

  • Ordered columns based on the Ordering Table Columns guidelines
  • Added foreign keys to any columns pointing to data in other tables
  • Added indexes for fields that are used in statements such as WHERE, ORDER BY, GROUP BY, and JOINs

When removing columns, tables, indexes or other structures:

  • Removed these in a post-deployment migration
  • Made sure the application no longer uses (or ignores) these structures
Edited by Rémy Coutable

Merge request reports