There are multiple options for seeding data into your Preview Environments.
Depending on what data store you using, one option may be using a custom docker image preloaded with a seed data dump.
Community postgresql images will load data under
/docker-entrypoint-initdb.d, and you can create a custom image as such:
FROM postgres:13.0-alpineCOPY database_name.sql /docker-entrypoint-initdb.d/
A good post regarding this method can be found here.
You will then want to specify your custom image in the
postgresql chart-values file, and ensure that docker credentials are provided in order for the cluster to pull the private image.
If you are using an application which supports application level data seeding (such as Rails), you can add a Helm post-install hook to execute your migration, and populate your data. Preview ensures that dependencies are ready and available before the deployment of application charts in order to support this use case. Note that for larger data sets, this will likely be slower than using a pre-built database image.
For more complicated data seeding, or if you have more complex configuration which must be applied after environment creation, Preview can deliver a webhook after workflow completion. This hook can be used to connect in to the deployed environment, and execute additional set up, such as injecting seed data into the Preview created database services.