Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rsync and schema validation for backup/recovery #2969

Merged
merged 7 commits into from
Feb 24, 2022

Conversation

cicharka
Copy link
Contributor

@cicharka cicharka commented Feb 9, 2022

Bug #2942 rsync command fails trying to copy artifacts

  • With new version of ansible we can use private_key option for
    synchronize module, therefore there's no need to use rsh

Bug #2930 Backup/recovery commands fail when default configuration for backup attached to cluster-config.yml

  • extend run_for_individual_documents method so it can choose relevant
    schema for validated document
  • Minor fixes for BACKUP.md documentation

@cicharka cicharka marked this pull request as draft February 9, 2022 12:49
@cicharka cicharka marked this pull request as ready for review February 9, 2022 12:52
seriva
seriva previously approved these changes Feb 9, 2022
seriva
seriva previously approved these changes Feb 15, 2022
asciible
asciible previously approved these changes Feb 21, 2022
@cicharka cicharka dismissed stale reviews from asciible and seriva via 3170996 February 21, 2022 09:12
@przemyslavic
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

seriva
seriva previously approved these changes Feb 22, 2022
@przemyslavic
Copy link
Collaborator

@cicharka
#2942 Fixed
#2930 - does not work properly when the backup/recovery configuration is attached to the data.yaml file used for cluster deployment:

---
kind: epiphany-cluster
name: default
provider: azure
specification:
  admin_user:
    key_path: /path/to/id_rsa
    name: operations
  cloud:
    default_os_image: redhat-7-x86_64
    region: West Europe
    subscription_name: 
    use_public_ips: true
    use_service_principal: true
  components:
    kubernetes_master:
      count: 1
      machine: kubernetes-master-machine
      subnets:
        - address_pool: 10.1.1.0/24
    kubernetes_node:
      count: 1
      machine: kubernetes-node-machine
      subnets:
        - address_pool: 10.1.1.0/24
    logging:
      count: 1
      machine: logging-machine
      subnets:
        - address_pool: 10.1.3.0/24
    monitoring:
      count: 1
      machine: monitoring-machine
      subnets:
        - address_pool: 10.1.4.0/24
    kafka:
      count: 0
      machine: kafka-machine
      subnets:
        - address_pool: 10.1.5.0/24
    postgresql:
      count: 2
      machine: postgresql-machine
      subnets:
        - address_pool: 10.1.6.0/24
    load_balancer:
      count: 1
      machine: load-balancer-machine
      subnets:
        - address_pool: 10.1.7.0/24
    rabbitmq:
      count: 2
      machine: rabbitmq-machine
      subnets:
        - address_pool: 10.1.8.0/24
    opendistro_for_elasticsearch:
      count: 0
      machine: logging-machine
      subnets:
        - address_pool: 10.1.10.0/24
    repository:
      count: 1
      machine: repository-machine
      subnets:
        - address_pool: 10.1.11.0/24
    single_machine:
      count: 0
      machine: single-machine
      subnets:
        - address_pool: 10.1.1.0/24
  name: testbackup
  prefix: 'qa'
title: Epiphany cluster Config
---        
kind: configuration/rabbitmq
title: "RabbitMQ"
provider: azure
name: default
specification:
  rabbitmq_monitoring_enabled: true
  rabbitmq_plugins:
    - rabbitmq_management_agent
    - rabbitmq_management
  cluster:
    is_clustered: true
---
kind: configuration/backup
title: Backup Config
provider: azure
name: default
specification:
  components:
    load_balancer:
      enabled: true
    logging:
      enabled: true
    monitoring:
      enabled: true
    postgresql:
      enabled: true
    rabbitmq:
      enabled: true
    kubernetes:
      enabled: true
---
kind: configuration/recovery
title: Recovery Config
provider: azure
name: default
specification:
  components:
    load_balancer:
      enabled: true
      snapshot_name: latest
    logging:
      enabled: true
      snapshot_name: latest
    monitoring:
      enabled: true
      snapshot_name: latest
    postgresql:
      enabled: true
      snapshot_name: latest
    rabbitmq:
      enabled: true
      snapshot_name: latest
2022-02-22T15:04:32.8839122Z �[38;21m15:04:32 INFO cli.src.commands.Backup - Starting step�[0m
2022-02-22T15:04:33.6336421Z �[38;21m15:04:33 INFO cli.src.schema.SchemaValidator - Starting step�[0m
2022-02-22T15:04:33.6732777Z �[31;21m15:04:33 ERROR cli.src.schema.SchemaValidator - Failed validating: epiphany-cluster�[0m
2022-02-22T15:04:33.6812003Z �[31;21m15:04:33 ERROR cli.src.schema.SchemaValidator - 'version' is a required property
2022-02-22T15:04:33.6813114Z 
2022-02-22T15:04:33.6814448Z Failed validating 'required' in schema:
2022-02-22T15:04:33.6815869Z     {'$schema': 'http://json-schema.org/draft-07/schema#',
2022-02-22T15:04:33.6817309Z      'definitions': {'name': {'default': 'default',
2022-02-22T15:04:33.6819387Z                               'examples': ['default'],
2022-02-22T15:04:33.6820991Z                               'pattern': '^[^\\s]*$',
2022-02-22T15:04:33.6822333Z                               'title': 'The Name Schema',
2022-02-22T15:04:33.6823501Z                               'type': 'string'},
2022-02-22T15:04:33.6824744Z                      'provider': {'default': 'aws',
2022-02-22T15:04:33.6826127Z                                   'examples': ['aws', 'azure', 'any'],
2022-02-22T15:04:33.6827492Z                                   'pattern': '^(aws|azure|any)$',
2022-02-22T15:04:33.6828375Z                                   'title': 'The Provider Schema',
2022-02-22T15:04:33.6829230Z                                   'type': 'string'},
2022-02-22T15:04:33.6830031Z                      'title': {'default': 'default',
2022-02-22T15:04:33.6830866Z                                'examples': ['default'],
2022-02-22T15:04:33.6831674Z                                'pattern': '^(.*)$',
2022-02-22T15:04:33.6832625Z                                'title': 'The Title Schema',
2022-02-22T15:04:33.6833432Z                                'type': 'string'},
2022-02-22T15:04:33.6834517Z                      'unvalidated_specification': {'title': 'The '
2022-02-22T15:04:33.6835447Z                                                             'Specification '
2022-02-22T15:04:33.6836364Z                                                             'Schema',
2022-02-22T15:04:33.6837350Z                                                    'type': ['object',
2022-02-22T15:04:33.6838177Z                                                             'null']},
2022-02-22T15:04:33.6839369Z                      'version': {'default': '0.4.2',
2022-02-22T15:04:33.6840512Z                                  'examples': ['0.4.2',
2022-02-22T15:04:33.6841104Z                                               '0.8.0rc1',
2022-02-22T15:04:33.6841680Z                                               '1.2.0dev'],
2022-02-22T15:04:33.6842458Z                                  'pattern': '^((\\d+\\.)(\\d+\\.)(\\d+)(rc\\d+|dev)?)$',

@cicharka cicharka requested a review from asciible February 22, 2022 15:10
Bug hitachienergy#2942 rsync command fails trying to copy artifacts
* With new version of ansible we can use private_key option for
  synchronize module, therefore there's no need to use rsh

Bug hitachienergy#2930 Backup/recovery commands fail when default configuration for
backup attached to cluster-config.yml
* extend run_for_individual_documents method so it can choose relevant
  schema for validated document
@cicharka cicharka force-pushed the fix/backup-recovery-rsync branch 2 times, most recently from 81abf6d to 1e1007f Compare February 23, 2022 09:38
@przemyslavic
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@przemyslavic
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@cicharka
Copy link
Contributor Author

After conversations with @przemyslavic and @seriva there is agreement:

  • documentation will instruct user to create new backup.yml/recovery.yml file in order to use epicli backup/recovery commands
  • nevertheless it will be possible to attach these configs to any yml file as there is additional validation to fetch desired kind of docs: select_all(loaded_docs, lambda x: x.kind in ['configuration/backup', 'configuration/recovery'])

@cicharka cicharka merged commit f058984 into hitachienergy:develop Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants