diff options
author | James Fargher <proglottis@gmail.com> | 2019-05-24 11:59:32 +0300 |
---|---|---|
committer | James Fargher <proglottis@gmail.com> | 2019-05-30 15:22:50 +0300 |
commit | c234e7312357388c1e088876772ecae22cf06297 (patch) | |
tree | 2ae5f037b7cd7429d92ed02ad93fc9a178ec1fca /db/post_migrate | |
parent | 1a25ad3e578c9f3a0682551b7bef0a554c2763b8 (diff) |
When an instance cluster already exists migrate disabled
Assume that if an instance level cluster already exists, then the
KubernetesService was not being used, but allow the admin to re-enable
it if required
Diffstat (limited to 'db/post_migrate')
-rw-r--r-- | db/post_migrate/20190517153211_migrate_k8s_service_integration.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/db/post_migrate/20190517153211_migrate_k8s_service_integration.rb b/db/post_migrate/20190517153211_migrate_k8s_service_integration.rb index f9f13d64be9..4bd04edb239 100644 --- a/db/post_migrate/20190517153211_migrate_k8s_service_integration.rb +++ b/db/post_migrate/20190517153211_migrate_k8s_service_integration.rb @@ -75,11 +75,13 @@ class MigrateK8sServiceIntegration < ActiveRecord::Migration[5.1] end def up + has_instance_cluster = Cluster.instance_type.where(enabled: true).exists? + MigrateK8sServiceIntegration::Service.kubernetes_service_templates.find_each do |service| next unless service.api_url && service.token MigrateK8sServiceIntegration::Cluster.create!( - enabled: service.active, + enabled: !has_instance_cluster && service.active, managed: false, name: 'KubernetesService', cluster_type: 'instance_type', |