picodata / genin

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

Некорректная работа upgrade #152

Closed avprotsenko closed 6 months ago

avprotsenko commented 8 months ago

genin 0.5.2

Как воспроизвести:

genin build -s cluster.genin.01.yml
genin upgrade --old cluster.genin.01.yml --new cluster.genin.02.yml
genin upgrade --from-latest-state --new cluster.genin.03.yml

Последняя команда полностью ломает конечный inventory.

cluster.genin.01.yml

---
topology:
  - name: router
    replicasets_count: 1
    roles:
      - app
    failure_domains: [router-kafka-group]
  - name: storage
    replicasets_count: 12
    replication_factor: 3 
    roles:
      - storage
    failure_domains: [storages-group]
  - name: event
    replicasets_count: 1
    replication_factor: 2
    roles:
      - event
    failure_domains: [service-group]
  - name: quotas-bauth
    replicasets_count: 1 
    replication_factor: 2
    roles:
      - quotas
    failure_domains: [service-group]
  - name: kafka
    replicasets_count: 1
    replication_factor: 2
    roles:
      - kafka
    failure_domains: [router-kafka-group]
hosts:
  - name: router-kafka-group
    config:
      http_port: 8081
      binary_port: 3031
    hosts:
      - name: a
        config:
          address: 192.168.1.2
      - name: b
        config:
          address: 192.168.1.3
  - name: service-group
    config:
      http_port: 8081
      binary_port: 3031
    hosts:
      - name: c
        config:
          address: 192.168.1.4
      - name: d
        config:
          address: 192.168.1.5
  - name: storages-group
    config:
      http_port: 8081
      binary_port: 3031
    hosts:
      - name: e
        config:
          address: 192.168.1.6
      - name: f
        config:
          address: 192.168.1.7
      - name: g
        config:
          address: 192.168.1.8
      - name: h
        config:
          address: 192.168.1.9
      - name: i
        config:
          address: 192.168.1.10
      - name: j
        config:
          address: 192.168.1.11
failover:
  mode: disabled
vars:
    ansible_user: root
    ansible_password: root
    cartridge_app_name: app
    cartridge_cluster_cookie: cluster_cookie

cluster.genin.02.yml

---
topology:
  - name: router
    replicasets_count: 1
    roles:
      - app
    failure_domains: [router-kafka-group]
  - name: storage
    replicasets_count: 13
    replication_factor: 3 
    roles:
      - storage
    failure_domains: [storages-group]
  - name: event
    replicasets_count: 1
    replication_factor: 2
    roles:
      - event
    failure_domains: [service-group]
  - name: quotas-bauth
    replicasets_count: 1 
    replication_factor: 2
    roles:
      - quotas
    failure_domains: [service-group]
  - name: kafka
    replicasets_count: 1
    replication_factor: 2
    roles:
      - kafka
    failure_domains: [router-kafka-group]
hosts:
  - name: router-kafka-group
    config:
      http_port: 8081
      binary_port: 3031
    hosts:
      - name: a
        config:
          address: 192.168.1.2
      - name: b
        config:
          address: 192.168.1.3
  - name: service-group
    config:
      http_port: 8081
      binary_port: 3031
    hosts:
      - name: c
        config:
          address: 192.168.1.4
      - name: d
        config:
          address: 192.168.1.5
  - name: storages-group
    config:
      http_port: 8081
      binary_port: 3031
    hosts:
      - name: e
        config:
          address: 192.168.1.6
      - name: f
        config:
          address: 192.168.1.7
      - name: g
        config:
          address: 192.168.1.8
      - name: h
        config:
          address: 192.168.1.9
      - name: i
        config:
          address: 192.168.1.10
      - name: j
        config:
          address: 192.168.1.11
      - name: k
        config:
          address: 192.168.1.12
      - name: l
        config:
          address: 192.168.1.13
      - name: m
        config:
          address: 192.168.1.14
failover:
  mode: disabled
vars:
    ansible_user: root
    ansible_password: root
    cartridge_app_name: app
    cartridge_cluster_cookie: cluster_cookie

cluster.genin.03.yml

---
topology:
  - name: router
    replicasets_count: 1
    roles:
      - app
    failure_domains: [router-kafka-group]
  - name: storage
    replicasets_count: 14
    replication_factor: 3 
    roles:
      - storage
    failure_domains: [storages-group]
  - name: event
    replicasets_count: 1
    replication_factor: 2
    roles:
      - event
    failure_domains: [service-group]
  - name: quotas-bauth
    replicasets_count: 1 
    replication_factor: 2
    roles:
      - quotas
    failure_domains: [service-group]
  - name: kafka
    replicasets_count: 1
    replication_factor: 2
    roles:
      - kafka
    failure_domains: [router-kafka-group]
hosts:
  - name: router-kafka-group
    config:
      http_port: 8081
      binary_port: 3031
    hosts:
      - name: a
        config:
          address: 192.168.1.2
      - name: b
        config:
          address: 192.168.1.3
  - name: service-group
    config:
      http_port: 8081
      binary_port: 3031
    hosts:
      - name: c
        config:
          address: 192.168.1.4
      - name: d
        config:
          address: 192.168.1.5
  - name: storages-group
    config:
      http_port: 8081
      binary_port: 3031
    hosts:
      - name: e
        config:
          address: 192.168.1.6
      - name: f
        config:
          address: 192.168.1.7
      - name: g
        config:
          address: 192.168.1.8
      - name: h
        config:
          address: 192.168.1.9
      - name: i
        config:
          address: 192.168.1.10
      - name: j
        config:
          address: 192.168.1.11
      - name: k
        config:
          address: 192.168.1.12
      - name: l
        config:
          address: 192.168.1.13
      - name: m
        config:
          address: 192.168.1.14
failover:
  mode: disabled
vars:
    ansible_user: root
    ansible_password: root
    cartridge_app_name: app
    cartridge_cluster_cookie: cluster_cookie