Skip to content

Commit 3a57988

Browse files
ipa
1 parent caafe42 commit 3a57988

9 files changed

Lines changed: 145 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: ironic-prometheus-exporter
5+
namespace: openstack
6+
labels:
7+
app: ironic-prometheus-exporter
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: ironic-prometheus-exporter
13+
template:
14+
metadata:
15+
labels:
16+
app: ironic-prometheus-exporter
17+
spec:
18+
containers:
19+
- name: ironic-prometheus-exporter
20+
image: ghcr.io/rackerlabs/understack/ironic-prometheus-exporter:latest
21+
imagePullPolicy: IfNotPresent
22+
ports:
23+
- name: metrics
24+
containerPort: 8000
25+
protocol: TCP
26+
volumeMounts:
27+
- name: ironic-prometheus-exporter
28+
mountPath: /opt/stack/node_metrics
29+
readOnly: true
30+
# Uncomment and adjust if your container requires explicit arguments
31+
# args:
32+
# - --metrics-path
33+
# - /opt/stack/node_metrics
34+
# - --port
35+
# - "8000"
36+
resources:
37+
requests:
38+
cpu: 50m
39+
memory: 64Mi
40+
limits:
41+
cpu: 250m
42+
memory: 256Mi
43+
volumes:
44+
- name: ironic-prometheus-exporter
45+
persistentVolumeClaim:
46+
claimName: pvc-ironic-prometheus-exporter
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- deployment.yaml
6+
- service.yaml
7+
- service-monitor.yaml
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: monitoring.coreos.com/v1
2+
kind: ServiceMonitor
3+
metadata:
4+
name: ironic-prometheus-exporter
5+
namespace: openstack
6+
spec:
7+
selector:
8+
matchLabels:
9+
app: ironic-prometheus-exporter
10+
namespaceSelector:
11+
matchNames:
12+
- openstack
13+
endpoints:
14+
- port: metrics
15+
interval: 30s
16+
path: /metrics
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: ironic-prometheus-exporter
5+
namespace: openstack
6+
labels:
7+
app: ironic-prometheus-exporter
8+
spec:
9+
type: ClusterIP
10+
selector:
11+
app: ironic-prometheus-exporter
12+
ports:
13+
- name: metrics
14+
port: 8000
15+
targetPort: 8000
16+
protocol: TCP
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
labels:
5+
undercloud.local/purpose: ironic-prometheus-exporter
6+
name: pvc-ironic-prometheus-exporter
7+
namespace: openstack
8+
spec:
9+
accessModes:
10+
- ReadWriteMany
11+
resources:
12+
requests:
13+
storage: 1Gi

components/ironic/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ pod:
230230
- name: ironic-etc-snippets
231231
mountPath: /etc/ironic/ironic.conf.d
232232
readOnly: true
233+
- name: ironic-prometheus-exporter
234+
mountPath: /opt/stack/node_metrics
233235
volumes:
234236
- name: dnsmasq-ironic
235237
persistentVolumeClaim:
@@ -247,6 +249,9 @@ pod:
247249
name: ironic-ks-etc
248250
- name: pod-usr-share-novnc
249251
emptyDir: {}
252+
- name: ironic-prometheus-exporter
253+
persistentVolumeClaim:
254+
claimName: pvc-ironic-prometheus-exporter
250255
ironic_api:
251256
ironic_api:
252257
volumeMounts:
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM python:3.12-slim AS prod
2+
3+
ENV PIP_NO_CACHE_DIR=off \
4+
PIP_DISABLE_PIP_VERSION_CHECK=on \
5+
PIP_DEFAULT_TIMEOUT=100
6+
7+
RUN apt-get update \
8+
&& apt-get install -y --no-install-recommends \
9+
git \
10+
&& apt-get autoremove -y \
11+
&& apt-get clean \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
COPY containers/ironic-prometheus-exporter/requirements.txt /
15+
16+
RUN --mount=type=cache,target=/root/.cache/pip pip install -r /requirements.txt dumb-init==1.2.5
17+
18+
RUN useradd -m -d /runner -s /bin/bash runner
19+
WORKDIR /runner
20+
USER runner
21+
22+
# RUN --mount=type=cache,target=/root/.cache/pip ansible-galaxy collection install -r /requirements.yml
23+
24+
# ENTRYPOINT ["dumb-init"]
25+
# CMD ["ansible-runner"]
26+
CMD ["python", "-m", "flask", "run"]
27+
# gunicorn3 -b <ip_address>:9608 \
28+
# --env IRONIC_CONFIG=$IRONIC_CONFIG \
29+
# --env FLASK_DEBUG=1 -w 4 \
30+
# --access-logfile=ipe_access.log \
31+
# --error-logfile=ipe_errors.log \
32+
# -D ironic_prometheus_exporter.app.wsgi:application
33+
# CMD [
34+
# "gunicorn", "-b", "0.0.0.0:9608"
35+
# ]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ironic-prometheus-exporter
2+
3+
``` bash
4+
docker build -t ironic-prometheus-exporter -f containers/ironic-prometheus-exporter/Dockerfile .
5+
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ironic-prometheus-exporter
2+
gunicorn

0 commit comments

Comments
 (0)