Skip to content

Commit

Permalink
chore: indentations / trim / clean
Browse files Browse the repository at this point in the history
  • Loading branch information
fredleger committed Apr 12, 2023
1 parent a6e4b7c commit d62d78d
Show file tree
Hide file tree
Showing 28 changed files with 171 additions and 176 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ When you send a pull request, please make sure all of your commits are atomic (o
Always write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this:

$ git commit -m "A brief summary of the commit
>
>
> A paragraph describing what changed and its impact."

Thanks again!
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The MIT License (MIT)
# The MIT License (MIT)

Copyright 2019 David Young
Copyright 2020 The Docker Mailserver Helm Chart Authors
Expand Down
15 changes: 5 additions & 10 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# How this chart is tested

# Automated tests
## Automated tests

Every pull request to the master branch trigger the following tests:

* ct lint
* ct install


[![Linting](https://github.com/funkypenguin/helm-docker-mailserver/workflows/Linting/badge.svg)](.github/workflows/on-pr-lint-charts.yml)
[![Testing](https://github.com/funkypenguin/helm-docker-mailserver/workflows/Testing/badge.svg)](.github/workflows/on-pr-test-charts.yml)


# Local testing
## Local testing

If you're submitting a PR, and you want to ensure your changes will pass automated testing (above), here are your options:

Expand All @@ -27,21 +25,18 @@ To run in Docker:

To run locally:

1. Have ct installed (Get a binary package from https://github.com/helm/chart-testing/releases)
1. Have ct installed (Get a binary package from <https://github.com/helm/chart-testing/releases>)
2. Run `ct lint --config=.ci/ct-config.yaml`

## Deployment testing

*ct* can also test a chart by deploying it to a temporary namespace in a Kubernetes cluster, and waiting for indications that the deployment has been successful. This is a good way to test how the deployment behaves "for real".




ct lint --config=.ci/ct-config.yaml
`ct lint --config=.ci/ct-config.yaml`

Create a KinD cluster, by running `kind create cluster`:

```
```sh
❯ kind create cluster
Creating cluster "kind" ...
✓ Ensuring node image (kindest/node:v1.17.0) 🖼
Expand Down
2 changes: 1 addition & 1 deletion charts/docker-mailserver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "11.0.0"
description: A fullstack but simple mailserver (smtp, imap, antispam, antivirus, ssl...) using Docker.
name: docker-mailserver
version: 2.0.1
version: 2.0.2
sources:
- https://github.com/docker-mailserver/docker-mailserver-helm
maintainers:
Expand Down
56 changes: 28 additions & 28 deletions charts/docker-mailserver/PERSISTENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,32 +61,32 @@ Kubernetes automating the provisioning and mounting of storage is very handy whe

1. Create the PersistentVolumeClaim
```bash
$ cat <<EOT | kubectl create -f -
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
selector:
matchLabels:
volume_name: test
EOT
```

2. Create the directory, on a worker

```bash
# mkdir -m 1777 /NFS_MOUNT/test
```

3. Install the chart

```bash
$ helm install --name test --set persistence.existingClaim=test .
$ cat <<EOT | kubectl create -f -
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
selector:
matchLabels:
volume_name: test
EOT
```

2. Create the directory, on a worker

```bash
# mkdir -m 1777 /NFS_MOUNT/test
```

3. Install the chart

```bash
$ helm install --name test --set persistence.existingClaim=test .
```
46 changes: 24 additions & 22 deletions charts/docker-mailserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,29 @@ Kubernetes](https://github.com/docker-mailserver/docker-mailserver/wiki/Using-in

## Contents

- [Contents](#contents)
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Architecture](#architecture)
- [Getting Started](#getting-started)
- [Install Helm](#1-install-helm)
- [Install Cert-manager](#2-install-cert-manager)
- [Install Docker Mailserver](#install-docker-mailserver)
- [Configuration and Operation](#configuration-and-operation)
- [Download setup.sh](#download-setupsh)
- [Create / Update / Delete users](#create--update--delete-users)
- [Setup OpenDKIM](#setup-opendkim)
- [Setup RainLoop](#setup-rainloop)
- [Configuration](#docker-mailserver-configuration)
- [Minimal configuration](#minimal-configuration)
- [Chart Configuration](#chart-configuration)
- [docker-mailserver Configuration](#docker-mailserver-configuration)
- [Rainloop Configuration](#rainloop-configuration)
- [HA Proxy-Ingress Configuration](#ha-proxy-ingress-configuration)
- [Development](#development)
- [Testing](#testing)
- [docker-mailserver-helm](#docker-mailserver-helm)
- [Contents](#contents)
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Architecture](#architecture)
- [Getting Started](#getting-started)
- [1. Install helm](#1-install-helm)
- [2. Install cert-manager](#2-install-cert-manager)
- [Install docker-mailserver](#install-docker-mailserver)
- [Configuration and Operation](#configuration-and-operation)
- [Install](#install)
- [Download setup.sh](#download-setupsh)
- [Create / Update / Delete users](#create--update--delete-users)
- [Setup OpenDKIM](#setup-opendkim)
- [Setup RainLoop](#setup-rainloop)
- [Docker Mailserver Configuration](#docker-mailserver-configuration)
- [Minimal configuration](#minimal-configuration)
- [Chart Configuration](#chart-configuration)
- [docker-mailserver Configuration](#docker-mailserver-configuration-1)
- [Rainloop Configuration](#rainloop-configuration)
- [HA Proxy-Ingress Configuration](#ha-proxy-ingress-configuration)
- [Development](#development)
- [Testing](#testing)

(Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc.go))

Expand Down Expand Up @@ -69,7 +71,7 @@ There are several ways you might deploy docker-mailserver. The most common would

### 1. Install helm

You need helm, obviously. Instructions are [here](https://helm.sh/docs/intro/install/).
You need helm, obviously. Instructions are [here](https://helm.sh/docs/intro/install/).

### 2. Install cert-manager

Expand Down
10 changes: 5 additions & 5 deletions charts/docker-mailserver/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

You've successfully launched docker-mailserver helm chart!

{{- if .Values.demoMode.enabled -}}
{{- if .Values.demoMode.enabled -}}

But wait, dear reader. You're still running in DEMO MODE.

Expand All @@ -66,16 +66,16 @@ NOTE: The above step is mandatory if you disable demo mode. Without valid DKIM k
You're not in demo mode! Assuming all has gone well, execute the commands below to retrieve the TXT records
to add to your DNS zones, to finish setting up DKIM:
{{/* Mount a dkim key for every domain configured */}}
---
---
{{ range .Values.domains }}
{{- $path := printf "cat config/opendkim/keys/%s/mail.txt" . }}
{{ $path }}
{{ end }}
---
{{ end }}

{{ if .Values.haproxy.enabled -}}
{{ if .Values.poorMansK8sLb.enabled -}}
{{ if .Values.haproxy.enabled -}}
{{ if .Values.poorMansK8sLb.enabled -}}

-------
You're running with HAProxy enabled, and poor-mans-k8s-lb turned on. Provided you've correctly setup your
Expand Down Expand Up @@ -109,7 +109,7 @@ to the internet. You may be running in host mode, or nodeport mode, or some othe

{{- if .Values.rainloop.enabled -}}
{{- if .Values.rainloop.ingress.enabled -}}
{{ if .Values.haproxy.enabled -}}
{{ if .Values.haproxy.enabled -}}
---
You've enabled RainLoop integration. Because you're using HAProxy, you'll need to configure RainLoop
to use an IMAPS server of {{ template "dockermailserver.fullname" . }} on port 10993 (with SSL), since port 993
Expand Down
2 changes: 1 addition & 1 deletion charts/docker-mailserver/templates/certificate.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if not .Values.ssl.useExisting -}}
{{- if not .Values.ssl.useExisting -}}
---
apiVersion: cert-manager.io/v1
kind: Certificate
Expand Down
40 changes: 19 additions & 21 deletions charts/docker-mailserver/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{/* This whole template is only necessary if we've enabled creation of the configmap (default true) */}}
{{- if not .Values.configMap.useExisting -}}
{{- if not .Values.configMap.useExisting -}}
---
apiVersion: "v1"
kind: "ConfigMap"
Expand All @@ -12,7 +12,7 @@ metadata:
name: {{ template "dockermailserver.fullname" . }}-configs
data:
{{/* Use sample data if user is running in demo mode */}}
{{- if .Values.demoMode.enabled -}}
{{- if .Values.demoMode.enabled -}}
### We are in demo mode, so add in some sample data for quick testing
postfix-accounts.cf: |
# A sample user - the password is "password"
Expand All @@ -24,16 +24,16 @@ data:
127.0.0.1
localhost
### End demo mode data
{{/* Use real data from "config" subdirectory if user is _not_ running in demo mode */}}
{{ else -}}
{{- else }}
postfix-main.cf: |
{{/* Enable proxy protocol for postscreen / dovecot */}}
{{- if .Values.haproxy.enabled }} # Necessary to permit proxy protocol from haproxy to postscreen
postscreen_upstream_proxy_protocol = haproxy
{{ end }}
{{ if not .Values.spfTestsDisabled }}
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_unauth_pipelining, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_recipient_domain, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net{{ range .Values.rblRejectDomains }}, reject_rbl_client {{ . }}{{ end }}
{{ end -}}
{{/* Enable proxy protocol for postscreen / dovecot */}}
{{- if .Values.haproxy.enabled }} # Necessary to permit proxy protocol from haproxy to postscreen
postscreen_upstream_proxy_protocol = haproxy
{{- end }}
{{- if not .Values.spfTestsDisabled }}
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_unauth_pipelining, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_recipient_domain, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net{{ range .Values.rblRejectDomains }}, reject_rbl_client {{ . }}{{ end }}
{{- end }}
{{/* Use real data from "config" subdirectory if user is _not_ running in demo mode */}}
{{- (.Files.Glob "config/*.cf").AsConfig | nindent 2 }}
{{- (.Files.Glob "config/opendkim/TrustedHosts").AsConfig | nindent 2 }}
{{- (.Files.Glob "config/opendkim/SigningTable").AsConfig | nindent 2 }}
Expand All @@ -42,11 +42,11 @@ data:
dovecot-services.cf: |
{{- if .Values.haproxy.enabled }}
haproxy_trusted_networks = {{ .Values.haproxy.trustedNetworks }}
{{ end }}
{{- end }}
service imap-login {
inet_listener imap {
{{ if .Values.haproxy.enabled -}}haproxy = yes{{ end }}
}
}
inet_listener imaps {
{{ if .Values.haproxy.enabled -}}haproxy = yes{{ end }}
}
Expand All @@ -55,18 +55,16 @@ data:
port = 10993
ssl = yes
}
{{ end }}
}
{{- end }}
}
service pop3-login {
inet_listener pop3 {
{{ if .Values.haproxy.enabled -}}haproxy = yes{{ end }}
{{- if .Values.haproxy.enabled -}}haproxy = yes{{ end }}
}
inet_listener pop3s {
{{ if .Values.haproxy.enabled -}}haproxy = yes{{ end }}
}
{{- if .Values.haproxy.enabled -}}haproxy = yes{{ end }}
}
}


80-replication.conf: |
mail_plugins = $mail_plugins notify replication
Expand All @@ -86,7 +84,7 @@ data:
user = docker
}
}
doveadm_port = 4117
doveadm_password = secret
Expand Down
6 changes: 3 additions & 3 deletions charts/docker-mailserver/templates/deployment-rainloop.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{/* This whole template is only necessary if we're using rainloop */}}
{{ if .Values.rainloop.enabled -}}
{{ if .Values.rainloop.enabled -}}
---
apiVersion: "apps/v1"
kind: "Deployment"
Expand All @@ -24,8 +24,8 @@ spec:
release: "{{ .Release.Name }}"
{{- if .Values.rainloop.annotations }}
annotations:
{{ toYaml .Values.rainloop.annotations | indent 8 }}
{{ end }}
{{ toYaml .Values.rainloop.annotations | indent 8 }}
{{ end }}
spec:
serviceAccountName: {{ template "dockermailserver.rainloop.serviceAccountName" . }}
containers:
Expand Down
2 changes: 1 addition & 1 deletion charts/docker-mailserver/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:
{{- end }}
{{- end }}
{{ if .Values.additionalVolumes }}
{{- toYaml .Values.additionalVolumes | indent 9 }}
{{- toYaml .Values.additionalVolumes | indent 8 }}
{{- end }}
- name: tmp
emptyDir: {}
Expand Down
6 changes: 3 additions & 3 deletions charts/docker-mailserver/templates/pvc-rainloop.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{/* This whole template is only necessary if we're using rainloop */}}
{{- if .Values.rainloop.enabled -}}
{{- if .Values.rainloop.enabled -}}
{{- if not .Values.rainloop.persistence.existingClaim -}}
---
kind: "PersistentVolumeClaim"
Expand All @@ -13,8 +13,8 @@ metadata:
volume.alpha.kubernetes.io/storage-class: "generic"
{{- end }}
{{- if .Values.rainloop.persistence.annotations }}
{{ toYaml .Values.rainloop.persistence.annotations | indent 2 }}
{{ end }}
{{ toYaml .Values.rainloop.persistence.annotations | indent 2 }}
{{ end }}
spec:
accessModes:
- {{ default "ReadWriteOnce" .Values.rainloop.persistence.accessMode | quote }}
Expand Down
2 changes: 1 addition & 1 deletion charts/docker-mailserver/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
volume.alpha.kubernetes.io/storage-class: "generic"
{{- end }}
{{- if .Values.persistence.annotations }}
{{ toYaml .Values.persistence.annotations | indent 2 }}
{{ toYaml .Values.persistence.annotations | indent 2 }}
{{ end }}
spec:
accessModes:
Expand Down
4 changes: 2 additions & 2 deletions charts/docker-mailserver/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{/* This whole template is only necessary if we've enabled creation of the configmap (default true) */}}
{{- if not .Values.secret.useExisting -}}
{{- if not .Values.secret.useExisting -}}
---
apiVersion: "v1"
kind: "Secret"
Expand All @@ -17,7 +17,7 @@ data:
{{- (.Files.Glob "*.secret").AsSecrets | nindent 2 -}}
{{- end -}}
{{/* If we're in demo mode, just import a pre-created key for example.com */}}
{{- if .Values.demoMode.enabled -}}
{{- if .Values.demoMode.enabled -}}
example.com-mail.private: {{ .Files.Get "demo-mode-dkim-key-for-example.com.key" | b64enc }}
{{/* If we're _not_ in demo mode, assume the user has created dkim keys for his domains, and import them */}}
{{- else -}}
Expand Down
Loading

0 comments on commit d62d78d

Please sign in to comment.