Validating the YAML in your custom resource file

You must validate your custom resource (CR) file before you apply it. It is likely that you edited the file multiple times, and possibly introduced errors or missed values during your customizations.

About this task

A good check before you apply the custom resource (CR) is to validate the YAML is executable. The web has many tools that you can use, but http://www.yamllint.com is simple and reliable.

If you want to use a command line tool, yq is a lightweight tool to help you check your YAML files. For more information, see yq - portable yaml processor.

When yq is installed, you can run the following command to verify that the custom resource has no errors.

yq <custom-resource-file>.yaml
Warning: Your CR file might contain confidential and sensitive information. Remove all of your security parameters and their values before you paste the contents of the file into the YAML Lint tool.

Procedure

  1. Go to http://www.yamllint.com/.
  2. Copy and paste the contents of your CR file (without your security parameters) into the gray text box, and click Go.

Results

The tool reports whether the YAML is valid. If the YAML is valid, it strips out the comments and displays the configuration in a UTF-8 format. Skim the configuration again and check for any values that still show "<Required>". If you kept the comments in your CR, checking it without these lines can make it easier to read.

If the YAML is not valid, the tool generates a message and indicates the line where the error is found.

What to do next

Correct any errors that are reported, and when your CR file has no errors make sure that the CR that you intend to use includes your security parameters.

If you created the CR by running the deployment script, apply the CR by following the steps in Option 2: Deploying the custom resource you created with the deployment script.