Skip to content

Commit 4567478

Browse files
committed
Make ct install actually work
1 parent 2b9ea33 commit 4567478

8 files changed

Lines changed: 86 additions & 22 deletions

File tree

.ci/ct-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
chart-repos:
55
- haproxy=https://haproxytech.github.io/helm-charts
66

7-
lint-conf: .ci/lint-config.yaml
7+
lint-conf: .ci/lint-config.yaml
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Linting
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'charts/**'
7+
- '.github/**'
8+
9+
jobs:
10+
lint-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v1
15+
16+
- name: Run chart-testing (lint)
17+
id: lint
18+
uses: helm/chart-testing-action@v1.0.0-rc.1
19+
with:
20+
config: .ci/ct-config.yaml
21+
command: lint
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name: Lint and Test Charts
1+
name: Testing
22

33
on:
4-
push:
4+
pull_request:
55
paths:
66
- 'charts/**'
77
- '.github/**'

.github/workflows/on-push-master-publish-chart.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,6 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v2
18-
# - uses: azure/setup-helm@v1
19-
# id: installhelm3
20-
# with:
21-
# version: 'v3.0.3'
22-
# - name: Publish helm charts
23-
# uses: funkypenguin/helm-gh-pages-action@v1.1.1
24-
# with:
25-
# # A personal access token needed to push your site after it has been built.
26-
# access-token: ${{ secrets.CR_TOKEN }}
27-
# # The branch expected by GitHub to have the static files needed for your site.
28-
# deploy-branch: chart
29-
# # The folder in which the helm charts are located
30-
# charts-folder: charts
3118

3219
- name: Fetch history
3320
run: git fetch --prune --unshallow

TESTING.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# How this chart is tested
2+
3+
# Automated tests
4+
5+
Every pull request to the master branch trigger the following tests:
6+
7+
* ct lint
8+
* ct install
9+
10+
# Local testing
11+
12+
If you're submitting a PR, and you want to ensure your changes will pass automated testing (above), here are your options:
13+
14+
## Linting
15+
16+
We use helm's [chart-testing](https://github.com/helm/chart-testing) tool to lint our charts. The tool can be installed locally, or it can be run in a Docker container.
17+
18+
To run in Docker:
19+
20+
1. Have Docker installed
21+
2. Run `./ci/scripts/local-lint`
22+
23+
To run locally:
24+
25+
1. Have ct installed (Get a binary package from https://github.com/helm/chart-testing/releases)
26+
2. Run `ct lint --config=.ci/ct-config.yaml`
27+
28+
## Deployment testing
29+
30+
*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".
31+
32+
33+
34+
35+
ct lint --config=.ci/ct-config.yaml
36+
37+
Create a KinD cluster, by running `kind create cluster`:
38+
39+
```
40+
❯ kind create cluster
41+
Creating cluster "kind" ...
42+
✓ Ensuring node image (kindest/node:v1.17.0) 🖼
43+
✓ Preparing nodes 📦
44+
✓ Writing configuration 📜
45+
✓ Starting control-plane 🕹️
46+
✓ Installing CNI 🔌
47+
✓ Installing StorageClass 💾
48+
Set kubectl context to "kind-kind"
49+
You can now use your cluster with:
50+
51+
kubectl cluster-info --context kind-kind
52+
53+
Have a nice day! 👋
54+
```
55+
56+
Trigger a `ct install` test against the KinD cluster, by running `t install --config=.ci/ct-config.yaml`. **ct** will target your current context (be careful if you've got multiple contexts configured!), create a temporary namespace, and deploy the chart into that namespace, until `helm --wait` indicates success. After this, the helm release will be removed, the namespace deleted, and you can retire your KinD cluster by running `kind delete cluster`.

charts/docker-mailserver/templates/_upstream-env-variables.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ We list them here (and include this template in deployment.yaml) to keep deploym
1818
- name: SMTP_ONLY
1919
value: {{ .Values.pod.dockermailserver.smtp_only | quote }}
2020
- name: SSL_TYPE
21-
value: {{ default "manual" .Values.pod.dockermailserver.ssl_type | quote }}
21+
value: {{ .Values.pod.dockermailserver.ssl_type | quote }}
2222
- name: SSL_CERT_PATH
2323
value: {{ default "/tmp/ssl/tls.crt" .Values.pod.dockermailserver.ssl_cert_path | quote }}
2424
- name: SSL_KEY_PATH

charts/docker-mailserver/templates/deployment.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,13 @@ spec:
142142
command:
143143
- /bin/bash
144144
- /tmp/docker-mailserver/am-i-healthy.sh
145-
initialDelaySeconds: 600
146-
timeoutSeconds: 60
147-
failureThreshold: 3
145+
initialDelaySeconds: 60
146+
timeoutSeconds: 10
147+
failureThreshold: 2
148148
readinessProbe:
149149
tcpSocket:
150150
port: 25
151-
initialDelaySeconds: 600
151+
initialDelaySeconds: 60
152152
periodSeconds: 20
153153
timeoutSeconds: 1
154154
failureThreshold: 3

charts/docker-mailserver/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ rainloop:
369369
## These values are for the haproxy sub-chart
370370
haproxy:
371371
# haproxy.enabled will deploy an haproxy sub-chart, configured for the TCP ports used by docker-mailserver
372-
enabled: true
372+
enabled: false
373373
controller:
374374
replicaCount: 1
375375
kind: "Deployment"

0 commit comments

Comments
 (0)