picodata / genin

Ansible cartridge inventory generator
BSD 2-Clause "Simplified" License
10 stars 3 forks source link

Дублирование порта при удалении инстанса #150

Open avprotsenko opened 9 months ago

avprotsenko commented 9 months ago

Если удалить из середины кластера инстанс через upgrade, а затем добавить в конец новый инстанс, он продублирует порт последнего инстанса. Как воспроизвести: cluster.genin.old.yml:

topology:
  - name: router
    replicasets_count: 2
    failure_domains: [router-1-1, router-2-1]
    roles:
      - app.roles.router
      - failover-coordinator
  - name: test1
    replicasets_count: 1
    replication_factor: 2
    failure_domains: [router-1-1, router-2-1]
    roles:
      - app.roles.test1
  - name: test2
    replicasets_count: 1
    replication_factor: 2
    failure_domains: [router-1-1, router-2-1]
    roles:
      - app.roles.test2
  - name: storage
    replicasets_count: 2
    replication_factor: 2
    failure_domains: [storage-1-1, storage-2-1]
    roles:
      - app.roles.storage

cluster.genin.new.yml:

topology:
  - name: router
    replicasets_count: 2
    failure_domains: [router-1-1, router-2-1]
    roles:
      - app.roles.router
      - failover-coordinator
  - name: test2
    replicasets_count: 1
    replication_factor: 2
    failure_domains: [router-1-1, router-2-1]
    roles:
      - app.roles.test2
  - name: storage
    replicasets_count: 2
    replication_factor: 2
    failure_domains: [storage-1-1, storage-2-1]
    roles:
      - app.roles.storage
genin upgrade --old cluster.genin.old.yml --new cluster.genin.new.yml

cluster.genin.new.yml:

topology:
  - name: router
    replicasets_count: 2
    failure_domains: [router-1-1, router-2-1]
    roles:
      - app.roles.router
      - failover-coordinator
  - name: test2
    replicasets_count: 1
    replication_factor: 2
    failure_domains: [router-1-1, router-2-1]
    roles:
      - app.roles.test2
  - name: storage
    replicasets_count: 2
    replication_factor: 2
    failure_domains: [storage-1-1, storage-2-1]
    roles:
      - app.roles.storage
  - name: test3
    replicasets_count: 1
    replication_factor: 2
    failure_domains: [router-1-1, router-2-1]
    roles:
      - ttc.roles.test3
genin upgrade --from-latest-state --new cluster.genin.new.yml

Результат:

+------------+-------------+------------+-------------+
|                       cluster                       |
+------------+-------------+------------+-------------+
|           DC1            |           DC2            |
+------------+-------------+------------+-------------+
| router-1-1 | storage-1-1 | router-2-1 | storage-2-1 |
+------------+-------------+------------+-------------+
| router-1   | storage-1-1 | router-2   | storage-1-2 |
| 8081/3031  | 8081/3031   | 8081/3031  | 8081/3031   |
+------------+-------------+------------+-------------+
| test2-1-1  | storage-2-1 | test2-1-2  | storage-2-2 |
| 8083/3033  | 8082/3032   | 8083/3033  | 8082/3032   |
+------------+-------------+------------+-------------+
| test3-1-1  |             | test3-1-2  |             |
| 8083/3033  |             | 8083/3033  |             |
+------------+-------------+------------+-------------+