Validated Patterns

Deploying the Portworx DR Pattern

Prerequisites
  • An OpenShift cluster

    • To create an OpenShift cluster, go to the Red Hat Hybrid Cloud console.

    • Select OpenShift -> Red Hat OpenShift Container Platform -> Create cluster.

  • A GitHub account with a personal access token that has repository read and write permissions.

  • The Helm binary, for instructions, see Installing Helm

  • Additional installation tool dependencies. For details, see Patterns quick start.

It is desirable to have a cluster for deploying the GitOps management hub assets and a separate cluster(s) for the managed cluster(s).

Preparing for deployment

Procedure
  1. Fork the portworx-dr repository on GitHub. You must fork the repository because your fork is updated as part of the GitOps and DevOps processes.

  2. Clone the forked copy of this repository.

    $ git clone git@github.com:your-username/portworx-dr.git
  3. Go to your repository: Ensure you are in the root directory of your Git repository by using:

    $ cd /path/to/your/repository
  4. Run the following command to set the upstream repository:

    $ git remote add -f upstream git@github.com:validatedpatterns-sandbox/portworx-dr.git
  5. Verify the setup of your remote repositories by running the following command:

    $ git remote -v
    Example output
    origin	git@github.com:kquinn1204/portworx-dr.git (fetch)
    origin	git@github.com:kquinn1204/portworx-dr.git (push)
    upstream	git@github.com:validatedpatterns-sandbox/portworx-dr.git (fetch)
    upstream	git@github.com:validatedpatterns-sandbox/portworx-dr.git (push)
  6. Make a local copy of secrets template outside of your repository to hold credentials for the pattern.

    Do not add, commit, or push this file to your repository. Doing so may expose personal credentials to GitHub.

    Run the following commands:

    $ cp values-secret.yaml.template ~/values-secret.yaml
  7. Populate this file with secrets, or credentials, that are needed to deploy the pattern successfully:

    $ vi ~/values-secret.yaml
    1. Edit the aws section to refer to the file containing your AWS credentials:

        - name: aws-creds
          vaultPrefixes:
          - global
          fields:
          - name: aws_access_key_id
            value: ""
            description: "An aws access key that can provision VMs and manage IAM (if using portworx)"
      
          - name: aws_secret_access_key
            value: ""
            description: "An aws access secret key that can provision VMs and manage IAM (if using portworx)"
    2. Add a Portworx Enterprise DR license:

        - name: portworx
          vaultPrefixes:
          - global
          fields:
          - name: dr_license
            path: "/path/to/enterprise+dr/license"
            description: "The portworx dr license that can be activated with `pxctl license activate saas --key <license>`"
    3. Add the kubeconfigs for both clusters:

        - name: kubeconfigs
          vaultPrefixes:
          - global
          fields:
          - name: primary_kubeconfig
            path: "/path/to/primary/cluster/kubeconfig"
            description: "path to the the kubeconfig for the primary cluster"
          - name: secondary_kubeconfig
            path: "/path/to/secondary/cluster/kubeconfig"
            description: "path to the the kubeconfig for the secondary (failover) cluster"
    4. Add an Ansible Automation Platform manifest:

        - name: aap-manifest
          vaultPrefixes:
          - hub
          fields:
          - name: b64content
            path: '~/Downloads/<manifest_filename>.zip'
            base64: true
            description: "Manifest obtained from following https://docs.redhat.com/en/documentation/red_hat_ansible_automation_platform/2.5/html/installing_on_openshift_container_platform/assembly-gateway-licensing-operator-copy#assembly-aap-obtain-manifest-files"
    5. Add an Ansible Automation Platform Automation Hub token:

        - name: automation-hub-token
          vaultPrefixes:
          - hub
          fields:
          - name: token
            path: '/path/to/automation-hub-token'
            description: "Automation hub token obtained from https://console.redhat.com/ansible/automation-hub/token"
    6. Add an AGOF Vault File. Normally the content "---" is sufficient:

        - name: agof-vault-file
          vaultPrefixes:
          - hub
          fields:
          - name: agof-vault-file
            value: '---'
            base64: true
            description: "Needed for AGOF, do not change!"
  8. Create and switch to a new branch named my-branch, by running the following command:

    $ git checkout -b my-branch
  9. The pattern will infer the baseDomain of your cluster based on the clusterDomain which is tracked by the pattern operator. Previously, this required the pattern to be forked to be useful - but this is no longer the case (you may still wish to change other settings in the RDR chart’s values file, such as aws.region settings. This file is at hub/rdr/values.yaml. If you do make customizations to this or other files, it is necessary to fork the pattern so that the changes will be seen by ArgoCD. If you made any changes to this or any other files tracked by git, git add them and then commit the changes by running the following command:

    $ git commit -m "any updates"
  10. Push the changes to your forked repository:

    $ git push origin my-branch

The preferred way to install this pattern is by using the script ./pattern.sh script.

Deploying the pattern by using the pattern.sh file

To deploy the pattern by using the pattern.sh file, complete the following steps:

  1. Log in to your cluster by following this procedure:

    1. Obtain an API token by visiting https://oauth-openshift.apps.<your-cluster>.<domain>/oauth/token/request.

    2. Log in to the cluster by running the following command:

      $ oc login --token=<retrieved-token> --server=https://api.<your-cluster>.<domain>:6443

      Or log in by running the following command:

      $ export KUBECONFIG=~/<path_to_kubeconfig>
  2. Deploy the pattern to your cluster. Run the following command:

    $ ./pattern.sh make install