diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-11-28 20:38:55 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-01-08 10:22:17 +0300 |
commit | e4745492821440b47a48b75e8786d049fde50fca (patch) | |
tree | d0ec865d32648e1f4759b83e7080b42c2c9a619a /db | |
parent | 5b2ca1c66c3a69a1177c0d2f62c208bdce7a81c0 (diff) |
Add test. Disable KubernetesService when migrated
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb b/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb index dde69058523..e1e02c2852a 100644 --- a/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb +++ b/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb @@ -46,18 +46,16 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati # with Platforms::Kubernetes due to delegate Kubernetes specific logic. # We only target unmanaged KubernetesService records. scope :unmanaged_kubernetes_service, -> do - joins( - 'INNER JOIN projects ON projects.id = services.project_id' \ - 'INNER JOIN cluster_projects ON projects.id = cluster_projects.project_id' \ - 'INNER JOIN clusters ON cluster_projects.cluster_id = clusters.id' \ + joins('INNER JOIN projects ON projects.id = services.project_id ' \ + 'INNER JOIN cluster_projects ON projects.id = cluster_projects.project_id ' \ + 'INNER JOIN clusters ON cluster_projects.cluster_id = clusters.id ' \ 'INNER JOIN cluster_platforms_kubernetes ON cluster_platforms_kubernetes.cluster_id = clusters.id') - .where( - "services.category = 'deployment' AND services.type = 'KubernetesService'" \ - "AND (" \ - " cluster_projects.project_id IS NULL" \ - " OR" \ - " services.properties NOT LIKE CONCAT('%', cluster_platforms_kubernetes.api_url, '%')" \ - ")") + .where("services.category = 'deployment' AND services.type = 'KubernetesService' " \ + "AND ( " \ + " cluster_projects.project_id IS NULL " \ + " OR " \ + " services.properties NOT LIKE CONCAT('%', cluster_platforms_kubernetes.api_url, '%') " \ + ") ") end end @@ -95,6 +93,9 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati encrypted_password_iv: nil, # KubernetesService doesn't have token: kubernetes_service.token # encrypted_token and encrypted_token_iv } ) + + # Disable the service, so that new cluster archetecture is going to be used + kubernetes_service.updated(active: false) end end |