You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Autodeployer, autorestarter and monitoring for Digitransit deployments
5
4
6
5
We deploy digitransit docker images automatically from Docker Hub. When a Docker image of a kubernetes deployment that we have deployed in our environment is updated at Docker Hub the new image is deployed automatically.
@@ -12,16 +11,18 @@ Additionally, some deployments are restarted periodically.
12
11
## Env variable configuration
13
12
14
13
These following environmental variables should be added:
15
-
* "SLACK_ACCESS_TOKEN" access token used for sending slack messages through a Slack app
16
-
* "MONITORING_SLACK_CHANNEL_ID" slack channel id (not the name) for most of the Slack messages
17
-
* "ALERT_SLACK_CHANNEL_ID" slack channel id (not the name) for sending messages about image freshness checks
18
-
* "DOCKER_USER" docker user that is used for interacting with the Docker API
19
-
* "DOCKER_AUTH" docker password that is used for interacting with the Docker API
20
-
* "TZ" optional timezone (defaults to "Europe/Helsinki")
14
+
15
+
- "SLACK_ACCESS_TOKEN" access token used for sending slack messages through a Slack app
16
+
- "MONITORING_SLACK_CHANNEL_ID" slack channel id (not the name) for most of the Slack messages
17
+
- "ALERT_SLACK_CHANNEL_ID" slack channel id (not the name) for sending messages about image freshness checks
18
+
- "DOCKER_USER" docker user that is used for interacting with the Docker API
19
+
- "DOCKER_AUTH" docker password that is used for interacting with the Docker API
20
+
- "TZ" optional timezone (defaults to "Europe/Helsinki")
21
21
22
22
## Prerequisites
23
23
24
24
Deployments should have the following labels defined as deployer uses `app` as an identifier for finding deployments/pods.
25
+
25
26
```yaml
26
27
metadata:
27
28
name: <deployment name>
@@ -39,41 +40,46 @@ spec:
39
40
Deployer configuration is stored in labels. For example take a look at https://github.com/HSLdevcom/digitransit-kubernetes-deploy/blob/master/roles/aks-apply/files/prod/opentripplanner-hsl-prod.yml where we have labels set as follows:
40
41
41
42
```yaml
42
-
metadata:
43
-
labels:
44
-
update: "auto"
45
-
restartAfterDeployments: "digitransit-ui-hsl-v3"
46
-
restartDelay: "5"
43
+
metadata:
44
+
labels:
45
+
update: 'auto'
46
+
restartAfterDeployments: 'digitransit-ui-hsl-v3'
47
+
restartDelay: '5'
47
48
```
48
49
49
50
### update: "auto"
51
+
50
52
Automatic image updates are enabled for deployment.
Restart this deployment when deployment opentripplanner-data-con-hsl is restarted.
54
57
It is possible to add multiple dependencies by separating them with underscore
55
58
56
59
### restartDelay: "1"
60
+
57
61
Wait at minimum 1 minute before restarting this deployment (because of dependant deployment has restarted)
58
62
59
63
## Cron style autorestarter configuration
60
64
61
65
Labels are also used for the periodic (cron style) restarts. These labels can coexist with the labels required for the auto deployments. Example label use below:
62
66
63
67
```yaml
64
-
metadata:
65
-
labels:
66
-
update: "auto"
67
-
restartAfterDeployments: "digitransit-ui-hsl-v3"
68
-
restartDelay: "1"
69
-
restartAt: "04.30"
70
-
restartLimitInterval: "240"
68
+
metadata:
69
+
labels:
70
+
update: 'auto'
71
+
restartAfterDeployments: 'digitransit-ui-hsl-v3'
72
+
restartDelay: '1'
73
+
restartAt: '04.30'
74
+
restartLimitInterval: '240'
71
75
```
72
76
73
77
### restartAt: "04.30"
78
+
74
79
Restarts deployment at 04:30. Attempts to restart deployment stop after deployment has been successfully restarted or an hour has passed. It is possible to define multiple restart points by separating them with underscores, for example "restartAt": "13.00_18.50".
75
80
76
81
### restartLimitInterval: "240"
82
+
77
83
Optional label that defines in minutes how long time has to be since the last restart for a restart to trigger at the time defined in "restartAt" label. If "restartLimitInterval" is not defined, the default value will be 1080 minutes (18 hours).
78
84
79
85
## Deployment image freshness monitoring
@@ -83,15 +89,17 @@ Optionally, it can be checked that an image has been updated within the last 12
83
89
Example config:
84
90
85
91
```yaml
86
-
metadata:
87
-
labels:
88
-
update: "auto"
89
-
checkImageFreshnessAt: "09.00"
90
-
imageFreshnessTitle: "Service_X"
92
+
metadata:
93
+
labels:
94
+
update: 'auto'
95
+
checkImageFreshnessAt: '09.00'
96
+
imageFreshnessTitle: 'Service_X'
91
97
```
92
98
93
99
### checkImageFreshnessAt: "04.30"
100
+
94
101
Label that defines when the check is done in `hh.mm`. If multiple deployments have identical check times, the checks and messaging are grouped together.
95
102
96
103
### imageFreshnessTitle: "240"
104
+
97
105
The title which is used for the deployment when messaging about image freshness over slack.
0 commit comments