Configuring 3DSnaps in OpenShift with FlashArray
For each of the snapshot types, Portworx supports specifying pre and post rules that are run on the application pods using the volumes being snapshotted. This allows users to quiesce the applications before the snapshot is taken and resume I/O after the snapshot is taken.
The high level workflow for configuring 3DSnaps involves creating rules and later on referencing the rules when creating the snapshots.
Step 1: Create Rules
A Stork Rule is a Custom Resource Definition (CRD) that allows to define actions that get performed on pods matching selectors. Below are the supported fields:
- podSelector: The actions will get executed on pods that only match the label selectors given here.
- actions: This contains a list of actions to be performed. Below are supported fields under actions:
- type: The type of action to run. Only type command is supported.
- background: If true, the action will run in background and will be terminated by Stork after the snapshot has been initiated. If false, the action will first complete and then the snapshot will get initiated.
- If background is set to true, add
${WAIT_CMD}as shown in the examples below. This is a placeholder and Stork will replace it with an appropriate command to wait for the command is done.
- If background is set to true, add
- value: This is the actual action content. For example, the command to run.
- runInSinglePod: If true, the action will be run on a single pod that matches the selectors.
- container: specifies the container in which Stork will execute the action.
Step 2: Create snapshots that reference the rules
Once you have the rules applied in your cluster, you can reference them in the VolumeSnapshot or GroupVolumeSnapshot for individual and group snapshots respectively.
VolumeSnapshots
Use following annotations on the VolumeSnapshot to specify pre and post rules.
- stork.rule/pre-snapshot: Stork will execute the rule which is given in the value of this annotation before taking the snapshot.
- stork.rule/post-snapshot: Stork will execute the rule which is given in the value of this annotation after taking the snapshot.