Download the code for a defined policy in YAML or JSON format through the Tanzu Mission Control console.

For policy types that are managed through the Policies page in the Tanzu Mission Control console, excluding access policies which are managed separately, you can download the JSON or YAML code for the policy. This allows you to treat policies as code so that you can perform versioning, tracking, back up, and other functions.

For example, you can define a policy in Tanzu Mission Control and then download the policy code. Then you can use that file to check into source control, or make changes to the policy and apply it to the cluster or other clusters.

Note: This capability is not available for access policies.

Prerequisites

Log in to the Tanzu Mission Control console.

Make sure you have the appropriate permissions to download policies.
  • To view and download the policies for an object, you must be associated with the .admin role on that object.

Procedure

  1. Click Policies in the left navigation pane of the Tanzu Mission Control console to show the subpages, and then click Assignments.
  2. On the Policies Assignments page, click the tab for the type of policy you want to see or create.
    For example, to see image registry policies click the Image registry tab.
  3. Use the tree control to navigate to the object for which you want to see policies, and then click the object whose policies you want to see.
    The Policies assignments page shows the direct policy for the object and the object's inherited policies.
  4. Download your policy code.
    The procedure differs slightly, depending on which type of policy you want to download.
    • For mutation and image registry policy types:
      1. In the list of defined policies for an object, click the menu icon for the policy and then choose the format you want to export.
    • For other policy types:
      1. In the list of defined policies for an object, click to expand the options for the policy.
      2. Click Download, and then choose the format you want to export.

Results

When you choose your download format ( Download JSON or Download YAML), Tanzu Mission Control generates the code for the policy and downloads the file through your browser.