[stable/redmine] Redmine mail receive (#19449)

* [stable/redmine] adds configurable health checks

Signed-off-by: Dmitrii Ermakov <demonihin@gmail.com>
Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] adds newline to values.yaml

Signed-off-by: Dmitrii Ermakov <demonihin@gmail.com>
Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] sets description to common format

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] documents probes parameters

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] version increase

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] Increments version

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] Implemented RedmineReceivingEmails

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] Increased chart version

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] Lint fixed "No new line character"

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] Update stable/redmine/templates/secrets.yaml

Co-Authored-By: Sameer Naik <sameer@fuloi.com>

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] Fixed wrong ordered list syntax

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] Removed extra newline

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] Removed extra newlines

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] Use bitnami/redmine image for receveiving

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] Increased version number

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] Increased version number

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] Fixed image name, tag

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] label changes on v14.0.0

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] version increment

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] fixed "no newline at the end of file"

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] mailReceiver labels fix  app.kubernetes.io/name: fullname => name

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>

* [stable/redmine] set arrays 2-space indent

Signed-off-by: Dmitriy Ermakov <demonihin@gmail.com>
This commit is contained in:
Dmitrii Ermakov
2020-01-02 02:41:39 -08:00
committed by Kubernetes Prow Robot
co-authored by Sameer Naik
parent 05fa81bf2f
commit cab71e2f3b
7 changed files with 615 additions and 82 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: redmine
version: 14.0.1
version: 14.1.1
appVersion: 4.0.5
description: A flexible project management web application.
keywords:
+110 -81
View File
@@ -57,88 +57,117 @@ helm install --name my-release stable/redmine --set databaseType=postgresql
The following table lists the configurable parameters of the Redmine chart and their default values.
| Parameter | Description | Default |
| ------------------------------------ | -------------------------------------------------------------------------- | ------------------------------------------------------- |
| `global.imageRegistry` | Global Docker image registr y | `nil` |
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `global.storageClass` | Global storage class for dynamic provisioning | `nil` |
| `image.registry` | Redmine image registry | `docker.io` |
| `image.repository` | Redmine image name | `bitnami/redmine` |
| `image.tag` | Redmine image tag | `{TAG_NAME}` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `nameOverride` | String to partially override redmine.fullname template | `nil` |
| `fullnameOverride` | String to fully override redmine.fullname template | `nil` |
| `redmineUsername` | User of the application | `user` |
| `redminePassword` | Application password | _random 10 character long alphanumeric string_ |
| `redmineEmail` | Admin email | `user@example.com` |
| `redmineLanguage` | Redmine default data language | `en` |
| `extraVars` | Environment variables, passed to redmine | `nil` |
| `smtpHost` | SMTP host | `nil` |
| `smtpPort` | SMTP port | `nil` |
| `smtpUser` | SMTP user | `nil` |
| `smtpPassword` | SMTP password | `nil` |
| `smtpTls` | Use TLS encryption with SMTP | `nil` |
| Parameter | Description | Default |
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| `global.imageRegistry` | Global Docker image registr y | `nil` |
| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `global.storageClass` | Global storage class for dynamic provisioning | `nil` |
| `image.registry` | Redmine image registry | `docker.io` |
| `image.repository` | Redmine image name | `bitnami/redmine` |
| `image.tag` | Redmine image tag | `{TAG_NAME}` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) |
| `nameOverride` | String to partially override redmine.fullname template | `nil` |
| `fullnameOverride` | String to fully override redmine.fullname template | `nil` |
| `redmineUsername` | User of the application | `user` |
| `redminePassword` | Application password | _random 10 character long alphanumeric string_ |
| `redmineEmail` | Admin email | `user@example.com` |
| `redmineLanguage` | Redmine default data language | `en` |
| `extraVars` | Environment variables, passed to redmine | `nil` |
| `smtpHost` | SMTP host | `nil` |
| `smtpPort` | SMTP port | `nil` |
| `smtpUser` | SMTP user | `nil` |
| `smtpPassword` | SMTP password | `nil` |
| `smtpTls` | Use TLS encryption with SMTP | `nil` |
| `existingSecret` | Use existing secret for password details (`redminePassword`, `smtpPassword` and `externalDatabase.password` will be ignored and picked up from this secret). It must contain the keys `redmine-password` and `smtp-password` when `postgresql.enabled=true` or `mariadb.enabled=true`. In case `postgresql.enabled=false` and `mariadb.enabled=false` it must contain the key `external-db-password` | `nil` |
| `databaseType` | Select database type | `mariadb` (allowed values: "mariadb" and "postgresql") |
| `mariadb.enabled` | Whether to deploy a MariaDB server to satisfy the database requirements | `true` |
| `mariadb.rootUser.password` | MariaDB admin password | `nil` |
| `postgresql.enabled` | Whether to deploy a PostgreSQL server to satisfy the database requirements | `false` |
| `postgresql.postgresqlDatabase` | PostgreSQL database | `bitnami_redmine` |
| `postgresql.postgresqlUsername` | PostgreSQL user | `bn_redmine` |
| `postgresql.postgresqlPassword` | PostgreSQL password | `nil` |
| `externalDatabase.host` | Host of the external database | `localhost` |
| `externalDatabase.name` | Name of the external database | `localhost` |
| `externalDatabase.user` | External db user | `user` |
| `externalDatabase.password` | Password for the db user | `""` |
| `externalDatabase.port` | Database port number | `3306` |
| `service.type` | Kubernetes Service type | `LoadBalancer` |
| `service.port` | Service HTTP port | `80` |
| `service.nodePorts.http` | Kubernetes http node port | `""` |
| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` |
| `service.loadBalancerIP` | LoadBalancer service IP address | `""` |
| `service.loadBalancerSourceRanges` | An array of load balancer sources | `0.0.0.0/0` |
| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `false` |
| `serviceAccount.name` | The name of the ServiceAccount to create | Generated using the `redmine.fullname` macro |
| `ingress.enabled` | Enable ingress controller resource | `false` |
| `ingress.certManager` | Add annotations for cert-manager | `false` |
| `ingress.hostname` | Default host for the ingress resource | `redmine.local` |
| `ingress.tls` | Enable TLS configuration | `false` |
| `ingress.annotations` | Ingress annotations | `{}` |
| `ingress.extraHosts[0].name` | Extra hosts for your Redmine installation | `nil` |
| `ingress.extraHosts[0].path` | Path within the url structure | `nil` |
| `ingress.extraTls[0].hosts[0]` | Extra TLS hosts | `nil` |
| `ingress.extraTls[0].secretName` | TLS Secret (certificates) for extra TLS hosts | `nil` |
| `ingress.secrets[0].name` | TLS Secret Name | `nil` |
| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` |
| `ingress.secrets[0].key` | TLS Secret Key | `nil` |
| `nodeSelector` | Node labels for pod assignment | `{}` (The value is evaluated as a template) |
| `tolerations` | List of node taints to tolerate | `[]` (The value is evaluated as a template) |
| `affinity` | Map of node/pod affinities | `{}` (The value is evaluated as a template) |
| `podAnnotations` | Pod annotations | `{}` |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.existingClaim` | The name of an existing PVC | `nil` |
| `persistence.storageClass` | PVC Storage Class | `nil` (uses alpha storage class annotation) |
| `persistence.accessMode` | PVC Access Mode | `ReadWriteOnce` |
| `persistence.size` | PVC Storage Request | `8Gi` |
| `podDisruptionBudget.enabled` | Pod Disruption Budget toggle | `false` |
| `podDisruptionBudget.minAvailable` | Minimum available pods | `nil` |
| `podDisruptionBudget.maxUnavailable` | Maximum unavailable pods | `nil` |
| `replicas` | The number of pod replicas | `1` |
| `resources` | Resources allocation (Requests and Limits) | `{}` |
| `securityContext` | SecurityContext | `{}` |
| `livenessProbe.enabled` | would you like a livenessProbe to be enabled | `true` |
| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 300 |
| `livenessProbe.periodSeconds` | How often to perform the probe | 10 |
| `livenessProbe.timeoutSeconds` | When the probe times out | 5 |
| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe | 1 |
| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe | 3 |
| `readinessProbe.enabled` | would you like a readinessProbe to be enabled | `true` |
| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | 5 |
| `readinessProbe.periodSeconds` | How often to perform the probe | 10 |
| `readinessProbe.timeoutSeconds` | When the probe times out | 1 |
| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe | 1 |
| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe | 3 |
| `databaseType` | Select database type | `mariadb` (allowed values: "mariadb" and "postgresql") |
| `mariadb.enabled` | Whether to deploy a MariaDB server to satisfy the database requirements | `true` |
| `mariadb.rootUser.password` | MariaDB admin password | `nil` |
| `postgresql.enabled` | Whether to deploy a PostgreSQL server to satisfy the database requirements | `false` |
| `postgresql.postgresqlDatabase` | PostgreSQL database | `bitnami_redmine` |
| `postgresql.postgresqlUsername` | PostgreSQL user | `bn_redmine` |
| `postgresql.postgresqlPassword` | PostgreSQL password | `nil` |
| `externalDatabase.host` | Host of the external database | `localhost` |
| `externalDatabase.name` | Name of the external database | `localhost` |
| `externalDatabase.user` | External db user | `user` |
| `externalDatabase.password` | Password for the db user | `""` |
| `externalDatabase.port` | Database port number | `3306` |
| `service.type` | Kubernetes Service type | `LoadBalancer` |
| `service.port` | Service HTTP port | `80` |
| `service.nodePorts.http` | Kubernetes http node port | `""` |
| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` |
| `service.loadBalancerIP` | LoadBalancer service IP address | `""` |
| `service.loadBalancerSourceRanges` | An array of load balancer sources | `0.0.0.0/0` |
| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `false` |
| `serviceAccount.name` | The name of the ServiceAccount to create | Generated using the `redmine.fullname` macro |
| `ingress.enabled` | Enable ingress controller resource | `false` |
| `ingress.certManager` | Add annotations for cert-manager | `false` |
| `ingress.hostname` | Default host for the ingress resource | `redmine.local` |
| `ingress.tls` | Enable TLS configuration | `false` |
| `ingress.annotations` | Ingress annotations | `{}` |
| `ingress.extraHosts[0].name` | Extra hosts for your Redmine installation | `nil` |
| `ingress.extraHosts[0].path` | Path within the url structure | `nil` |
| `ingress.extraTls[0].hosts[0]` | Extra TLS hosts | `nil` |
| `ingress.extraTls[0].secretName` | TLS Secret (certificates) for extra TLS hosts | `nil` |
| `ingress.secrets[0].name` | TLS Secret Name | `nil` |
| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` |
| `ingress.secrets[0].key` | TLS Secret Key | `nil` |
| `nodeSelector` | Node labels for pod assignment | `{}` (The value is evaluated as a template) |
| `tolerations` | List of node taints to tolerate | `[]` (The value is evaluated as a template) |
| `affinity` | Map of node/pod affinities | `{}` (The value is evaluated as a template) |
| `podAnnotations` | Pod annotations | `{}` |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.existingClaim` | The name of an existing PVC | `nil` |
| `persistence.storageClass` | PVC Storage Class | `nil` (uses alpha storage class annotation) |
| `persistence.accessMode` | PVC Access Mode | `ReadWriteOnce` |
| `persistence.size` | PVC Storage Request | `8Gi` |
| `podDisruptionBudget.enabled` | Pod Disruption Budget toggle | `false` |
| `podDisruptionBudget.minAvailable` | Minimum available pods | `nil` |
| `podDisruptionBudget.maxUnavailable` | Maximum unavailable pods | `nil` |
| `replicas` | The number of pod replicas | `1` |
| `resources` | Resources allocation (Requests and Limits) | `{}` |
| `securityContext` | SecurityContext | `{}` |
| `livenessProbe.enabled` | would you like a livenessProbe to be enabled | `true` |
| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 300 |
| `livenessProbe.periodSeconds` | How often to perform the probe | 10 |
| `livenessProbe.timeoutSeconds` | When the probe times out | 5 |
| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe | 1 |
| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe | 3 |
| `readinessProbe.enabled` | would you like a readinessProbe to be enabled | `true` |
| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | 5 |
| `readinessProbe.periodSeconds` | How often to perform the probe | 10 |
| `readinessProbe.timeoutSeconds` | When the probe times out | 1 |
| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe | 1 |
| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe | 3 |
| `mailReceiver.enabled` | Whether to enable scheduled mail-to-task CronJob | `false` |
| `mailReceiver.schedule` | Kubernetes CronJob schedule | `*/5 * * * *` |
| `mailReceiver.suspend` | Whether to create suspended CronJob | `true` |
| `mailReceiver.image.registry` | Mail to Task image registry | `docker.io` |
| `mailReceiver.image.repository` | Mail to Task image repository | `bitnami/redmine` |
| `mailReceiver.image.tag` | Mail to Task image tag | `4.0.5-debian-9-r28` |
| `mailReceiver.image.pullPolicy` | Mail to Task image pull policy | `IfNotPresent` |
| `mailReceiver.mailProtocol` | Mail protocol to use for reading emails: `IMAP` or `POP3` | `IMAP` |
| `mailReceiver.host` | Server to receive emails from | `""` |
| `mailReceiver.port` | TCP port on the `host` | `143` |
| `mailReceiver.username` | Login to authenticate on the `host` | `""` |
| `mailReceiver.password` | Password to authenticate on the `host` | `""` |
| `mailReceiver.ssl` | Whether use SSL/TLS to connect to the `host` | `true` |
| `mailReceiver.startTLS` | Whether use StartTLS to connect to the `host` | `false` |
| `mailReceiver.imapFolder` | IMAP only. Folder to read emails from | `INBOX` |
| `mailReceiver.moveOnsuccess` | IMAP only. Folder to move processed emails to | `""` |
| `mailReceiver.moveOnFailure` | IMAP only. Folder to move emails with processing errors to | `""` |
| `mailReceiver.unknownUserAction` | Action to perform is an email received from unregistered user | `ignore` |
| `mailReceiver.noPermissionCheck` | Whether skip permission check during creating a new task | `0` |
| `mailReceiver.noAccountNotice` | Whether send an email to an unregistered user created during a new task creation | `1` |
| `mailReceiver.defaultGroup` | Defines a group list to add created user to | `""` |
| `mailReceiver.project` | Defines identifier of the target project for a new task | `""` |
| `mailReceiver.projectFromSubaddress` | Defines email address to select project from subaddress | `""` |
| `mailReceiver.status` | Defines a new task status | `""` |
| `mailReceiver.tracker` | Defines a new task tracker | `""` |
| `mailReceiver.category` | Defines a new task category | `""` |
| `mailReceiver.priority` | Defines a new task priority | `""` |
| `mailReceiver.assignedTo` | Defines a new task priority | `""` |
| `mailReceiver.allowOverride` | Defines if email content is allowed to set attributes values. Values is a comma separated list of attributes or `all` to alllow all attributes | `""` |
The above parameters map to the env variables defined in [bitnami/redmine](http://github.com/bitnami/bitnami-docker-redmine). For more information please refer to the [bitnami/redmine](http://github.com/bitnami/bitnami-docker-redmine) image documentation.
+57
View File
@@ -196,3 +196,60 @@ Usage:
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
{{/*
Expand the name of the chart.
*/}}
{{- define "redmine.mailReceiver.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified mail receiver app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "redmine.mailReceiver.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-mail-receiver" .Release.Name $name | trunc 40 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Return the proper Redmine mail Receiver image name
*/}}
{{- define "redmine.mailReceiver.image" -}}
{{- $registryName := .Values.mailReceiver.image.registry -}}
{{- $repositoryName := .Values.mailReceiver.image.repository -}}
{{- $tag := .Values.mailReceiver.image.tag | toString -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
Also, we can't use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imageRegistry }}
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}
{{/*
Mail Receiver CronJob labels
*/}}
{{- define "redmine.mailReceiver.labels" -}}
app.kubernetes.io/name: {{ template "redmine.mailReceiver.name" . }}
helm.sh/chart: {{ template "redmine.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
+140
View File
@@ -0,0 +1,140 @@
{{- if .Values.mailReceiver.enabled }}
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ template "redmine.mailReceiver.fullname" . }}
labels: {{- include "redmine.mailReceiver.labels" . | nindent 4 }}
spec:
schedule: "{{ .Values.mailReceiver.schedule }}"
suspend: {{ .Values.mailReceiver.suspend }}
jobTemplate:
spec:
template:
metadata:
labels: {{- include "redmine.mailReceiver.labels" . | nindent 12 }}
spec:
volumes:
- name: mail-receiver
configMap:
name: {{ template "redmine.fullname" . }}
defaultMode: 0744
restartPolicy: Never
concurrencyPolicy: Forbid
imagePullPolicy: {{ .Values.mailReceiver.image.pullPolicy | quote }}
containers:
- name: {{ template "redmine.mailReceiver.fullname" . }}
image: {{ template "redmine.mailReceiver.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
command:
- bash
args:
- -c
- /cj/receive.sh
volumeMounts:
- name: mail-receiver
mountPath: /cj
resources:
{{ toYaml .Values.resources | indent 16 }}
env:
{{- if eq .Values.databaseType "mariadb" }}
- name: REDMINE_MAIL_RECEIVER_DB_MYSQL
{{- if .Values.mariadb.enabled }}
value: {{ template "redmine.mariadb.fullname" . }}
- name: REDMINE_MAIL_RECEIVER_DB_DATABASE
value: {{ .Values.mariadb.db.name | quote }}
- name: REDMINE_MAIL_RECEIVER_DB_USERNAME
value: {{ .Values.mariadb.db.user | quote }}
- name: REDMINE_MAIL_RECEIVER_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redmine.mariadb.fullname" . }}
key: mariadb-password
- name: REDMINE_MAIL_RECEIVER_DB_PORT
value: "3306"
{{- else }}
value: {{ .Values.externalDatabase.host | quote }}
{{- end }}
{{- else if eq .Values.databaseType "postgresql" }}
- name: REDMINE_MAIL_RECEIVER_DB_POSTGRES
{{- if .Values.postgresql.enabled }}
value: {{ template "redmine.postgresql.fullname" . }}
- name: REDMINE_MAIL_RECEIVER_DB_DATABASE
value: {{ .Values.postgresql.postgresqlDatabase | quote }}
- name: REDMINE_MAIL_RECEIVER_DB_USERNAME
value: {{ .Values.postgresql.postgresqlUsername | quote }}
- name: REDMINE_MAIL_RECEIVER_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redmine.postgresql.fullname" . }}
key: postgresql-password
- name: REDMINE_MAIL_RECEIVER_DB_PORT
value: "5432"
{{- else }}
value: {{ .Values.externalDatabase.host | quote }}
{{- end }}
{{- end }}
{{- if or (and (eq .Values.databaseType "mariadb") (not .Values.mariadb.enabled)) (and (eq .Values.databaseType "postgresql") (not .Values.postgresql.enabled)) }}
- name: REDMINE_MAIL_RECEIVER_DB_DATABASE
value: {{ .Values.externalDatabase.name | quote }}
- name: REDMINE_MAIL_RECEIVER_DB_USERNAME
value: {{ .Values.externalDatabase.user | quote }}
- name: REDMINE_MAIL_RECEIVER_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redmine.secretName" . }}
key: external-db-password
- name: REDMINE_MAIL_RECEIVER_DB_PORT
value: {{ .Values.externalDatabase.port | quote }}
{{- end }}
- name: REDMINE_MAIL_RECEIVER_HOST
value: {{ .Values.mailReceiver.host | quote }}
- name: REDMINE_MAIL_RECEIVER_PORT
value: {{ .Values.mailReceiver.port | quote }}
- name: REDMINE_MAIL_RECEIVER_USERNAME
value: {{ .Values.mailReceiver.username | quote }}
- name: REDMINE_MAIL_RECEIVER_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "redmine.secretName" . }}
key: mail-receiver-password
- name: REDMINE_MAIL_RECEIVER_USE_SSL
value: {{ .Values.mailReceiver.ssl | quote }}
- name: REDMINE_MAIL_RECEIVER_STARTTLS
value: {{ .Values.mailReceiver.startTLS | quote }}
- name: REDMINE_MAIL_RECEIVER_IMAP_FOLDER
value: {{ .Values.mailReceiver.imapFolder | quote }}
- name: REDMINE_MAIL_RECEIVER_IMAP_MOVE_ON_SUCCESS
value: {{ .Values.mailReceiver.moveOnSuccess | quote }}
- name: REDMINE_MAIL_RECEIVER_IMAP_MOVE_ON_FAILURE
value: {{ .Values.mailReceiver.moveOnFailure | quote }}
- name: REDMINE_MAIL_RECEIVER_UNKNOWN_USER_ACTION
value: {{ .Values.mailReceiver.unknownUserAction | quote }}
- name: REDMINE_MAIL_RECEIVER_NO_PERMISSION_CHECK
value: {{ .Values.mailReceiver.noPermissionCheck | quote }}
- name: REDMINE_MAIL_RECEIVER_NO_ACCOUNT_NOTICE
value: {{ .Values.mailReceiver.noAccountNotice | quote }}
- name: REDMINE_MAIL_RECEIVER_DEFAULT_GROUP
value: {{ .Values.mailReceiver.defaultGroup | quote }}
- name: REDMINE_MAIL_RECEIVER_PROJECT
value: {{ .Values.mailReceiver.project | quote }}
- name: REDMINE_MAIL_RECEIVER_PROJECT_FROM_SUBADDRESS
value: {{ .Values.mailReceiver.projectFromSubaddress | quote }}
- name: REDMINE_MAIL_RECEIVER_STATUS
value: {{ .Values.mailReceiver.status | quote }}
- name: REDMINE_MAIL_RECEIVER_TRACKER
value: {{ .Values.mailReceiver.tracker | quote }}
- name: REDMINE_MAIL_RECEIVER_CATEGORY
value: {{ .Values.mailReceiver.category | quote }}
- name: REDMINE_MAIL_RECEIVER_PRIORITY
value: {{ .Values.mailReceiver.priority | quote }}
- name: REDMINE_MAIL_RECEIVER_ASSIGNED_TO
value: {{ .Values.mailReceiver.assignedTo | quote }}
- name: REDMINE_MAIL_RECEIVER_ALLOW_OVERRIDE
value: {{ .Values.mailReceiver.allowOverride | quote }}
- name: REDMINE_MAIL_RECEIVER_SECRET_KEY_BASE
value: {{ randAlphaNum 64 | quote }}
- name: REDMINE_MAIL_RECEIVER_PROTOCOL
value: {{ .Values.mailReceiver.mailProtocol | quote }}
- name: REDMINE_MAIL_RECEIVER_POP3_DELETE_UNPROCESSED
value: {{ .Values.mailReceiver.moveOnFailure | quote }}
{{- end }}
@@ -0,0 +1,205 @@
{{- if .Values.mailReceiver.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "redmine.fullname" . }}
labels: {{- include "redmine.labels" . | nindent 4 }}
data:
receive.sh: |
#!/usr/bin/env bash
if [ $REDMINE_MAIL_RECEIVER_DEBUG ]; then
set -x
fi
# Perform basic validation
if [ "$REDMINE_MAIL_RECEIVER_HOST" = "" ]; then
echo "Envar REDMINE_MAIL_RECEIVER_HOST undefined"
exit 1
fi
if [ "$REDMINE_MAIL_RECEIVER_PORT" = "" ]; then
echo "Envar REDMINE_MAIL_RECEIVER_PORT undefined"
exit 1
fi
if [ "$REDMINE_MAIL_RECEIVER_USERNAME" = "" ]; then
echo "Envar REDMINE_MAIL_RECEIVER_USERNAME undefined"
exit 1
fi
if [ "$REDMINE_MAIL_RECEIVER_PASSWORD" = "" ]; then
echo "Envar REDMINE_MAIL_RECEIVER_PASSWORD undefined"
exit 1
fi
# Set workdir
cd /opt/bitnami/redmine
# Configuring Database connection
if [ $REDMINE_DB_MYSQL ]; then
cat <<END > config/database.yml
production:
adapter: mysql2
database: <%= ENV["REDMINE_MAIL_RECEIVER_DB_DATABASE"] %>
host: <%= ENV["REDMINE_MAIL_RECEIVER_DB_MYSQL"] %>
username: <%= ENV["REDMINE_MAIL_RECEIVER_DB_USERNAME"] %>
password: <%= ENV["REDMINE_MAIL_RECEIVER_DB_PASSWORD"] %>
port: <%= ENV["REDMINE_MAIL_RECEIVER_DB_PORT"] %>
encoding: utf8
test:
adapter: postgresql
database: <%= ENV["REDMINE_MAIL_RECEIVER_DB_DATABASE"] %>
host: <%= ENV["REDMINE_MAIL_RECEIVER_DB_POSTGRES"] %>
username: <%= ENV["REDMINE_MAIL_RECEIVER_DB_USERNAME"] %>
password: <%= ENV["REDMINE_MAIL_RECEIVER_DB_PASSWORD"] %>
port: <%= ENV["REDMINE_MAIL_RECEIVER_DB_PORT"] %>
encoding: utf8
END
elif [ $REDMINE_DB_POSTGRES ]; then
cat <<END > config/database.yml
test:
adapter: mysql2
database: <%= ENV["REDMINE_MAIL_RECEIVER_DB_DATABASE"] %>
host: <%= ENV["REDMINE_MAIL_RECEIVER_DB_MYSQL"] %>
username: <%= ENV["REDMINE_MAIL_RECEIVER_DB_USERNAME"] %>
password: <%= ENV["REDMINE_MAIL_RECEIVER_DB_PASSWORD"] %>
port: <%= ENV["REDMINE_MAIL_RECEIVER_DB_PORT"] %>
encoding: utf8
production:
adapter: postgresql
database: <%= ENV["REDMINE_MAIL_RECEIVER_DB_DATABASE"] %>
host: <%= ENV["REDMINE_MAIL_RECEIVER_DB_POSTGRES"] %>
username: <%= ENV["REDMINE_MAIL_RECEIVER_DB_USERNAME"] %>
password: <%= ENV["REDMINE_MAIL_RECEIVER_DB_PASSWORD"] %>
port: <%= ENV["REDMINE_MAIL_RECEIVER_DB_PORT"] %>
encoding: utf8
END
else
echo "No database settings given. Exiting"
exit 1
fi
# Build receiver command
COMMAND=""
if [ "$REDMINE_MAIL_RECEIVER_PROTOCOL" = "IMAP" ]; then
COMMAND="bundle exec rake redmine:email:receive_imap --trace "
if [ "$REDMINE_MAIL_RECEIVER_IMAP_FOLDER" != "" ]; then
COMMAND="$COMMAND folder=\"$REDMINE_MAIL_RECEIVER_IMAP_FOLDER\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_IMAP_MOVE_ON_SUCCESS" != "" ]; then
COMMAND="$COMMAND move_on_success=\"$REDMINE_MAIL_RECEIVER_IMAP_MOVE_ON_SUCCESS\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_IMAP_MOVE_ON_FAILURE" != "" ]; then
COMMAND="$COMMAND move_on_failure=\"$REDMINE_MAIL_RECEIVER_IMAP_MOVE_ON_FAILURE\" "
fi
elif [ "$REDMINE_MAIL_RECEIVER_PROTOCOL" = "IMAP" ]; then
COMMAND="bundle exec rake redmine:email:receive_pop3 --trace "
if [ "$REDMINE_MAIL_RECEIVER_POP3_DELETE_UNPROCESSED" != "" ]; then
COMMAND="$COMMAND delete_unprocessed=\"$REDMINE_MAIL_RECEIVER_POP3_DELETE_UNPROCESSED\" "
fi
else
echo "Unsupported mail receive protocol. Exiting"
exit 1
fi
# Add required values
COMMAND="$COMMAND RAILS_ENV='production' \
host=\"$REDMINE_MAIL_RECEIVER_HOST\" \
port=\"$REDMINE_MAIL_RECEIVER_PORT\" \
username=\"$REDMINE_MAIL_RECEIVER_USERNAME\" \
password=\"$REDMINE_MAIL_RECEIVER_PASSWORD\" "
# Add optional values
if [ "$REDMINE_MAIL_RECEIVER_USE_SSL" ]; then
COMMAND="$COMMAND ssl=\"$REDMINE_MAIL_RECEIVER_USE_SSL\" "
fi
if [ -z "$REDMINE_MAIL_RECEIVER_STARTTLS" -a "$REDMINE_MAIL_RECEIVER_STARTTLS" ]; then
COMMAND="$COMMAND starttls=\"$REDMINE_MAIL_RECEIVER_STARTTLS\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_UNKNOWN_USER_ACTION" != "" ]; then
COMMAND="$COMMAND unknown_user=\"$REDMINE_MAIL_RECEIVER_UNKNOWN_USER_ACTION\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_NO_PERMISSION_CHECK" != "" ]; then
COMMAND="$COMMAND no_permission_check=\"$REDMINE_MAIL_RECEIVER_NO_PERMISSION_CHECK\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_NO_ACCOUNT_NOTICE" != "" ]; then
COMMAND="$COMMAND no_account_notice=\"$REDMINE_MAIL_RECEIVER_NO_ACCOUNT_NOTICE\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_DEFAULT_GROUP" != "" ]; then
COMMAND="$COMMAND default_group=\"$REDMINE_MAIL_RECEIVER_DEFAULT_GROUP\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_PROJECT" != "" ]; then
COMMAND="$COMMAND project=\"$REDMINE_MAIL_RECEIVER_PROJECT\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_PROJECT_FROM_SUBADDRESS" != "" ]; then
COMMAND="$COMMAND project_from_subaddress=\"$REDMINE_MAIL_RECEIVER_PROJECT_FROM_SUBADDRESS\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_STATUS" != "" ]; then
COMMAND="$COMMAND status=\"$REDMINE_MAIL_RECEIVER_STATUS\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_TRACKER" != "" ]; then
COMMAND="$COMMAND tracker=\"$REDMINE_MAIL_RECEIVER_TRACKER\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_CATEGORY" != "" ]; then
COMMAND="$COMMAND category=\"$REDMINE_MAIL_RECEIVER_CATEGORY\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_PRIORITY" != "" ]; then
COMMAND="$COMMAND priority=\"$REDMINE_MAIL_RECEIVER_PRIORITY\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_ASSIGNED_TO" != "" ]; then
COMMAND="$COMMAND assigned_to=\"$REDMINE_MAIL_RECEIVER_ASSIGNED_TO\" "
fi
if [ "$REDMINE_MAIL_RECEIVER_ALLOW_OVERRIDE" != "" ]; then
COMMAND="$COMMAND allow_override=\"$REDMINE_MAIL_RECEIVER_ALLOW_OVERRIDE\" "
fi
if [ $REDMINE_MAIL_RECEIVER_DEBUG ]; then
echo "Unsecure printing mail receiving command"
echo $COMMAND
echo ""
fi
# Configuring secrets
cat <<END > config/secrets.yml
development:
secret_key_base:
test:
secret_key_base:
production:
secret_key_base: <%= ENV["REDMINE_MAIL_RECEIVER_SECRET_KEY_BASE"] %>
END
echo "Start rake receive email process"
# Execute command
eval $COMMAND
echo "Email receiveing completed"
exit 0
{{- end -}}
+3
View File
@@ -19,4 +19,7 @@ data:
external-db-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- end }}
{{- if and .Values.mailReceiver.enabled .Values.mailReceiver.password }}
mail-receiver-password: {{ default "" .Values.mailReceiver.password | b64enc | quote }}
{{- end }}
{{- end }}
+99
View File
@@ -371,3 +371,102 @@ ingress:
## - name: redmine.local-tls
## key:
## certificate:
## Configure CronJob scheduler for receiveing emails and converting them to tasks
## ref: http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails
##
mailReceiver:
## Whether to enable scheduled task
enabled: false
## CronJob schedule
schedule: "*/5 * * * *"
## CronJob suspend flag
suspend: true
image:
registry: docker.io
repository: bitnami/redmine
tag: 4.0.5-debian-9-r28
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent
## Protocol to use to get emails from configured server.
## Supported values are "IMAP" or "POP3"
mailProtocol: IMAP
## Server hostname to connect to
host: ""
## Server TCP port to connect to
port: 993
## Username to authenticate on server
username: ""
## Password to authenticate on server
password: ""
## ssl flag for redmine mail client
## If true then client will use SSL/TLS
ssl: true
## starttls flag for redmine mail client
## If true then client will use StartTLS
startTLS: false
## IMAP only. Folder to read emails from
imapFolder: "INBOX"
## Folder on mail server to move correctly parsed emails to
## If empty - just leave emails as read
moveOnSuccess: ""
## Folder on mail server to move emails with parsing errors to
## If empty - just leave emails as read
moveOnFailure: ""
## Action to perform for unknown email sender
## ref: http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails
unknownUserAction: ingore
## If set to 1 then redmine does not check task creator (source email) permissions for creating a new task
## If set to 0 then task creator must have permission to create a new task
noPermissionCheck: 0
## Whether send a just created user (the creator of the task) email about his new account
## 0 - send, 1 - not send
noAccountNotice: 1
## Defines a group list to add created user to
## Groups must be enumerated as names separated by comma without spaces
defaultGroup: ""
## Defines a project to create a new task in
project: ""
## Defines an email to use as a base for getting project name for a new task
projectFromSubaddress: ""
## Defines a new task status
status: ""
## Defines a new task tracker
tracker: ""
## Defines a new task category
category: ""
## Defines a new task priority
priority: ""
## Defines a new task assignee
assignedTo: ""
## Defines a list of attributes which can be overrided by received email body
## "all" means that all attributes can be overrided
allowOverride: ""