Skip to main content
  • Place orders quickly and easily
  • View orders and track your shipping status
  • Enjoy members-only rewards and discounts
  • Create and access a list of your products

PowerProtect Data Manager 19.10 Kubernetes User Guide

About application templates

Application templates translate the specific configuration details and required interface steps for each database application deployment to the standard PowerProtect Data Manager backup functionality for Kubernetes.

CAUTION Do not create more than one template with the same label and the same namespace. In this circumstance, only the last-deployed template takes effect, which may cause undesirable results.

Application templates are typically deployed from customizable YAML files that come with the CLI package. When complete, the application template contains the following items:

  • AppLabel – corresponds to the label that you applied to each pod during deployment. The label identifies all pods that belong to the indicated database application. Labels can contain multiple key-value pairs in a comma-separated list.

    If more than one instance of each database application exists in the same namespace, two application templates are required. In this case, each application must use different values for AppLabel.

    For example, the label app=mysql matches the template with any pod which has a label that takes the form of a key named app and the value mysql.

  • Type – identifies the type of database application inside the pod or pods.
  • AppActions – matches a prescribed action or filter to a resource type, such as pods.

The next topics explain application actions in more detail.

You can deploy application templates to the PowerProtect namespace or to a specific user-defined namespace. Using a template in the PowerProtect namespace applies the template to all other namespaces. This result can include namespaces where you may not have credentials to run some user-supplied commands or where the expected context may differ from the real context. If you deploy a template to the PowerProtect namespace, that template can use only the default hook actions that are described in a subsequent topic.

When you require specific user-supplied commands for a database application, create an application template for each namespace. Templates in specific namespaces override any behavior that would come from a template of the same name in the PowerProtect namespace.

Default application templates

When you deploy application templates without specifying custom values in a YAML file, the deployment uses values from the default configuration files.

For example, the default MySQL application template supports both stand-alone and cluster instances of MySQL, with a single StatefulSet. In this StatefulSet, the primary pod has index 0. Secondary pods have an index that ranges from 1 to n-1, where n is the number of replicas.

The default MongoDB template supports only stand-alone instances, with similar StatefulSet pod parameters.

Application template example

The following example illustrates the syntax for a MySQL database:

apiVersion: "powerprotect.dell.com/v1beta1"
kind: ApplicationTemplate
metadata:
    name: ClusteredMySQLTemplate
    namespace: examplenamespace
spec:
    type: "MYSQL"
    enable: true
    appLabel: "app=mysql"
    appActions:
        Pod:
            preHook: 
                 command: '["/bin/sh", "-c", "mysql -uroot -p$MYSQL_ROOT_PASSWORD -e \"FLUSH TABLES WITH READ LOCK; FLUSH LOGS;SELECT SLEEP(100);\" >/tmp/quiesce.log 2>&1 & for i in 1..10; do sleep 1; mysql -uroot -p$MYSQL_ROOT_PASSWORD -e \"SHOW PROCESSLIST\" | grep \"SLEEP(100)\" > /tmp/sleep.pid ; if [ $? -eq 0 ]; then exit 0; fi; done; exit 1"]'
            postHook: 
                command: '["/bin/sh", "-c", "SLEEPPID=`cut -f1 /tmp/sleep.pid` ; mysql -uroot -p$MYSQL_ROOT_PASSWORD -e \"KILL $SLEEPPID\" ; rm /tmp/sleep.pid"]'
        StatefulSet:
            selectors:
                - selectorTerms:
                     - field: "Labels"
                       selectorExpression: "app=mysql"
                     - field: "Name"
                       selectorExpression: ".*-[1-9][0-9]*$"'  # Secondary pods with index > 0
                - selectorTerms:
                     - field: "Labels"
                       selectorExpression: "app=mysql"
                     - field: "Name"
                       selectorExpression: ".*-0$"'  # Primary pod index 0

After you obtain and extract the CLI package, you can find more sample templates in the examples directory.


Rate this content

Accurate
Useful
Easy to understand
Was this article helpful?
0/3000 characters
  Please provide ratings (1-5 stars).
  Please provide ratings (1-5 stars).
  Please provide ratings (1-5 stars).
  Please select whether the article was helpful or not.
  Comments cannot contain these special characters: <>()\