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

[CPDEV-93171] - do not export kubernetes resources by default #553

Merged
merged 2 commits into from
Nov 29, 2023

Conversation

Imadzuma
Copy link
Contributor

Description

Exported kubernetes objects in backup procedure are not used in restore procedure, but they take a lot of time to export (especially in big clusters). They can be helpful only for some manual changes, but they do not needed by default.

Additionally now user can't skip kubernetes resources export in procedure.yaml, because it's not allowed in json schema. He can only skip whole task.
And finally user can't export only specific resource because of the same reason. For example the following configuration is restricted:

backup_plan:
  kubernetes:
    namespaced_resources:
      namespaces: all
      resources:
      - configmaps
    nonnamespaced_resources: []

Fixes # (issue)

Solution

  • Fixed json schema and backup procedure itself to process empty list of resources and namespaces;
  • Fixed defaults for backup_plan.kubernetes not to load kubernetes resources by default;
  • Fixed unittests for backup procedure;
  • Added information about new defaults in documentation;

Test Cases

TestCase 1: default behavior

Test Configuration:

  • Hardware:
  • OS:
  • Inventory: any cluster, empty ``backup_plan.kubernetes` in procedure inventory for backup;

Steps:

  1. kubemarine install;
  2. kubemarine backup;

Results:

Before After
All kubernetes resources are exported in backup No kubernetes resources in backup

TestCase 2: specific not-namespaced resource

Test Configuration:

  • Hardware:
  • OS:
  • Inventory: any cluster, procedure.yaml contains only one not-namespaced resource, e.g. for CRD:
backup_plan:
  kubernetes:
    namespaced_resources:
      resources: []
    nonnamespaced_resources:
      - customresourcedefinitions.apiextensions.k8s.io

Steps:

  1. kubemarine install;
  2. kubemarine backup;

Results:

Before After
Schema error Only specified resources are exported

TestCase 3: specific namespaced resource (loaded for all namespaces)

Test Configuration:

  • Hardware:
  • OS:
  • Inventory: any cluster, procedure.yaml contains only one namespaced resource, e.g. for configmaps:
backup_plan:
  kubernetes:
    namespaced_resources:
      resources:
      - configmaps
    nonnamespaced_resources: []

Steps:

  1. kubemarine install;
  2. kubemarine backup;

Results:

Before After
Schema error Only specified resources are exported for all namespaces

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Integration CI passed
  • Unit tests. If Yes list of new/changed tests with brief description
  • There is no merge conflicts

Unit tests

Indicate new or changed unit tests and what they do, if any.

@Imadzuma Imadzuma requested review from koryaga and ilia1243 November 23, 2023 08:01
@koryaga koryaga self-assigned this Nov 23, 2023
@koryaga koryaga added improvement New feature or request bug Something isn't working labels Nov 23, 2023
@koryaga koryaga merged commit 11cc9e6 into main Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working improvement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants