title: Adding an init-container to a pod in a standard Helm chart
body: <p>I am using a standard PostgreSQL Helm chart for deploying the database to a Kubernetes cluster. I need to add logic to the deployment procedure for loading the latest database backup into PostgreSQL. I would like to create an init container for a master pod defined in statefulsets.yaml. </p>
  
  <p>I can add the init container definition directly in statefulsets.yaml template of PostgreSQL chart. I would like to avoid doing that for obvious reasons (applying Open/Closed Principle).</p>
  
  <p>How can I add an init container to PostgreSQL master without modifying the standard Helm chart (e.g., from values.yaml)?</p>
  
  <p>Is there a better way to load the database backup (other than an init container)?</p>