Skip to content

Commit a1c4235

Browse files
authored
Merge pull request #49 from scality/feature/RELENG-4942-add-monitoring
First monitoring setup
2 parents 0c65185 + 8258473 commit a1c4235

File tree

18 files changed

+216
-22
lines changed

18 files changed

+216
-22
lines changed

.github/workflows/tests.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,20 @@ jobs:
3333
restore-keys: |
3434
${{ runner.os }}-multi-buildx
3535
36-
- name: Login to Registry
36+
- name: Login to ghcr Registry
3737
uses: docker/login-action@v1
3838
with:
3939
registry: ghcr.io
4040
username: ${{ github.repository_owner }}
4141
password: ${{ secrets.GITHUB_TOKEN }}
4242

43+
- name: Login to Scality Registry
44+
uses: docker/login-action@v1
45+
with:
46+
registry: registry.scality.com
47+
username: ${{ secrets.REGISTRY_LOGIN }}
48+
password: ${{ secrets.REGISTRY_PASSWORD }}
49+
4350
- name: Build and push
4451
uses: docker/build-push-action@v2
4552
with:
@@ -53,6 +60,16 @@ jobs:
5360
# And: https://github.com/docker/buildx#--cache-tonametypetypekeyvalue
5461
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
5562

63+
- name: Build and push manager
64+
uses: docker/build-push-action@v2
65+
with:
66+
context: .
67+
file: ./manager.Dockerfile
68+
push: true
69+
tags: "registry.scality.com/openstack-actions-runner-dev/openstack-actions-runner:${{ github.sha }}"
70+
cache-from: type=local,src=/tmp/.buildx-cache
71+
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
72+
5673
- name: Move cache
5774
run: |
5875
rm -rf /tmp/.buildx-cache

charts/openstack-actions-runner/templates/deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ kind: Deployment
33
metadata:
44
name: {{ include "openstack-actions-runner.fullname" . }}
55
labels:
6+
role: manager
67
{{- include "openstack-actions-runner.labels" . | nindent 4 }}
78
spec:
89
selector:
910
matchLabels:
11+
role: manager
1012
{{- include "openstack-actions-runner.selectorLabels" . | nindent 6 }}
1113
template:
1214
metadata:
@@ -18,6 +20,7 @@ spec:
1820
{{- toYaml . | nindent 8 }}
1921
{{- end }}
2022
labels:
23+
role: manager
2124
{{- include "openstack-actions-runner.selectorLabels" . | nindent 8 }}
2225
spec:
2326
{{- with .Values.imagePullSecrets }}
@@ -37,6 +40,9 @@ spec:
3740
args: ["--settings-file", "/app/config/settings.yml"]
3841
resources:
3942
{{- toYaml .Values.resources | nindent 12 }}
43+
ports:
44+
- name: metrics
45+
containerPort: {{ .Values.metricsPort }}
4046
env:
4147
- name: REDIS_PASSWORD
4248
valueFrom:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "openstack-actions-runner.fullname" . }}-manager
5+
labels:
6+
role: manager
7+
{{- include "openstack-actions-runner.labels" . | nindent 4 }}
8+
spec:
9+
type: {{ .Values.deployment.service.type }}
10+
ports:
11+
- name: metrics
12+
port: {{ .Values.metricsPort }}
13+
protocol: TCP
14+
selector:
15+
role: manager
16+
{{- include "openstack-actions-runner.selectorLabels" . | nindent 4 }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{ if .Values.serviceMonitor.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
name: {{ include "openstack-actions-runner.fullname" . }}-manager
6+
labels:
7+
{{- include "openstack-actions-runner.labels" . | nindent 4 }}
8+
{{- if .Values.serviceMonitor.labels }}
9+
{{- toYaml .Values.serviceMonitor.labels | nindent 4 }}
10+
{{- end }}
11+
spec:
12+
endpoints:
13+
- interval: {{ .Values.serviceMonitor.interval }}
14+
scrapeTimeout: {{ .Values.serviceMonitor.timeout }}
15+
port: metrics
16+
path: "/"
17+
selector:
18+
matchLabels:
19+
role: manager
20+
{{- include "openstack-actions-runner.labels" . | nindent 6 }}
21+
namespaceSelector:
22+
matchNames:
23+
- {{ .Release.Namespace | quote }}
24+
{{- end }}

charts/openstack-actions-runner/templates/settings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ data:
88
cloud_nine_region: {{ .Values.cloudNineRegion }}
99
cloud_nine_tenant: {{ .Values.cloudNineTenant }}
1010
python_config: {{ .Values.pythonConfigModule }}
11+
metrics_port: {{ .Values.metricsPort }}
1112
runner_pool:
1213
{{ .Values.runnerPool | toYaml | indent 6 }}
1314
extra_runner_timer:

charts/openstack-actions-runner/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,10 @@ redis:
144144
networkPolicy:
145145
enabled: true
146146

147+
metricsPort: 5000
148+
149+
serviceMonitor:
150+
enabled: false
151+
labels: {}
152+
interval: 30s
153+
timeout: 30s

config_example.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Your github organization on witch you want to attache your self-hosted runners
1+
# Your github organization where you want to attach your self-hosted runners
22
github_organization: ""
33

44
# Cloud nine connection infos
@@ -42,3 +42,7 @@ timeout_runner_timer:
4242
redis:
4343
host: redis
4444
port: 6379
45+
46+
47+
# The Openmetrics port
48+
metrics_port: 5000

docker-compose.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
version: "3.9"
22
services:
33
runner_manager:
4-
build: .
4+
build:
5+
context: .
6+
dockerfile: manager.Dockerfile
57
command:
68
- python3
79
- /app/runners_manager/start.py
@@ -16,6 +18,8 @@ services:
1618
environment:
1719
- PYTHONUNBUFFERED=0
1820
- PYTHONIOENCODING=UTF-8
21+
ports:
22+
- 5000:5000
1923

2024
web:
2125
build:
@@ -39,3 +43,5 @@ services:
3943
- "8080:8080"
4044
redis:
4145
image: "redis:alpine"
46+
ports:
47+
- 6379:6379

manager-requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ coverage==5.5
99
marshmallow==3.12.1
1010
wheel==0.36.2
1111
redis==3.5.3
12-
fakeredis==1.6.0
12+
fakeredis==1.6.0
13+
prometheus-client==0.12.0

manager.Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ RUN apt-get --assume-yes update \
3030

3131

3232
WORKDIR /app
33-
COPY ./ /app/
33+
34+
COPY manager-requirements.txt /app/
35+
36+
RUN pip3 install -r manager-requirements.txt
37+
38+
COPY . /app/
39+
3440
RUN pip3 install . --use-feature=in-tree-build
3541

3642
CMD runner-manager

0 commit comments

Comments
 (0)