UNCLASSIFIED - NO CUI

Use IB image for Mattermost init container

PR - https://github.com/mattermost/mattermost-operator/pull/242 - introduced ability to specify custom init containers.

We will want to follow the note in that PR to disable the existing readiness checks (which use a non-IB image) and instead create an init container that runs IB postgres to check the DB status.

Upstream example, note the disableReadinessCheck value and the podExtensions used to make a new init container.

apiVersion: installation.mattermost.com/v1beta1
kind: Mattermost
metadata:
  name: mm-test
spec:
  database:
    disableReadinessCheck: true
...
  podExtensions:
    initContainers:
    - command:
      - /bin/sh
      - -c
      - echo Hello world
      image: busybox
      name: hello
...

The "default" db init container looked like:

		return &corev1.Container{
			Name:            "init-check-database",
			Image:           "postgres:13",
			ImagePullPolicy: corev1.PullIfNotPresent,
			Env:             envVars,
			Command: []string{
				"sh", "-c",
				"until pg_isready --dbname=\"$DB_CONNECTION_CHECK_URL\"; do echo waiting for database; sleep 5; done;",
			},
		}

Should be able to copy/modify this to fit into podExtensions.initContainers, ensuring that an IB image is used by default.

AC:

NOTE: This is a security issue because we are not using the secure IB container 😄

Edited by Micah Nagel