How to customise mongodb in the deployment.yaml config?

You should write a Tutor plugin that provides an override to the Kubernetes configuration.

Tutor uses Kustomize and provides a patch k8s-override that performs an strategic merge to the kubernetes manifests. You can read a little about how they work, but the gist of it would be to create a plugin that has the k8s-override patch with a partial definition of the resource you want to change.

from tutor import hooks

hooks.Filters.ENV_PATCHES.add_item(
    (
        "k8s-override",
"""
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mydeployment
spec:
  template:
    spec:
      # ... Fields I want to override
"""
    )
)
1 Like