yaml-mapper

command
v1.31.2-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

README.md

Purpose

The purpose of this tool is to map a YAML file of a certain structure to another YAML file of a different structure. For instance, migrating a Helm chart values.yaml file to another values.yaml file after a significant chart update.

Motivation

The motivation for creating this tool is to provide a way to support Datadog users who want to switch from using the datadog Helm chart to using the Datadog Operator controller when deploying the Datadog Agent. It is a significant change that requires creating a new DatadogAgent custom resource specification. As a result, we are providing a way to map from a Helm chart values.yaml file to a DatadogAgent CRD spec, using a provided mapping.yaml file.

How to install

make yaml-mapper

[!TIP] Add the /bin directory to your PATH to easily access the yaml-mapper executable.

How to use

Mapping Helm YAML to DatadogAgent CRD Spec

This mapper converts a datadog Helm chart values YAML file to the DatadogAgent CRD spec.

The resulting file is written to dda.yaml.<timestamp>. To specify a destination file, use flag --destPath=[<FILENAME>.yaml].

Content from a file can be optionally prepended to the output. To specify the header file, use flag --headerPath=[<FILENAME>.yaml].

By default, the output is also printed to STDOUT; to disable this use the flag --printOutput=false.

Example usage

yaml-mapper --sourcePath=<EXAMPLE_SOURCE>.yaml --mappingPath=mapper/mapping_datadog_helm_to_datadogagent_crd.yaml --headerPath=<EXAMPLE_HEADER>.yaml

The following command writes the mapped DDA to the provided destination.yaml file.

yaml-mapper --sourcePath=examples/example_source.yaml --mappingPath=mapper/mapping_datadog_helm_to_datadogagent_crd.yaml --headerPath=examples/example_header.yaml --destPath=examples/destination.yaml
Update Mapping File from a Source YAML

When updating the mapping file, be sure to add the corresponding key!

Below are different ways to update the mapping file based on your source:

  1. Local values.yaml from your branch

    If you have run into a CI error when adding a new field to values.yaml, run this command:

    yaml-mapper --updateMap --sourcePath=<PATH_TO>helm-charts/charts/datadog/values.yaml
    
  2. Latest published Datadog Helm chart values

    This pulls the latest values.yaml from the latest published Helm chart and updates the default mapping file.

    yaml-mapper --updateMap
    
  3. Update a custom mapping file with a custom source YAML

    yaml-mapper --updateMap --sourcePath=<YOUR_SOURCE_FILE> --mappingPath=<YOUR_MAPPING_FILE>
    
Update Mapping Keys

Currently, this process is manual. To update a mapping key, search for it in the operator configuration. When adding the corresponding operator value, be sure to prepend it with spec..

If the key does not have a corresponding value in the Datadog Operator configuration, leave the mapping as is with an empty string.

Thank you for helping us keep the mapping accurate and up to date!

Use a custom mapping

This tooling can be used to perform custom YAML mapping. Supply your own YAML mapping file using the following format:

source.key: destination.key

Both the key and value are period-delimited instead of nested or indented, as in a typical YAML file.

Optionally, define a headerPath to prepend to the mapped output.

apiVersion: v1
kind: MyCustomResource

Pass the source file and mapping file to the command:

yaml-mapper --sourcePath=source.yaml --mappingPath=mapping.yaml [--headerPath=<your-header-file]

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL