Skip to content

Commit

Permalink
Merge pull request #118 from MichaelSp/unittests
Browse files Browse the repository at this point in the history
restore helm unittests
  • Loading branch information
cfis authored Sep 29, 2024
2 parents 4ec28e2 + 96c4ba3 commit 0ad4d47
Show file tree
Hide file tree
Showing 15 changed files with 696 additions and 140 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/on-push-lint-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
KUBE_SCORE_VERSION: 1.17.0
HELM_VERSION: v3.13.2

concurrency:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

Expand Down Expand Up @@ -44,12 +44,27 @@ jobs:
KUBE_SCORE: /tmp/bin/kube-score
run: .ci/scripts/kube-score.sh

unittest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: install helm unittest
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest.git
- name: Run helm unittest
run: helm unittest charts/*

chart-testing:
runs-on: ubuntu-latest
strategy:
matrix:
# Choose from https://hub.docker.com/r/kindest/node/tags
KubeVersion: [1.27.3, 1.28.0, 1.29.0]
KubeVersion: [ 1.27.3, 1.28.0, 1.29.0 ]

steps:
- name: Checkout
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: "14.0.0"
description: A fullstack but simple mailserver (smtp, imap, antispam, antivirus, ssl...) using Docker.
name: docker-mailserver
version: 4.0.6
version: 4.0.7
sources:
- https://github.com/docker-mailserver/docker-mailserver-helm
maintainers:
Expand Down
1 change: 0 additions & 1 deletion charts/docker-mailserver/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ spec:
{{- if $persistence.enabled }}
- name: {{ $name }}
mountPath: {{ $persistence.mountPath }}
readonly: true
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
manifest should match snapshot:
1: |
apiVersion: v1
data:
dovecot.cf: "\nhaproxy_trusted_networks = 10.0.0.0/8 192.168.0.0/16 172.16.0.0/16\nservice imap-login {\n inet_listener imap {\n port = 143\n }\n \n inet_listener imaps {\n port = 993\n ssl = yes\n }\n \n inet_listener imap_proxy {\n haproxy = yes\n port = 10143\n ssl = no\n }\n\n inet_listener imaps_proxy {\n haproxy = yes\n port = 10993\n ssl = yes\n }\n}\n"
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/name: RELEASE-NAME-docker-mailserver
chart: docker-mailserver-0.1.0
heritage: Helm
release: RELEASE-NAME
name: dovecot-cf
2: |
apiVersion: v1
data:
fts-xapian-plugin.conf: ""
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/name: RELEASE-NAME-docker-mailserver
chart: docker-mailserver-0.1.0
heritage: Helm
release: RELEASE-NAME
name: fts-xapian-plugin-conf
3: |
apiVersion: v1
data:
user-patches.sh: "#!/bin/bash\n# Make sure to keep this file in sync with https://github.com/docker-mailserver/docker-mailserver/blob/master/target/postfix/master.cf!\ncat <<EOS >> /etc/postfix/master.cf\n\n# Submission with proxy\n10587 inet n - n - - smtpd\n -o syslog_name=postfix/submission\n -o smtpd_tls_security_level=encrypt\n -o smtpd_sasl_auth_enable=yes\n -o smtpd_sasl_type=dovecot\n -o smtpd_reject_unlisted_recipient=no\n -o smtpd_sasl_authenticated_header=yes\n -o smtpd_client_restrictions=permit_sasl_authenticated,reject\n -o smtpd_relay_restrictions=permit_sasl_authenticated,reject\n -o smtpd_sender_restrictions=\\$mua_sender_restrictions\n -o smtpd_discard_ehlo_keywords=\n -o milter_macro_daemon_name=ORIGINATING\n -o cleanup_service_name=sender-cleanup\n -o smtpd_upstream_proxy_protocol=haproxy \n\n# Submissions with proxy\n10465 inet n - n - - smtpd\n -o syslog_name=postfix/submissions\n -o smtpd_tls_wrappermode=yes\n -o smtpd_sasl_auth_enable=yes\n -o smtpd_sasl_type=dovecot\n -o smtpd_reject_unlisted_recipient=no\n -o smtpd_sasl_authenticated_header=yes\n -o smtpd_client_restrictions=permit_sasl_authenticated,reject\n -o smtpd_relay_restrictions=permit_sasl_authenticated,reject\n -o smtpd_sender_restrictions=\\$mua_sender_restrictions\n -o smtpd_discard_ehlo_keywords=\n -o milter_macro_daemon_name=ORIGINATING\n -o cleanup_service_name=sender-cleanup\n -o smtpd_upstream_proxy_protocol=haproxy\n\n# Smtp with proxy\n12525 inet n - n - 1 postscreen\n -o syslog_name=postfix/smtp-proxy\n -o postscreen_upstream_proxy_protocol=haproxy\n -o postscreen_cache_map=btree:$data_directory/postscreen_10025_cache\nEOS\n"
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/name: RELEASE-NAME-docker-mailserver
chart: docker-mailserver-0.1.0
heritage: Helm
release: RELEASE-NAME
name: user-patches-sh
237 changes: 237 additions & 0 deletions charts/docker-mailserver/tests/__snapshot__/deployment_test.yaml.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
manifest should match snapshot:
1: |
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: RELEASE-NAME-docker-mailserver
chart: docker-mailserver-0.1.0
heritage: Helm
release: RELEASE-NAME
name: RELEASE-NAME-docker-mailserver
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: RELEASE-NAME-docker-mailserver
release: RELEASE-NAME
strategy:
type: Recreate
template:
metadata:
labels:
app.kubernetes.io/name: RELEASE-NAME-docker-mailserver
release: RELEASE-NAME
spec:
containers:
- env:
- name: AMAVIS_LOGLEVEL
value: "0"
- name: DOVECOT_INET_PROTOCOLS
value: all
- name: DOVECOT_MAILBOX_FORMAT
value: maildir
- name: ENABLE_AMAVIS
value: "0"
- name: ENABLE_CLAMAV
value: "0"
- name: ENABLE_DNSBL
value: "0"
- name: ENABLE_FAIL2BAN
value: "0"
- name: ENABLE_FETCHMAIL
value: "0"
- name: ENABLE_GETMAIL
value: "0"
- name: ENABLE_IMAP
value: "1"
- name: ENABLE_OPENDKIM
value: "0"
- name: ENABLE_OPENDMARC
value: "0"
- name: ENABLE_POLICYD_SPF
value: "0"
- name: ENABLE_POSTGREY
value: "0"
- name: ENABLE_QUOTAS
value: "1"
- name: ENABLE_RSPAMD
value: "1"
- name: ENABLE_RSPAMD_REDIS
value: "1"
- name: ENABLE_SASLAUTHD
value: "0"
- name: ENABLE_SPAMASSASSIN
value: "0"
- name: ENABLE_SPAMASSASSIN_KAM
value: "0"
- name: ENABLE_SRS
value: "0"
- name: ENABLE_UPDATE_CHECK
value: "1"
- name: FAIL2BAN_BLOCKTYPE
value: drop
- name: FETCHMAIL_PARALLEL
value: "0"
- name: FETCHMAIL_POLL
value: "300"
- name: GETMAIL_POLL
value: "5"
- name: LOGROTATE_COUNT
value: "4"
- name: LOGROTATE_INTERVAL
value: weekly
- name: LOG_LEVEL
value: info
- name: MARK_SPAM_AS_READ
value: "0"
- name: MOVE_SPAM_TO_JUNK
value: "1"
- name: OVERRIDE_HOSTNAME
value: mail.example.com
- name: PERMIT_DOCKER
value: none
- name: POSTFIX_INET_PROTOCOLS
value: all
- name: POSTFIX_REJECT_UNKNOWN_CLIENT_HOSTNAME
value: "0"
- name: POSTGREY_AUTO_WHITELIST_CLIENTS
value: "5"
- name: POSTGREY_DELAY
value: "300"
- name: POSTGREY_MAX_AGE
value: "35"
- name: POSTGREY_TEXT
value: Delayed by Postgrey
- name: POSTSCREEN_ACTION
value: enforce
- name: RELAY_PORT
value: "25"
- name: RSPAMD_CHECK_AUTHENTICATED
value: "0"
- name: RSPAMD_GREYLISTING
value: "0"
- name: RSPAMD_HFILTER
value: "1"
- name: RSPAMD_HFILTER_HOSTNAME_UNKNOWN_SCORE
value: "6"
- name: RSPAMD_LEARN
value: "0"
- name: RSPAMD_NEURAL
value: "0"
- name: SA_KILL
value: "10"
- name: SA_TAG
value: "2"
- name: SA_TAG2
value: "6.31"
- name: SPAMASSASSIN_SPAM_TO_INBOX
value: "1"
- name: SPAM_SUBJECT
value: '***SPAM*** '
- name: SRS_SENDER_CLASSES
value: envelope_sender
- name: UPDATE_CHECK_INTERVAL
value: 1d
image: mailserver/docker-mailserver:0.1.0
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- /bin/bash
- -c
- supervisorctl status | grep -E "amavis|clamav|cron|dovecot|mailserver|opendkim|opendmarc|postfix|rsyslog" | grep RUNNING
failureThreshold: 3
initialDelaySeconds: 10
timeoutSeconds: 5
name: docker-mailserver
ports:
- containerPort: 25
name: smtp
- containerPort: 465
name: submissions
- containerPort: 587
name: submission
- containerPort: 12525
name: smtp-proxy
- containerPort: 10465
name: subs-proxy
- containerPort: 10587
name: sub-proxy
- containerPort: 143
name: imap
- containerPort: 993
name: imaps
- containerPort: 10143
name: imap-proxy
- containerPort: 10993
name: imaps-proxy
- containerPort: 11334
name: rspamd
readinessProbe:
exec:
command:
- /bin/bash
- -c
- supervisorctl status | grep -E "mailserver|postfix" | grep RUNNING
failureThreshold: 3
initialDelaySeconds: 10
timeoutSeconds: 5
resources:
limits:
cpu: "2"
ephemeral-storage: 500Mi
memory: 2048Mi
requests:
cpu: "1"
ephemeral-storage: 100Mi
memory: 1536Mi
securityContext:
privileged: false
readOnlyRootFilesystem: false
volumeMounts:
- mountPath: /tmp/docker-mailserver/dovecot.cf
name: dovecot-cf
subPath: dovecot.cf
- mountPath: /etc/dovecot/conf.d/10-plugin.conf
name: fts-xapian-plugin-conf
subPath: fts-xapian-plugin.conf
- mountPath: /tmp/docker-mailserver/user-patches.sh
name: user-patches-sh
subPath: user-patches.sh
- mountPath: /tmp/docker-mailserver
name: mail-config
- mountPath: /var/mail
name: mail-data
- mountPath: /var/log/mail
name: mail-log
- mountPath: /var/mail-state
name: mail-state
nodeSelector: {}
priorityClassName: null
restartPolicy: Always
runtimeClassName: null
securityContext: null
serviceAccountName: RELEASE-NAME-docker-mailserver
volumes:
- configMap:
name: dovecot-cf
name: dovecot-cf
- configMap:
name: fts-xapian-plugin-conf
name: fts-xapian-plugin-conf
- configMap:
name: user-patches-sh
name: user-patches-sh
- name: mail-config
persistentVolumeClaim:
claimName: RELEASE-NAME-docker-mailserver-mail-config
- name: mail-data
persistentVolumeClaim:
claimName: RELEASE-NAME-docker-mailserver-mail-data
- name: mail-log
persistentVolumeClaim:
claimName: RELEASE-NAME-docker-mailserver-mail-log
- name: mail-state
persistentVolumeClaim:
claimName: RELEASE-NAME-docker-mailserver-mail-state
Loading

0 comments on commit 0ad4d47

Please sign in to comment.