Skip to content

Commit 18eece9

Browse files
authored
feat(opensearch): Add prometheus-exporter plugin to opensearch image (#1223)
* add elasticsearch exporter to opensearch image * add changelog entry * switch from elasticsearch-exporter to opensearch-prometheus-exporter
1 parent 5f73e7c commit 18eece9

File tree

9 files changed

+113
-0
lines changed

9 files changed

+113
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
99
- ubi9-rust-builder: Include `.tar.gz` snapshots of the operator source code in container images ([#1207])
1010
- opensearch: Add Opensearch as new product with version `3.1.0` ([#1215]).
1111
- opensearch: Use build-repo.stackable.tech instead of Maven Central ([#1222]).
12+
- opensearch: Add the `opensearch-prometheus-exporter` plugin to the image ([#1223]).
1213
- nifi: Backport NIFI-14848 to NiFi ([#1225])
1314

1415
### Changed
@@ -21,6 +22,7 @@ All notable changes to this project will be documented in this file.
2122
[#1219]: https://github.com/stackabletech/docker-images/pull/1219
2223
[#1220]: https://github.com/stackabletech/docker-images/pull/1220
2324
[#1222]: https://github.com/stackabletech/docker-images/pull/1222
25+
[#1223]: https://github.com/stackabletech/docker-images/pull/1223
2426
[#1225]: https://github.com/stackabletech/docker-images/pull/1225
2527

2628
## [25.7.0] - 2025-07-23

conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
opensearch_security_plugin = importlib.import_module(
3434
"opensearch.security-plugin.versions"
3535
)
36+
opensearch_prometheus_exporter = importlib.import_module(
37+
"opensearch.opensearch-prometheus-exporter.versions"
38+
)
3639
spark_k8s = importlib.import_module("spark-k8s.versions")
3740
stackable_base = importlib.import_module("stackable-base.versions")
3841
stackable_devel = importlib.import_module("stackable-devel.versions")
@@ -75,6 +78,10 @@
7578
"name": "opensearch/security-plugin",
7679
"versions": opensearch_security_plugin.versions,
7780
},
81+
{
82+
"name": "opensearch/opensearch-prometheus-exporter",
83+
"versions": opensearch_prometheus_exporter.versions,
84+
},
7885
{"name": "spark-k8s", "versions": spark_k8s.versions},
7986
{"name": "stackable-base", "versions": stackable_base.versions},
8087
{"name": "stackable-devel", "versions": stackable_devel.versions},

opensearch/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
# check=error=true
33

44
FROM stackable/image/opensearch/security-plugin AS opensearch-security-plugin
5+
FROM stackable/image/opensearch/opensearch-prometheus-exporter AS opensearch-prometheus-exporter
56
FROM stackable/image/java-devel AS opensearch-builder
67

78
ARG PRODUCT
89
ARG RELEASE
910
ARG OPENSEARCH_SECURITY_PLUGIN
11+
ARG OPENSEARCH_OPENSEARCH_PROMETHEUS_EXPORTER
1012
ARG STACKABLE_USER_UID
1113
ARG TARGETARCH
1214

@@ -56,6 +58,18 @@ rm opensearch-security-${OPENSEARCH_SECURITY_PLUGIN}.zip
5658
mv config /stackable/opensearch-${PRODUCT}/config/opensearch-security
5759
EOF
5860

61+
WORKDIR /stackable/opensearch-prometheus-exporter
62+
COPY \
63+
--chown=${STACKABLE_USER_UID}:0 \
64+
--from=opensearch-prometheus-exporter \
65+
/stackable/src/opensearch/opensearch-prometheus-exporter/patchable-work/worktree/${OPENSEARCH_OPENSEARCH_PROMETHEUS_EXPORTER}/build/distributions/prometheus-exporter-${OPENSEARCH_OPENSEARCH_PROMETHEUS_EXPORTER}.zip \
66+
opensearch-prometheus-exporter-${OPENSEARCH_OPENSEARCH_PROMETHEUS_EXPORTER}.zip
67+
68+
RUN <<EOF
69+
unzip opensearch-prometheus-exporter-${OPENSEARCH_SECURITY_PLUGIN}.zip
70+
rm opensearch-prometheus-exporter-${OPENSEARCH_SECURITY_PLUGIN}.zip
71+
EOF
72+
5973
WORKDIR /stackable/opensearch-${PRODUCT}
6074

6175
RUN <<EOF
@@ -77,6 +91,7 @@ FROM stackable/image/jdk-base AS final
7791
ARG PRODUCT
7892
ARG RELEASE
7993
ARG OPENSEARCH_SECURITY_PLUGIN
94+
ARG OPENSEARCH_OPENSEARCH_PROMETHEUS_EXPORTER
8095
ARG STACKABLE_USER_UID
8196

8297
ARG NAME="OpenSearch"
@@ -109,6 +124,11 @@ COPY \
109124
--from=opensearch-builder \
110125
/stackable/opensearch-security \
111126
/stackable/opensearch-${PRODUCT}-stackable${RELEASE}/plugins/opensearch-security
127+
COPY \
128+
--chown=${STACKABLE_USER_UID}:0 \
129+
--from=opensearch-builder \
130+
/stackable/opensearch-prometheus-exporter \
131+
/stackable/opensearch-${PRODUCT}-stackable${RELEASE}/plugins/prometheus-exporter
112132
COPY \
113133
--chown=${STACKABLE_USER_UID}:0 \
114134
--from=opensearch-builder \
@@ -119,6 +139,11 @@ COPY \
119139
--from=opensearch-security-plugin \
120140
/stackable/opensearch-security-${OPENSEARCH_SECURITY_PLUGIN}-stackable${RELEASE}-src.tar.gz \
121141
/stackable
142+
COPY \
143+
--chown=${STACKABLE_USER_UID}:0 \
144+
--from=opensearch-prometheus-exporter \
145+
/stackable/opensearch-prometheus-exporter-${OPENSEARCH_OPENSEARCH_PROMETHEUS_EXPORTER}-stackable${RELEASE}-src.tar.gz \
146+
/stackable
122147
COPY \
123148
--chown=${STACKABLE_USER_UID}:0 \
124149
--from=opensearch-builder \
@@ -129,6 +154,11 @@ COPY \
129154
--from=opensearch-security-plugin \
130155
/stackable/src/opensearch/security-plugin/patchable-work/worktree/${OPENSEARCH_SECURITY_PLUGIN}/build/reports/bom.json \
131156
/stackable/opensearch-security-${OPENSEARCH_SECURITY_PLUGIN}-stackable${RELEASE}.cdx.json
157+
COPY \
158+
--chown=${STACKABLE_USER_UID}:0 \
159+
--from=opensearch-prometheus-exporter \
160+
/stackable/src/opensearch/opensearch-prometheus-exporter/patchable-work/worktree/${OPENSEARCH_OPENSEARCH_PROMETHEUS_EXPORTER}/build/reports/bom.json \
161+
/stackable/opensearch-prometheus-exporter-${OPENSEARCH_OPENSEARCH_PROMETHEUS_EXPORTER}-stackable${RELEASE}.cdx.json
132162

133163
RUN <<EOF
134164
microdnf update
@@ -140,6 +170,7 @@ rm -rf /var/cache/yum
140170
chown ${STACKABLE_USER_UID}:0 ${HOME}
141171
chmod g=u /stackable/opensearch-${PRODUCT}-stackable${RELEASE}
142172
chmod g=u /stackable/opensearch-${PRODUCT}-stackable${RELEASE}/plugins/opensearch-security
173+
chmod g=u /stackable/opensearch-${PRODUCT}-stackable${RELEASE}/plugins/prometheus-exporter
143174
chmod g=u /stackable/*-src.tar.gz
144175
chmod g=u /stackable/*.cdx.json
145176
ln -s /stackable/opensearch-${PRODUCT}-stackable${RELEASE} ${OPENSEARCH_HOME}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# syntax=docker/dockerfile:1.16.0@sha256:e2dd261f92e4b763d789984f6eab84be66ab4f5f08052316d8eb8f173593acf7
2+
# check=error=true
3+
4+
FROM stackable/image/java-devel AS opensearch-prometheus-exporter-builder
5+
6+
ARG PRODUCT
7+
ARG RELEASE
8+
ARG STACKABLE_USER_UID
9+
10+
USER ${STACKABLE_USER_UID}
11+
WORKDIR /stackable
12+
13+
COPY --chown=${STACKABLE_USER_UID}:0 opensearch/opensearch-prometheus-exporter/stackable/patches/patchable.toml /stackable/src/opensearch/opensearch-prometheus-exporter/stackable/patches/patchable.toml
14+
COPY --chown=${STACKABLE_USER_UID}:0 opensearch/opensearch-prometheus-exporter/stackable/patches/${PRODUCT} /stackable/src/opensearch/opensearch-prometheus-exporter/stackable/patches/${PRODUCT}
15+
16+
RUN <<EOF
17+
cd "$(/stackable/patchable --images-repo-root=src checkout opensearch/opensearch-prometheus-exporter ${PRODUCT})"
18+
19+
# Create snapshot of the source code including custom patches
20+
tar -czf /stackable/opensearch-prometheus-exporter-${PRODUCT}-stackable${RELEASE}-src.tar.gz .
21+
./gradlew clean assemble -Dbuild.snapshot=false
22+
./gradlew cyclonedxBom --warning-mode=summary -Dbuild.snapshot=false
23+
EOF
24+
25+
RUN <<EOF
26+
# Change the group permissions already in the builder image to reduce the size of the final image.
27+
# see https://github.com/stackabletech/docker-images/issues/961
28+
chmod -R g=u /stackable
29+
EOF
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From f89f753d1bc03598bfe129c367233fec6daee078 Mon Sep 17 00:00:00 2001
2+
From: Benedikt Labrenz <[email protected]>
3+
Date: Tue, 12 Aug 2025 14:59:12 +0200
4+
Subject: Add CycloneDX plugin
5+
6+
---
7+
build.gradle | 14 ++++++++++++++
8+
1 file changed, 14 insertions(+)
9+
10+
diff --git a/build.gradle b/build.gradle
11+
index 6c09118..d47ae14 100644
12+
--- a/build.gradle
13+
+++ b/build.gradle
14+
@@ -63,6 +63,20 @@ buildscript {
15+
}
16+
}
17+
18+
+plugins {
19+
+ id "org.cyclonedx.bom" version "2.3.1"
20+
+}
21+
+
22+
+cyclonedxBom {
23+
+ includeConfigs = ["runtimeClasspath"]
24+
+ includeLicenseText = false
25+
+ skipConfigs = ["compileClasspath", "testCompileClasspath"]
26+
+ projectType = "application"
27+
+ schemaVersion = "1.6"
28+
+ outputFormat = "json"
29+
+ componentVersion = versions.version
30+
+}
31+
+
32+
apply plugin: 'java'
33+
apply plugin: 'idea'
34+
apply plugin: 'opensearch.opensearchplugin'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
base = "df60b43e34d0f7fba6be9e003924a413764df85e"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
upstream = "https://github.com/opensearch-project/opensearch-prometheus-exporter"
2+
default-mirror = "https://github.com/stackabletech/opensearch-prometheus-exporter"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
versions = [
2+
{
3+
"product": "3.1.0.0",
4+
"java-devel": "21",
5+
},
6+
]

opensearch/versions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"java-devel": "21",
55
"jdk-base": "21",
66
"opensearch/security-plugin": "3.1.0.0",
7+
"opensearch/opensearch-prometheus-exporter": "3.1.0.0",
78
},
89
]

0 commit comments

Comments
 (0)