Summary
Document how to deploy Mattermost operator in conjunction with Gitlab (selfhosted) operator
Steps to reproduce
Attempt to deploy Mattermost operator with Gitlab operator in Kubernetes, search documentation only this page has information with both using helm charts
Expected behavior
Documentation explains how to deploy Mattermost with Gitlab operator
Observed behavior (that appears unintentional)
I had to figure it out, wasn't very difficult from having experience using Gitlab and Mattermost with helm charts but new users may have trouble.
Possible fixes
Add documentation
Example follows:
---
apiVersion: v1
kind: Secret
metadata:
name: mm-postgres-connection
type: Opaque
data:
DB_CONNECTION_STRING: "postgres://gitlab:<password_from_gitlab-postgresql-password_secret>@gitlab-postgresql:5432/mattermost-db?sslmode=disable&connect_timeout=10"
---
apiVersion: installation.mattermost.com/v1beta1
kind: Mattermost
metadata:
name: mattermost-gitlab
spec:
size: 100users
ingress:
enabled: true
host: "mattermost.example.tld"
tlsSecret: mattermost-tls
annotations: {}
version: 9.8.0
image: mattermost/mattermost-team-edition
licenseSecret: ""
database:
disableReadinessCheck: true
external:
secret: mm-postgres-connection
fileStore:
external:
url: gitlab-minio-svc:9000
bucket: mattermost-data
secret: gitlab-minio-secret
imagePullPolicy: IfNotPresent
mattermostEnv:
- name: MM_GITLABSETTINGS_ENABLE
value: "true"
- name: MM_GITLABSETTINGS_SECRET
value: "<gitlab_mattermost_oauth_secret>"
- name: MM_GITLABSETTINGS_ID
value: "<gitlab_mattermost_oauth_application_id>"
- name: MM_GITLABSETTINGS_SCOPE
value: ""
- name: MM_GITLABSETTINGS_AUTHENDPOINT
value: "https://gitlab.example.tld/oauth/authorize"
- name: MM_GITLABSETTINGS_TOKENENDPOINT
value: "https://gitlab.example.tld/oauth/token"
- name: MM_GITLABSETTINGS_USERAPIENDPOINT
value: "https://gitlab.example.tld/api/v4/user"
- name: MM_FILESETTINGS_AMAZONS3SSL
value: "false"
podExtensions:
initContainers:
- name: bootstrap-database
image: "postgres:13"
imagePullPolicy: IfNotPresent
env:
- name: POSTGRES_PASSWORD_GITLAB
valueFrom:
secretKeyRef:
name: gitlab-postgresql-password
key: postgresql-password
- name: POSTGRES_USER_GITLAB
value: gitlab
- name: POSTGRES_HOST_GITLAB
value: gitlab-postgresql
- name: POSTGRES_PORT_GITLAB
value: "5432"
- name: POSTGRES_DB_NAME_MATTERMOST
value: mattermost-db
command:
- sh
- "-c"
- |
if PGPASSWORD=$POSTGRES_PASSWORD_GITLAB psql -h $POSTGRES_HOST_GITLAB -p $POSTGRES_PORT_GITLAB -U $POSTGRES_USER_GITLAB -lqt | cut -d \| -f 1 | grep -qw $POSTGRES_DB_NAME_MATTERMOST; then
echo "database already exist, exiting initContainer"
exit 0
else
echo "Database does not exist. creating...."
PGPASSWORD=$POSTGRES_PASSWORD_GITLAB createdb -h $POSTGRES_HOST_GITLAB -p $POSTGRES_PORT_GITLAB -U $POSTGRES_USER_GITLAB $POSTGRES_DB_NAME_MATTERMOST
echo "Done"
fi
- name: create-minio-bucket
image: "minio/mc:latest"
imagePullPolicy: IfNotPresent
env:
- name: MINIO_ENDPOINT
value: gitlab-minio-svc
- name: MINIO_PORT
value: "9000"
- name: MINIO_ACCESS_KEY
valueFrom:
secretKeyRef:
name: gitlab-minio-secret
key: accesskey
- name: MINIO_SECRET_KEY
valueFrom:
secretKeyRef:
name: gitlab-minio-secret
key: secretkey
- name: MATTERMOST_BUCKET_NAME
value: mattermost-data
command:
- sh
- "-c"
- |
echo "Connecting to Minio server: http://$MINIO_ENDPOINT:$MINIO_PORT"
/usr/bin/mc config host add myminio http://$MINIO_ENDPOINT:$MINIO_PORT $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
/usr/bin/mc ls myminio
echo $?
/usr/bin/mc ls myminio/$MATTERMOST_BUCKET_NAME > /dev/null 2>&1
if [ $? -eq 1 ] ; then
echo "Creating bucket '$MATTERMOST_BUCKET_NAME'"
/usr/bin/mc mb myminio/$MATTERMOST_BUCKET_NAME
else
echo "Bucket '$MATTERMOST_BUCKET_NAME' already exists."
exit 0
fi
Summary
Document how to deploy Mattermost operator in conjunction with Gitlab (selfhosted) operator
Steps to reproduce
Attempt to deploy Mattermost operator with Gitlab operator in Kubernetes, search documentation only this page has information with both using helm charts
Expected behavior
Documentation explains how to deploy Mattermost with Gitlab operator
Observed behavior (that appears unintentional)
I had to figure it out, wasn't very difficult from having experience using Gitlab and Mattermost with helm charts but new users may have trouble.
Possible fixes
Add documentation
Example follows: