Defining assets (or other resources) in multiple namespaces

I have an asset defined that is used for checks that will run in multiple namespaces. Do I need to define an asset for each namespace in multiple files or is there some other alternative?

I’m also interested in defining handlers, in a single file definition, to run in mulitple namespaces.

Thanks!

1 Like

Hi there, @KendallChenoweth :wave: you will need to register the asset(s) in each namespace you want to use them in, but you no longer need to hardcode this into your Asset definitions. As of Sensu Go version 5.10 you can omit the metadata.namespaces attribute in resource definitions and provide the namespace via sensuctl (defaults to the “active” namespace, or by specifying the namespace using the --namespace flag).

Here’s the excerpt from the 5.10.0 release notes:

The sensuctl create command now supports specifying the namespace for a group of resources at the time of creation, allowing you to replicate resources across namespaces without manual editing. See the sensuctl reference for more information and usage examples.

Source: https://docs.sensu.io/sensu-go/latest/release-notes/#5-10-0-release-notes

More on this new feature.
We just adjusted Bonsai Asset Index to work better with 5.10+. so Bonsai no longer hardcodes the namespace by default for generated asset configuration files. It should be much easier now to apply the Bonsai provided asset configs into you artive namespace now!

1 Like