From ba3b3d8081a4cb366ebbd0fe81739e871ce8a574 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Wed, 19 Sep 2018 21:09:28 +0200 Subject: [PATCH] [stable/mattemost-team-edition] Add initial charts for Mattermost Team Edition (#5987) * Add initial charts for Mattermost Team Edition Signed-off-by: cpanato * update based on feedback Signed-off-by: cpanato * update dependencies Signed-off-by: cpanato --- stable/mattermost-team-edition/.helmignore | 24 ++ stable/mattermost-team-edition/Chart.yaml | 19 ++ stable/mattermost-team-edition/OWNERS | 6 + stable/mattermost-team-edition/README.md | 120 +++++++++ .../ci/default-values.yaml | 6 + .../mattermost-team-edition/requirements.lock | 6 + .../mattermost-team-edition/requirements.yaml | 5 + .../templates/NOTES.txt | 27 ++ .../templates/_helpers.tpl | 32 +++ .../templates/config.tpl | 234 ++++++++++++++++++ .../templates/configmap-config.yaml | 12 + .../templates/deployment.yaml | 76 ++++++ .../templates/ingress.yaml | 39 +++ .../templates/pvc.yaml | 28 +++ .../templates/service.yaml | 19 ++ .../tests/mattermost-config-test.yaml | 14 ++ .../templates/tests/mattermost-test.yaml | 42 ++++ stable/mattermost-team-edition/values.yaml | 113 +++++++++ 18 files changed, 822 insertions(+) create mode 100644 stable/mattermost-team-edition/.helmignore create mode 100644 stable/mattermost-team-edition/Chart.yaml create mode 100644 stable/mattermost-team-edition/OWNERS create mode 100644 stable/mattermost-team-edition/README.md create mode 100644 stable/mattermost-team-edition/ci/default-values.yaml create mode 100644 stable/mattermost-team-edition/requirements.lock create mode 100644 stable/mattermost-team-edition/requirements.yaml create mode 100644 stable/mattermost-team-edition/templates/NOTES.txt create mode 100644 stable/mattermost-team-edition/templates/_helpers.tpl create mode 100644 stable/mattermost-team-edition/templates/config.tpl create mode 100644 stable/mattermost-team-edition/templates/configmap-config.yaml create mode 100644 stable/mattermost-team-edition/templates/deployment.yaml create mode 100644 stable/mattermost-team-edition/templates/ingress.yaml create mode 100644 stable/mattermost-team-edition/templates/pvc.yaml create mode 100644 stable/mattermost-team-edition/templates/service.yaml create mode 100644 stable/mattermost-team-edition/templates/tests/mattermost-config-test.yaml create mode 100644 stable/mattermost-team-edition/templates/tests/mattermost-test.yaml create mode 100644 stable/mattermost-team-edition/values.yaml diff --git a/stable/mattermost-team-edition/.helmignore b/stable/mattermost-team-edition/.helmignore new file mode 100644 index 000000000000..a34fb98b2f7c --- /dev/null +++ b/stable/mattermost-team-edition/.helmignore @@ -0,0 +1,24 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj + +# OWNERS file for Kubernetes +OWNERS diff --git a/stable/mattermost-team-edition/Chart.yaml b/stable/mattermost-team-edition/Chart.yaml new file mode 100644 index 000000000000..10ab59c76b11 --- /dev/null +++ b/stable/mattermost-team-edition/Chart.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +description: Mattermost Team Edition server. +name: mattermost-team-edition +version: 1.0.0 +appVersion: 5.2.1 +keywords: +- mattermost +- communication +- team collaboration +home: https://mattermost.com +icon: http://www.mattermost.org/wp-content/uploads/2016/04/icon.png +source: +- https://github.com/mattermost/mattermost-server +- https://github.com/mattermost/mattermost-kubernetes +maintainers: + - name: cpanato + email: carlos@mattermost.com + - name: jwilander + email: joram@mattermost.com diff --git a/stable/mattermost-team-edition/OWNERS b/stable/mattermost-team-edition/OWNERS new file mode 100644 index 000000000000..1c3f39f778fb --- /dev/null +++ b/stable/mattermost-team-edition/OWNERS @@ -0,0 +1,6 @@ +approvers: +- cpanato +- jwilander +reviewers: +- cpanato +- jwilander diff --git a/stable/mattermost-team-edition/README.md b/stable/mattermost-team-edition/README.md new file mode 100644 index 000000000000..46e12b27e6e0 --- /dev/null +++ b/stable/mattermost-team-edition/README.md @@ -0,0 +1,120 @@ +# Mattermost Team Edition + +[Mattermost](https://mattermost.com/) is a hybrid cloud enterprise messaging workspace that brings your messaging and tools together to get more done, faster. + +## TL;DR; + +```bash +$ helm install stable/mattermost-team-edition \ + --set mysql.mysqlUser=sampleUser \ + --set mysql.mysqlPassword=samplePassword \ +``` + +## Introduction + +This chart creates a [Mattermost Team Edition](https://mattermost.com/)deployment on a [Kubernetes](http://kubernetes.io) +cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.8+ with Beta APIs enabled + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```bash +$ helm install --name my-release stable/mattermost-team-edition +``` + +The command deploys Mattermost on the Kubernetes cluster in the default configuration. The [configuration](#configuration) +section lists the parameters that can be configured during installation. + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```bash +$ helm delete my-release +``` +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following table lists the configurable parameters of the Mattermost Team Edition chart and their default values. + +Parameter | Description | Default +--- | --- | --- +`image.repository` | container image repository | `mattermost/mattermost-team-edition` +`image.tag` | container image tag | `5.2.1` +`config.SiteUrl` | The URL that users will use to access Mattermost. ie `https://mattermost.mycompany.com` | `` +`config.SiteName` | Name of service shown in login screens and UI | `Mattermost` +`config.FilesAccessKey` | The AWS Access Key, if you want store the files on S3 | `` +`config.FilesSecretKey` | The AWS Secret Key | `` +`config.FileBucketName` | The S3 bucket name | `` +`config.SMTPHost` | Location of SMTP email server | `` +`config.SMTPPort` | Port of SMTP email server | `` +`config.SMTPUsername` | The username for authenticating to the SMTP server | `` +`config.SMTPPassword` | The password associated with the SMTP username | `` +`config.FeedbackEmail` | Address displayed on email account used when sending notification emails from Mattermost system | `` +`config.FeedbackName` | Name displayed on email account used when sending notification emails from Mattermost system | `` +`ingress.enabled` | if `true`, an ingress is created | `false` +`ingress.hosts` | a list of ingress hosts | `[mattermost.example.com]` +`ingress.tls` | a list of [IngressTLS](https://v1-8.docs.kubernetes.io/docs/api-reference/v1.8/#ingresstls-v1beta1-extensions) items | `[]` +`mysql.mysqlRootPassword` | Root Password for Mysql (Opcional) | "" +`mysql.mysqlUser` | Username for Mysql (Required) | "" +`mysql.mysqlPassword` | User Password for Mysql (Required) | "" +`mysql.mysqlDatabase` | Database name (Required) | "mattermost" + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```bash +$ helm install --name my-release \ + --set image.tag=release-5.2.1 \ + --set mysql.mysqlUser=sampleUser \ + --set mysql.mysqlPassword=samplePassword \ + stable/mattermost-team-edition +``` + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```bash +$ helm install --name my-release -f values.yaml stable/mattermost-team-edition +``` + +### External Databases +There is an option to use external database services (PostgreSQL or MySQL) for your Mattermost installation. +If you use an external Database you will need to disable the MySQL chart in the `values.yaml` + +```Bash +mysql: + enabled: false +``` + +#### PostgreSQL +To use an external **PostgreSQL**, You need to set Mattermost **externalDB** config + +**IMPORTANT:** Make sure the DB is already created before deploying Mattermost services + +```Bash +externalDB: + enabled: true + externalDriverType: "postgres" + externalConnectionString: "postgres://:@:5432/?sslmode=disable&connect_timeout=10" +``` + +#### MySQL +To use an external **MySQL**, You need to set Mattermost **externalDB** config + +**IMPORTANT:** Make sure the DB is already created before deploying Mattermost services + +```Bash +externalDB: + enabled: true + externalDriverType: "mysql" + externalConnectionString: ":@tcp(:3306)/?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s" +``` + +#### Limitations + +For the Team Edition you can have just one replica running. diff --git a/stable/mattermost-team-edition/ci/default-values.yaml b/stable/mattermost-team-edition/ci/default-values.yaml new file mode 100644 index 000000000000..4fcfa8a5e77a --- /dev/null +++ b/stable/mattermost-team-edition/ci/default-values.yaml @@ -0,0 +1,6 @@ +mysql: + enabled: true + mysqlRootPassword: "rootpassord" + mysqlUser: "mmuser" + mysqlPassword: "mmpassword" + mysqlDatabase: mattermost \ No newline at end of file diff --git a/stable/mattermost-team-edition/requirements.lock b/stable/mattermost-team-edition/requirements.lock new file mode 100644 index 000000000000..e50995ed2337 --- /dev/null +++ b/stable/mattermost-team-edition/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: mysql + repository: https://kubernetes-charts.storage.googleapis.com + version: 0.10.1 +digest: sha256:be368592f2a1722d1b90e6881e2d381b47d674d1f76c50ed85b27cfb00dcda35 +generated: 2018-09-14T14:08:32.750548865+02:00 diff --git a/stable/mattermost-team-edition/requirements.yaml b/stable/mattermost-team-edition/requirements.yaml new file mode 100644 index 000000000000..7bd448a43b50 --- /dev/null +++ b/stable/mattermost-team-edition/requirements.yaml @@ -0,0 +1,5 @@ +dependencies: +- name: mysql + version: 0.10.1 + repository: https://kubernetes-charts.storage.googleapis.com + condition: mysql.enabled diff --git a/stable/mattermost-team-edition/templates/NOTES.txt b/stable/mattermost-team-edition/templates/NOTES.txt new file mode 100644 index 000000000000..2dfeded5d180 --- /dev/null +++ b/stable/mattermost-team-edition/templates/NOTES.txt @@ -0,0 +1,27 @@ +You can easily connect to the remote instance from your browser. Forward the webserver port to localhost:8065 + +- kubectl port-forward --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "mattermost-team-edition.fullname" . }},release={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }') 8080:8065 + +{{ if .Values.ingress.enabled }} + +Mattermost will be available at the URL, if you setup the nginx-ingress or other type of ingress: + +{{ if .Values.ingress.tls }} +{{ range .Values.ingress.hosts }} + https://{{ . }} +{{ end }} + +{{ else }} + +{{ range .Values.ingress.hosts }} + http://{{ . }} +{{ end }} + +{{ end }} + +{{ else }} + +To expose Mattermost via an Ingress you need to set host and enable ingress. + +helm install --set host=mattermost.yourdomain.com --set ingress.enabled=true stable/mattermost-team-edition +{{ end }} diff --git a/stable/mattermost-team-edition/templates/_helpers.tpl b/stable/mattermost-team-edition/templates/_helpers.tpl new file mode 100644 index 000000000000..45975a058ae8 --- /dev/null +++ b/stable/mattermost-team-edition/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "mattermost-team-edition.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "mattermost-team-edition.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "mattermost-team-edition.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/stable/mattermost-team-edition/templates/config.tpl b/stable/mattermost-team-edition/templates/config.tpl new file mode 100644 index 000000000000..5228178af653 --- /dev/null +++ b/stable/mattermost-team-edition/templates/config.tpl @@ -0,0 +1,234 @@ +{{ define "config.tpl" }} +{ + "ServiceSettings": { + "SiteURL": {{ .Values.config.siteUrl | default "" | quote }}, + "LicenseFileLocation": "", + "ListenAddress": ":8065", + "ConnectionSecurity": "", + "TLSCertFile": "", + "TLSKeyFile": "", + "UseLetsEncrypt": false, + "LetsEncryptCertificateCacheFile": "./config/letsencrypt.cache", + "Forward80To443": false, + "ReadTimeout": 300, + "WriteTimeout": 300, + "MaximumLoginAttempts": 10, + "GoroutineHealthThreshold": -1, + "GoogleDeveloperKey": "", + "EnableOAuthServiceProvider": false, + "EnableIncomingWebhooks": true, + "EnableOutgoingWebhooks": true, + "EnableCommands": true, + "EnableOnlyAdminIntegrations": false, + "EnablePostUsernameOverride": false, + "EnablePostIconOverride": false, + "EnableLinkPreviews": false, + "EnableTesting": false, + "EnableDeveloper": false, + "EnableSecurityFixAlert": true, + "EnableInsecureOutgoingConnections": false, + "EnableMultifactorAuthentication": false, + "EnforceMultifactorAuthentication": false, + "AllowCorsFrom": "", + "SessionLengthWebInDays": 30, + "SessionLengthMobileInDays": 30, + "SessionLengthSSOInDays": 30, + "SessionCacheInMinutes": 10, + "WebsocketSecurePort": 443, + "WebsocketPort": 80, + "WebserverMode": "gzip", + "EnableCustomEmoji": false, + "RestrictCustomEmojiCreation": "all", + "RestrictPostDelete": "all", + "AllowEditPost": "always", + "PostEditTimeLimit": 300, + "TimeBetweenUserTypingUpdatesMilliseconds": 5000, + "EnablePostSearch": true, + "EnableUserTypingMessages": true, + "EnableUserStatuses": true, + "ClusterLogTimeoutMilliseconds": 2000 + }, + "TeamSettings": { + "SiteName": {{ .Values.config.siteName | default "Mattermost" | quote }}, + "MaxUsersPerTeam": 50000, + "EnableTeamCreation": true, + "EnableUserCreation": true, + "EnableOpenServer": true, + "RestrictCreationToDomains": "", + "EnableCustomBrand": false, + "CustomBrandText": "", + "CustomDescriptionText": "", + "RestrictDirectMessage": "any", + "RestrictTeamInvite": "all", + "RestrictPublicChannelManagement": "all", + "RestrictPrivateChannelManagement": "all", + "RestrictPublicChannelCreation": "all", + "RestrictPrivateChannelCreation": "all", + "RestrictPublicChannelDeletion": "all", + "RestrictPrivateChannelDeletion": "all", + "RestrictPrivateChannelManageMembers": "all", + "UserStatusAwayTimeout": 300, + "MaxChannelsPerTeam": 50000, + "MaxNotificationsPerChannel": 1000 + }, + "SqlSettings": { + {{ if .Values.externalDB.enabled }} + "DriverName": "{{ .Values.externalDB.externalDriverType }}", + "DataSource": "{{ .Values.externalDB.externalConnectionString }}", + {{ else }} + "DriverName": "mysql", + "DataSource": "{{ .Values.mysql.mysqlUser }}:{{ .Values.mysql.mysqlPassword }}@tcp({{ .Release.Name }}-mysql:3306)/{{ .Values.mysql.mysqlDatabase }}?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s", + {{ end }} + "DataSourceReplicas": [], + "DataSourceSearchReplicas": [], + "MaxIdleConns": 20, + "MaxOpenConns": 35, + "Trace": false, + "AtRestEncryptKey": "{{ randAlphaNum 32 }}", + "QueryTimeout": 30 + }, + "LogSettings": { + "EnableConsole": true, + "ConsoleLevel": "INFO", + "EnableFile": true, + "FileLevel": "INFO", + "FileFormat": "", + "FileLocation": "", + "EnableWebhookDebugging": true, + "EnableDiagnostics": true + }, + "PasswordSettings": { + "MinimumLength": 5, + "Lowercase": false, + "Number": false, + "Uppercase": false, + "Symbol": false + }, + "FileSettings": { + "EnableFileAttachments": true, + "MaxFileSize": 52428800, + {{ if .Values.config.filesAccessKey }} + "DriverName": "amazons3", + {{ else }} + "DriverName": "local", + {{ end }} + "Directory": "./data/", + "EnablePublicLink": false, + "PublicLinkSalt": "{{ randAlphaNum 32 }}", + "ThumbnailWidth": 120, + "ThumbnailHeight": 100, + "PreviewWidth": 1024, + "PreviewHeight": 0, + "ProfileWidth": 128, + "ProfileHeight": 128, + "InitialFont": "luximbi.ttf", + "AmazonS3AccessKeyId": {{ .Values.config.filesAccessKey | default "" | quote }}, + "AmazonS3SecretAccessKey": {{ .Values.config.filesSecretKey | default "" | quote }}, + "AmazonS3Bucket": {{ .Values.config.fileBucketName | default "" | quote }}, + "AmazonS3Region": "", + "AmazonS3Endpoint": "s3.amazonaws.com", + "AmazonS3SSL": false, + "AmazonS3SignV2": false + }, + "EmailSettings": { + "EnableSignUpWithEmail": true, + "EnableSignInWithEmail": true, + "EnableSignInWithUsername": true, + {{ if .Values.config.smtpServer }} + "SendEmailNotifications": true, + {{ else }} + "SendEmailNotifications": false, + {{ end }} + "RequireEmailVerification": false, + "FeedbackName": {{ .Values.config.feedbackName | default "" | quote }}, + "FeedbackEmail": {{ .Values.config.feedbackEmail | default "" | quote }}, + "FeedbackOrganization": "", + "SMTPUsername": {{ .Values.config.smtpUsername | default "" | quote }}, + "SMTPPassword": {{ .Values.config.smtpPassword | default "" | quote }}, + {{ if and .Values.config.smtpUsername .Values.config.smtpPassword }} + "EnableSMTPAuth": true, + {{ else }} + "EnableSMTPAuth": false, + {{ end }} + "SMTPServer": {{ .Values.config.smtpServer | default "" | quote }}, + "SMTPPort": {{ .Values.config.smtpPort | default "" | quote }}, + "ConnectionSecurity": {{ .Values.config.smtpConnection | default "" | quote }}, + "InviteSalt": "{{ randAlphaNum 32 }}", + "SendPushNotifications": true, + "PushNotificationServer": "https://push.mattermost.com", + "PushNotificationContents": "generic", + "EnableEmailBatching": false, + "EmailBatchingBufferSize": 256, + "EmailBatchingInterval": 30, + "SkipServerCertificateVerification": false + }, + "RateLimitSettings": { + "Enable": false, + "PerSec": 10, + "MaxBurst": 100, + "MemoryStoreSize": 10000, + "VaryByRemoteAddr": true, + "VaryByHeader": "" + }, + "PrivacySettings": { + "ShowEmailAddress": true, + "ShowFullName": true + }, + "SupportSettings": { + "TermsOfServiceLink": "https://about.mattermost.com/default-terms/", + "PrivacyPolicyLink": "https://about.mattermost.com/default-privacy-policy/", + "AboutLink": "https://about.mattermost.com/default-about/", + "HelpLink": "https://about.mattermost.com/default-help/", + "ReportAProblemLink": "https://about.mattermost.com/default-report-a-problem/", + "SupportEmail": "feedback@mattermost.com" + }, + "AnnouncementSettings": { + "EnableBanner": false, + "BannerText": "", + "BannerColor": "#f2a93b", + "BannerTextColor": "#333333", + "AllowBannerDismissal": true + }, +{{ if .Values.auth.gitlab }} + "GitLabSettings": {{ .Values.auth.gitlab | toJson }}, +{{ end }} + "LocalizationSettings": { + "DefaultServerLocale": "en", + "DefaultClientLocale": "en", + "AvailableLocales": "" + }, + "NativeAppSettings": { + "AppDownloadLink": "https://about.mattermost.com/downloads/", + "AndroidAppDownloadLink": "https://about.mattermost.com/mattermost-android-app/", + "IosAppDownloadLink": "https://about.mattermost.com/mattermost-ios-app/" + }, + "AnalyticsSettings": { + "MaxUsersForStatistics": 2500 + }, + "WebrtcSettings": { + "Enable": false, + "GatewayWebsocketUrl": "", + "GatewayAdminUrl": "", + "GatewayAdminSecret": "", + "StunURI": "", + "TurnURI": "", + "TurnUsername": "", + "TurnSharedKey": "" + }, + "DisplaySettings": { + "CustomUrlSchemes": [], + "ExperimentalTimezone": true + }, + "TimezoneSettings": { + "SupportedTimezonesPath": "timezones.json" + }, + "PluginSettings": { + "Enable": true, + "EnableUploads": true, + "Directory": "./plugins", + "ClientDirectory": "./client/plugins", + "Plugins": {}, + "PluginStates": {} + } +} +{{ end }} diff --git a/stable/mattermost-team-edition/templates/configmap-config.yaml b/stable/mattermost-team-edition/templates/configmap-config.yaml new file mode 100644 index 000000000000..9b1a254b2697 --- /dev/null +++ b/stable/mattermost-team-edition/templates/configmap-config.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "mattermost-team-edition.fullname" . }}-config-json + labels: + chart: {{ template "mattermost-team-edition.chart" . }} + app: {{ template "mattermost-team-edition.fullname" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: + config.json: | +{{ include "config.tpl" . | printf "%s" | indent 4 }} diff --git a/stable/mattermost-team-edition/templates/deployment.yaml b/stable/mattermost-team-edition/templates/deployment.yaml new file mode 100644 index 000000000000..bd905a7b72df --- /dev/null +++ b/stable/mattermost-team-edition/templates/deployment.yaml @@ -0,0 +1,76 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ template "mattermost-team-edition.fullname" . }} + labels: + chart: {{ template "mattermost-team-edition.chart" . }} + app: {{ template "mattermost-team-edition.fullname" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ template "mattermost-team-edition.fullname" . }} + release: {{ .Release.Name }} + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/config.tpl") . | sha256sum }} + labels: + app: {{ template "mattermost-team-edition.fullname" . }} + release: {{ .Release.Name }} + chart: {{ template "mattermost-team-edition.chart" . }} + heritage: {{ .Release.Service }} + spec: + {{ if not .Values.externalDB.enabled }} + initContainers: + - name: "init-mysql" + image: "appropriate/curl:latest" + imagePullPolicy: "IfNotPresent" + command: ["sh", "-c", "until curl --max-time 5 http://{{ .Release.Name }}-mysql:3306; do echo waiting for {{ .Release.Name }}-mysql; sleep 5; done;"] + {{ end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.imagePullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + initialDelaySeconds: 90 + timeoutSeconds: 5 + periodSeconds: 15 + httpGet: + path: /api/v4/system/ping + port: {{ .Values.service.internalPort }} + readinessProbe: + initialDelaySeconds: 15 + timeoutSeconds: 5 + periodSeconds: 15 + httpGet: + path: /api/v4/system/ping + port: {{ .Values.service.internalPort }} + volumeMounts: + - mountPath: /mattermost/config/config.json + name: config-json + subPath: config.json + - mountPath: /mattermost/data + name: mattermost-data + resources: +{{ toYaml .Values.resources | indent 12 }} + volumes: + - name: config-json + configMap: + name: {{ template "mattermost-team-edition.fullname" . }}-config-json + items: + - key: config.json + path: config.json + - name: mattermost-data + {{ if .Values.persistence.data.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "mattermost-team-edition.fullname" .) }} + {{ else }} + emptyDir: {} + {{ end }} diff --git a/stable/mattermost-team-edition/templates/ingress.yaml b/stable/mattermost-team-edition/templates/ingress.yaml new file mode 100644 index 000000000000..b0b312d44116 --- /dev/null +++ b/stable/mattermost-team-edition/templates/ingress.yaml @@ -0,0 +1,39 @@ +{{ $ingress := .Values.ingress }} +{{ if $ingress.enabled }} +{{ $serviceName := include "mattermost-team-edition.name" . }} +{{ $servicePort := .Values.service.externalPort }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "mattermost-team-edition.fullname" . }} + labels: + chart: {{ template "mattermost-team-edition.chart" . }} + app: {{ template "mattermost-team-edition.fullname" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: +{{ if .Values.ingress.tls }} + nginx.ingress.kubernetes.io/ssl-redirect: "true" + kubernetes.io/tls-acme: "true" +{{ else }} + nginx.ingress.kubernetes.io/ssl-redirect: "false" +{{ end }} +{{ with $ingress.annotations }} +{{ toYaml . | indent 4 }} +{{ end }} +spec: + rules: + {{ range $host := $ingress.hosts }} + - host: {{ $host }} + http: + paths: + - path: {{ $ingress.path }} + backend: + serviceName: {{ $serviceName }} + servicePort: {{ $servicePort }} + {{ end }} + {{ if $ingress.tls }} + tls: +{{ toYaml $ingress.tls | indent 4 }} + {{ end }} +{{ end }} diff --git a/stable/mattermost-team-edition/templates/pvc.yaml b/stable/mattermost-team-edition/templates/pvc.yaml new file mode 100644 index 000000000000..a67b922a6940 --- /dev/null +++ b/stable/mattermost-team-edition/templates/pvc.yaml @@ -0,0 +1,28 @@ +{{ if and .Values.persistence.data.enabled (not .Values.persistence.data.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "mattermost-team-edition.fullname" . }} + labels: + chart: {{ template "mattermost-team-edition.chart" . }} + app: {{ template "mattermost-team-edition.fullname" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + {{ range $key, $value := .Values.persistence.data.annotations }} + {{ $key }}: {{ $value | quote }} + {{ end }} +spec: + accessModes: + - {{ .Values.persistence.data.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.data.size | quote }} +{{ if .Values.persistence.data.storageClass }} +{{ if (eq "-" .Values.persistence.data.storageClass) }} + storageClassName: "" +{{ else }} + storageClassName: "{{ .Values.persistence.data.storageClass }}" +{{ end }} +{{ end }} +{{ end }} diff --git a/stable/mattermost-team-edition/templates/service.yaml b/stable/mattermost-team-edition/templates/service.yaml new file mode 100644 index 000000000000..62583dbb7104 --- /dev/null +++ b/stable/mattermost-team-edition/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "mattermost-team-edition.name" . }} + labels: + chart: {{ template "mattermost-team-edition.chart" . }} + app: {{ template "mattermost-team-edition.fullname" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + selector: + app: {{ template "mattermost-team-edition.fullname" . }} + release: {{ .Release.Name }} + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + protocol: TCP + name: {{ template "mattermost-team-edition.name" . }} diff --git a/stable/mattermost-team-edition/templates/tests/mattermost-config-test.yaml b/stable/mattermost-team-edition/templates/tests/mattermost-config-test.yaml new file mode 100644 index 000000000000..e965a778f1a0 --- /dev/null +++ b/stable/mattermost-team-edition/templates/tests/mattermost-config-test.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "mattermost-team-edition.fullname" . }}-tests + labels: + chart: {{ template "mattermost-team-edition.chart" . }} + app: {{ template "mattermost-team-edition.fullname" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: + run.sh: |- + @test "Testing Mattermost is accessible" { + curl --retry 48 --retry-delay 10 {{ template "mattermost-team-edition.name" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.internalPort }} + } diff --git a/stable/mattermost-team-edition/templates/tests/mattermost-test.yaml b/stable/mattermost-team-edition/templates/tests/mattermost-test.yaml new file mode 100644 index 000000000000..4cf545a1e3e5 --- /dev/null +++ b/stable/mattermost-team-edition/templates/tests/mattermost-test.yaml @@ -0,0 +1,42 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ template "mattermost-team-edition.fullname" . }}-test-{{ randAlphaNum 5 | lower }}" + labels: + chart: {{ template "mattermost-team-edition.chart" . }} + app: {{ template "mattermost-team-edition.fullname" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + "helm.sh/hook": test-success +spec: + initContainers: + - name: "test-framework" + image: "dduportal/bats:0.4.0" + command: + - "bash" + - "-c" + - | + set -ex + # copy bats to tools dir + cp -R /usr/local/libexec/ /tools/bats/ + volumeMounts: + - mountPath: /tools + name: tools + containers: + - name: {{ .Release.Name }}-test + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + command: ["/tools/bats/bats", "-t", "/tests/run.sh"] + volumeMounts: + - mountPath: /tests + name: tests + readOnly: true + - mountPath: /tools + name: tools + volumes: + - name: tests + configMap: + name: {{ template "mattermost-team-edition.fullname" . }}-tests + - name: tools + emptyDir: {} + restartPolicy: Never diff --git a/stable/mattermost-team-edition/values.yaml b/stable/mattermost-team-edition/values.yaml new file mode 100644 index 000000000000..8c2dd2ae2f03 --- /dev/null +++ b/stable/mattermost-team-edition/values.yaml @@ -0,0 +1,113 @@ +# Default values for mattermost-team-edition. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +image: + repository: mattermost/mattermost-team-edition + tag: 5.2.1 + imagePullPolicy: IfNotPresent + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## ref: https://docs.gitlab.com/ee/install/requirements.html#storage +## +persistence: + ## This volume persists generated data from users, like images, attachments... + ## + data: + enabled: true + size: 10Gi + ## If defined, volume.beta.kubernetes.io/storage-class: + ## Default: volume.alpha.kubernetes.io/storage-class: default + ## + # storageClass: + accessMode: ReadWriteOnce + # existingClaim: "" + +# Mattermost configuration: +config: + siteUrl: "http://mattermost.example.com" + siteName: "Mattermost" + filesAccessKey: + filesSecretKey: + fileBucketName: + smtpServer: + smtpPort: + # empty, TLS, or STARTTLS + smtpConnection: + smtpUsername: + smtpPassword: + feedbackEmail: + feedbackName: + +service: + type: ClusterIP + externalPort: 8065 + internalPort: 8065 + +ingress: + enabled: false + path: / + annotations: + # kubernetes.io/ingress.class: nginx + # nginx.ingress.kubernetes.io/proxy-body-size: 50m + # nginx.ingress.kubernetes.io/proxy-send-timeout: "600" + # nginx.ingress.kubernetes.io/proxy-read-timeout: "600" + # nginx.ingress.kubernetes.io/proxy-buffering: "on" + # nginx.ingress.kubernetes.io/configuration-snippet: | + # proxy_cache mattermost_cache; + # proxy_cache_revalidate on; + # proxy_cache_min_uses 2; + # proxy_cache_use_stale timeout; + # proxy_cache_lock on; + #### To use the nginx cache you will need to set an http-snippet in the ingress-nginx configmap + #### http-snippet: | + #### proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off; + + + hosts: + - mattermost.example.com + tls: + # - secretName: mattermost.example.com-tls + # hosts: + # - mattermost.example.com + +auth: + gitlab: + # Enable: "false" + # Secret: "" + # Id: "" + # Scope: "" + # AuthEndpoint: + # TokenEndpoint: + # UserApiEndpoint: + +## If use this please disable the mysql chart, setting the config mysql.enable to false +externalDB: + enabled: false + # externalDriverType: "postgres" #or mysql + # externalConnectionString: "postgres://:@:5432/?sslmode=disable&connect_timeout=10" + # for mysql: ":@tcp(:3306)/?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s" + +mysql: + enabled: true + mysqlRootPassword: "" + mysqlUser: "" + mysqlPassword: "" + mysqlDatabase: mattermost + + repository: mysql + tag: 5.7 + imagePullPolicy: IfNotPresent + + persistence: + enabled: true + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + storageClass: "" + accessMode: ReadWriteOnce + size: 10Gi + # existingClaim: ""