Velero
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Velero data-only restore design discussion [TOC] This document discusses how to implement [Velero’s data-only restore feature](https://github.com/vmware-tanzu/velero/issues/7345). There is already a [pull request](https://github.com/vmware-tanzu/velero/pull/7481) created as the design document. The discussion mainly focuses on how to implement the data-only restore. There are two ways considered. ## Proposals ### In-place data-only restore The first way is called the “in-place”, which means the data is restored to the existing volumes. The pros: * It’s possible to restore data without recreating the workload. * It’s possible to support granular restore(only restoring filtered files) in the future. * It’s possible to support no downtime during the restoration. The cons: * There is no easy way to support the snapshot-based backup because most storage providers can’t read data directly from the snapshot. * There is no easy way to support the block-mode volumes. * It’s hard to avoid data conflict with the pod’s running process during restoration. ### The replace data-only restore The second way is called the “replace”, which means the data is restored into a brand-new volume. The pros: * It supports snapshot-based backups as well as filesystem-based backups. * It’s easy to support rolling back the existing data and restoring the backed-up data. The cons: * Because data is restored into new volumes, mounting new volumes into the existing workloads is a tough task. Either the user needs to handle it manually, or Velero needs to modify the workload to mount the volumes as the new PVCs or the new PVs. * It cannot cover granular restore(only restoring filtered files). ## Consensus The community already has a consensus that the “in-place” and “replace” ways are valuable and useful for different user scenarios. Ideally, Velero should support both of them. Because of the team’s bandwidth, we can only implement one of the two options in the short term, so we need to prioritize the two options, which should be implemented first. ## Continuing discussion ### In-place or replace The first thing that needs to settle down for this feature is which way should be implemented in the first phase of this feature, the “in-place” way or the “replace” way. At first, the consensus is that “in-place” data-only restore is more wanted, because: * It can easily support k8s resources governed by external tools, such as GitOps. * Granular restore(only restoring filtered files) supports. But the “replace” way is preferred later. The reason is the “replace” way can support more scenarios. As the [use case section](#Use-Cases-for-data-only-restore) displays, the `in-place` way of data-only restore can address more scenarios. Please continue to add scenarios in to it. We will prioritize on which way can solve more scenarios. ### Volume not mounted by pod scenario Restore data into volumes that are not mounted by any pod is a scenario needs consideration for both in-place and replace way of data-only restore. For the in-place way, because the Velero current filesystem-based volume restore needs to know the volume's mounting path on the node, non-mounting volumes don't have that. Velero need to create a dummy pod to do that. For the replace way, because most of the PVC are created as the `WaitForFirstConsumer` fashion, the PVC's volume is not mounted until it's consumed by a pod. Velero also needs to consider using a dummy pod here. ### What is expected for in-place This section describes what is expected for the in-place data-only restore if we choose it. The idea of in-place is using the existing PodVolume mechanism. The PodVolume way will use the Kopia to download data into volumes. For the PodVolumeBackup volumes, the PodVolumeRestore is generated according to the PodVolumeBackup. For the CSI-data-moved volumes, Velero will generate the PodVolumeRestore by the DataUpload information. At first, injecting an InitContainer into the data-only restore volume mounting pod is preferred. By injecting an InitContainer, the pod restarts, and the workload container will not start until the PodVolumeRestore process finishes. This can avoid the conflict between PodVolumeRestore and the workload container’s data reading and writing. But this needs to modify the pod’s spec, which means the current pod should be deleted and recreated with modification. If there are controllers governing the pod, for example, Deployment and StatefulSet, there would be conflict. Both the controller and the data-only restore operation try to delete and recreate pods. Even if the conflict is resolved, the pod downtime during restoration is still unwanted. As a result, the proposal is that **the user needs to prepare to avoid the possible data conflict before running the data-only restore**. This is the most feasible way to achieve the no-downtime goal and not modify the workload. A possible future enhancement is introducing a pre-hook for the Velero Restore. Users can use the pre-hook to run commands to prepare for restoring data, but the pre-hook is a new mechanism. We need to consider whether there is a need for the pre-hook, or if it is only useful for the in-place data-only restoration. ### What is expected for replace This section describes what is expected for the “replace” data-only restore if we choose it. The “replace” restore utilizes the existing Generic Data Path to create an intermediate pod to write the data into the target PV’s volume. After the data restoration completion, the target PV is unbound from the intermediate pod and then mounted to the target pod. For the CSI-data-moved volumes, the DataDownload is generated upon the backup-created DataUpload. For the other cases, the DataDownload is generated according to the volumes’ backup method. Because the pod’s spec, PVC’s spec, and the PV’s spec are immutable, deletion and recreation of the target pod are required to mount the new volume created from the data-only restore, and the controller needs modification to avoid conflict with the target pod’s controller. There are a lot of CRDs that can create pods. To simplify the problem, the proposal focuses on the k8s controllers, which are Deployment, Statefulset, and Daemonset. The CRDs are not supported. ## Use Cases for data-only restore ### Scenario 1 I have a cluster with Stateful App1 deployed. This App has CRDs (Stateless) and PVC (Stateful). I lost the cluster (hardware failure). I have provisioned a new cluster and deployed the App1 again, I want to restore data from the cluster where App1 was previously deployed. * In this scenario, as the application is deployed on the second cluster freshly and users want to restore the data only, **in-place data-only restore** is suited for this scenario. ### Scenario 2 I have a cluster with Stateful App1 deployed. This App has CRDs (Stateless) and PVC (Stateful). I want to restore data to the last day. * In this scenario, as the application is working and the user wants to restore the data only for business reasons, **replace data-only restore** is suited for this scenario so that if the restore job fails, it does not corrupt the latest data. As a workaround, user may take another backup just before restoring if there is no option for the replace data-only restore. ### Scenario 3 I have a cluster with Stateful App1 deployed. This App has CRDs (Stateless) and PVC (Stateful). I want to restore data to the last day on a new PVC in a different namespace. * In this scenario, as the application is working and the user wants to restore data to validate software upgrades/patches, **in-place data-only restore** is suited for this scenario. ### Scenario 4 I have a cluster with Stateful App1 deployed. This App has CRDs (Stateless) and PVC (Stateful). I want to restore specific data to the last day. * In this scenario, as the application is working and the user wants to restore specific data within a directory within the PVC for business reasons, **in-place data-only restore** is suited for this scenario so that if the restore job fails, it does not corrupt the latest data. As a workaround, user may take another backup just before restoring if there is no option for the replace data-only restore. ### Scenario 5 Data migration, users may want to migrate data across storage providers e.g. copy the data from an existing on-prem PVC into a cloud storage based PVC. Velero should provide options for both scenarios. Based on user scenarios, both in-place data-only restore and replace data-only restore options should be available in Velero. ### Scenario 6 I have a cluster with Stateful App1 deployed. This App has CRDs (Stateless) and PVC (Stateful). The PVC is created as a block mode device. I lost the cluster (hardware failure). I have provisioned a new cluster and deployed the App1 again, I want to restore data from the cluster where App1 was previously deployed. * In this scenario, as the application is deployed on the second cluster freshly and users want to restore the data only, because the PVC is in block mode, **replace data-only restore** is suited for this scenario.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully