diff --git a/stable/mattermost-team-edition/Chart.yaml b/stable/mattermost-team-edition/Chart.yaml index 345829cb53..76e2adae6f 100644 --- a/stable/mattermost-team-edition/Chart.yaml +++ b/stable/mattermost-team-edition/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Mattermost Team Edition server. name: mattermost-team-edition -version: 2.3.0 +version: 3.0.0 appVersion: 5.8.0 keywords: - mattermost diff --git a/stable/mattermost-team-edition/README.md b/stable/mattermost-team-edition/README.md index 82d40ce727..282d4ced68 100644 --- a/stable/mattermost-team-edition/README.md +++ b/stable/mattermost-team-edition/README.md @@ -30,6 +30,14 @@ $ 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. +## Upgrading the Chart to 3.0.0+ + +Breaking Helm chart changes was introduced with version 3.0.0. The easiest +method of resolving them is to simply upgrade the chart and let it fail with and +provide you with a custom message on what you need to change in your +configuration. Note that this failure will occur before any changes have been +made to the k8s cluster. + ## Uninstalling the Chart To uninstall/delete the `my-release` deployment: @@ -43,36 +51,29 @@ The command removes all the Kubernetes components associated with the chart and 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.8.0` -`image.imagePullPolicy` | container image pull policy | `IfNotPresent` -`initContainerImage.repository` | init container image repository | `appropriate/curl` -`initContainerImage.tag` | init container image tag | `latest` -`initContainerImage.imagePullPolicy` | container image pull policy | `IfNotPresent` -`revisionHistoryLimit` | How many old ReplicaSets for Mattermost Deployment you want to retain | `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 | `` -`config.enableSignUpWithEmail` | Allow team creation and account signup using email and password. | `true` -`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" -`extraEnvVars` | Extra environments variables to be used in the deployments | -`extraInitContainers` | Additional init containers. Passed through the `tpl` function | `` +Parameter | Description | Default +--- | --- | --- +`configJSON` | The `config.json` configuration to be used by the mattermost server. The values you provide will by using Helm's merging behavior override individual default values only. See the [example configuration](#example-configuration) and the [Mattermost documentation](https://docs.mattermost.com/administration/config-settings.html) for details. | See `configJSON` in [values.yaml](https://github.com/helm/charts/blob/master/stable/mattermost-team-edition/values.yaml) +`image.repository` | Container image repository | `mattermost/mattermost-team-edition` +`image.tag` | Container image tag | `5.8.0` +`image.imagePullPolicy` | Container image pull policy | `IfNotPresent` +`initContainerImage.repository` | Init container image repository | `appropriate/curl` +`initContainerImage.tag` | Init container image tag | `latest` +`initContainerImage.imagePullPolicy` | Container image pull policy | `IfNotPresent` +`revisionHistoryLimit` | How many old ReplicaSets for Mattermost Deployment you want to retain | `1` +`ingress.enabled` | If `true`, an ingress is created | `false` +`ingress.hosts` | A list of ingress hosts | `[mattermost.example.com]` +`ingress.tls` | A list of [ingress tls](https://kubernetes.io/docs/concepts/services-networking/ingress/#tls) items | `[]` +`mysql.enabled` | Enables deployment of a mysql server | `true` +`mysql.mysqlRootPassword` | Root Password for Mysql (Optional) | "" +`mysql.mysqlUser` | Username for Mysql (Required) | "" +`mysql.mysqlPassword` | User Password for Mysql (Required) | "" +`mysql.mysqlDatabase` | Database name (Required) | "mattermost" +`externalDB.enabled` | Enables use of an preconfigured external database server | `false` +`externalDB.externalDriverType` | `"postgres"` or `"mysql"` | "" +`externalDB.externalConnectionString` | See the section about [external databases](#External-Databases). | "" +`extraEnvVars` | Extra environments variables to be used in the deployments | `[]` +`extraInitContainers` | Additional init containers | `[]` Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, @@ -90,6 +91,24 @@ Alternatively, a YAML file that specifies the values for the parameters can be p $ helm install --name my-release -f values.yaml stable/mattermost-team-edition ``` +### Example configuration + +A basic example of a `.yaml` file with values that could be passed to the `helm` +command with the `-f` or `--values` flag to get started. + +```yaml +ingress: + enabled: true + hosts: + - mattermost.example.com + +configJSON: + ServiceSettings: + SiteURL: "https://mattermost.example.com" + TeamSettings: + SiteName: "Mattermost on Example.com" +``` + ### 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` diff --git a/stable/mattermost-team-edition/ci/extra-values.yaml b/stable/mattermost-team-edition/ci/extra-values.yaml index 7f9859e530..6584a2aa33 100644 --- a/stable/mattermost-team-edition/ci/extra-values.yaml +++ b/stable/mattermost-team-edition/ci/extra-values.yaml @@ -9,7 +9,7 @@ extraEnvVars: - name: TEST_SAMPLE value: blablabal -extraInitContainers: | +extraInitContainers: - name: test-init image: busybox imagePullPolicy: IfNotPresent diff --git a/stable/mattermost-team-edition/templates/NOTES.txt b/stable/mattermost-team-edition/templates/NOTES.txt index 35fba34c6b..4d662d0993 100644 --- a/stable/mattermost-team-edition/templates/NOTES.txt +++ b/stable/mattermost-team-edition/templates/NOTES.txt @@ -1,6 +1,6 @@ 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.kubernetes.io/name={{ include "mattermost-team-edition.name" . }},release={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }') 8080:8065 +- kubectl port-forward --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "mattermost-team-edition.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }') 8080:8065 {{ if .Values.ingress.enabled }} @@ -25,3 +25,7 @@ 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 }} + +{{ include "mattermost.warnings" . }} + +{{ include "mattermost.deprecations" . }} diff --git a/stable/mattermost-team-edition/templates/_deprecations.tpl b/stable/mattermost-team-edition/templates/_deprecations.tpl new file mode 100644 index 0000000000..46a6f27955 --- /dev/null +++ b/stable/mattermost-team-edition/templates/_deprecations.tpl @@ -0,0 +1,151 @@ +{{- /* +A template for handling deprecation messages. The messages templated here will +be combined into a single `fail` call. This creates a means for the user to +receive all messages at one time, in place a frustrating iterative approach. + +To add a deprecation: + +1. Define a new template prefixed `mattermost.deprecate.` +2. Check for deprecated values / patterns, and directly output messages (see + message format below) +3. Add a line to `mattermost.deprecations` to include the new template. + +Message format: + +``` +deprecatedHelmConfig.option is deprecated, please use the following configuration instead... + +newHelmConfig: + option: + {{- .Values.deprecatedHelmConfig.option | toYaml | nindent 4 }} +``` +*/}} + +{{- /* +Compile all deprecations into a single message, and call fail. +*/}} + +{{- define "mattermost.deprecations" }} +{{- $depHeader := print "\n\nFAILURE DUE TO DEPRECATIONS:\n----------------------------" }} +{{- $depMessage := "" }} + +{{- /* +deprecations in order to transition to a passthrough configuration in configJSON +*/}} +{{- $passthroughs := list }} +{{- $passthroughs := append $passthroughs (include "mattermost.deprecate.auth.gitlab" .) }} +{{- $passthroughs := append $passthroughs (include "mattermost.deprecate.config.siteUrl" .) }} +{{- $passthroughs := append $passthroughs (include "mattermost.deprecate.config.siteName" .) }} +{{- $passthroughs := append $passthroughs (include "mattermost.deprecate.config.fileSettings" .) }} +{{- $passthroughs := append $passthroughs (include "mattermost.deprecate.config.emailSettings" .) }} +{{- $passthroughs := without $passthroughs "" }} +{{- if $passthroughs }} +{{- $passthroughsHeader := print "\n\nconfigJSON:" }} +{{- $passthroughsMessage := print $passthroughsHeader (join "\n" $passthroughs) }} +{{- $depMessage := print $depMessage $passthroughsMessage }}} +{{- end }} + +{{- if typeIs "string" .Values.extraInitContainers }} +{{- $stringToListMessage := print "\n\nPlease make extraInitContainers a list instead of a string.\nGot a '|' symbol after extraInitContainers? Remove it." }} +{{- $depMessage := print $depMessage $stringToListMessage }} +{{- end }} + +{{- /* print output */}} +{{- if $depMessage }} +{{- printf $depMessage | fail }} +{{- end }} +{{- end }} + + + +{{- /* Deprecate auth.gitlab */}} +{{- define "mattermost.deprecate.auth.gitlab" }} +{{- if typeIs "map[string]interface {}" .Values.auth }} +{{- if typeIs "map[string]interface {}" .Values.auth.gitlab }} + # auth.gitlab is deprecated, instead use: + GitLabSettings: + {{- .Values.auth.gitlab | toYaml | nindent 4 }} +{{- end }} +{{- end }} +{{- end }} + +{{- /* Deprecate config.siteUrl */}} +{{- define "mattermost.deprecate.config.siteUrl" }} +{{- if typeIs "map[string]interface {}" .Values.config }} +{{- if .Values.config.siteUrl }} + # config.siteUrl is deprecated, instead use: + ServiceSettings: + SiteURL: {{ .Values.config.siteUrl | quote }} +{{- end }} +{{- end }} +{{- end }} + +{{- /* Deprecate config.siteName */}} +{{- define "mattermost.deprecate.config.siteName" }} +{{- if typeIs "map[string]interface {}" .Values.config }} +{{- if .Values.config.siteName }} + # config.siteName is deprecated, instead use: + TeamSettings: + SiteName: {{ .Values.config.siteName | quote }} +{{- end }} +{{- end }} +{{- end }} + +{{- /* Deprecate config.fileSettings */}} +{{- define "mattermost.deprecate.config.fileSettings" }} +{{- if typeIs "map[string]interface {}" .Values.config }} +{{- $FileSettings := dict }} +{{- if or .Values.config.filesAccessKey (or .Values.config.filesSecretKey .Values.config.fileBucketName) }} +{{- $_ := set $FileSettings "DriverName" "amazons3" }} +{{- $_ := set $FileSettings "AmazonS3AccessKeyId" (.Values.config.filesAccessKey | default "") }} +{{- $_ := set $FileSettings "AmazonS3SecretAccessKey" (.Values.config.filesSecretKey | default "") }} +{{- $_ := set $FileSettings "AmazonS3Bucket" (.Values.config.fileBucketName | default "") }} + # config.fileSecretKey, + # config.fileAccessKey, + # config.fileBucketName, + # are all deprecated, instead use: + FileSettings: + {{- $FileSettings | toYaml | nindent 4 }} +{{- end }} +{{- end }} +{{- end }} + +{{- /* Deprecate config.emailSettings */}} +{{- define "mattermost.deprecate.config.emailSettings" }} +{{- if typeIs "map[string]interface {}" .Values.config }} +{{- if or .Values.config.smtpServer (or (hasKey .Values.config "enableSignUpWithEmail") (or .Values.config.feedbackName .Values.config.feedbackEmail)) }} +{{- $EmailSettings := dict }} +{{- if .Values.config.smtpServer }} +{{- $_ := set $EmailSettings "SendEmailNotifications" true }} +{{- else }} +{{- $_ := set $EmailSettings "SendEmailNotifications" false }} +{{- end }} +{{- $_ := set $EmailSettings "EnableSignUpWithEmail" (.Values.config.enableSignUpWithEmail | default true) }} +{{- $_ := set $EmailSettings "FeedbackName" (.Values.config.feedbackName | default "") }} +{{- $_ := set $EmailSettings "FeedbackEmail" (.Values.config.feedbackEmail | default "") }} +{{- $_ := set $EmailSettings "SMTPUsername" (.Values.config.smtpUsername | default "") }} +{{- $_ := set $EmailSettings "SMTPPassword" (.Values.config.smtpPassword | default "") }} +{{- if and .Values.config.smtpUsername .Values.config.smtpPassword }} +{{- $_ := set $EmailSettings "EnableSMTPAuth" true }} +{{- else }} +{{- $_ := set $EmailSettings "EnableSMTPAuth" false }} +{{- end }} +{{- $_ := set $EmailSettings "SMTPServer" (.Values.config.smtpServer | default "") }} +{{- $_ := set $EmailSettings "SMTPPort" (.Values.config.smtpPort | default "") }} +{{- $_ := set $EmailSettings "ConnectionSecurity" (.Values.config.smtpConnection | default "") }} + # config.enableSignUpWithEmail, + # config.feedbackName, + # config.feedbackEmail, + # config.smtpUsername, + # config.smtpPassword, + # config.smtpUsername, + # config.smtpPassword, + # config.smtpServer, + # config.smtpPort, + # config.smtpConnection, + # are all deprecated, instead use: + EmailSettings: + {{- $EmailSettings | toYaml | nindent 4 }} +{{- end }} +{{- end }} +{{- end }} diff --git a/stable/mattermost-team-edition/templates/_warnings.tpl b/stable/mattermost-team-edition/templates/_warnings.tpl new file mode 100644 index 0000000000..687f628f77 --- /dev/null +++ b/stable/mattermost-team-edition/templates/_warnings.tpl @@ -0,0 +1,29 @@ +{{- /* +A template for handling warning messages. +*/}} + +{{- /* Warn about not setting salt and keys explicitly */}} +{{- define "mattermost.warnings" }} +{{- with .Values.configJSON }} +{{- if not (and (.EmailSettings.InviteSalt) (and .FileSettings.PublicLinkSalt .SqlSettings.AtRestEncryptKey)) }} +WARNING: +-------- + +Every `helm upgrade` will generate a new set of keys unless it is set manually like this: + +configJSON: + {{- if not .EmailSettings.InviteSalt }} + EmailSettings: + InviteSalt: {{ randAlphaNum 32 }} + {{- end }} + {{- if not .FileSettings.PublicLinkSalt }} + FileSettings: + PublicLinkSalt: {{ randAlphaNum 32 }} + {{- end }} + {{- if not .SqlSettings.AtRestEncryptKey }} + SqlSettings: + AtRestEncryptKey: {{ randAlphaNum 32 }} + {{- end }} +{{- end }} +{{- end }} +{{- end }} diff --git a/stable/mattermost-team-edition/templates/config.tpl b/stable/mattermost-team-edition/templates/config.tpl deleted file mode 100644 index ebff087282..0000000000 --- a/stable/mattermost-team-edition/templates/config.tpl +++ /dev/null @@ -1,234 +0,0 @@ -{{ 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": {{ .Values.config.enableSignUpWithEmail }}, - "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-test.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 deleted file mode 100644 index 5c29dfc178..0000000000 --- a/stable/mattermost-team-edition/templates/configmap-config.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "mattermost-team-edition.fullname" . }}-config-json - labels: - app.kubernetes.io/name: {{ include "mattermost-team-edition.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - helm.sh/chart: {{ include "mattermost-team-edition.chart" . }} -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 index a94c2d05a8..f0ef68fdd7 100644 --- a/stable/mattermost-team-edition/templates/deployment.yaml +++ b/stable/mattermost-team-edition/templates/deployment.yaml @@ -21,7 +21,7 @@ spec: template: metadata: annotations: - checksum/config: {{ include (print $.Template.BasePath "/configmap-config.yaml") . | sha256sum }} + checksum/config: {{ include (print $.Template.BasePath "/secret-config.yaml") . | sha256sum }} labels: app.kubernetes.io/name: {{ include "mattermost-team-edition.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} @@ -36,7 +36,7 @@ spec: command: ["sh", "-c", "until curl --max-time 5 http://{{ .Release.Name }}-mysql:3306; do echo waiting for {{ .Release.Name }}-mysql; sleep 5; done;"] {{- end }} {{- if .Values.extraInitContainers }} -{{ tpl .Values.extraInitContainers . | indent 6 }} + {{- .Values.extraInitContainers | toYaml | nindent 6 }} {{- end }} containers: - name: {{ .Chart.Name }} @@ -44,11 +44,11 @@ spec: imagePullPolicy: {{ .Values.image.imagePullPolicy }} env: {{- if .Values.extraEnvVars }} -{{ toYaml .Values.extraEnvVars | indent 10 }} + {{- .Values.extraEnvVars | toYaml | nindent 10 }} {{- end }} ports: - name: http - containerPort: 80 + containerPort: {{ .Values.service.internalPort }} protocol: TCP livenessProbe: initialDelaySeconds: 90 @@ -56,14 +56,14 @@ spec: periodSeconds: 15 httpGet: path: /api/v4/system/ping - port: {{ .Values.service.internalPort }} + port: http readinessProbe: initialDelaySeconds: 15 timeoutSeconds: 5 periodSeconds: 15 httpGet: path: /api/v4/system/ping - port: {{ .Values.service.internalPort }} + port: http volumeMounts: - mountPath: /mattermost/config/config.json name: config-json @@ -71,14 +71,11 @@ spec: - mountPath: /mattermost/data name: mattermost-data resources: -{{ toYaml .Values.resources | indent 12 }} + {{- .Values.resources | toYaml | nindent 12 }} volumes: - name: config-json - configMap: - name: {{ include "mattermost-team-edition.fullname" . }}-config-json - items: - - key: config.json - path: config.json + secret: + secretName: {{ include "mattermost-team-edition.fullname" . }}-config-json - name: mattermost-data {{ if .Values.persistence.data.enabled }} persistentVolumeClaim: diff --git a/stable/mattermost-team-edition/templates/ingress.yaml b/stable/mattermost-team-edition/templates/ingress.yaml index 1a01afe985..54357bdec5 100644 --- a/stable/mattermost-team-edition/templates/ingress.yaml +++ b/stable/mattermost-team-edition/templates/ingress.yaml @@ -12,15 +12,15 @@ metadata: app.kubernetes.io/managed-by: {{ .Release.Service }} helm.sh/chart: {{ include "mattermost-team-edition.chart" . }} annotations: -{{ if .Values.ingress.tls }} + {{- if .Values.ingress.tls }} nginx.ingress.kubernetes.io/ssl-redirect: "true" kubernetes.io/tls-acme: "true" -{{ else }} + {{- else }} nginx.ingress.kubernetes.io/ssl-redirect: "false" -{{ end }} -{{ with $ingress.annotations }} -{{ toYaml . | indent 4 }} -{{ end }} + {{- end }} + {{- with $ingress.annotations }} + {{- . | toYaml | nindent 4 }} + {{- end }} spec: rules: {{ range $host := $ingress.hosts }} @@ -34,6 +34,6 @@ spec: {{ end }} {{ if $ingress.tls }} tls: -{{ toYaml $ingress.tls | indent 4 }} + {{- $ingress.tls | toYaml | nindent 4 }} {{ end }} {{ end }} diff --git a/stable/mattermost-team-edition/templates/pvc.yaml b/stable/mattermost-team-edition/templates/pvc.yaml index 50bb5e7e87..8dd705aacb 100644 --- a/stable/mattermost-team-edition/templates/pvc.yaml +++ b/stable/mattermost-team-edition/templates/pvc.yaml @@ -1,4 +1,4 @@ -{{ if and .Values.persistence.data.enabled (not .Values.persistence.data.existingClaim) }} +{{- if and .Values.persistence.data.enabled (not .Values.persistence.data.existingClaim) -}} kind: PersistentVolumeClaim apiVersion: v1 metadata: @@ -9,20 +9,20 @@ metadata: app.kubernetes.io/managed-by: {{ .Release.Service }} helm.sh/chart: {{ include "mattermost-team-edition.chart" . }} annotations: - {{ range $key, $value := .Values.persistence.data.annotations }} + {{- range $key, $value := .Values.persistence.data.annotations }} {{ $key }}: {{ $value | quote }} - {{ end }} + {{- 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) }} +{{- if .Values.persistence.data.storageClass }} +{{- if (eq "-" .Values.persistence.data.storageClass) }} storageClassName: "" -{{ else }} +{{- else }} storageClassName: "{{ .Values.persistence.data.storageClass }}" -{{ end }} -{{ end }} -{{ end }} +{{- end }} +{{- end }} +{{- end }} diff --git a/stable/mattermost-team-edition/templates/secret-config.yaml b/stable/mattermost-team-edition/templates/secret-config.yaml new file mode 100644 index 0000000000..c22d867eec --- /dev/null +++ b/stable/mattermost-team-edition/templates/secret-config.yaml @@ -0,0 +1,40 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "mattermost-team-edition.fullname" . }}-config-json + labels: + app.kubernetes.io/name: {{ include "mattermost-team-edition.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + helm.sh/chart: {{ include "mattermost-team-edition.chart" . }} +type: Opaque +data: + {{- /* Make a deep enough copy of the default config */}} + {{- $c := dict }} + {{- range $key, $dictVal := .Values.configJSON }} + {{- $dictCopy := merge (dict) $dictVal }} + {{- $_ := set $c $key $dictCopy }} + {{- end }} + + {{- /* Update the copied default config based on .Values */}} + + {{- if or .Values.configJSON.SqlSettings.DriverName .Values.configJSON.SqlSettings.DataSource }} + {{- $message := "Use 'mysql' or 'externalDB' to instead of using a configuration with:\n\nconfigJSON:\n SqlSettings\n DriverName: ...\n DataSource: ..." }} + {{- print "\n\nDIRECT CONFIGURATION NOT SUPPORTED:\n-----------------------------------\n\n" $message | fail }} + {{- end }} + + {{- if .Values.externalDB.enabled }} + {{- $_ := set $c.SqlSettings "DriverName" (.Values.externalDB.externalDriverType) }} + {{- $_ := set $c.SqlSettings "DataSource" (.Values.externalDB.externalConnectionString) }} + {{- else }} + {{- $_ := set $c.SqlSettings "DriverName" "mysql" }} + {{- $_ := set $c.SqlSettings "DataSource" (print .Values.mysql.mysqlUser ":" .Values.mysql.mysqlPassword "@tcp(" .Release.Name "-mysql:3306)/" .Values.mysql.mysqlDatabase "?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s") }} + {{- end }} + + {{- $_ := set $c.SqlSettings "AtRestEncryptKey" (.Values.configJSON.SqlSettings.AtRestEncryptKey | default (randAlphaNum 32)) }} + {{- $_ := set $c.FileSettings "PublicLinkSalt" (.Values.configJSON.FileSettings.PublicLinkSalt | default (randAlphaNum 32)) }} + {{- $_ := set $c.EmailSettings "InviteSalt" (.Values.configJSON.EmailSettings.InviteSalt | default (randAlphaNum 32)) }} + + {{- /* Render the processed config as a JSON string */}} + {{- /* NOTE: Mounted at /mattermost/config/config.json on the mattermost pod */}} + config.json: {{ $c | toJson | b64enc }} diff --git a/stable/mattermost-team-edition/templates/service.yaml b/stable/mattermost-team-edition/templates/service.yaml index a4e8e8434c..08f061b3bd 100644 --- a/stable/mattermost-team-edition/templates/service.yaml +++ b/stable/mattermost-team-edition/templates/service.yaml @@ -15,6 +15,6 @@ spec: type: {{ .Values.service.type }} ports: - port: {{ .Values.service.externalPort }} - targetPort: {{ .Values.service.internalPort }} + targetPort: http protocol: TCP name: {{ include "mattermost-team-edition.name" . }} diff --git a/stable/mattermost-team-edition/values.yaml b/stable/mattermost-team-edition/values.yaml index ffcc274299..e434dd8b6f 100644 --- a/stable/mattermost-team-edition/values.yaml +++ b/stable/mattermost-team-edition/values.yaml @@ -31,23 +31,6 @@ persistence: accessMode: ReadWriteOnce # existingClaim: "" -# Mattermost configuration: -config: - siteUrl: "" - siteName: "Mattermost" - filesAccessKey: - filesSecretKey: - fileBucketName: - smtpServer: - smtpPort: - # empty, TLS, or STARTTLS - smtpConnection: - smtpUsername: - smtpPassword: - feedbackEmail: - feedbackName: - enableSignUpWithEmail: true - service: type: ClusterIP externalPort: 8065 @@ -56,7 +39,7 @@ service: ingress: enabled: false path: / - annotations: + annotations: {} # kubernetes.io/ingress.class: nginx # certmanager.k8s.io/issuer: your-issuer # nginx.ingress.kubernetes.io/proxy-body-size: 50m @@ -79,28 +62,17 @@ ingress: # 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 +## If use this please disable the mysql chart by setting 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" - # When using existingUser and ExistingSecret (for example when configuring to use MM with Gitlab helm charts) you will need to - # define a initContainer to read those configs and create the database in the existing gitlab and set the config.json - # See the initContainer example below - # existingUser: gitlab - # existingSecret: "gitlab-postgresql-password" + ## postgres or mysql + externalDriverType: "" + + ## postgres: "postgres://:@:5432/?sslmode=disable&connect_timeout=10" + ## mysql: ":@tcp(:3306)/?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s" + externalConnectionString: "" mysql: enabled: true @@ -127,11 +99,13 @@ mysql: # existingClaim: "" ## Additional env vars -extraEnvVars: +extraEnvVars: [] # This is an example of extra env vars when using with the deployment with GitLab Helm Charts # - name: POSTGRES_PASSWORD_GITLAB # valueFrom: # secretKeyRef: + # # NOTE: Needs to be manually created + # # kubectl create secret generic gitlab-postgresql-password --namespace --from-literal postgres-password= # name: gitlab-postgresql-password # key: postgres-password # - name: POSTGRES_USER_GITLAB @@ -148,8 +122,8 @@ extraEnvVars: # value: postgres://$(POSTGRES_USER_GITLAB):$(POSTGRES_PASSWORD_GITLAB)@$(POSTGRES_HOST_GITLAB):$(POSTGRES_PORT_GITLAB)/$(POSTGRES_DB_NAME_MATTERMOST)?sslmode=disable&connect_timeout=10 ## Additional init containers -extraInitContainers: | -# This is an example of extra Init Container when using with the deployment with GitLab Helm Charts +extraInitContainers: [] + # This is an example of extra Init Container when using with the deployment with GitLab Helm Charts # - name: bootstrap-database # image: "postgres:9.6-alpine" # imagePullPolicy: IfNotPresent @@ -179,3 +153,231 @@ extraInitContainers: | # PGPASSWORD=$POSTGRES_PASSWORD_GITLAB createdb -h $POSTGRES_HOST_GITLAB -p $POSTGRES_PORT_GITLAB -U $POSTGRES_USER_GITLAB $POSTGRES_DB_NAME_MATTERMOST # echo "Done" # fi + +# NOTE: These acts as the default values for the config.json file read by the +# mattermost server itself. You can override the configJSON object just like any +# Helm template value. Since it is an object, the object you provide will merge +# with these defaults. Also note that this is YAML, so you can choose to use +# either JSON or YAML as JSON is a subset of YAML. No matter what you choose, +# the config.json file that will be generated will be correctly JSON formatted. +configJSON: { + "ServiceSettings": { + "SiteURL": "", + "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": "Mattermost", + "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": { + "DriverName": "", + "DataSource": "", + "DataSourceReplicas": [], + "DataSourceSearchReplicas": [], + "MaxIdleConns": 20, + "MaxOpenConns": 35, + "Trace": false, + "AtRestEncryptKey": "", + "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, + "DriverName": "local", + "Directory": "./data/", + "EnablePublicLink": false, + "PublicLinkSalt": "", + "ThumbnailWidth": 120, + "ThumbnailHeight": 100, + "PreviewWidth": 1024, + "PreviewHeight": 0, + "ProfileWidth": 128, + "ProfileHeight": 128, + "InitialFont": "luximbi.ttf", + "AmazonS3AccessKeyId": "", + "AmazonS3SecretAccessKey": "", + "AmazonS3Bucket": "", + "AmazonS3Region": "", + "AmazonS3Endpoint": "s3.amazonaws.com", + "AmazonS3SSL": false, + "AmazonS3SignV2": false + }, + "EmailSettings": { + "EnableSignUpWithEmail": true, + "EnableSignInWithEmail": true, + "EnableSignInWithUsername": true, + "SendEmailNotifications": false, + "RequireEmailVerification": false, + "FeedbackName": "", + "FeedbackEmail": "", + "FeedbackOrganization": "", + "SMTPUsername": "", + "SMTPPassword": "", + "EnableSMTPAuth": "", + "SMTPServer": "", + "SMTPPort": "", + "ConnectionSecurity": "", + "InviteSalt": "", + "SendPushNotifications": true, + "PushNotificationServer": "https://push-test.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 + }, + "GitLabSettings": { + "Enable": false, + "Secret": "", + "Id": "", + "Scope": "", + "AuthEndpoint": "", + "TokenEndpoint": "", + "UserApiEndpoint": "" + }, + "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": {} + } +}