Skip to main content

According to the introduction on the official website

https://docs.kasten.io/latest/api/transforms.html

When adding an element to an array, "-" can be used in the path to add an element at the and of the array.

Can you give me an example of such a demonstration?

 

Thanks for posting your question here @halaMayday .

I am adding an example that came to my mind immediately after seeing this message.

Below is the example of a transforms that can append an environment variable at the end of the array to the first container of the deployments.

 

Adding the transforms path and json value used in the above example for reference

  transforms:
- subject:
resource: deployments
name: test
json:
- op: add
path: /spec/template/spec/containers/0/env/-
value:
name: JAI_TRANSFORMS_EXAMPLE
value: test for adding an element to the end of an existing array

 


Comment