Skip to content

Commit 7e7e59c

Browse files
committed
LOG-1272: Fix various flaws in elasticsearch5 image related to jaskson library
Converge on single dockerfile that can consume content built by PNC for CI and also is buildable downstream. (cherry picked from commit 3d7d8c6)
1 parent fec558a commit 7e7e59c

15 files changed

+44
-104
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/prometheus-exporter-*.zip
12
*~
23
_output/
34

elasticsearch/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.rhel8

elasticsearch/Dockerfile.origin

Lines changed: 0 additions & 60 deletions
This file was deleted.

elasticsearch/Dockerfile.origin

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.rhel8

elasticsearch/Dockerfile.rhel8

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,26 @@ FROM registry.ci.openshift.org/ocp/builder:rhel-8-base-openshift-4.7
22

33
MAINTAINER OpenShift Development <[email protected]>
44

5+
LABEL \
6+
License="GPLv2+" \
7+
io.k8s.description="Elasticsearch container for EFK aggregated logging storage" \
8+
io.k8s.display-name="Elasticsearch 6" \
9+
io.openshift.tags="logging,elk,elasticsearch" \
10+
vendor="Red Hat" \
11+
name="openshift/ose-logging-elasticsearch6" \
12+
com.redhat.component="logging-elasticsearch6-container" \
13+
io.openshift.maintainer.product="OpenShift Container Platform" \
14+
io.openshift.maintainer.component="Logging"
15+
516
EXPOSE 9200
617
EXPOSE 9300
718
USER 0
819

20+
ARG ES_ARCHIVE_URL
21+
ARG PROMETHEUS_EXPORTER_URL
22+
ARG OPENDISTRO_URL
23+
ARG OPENSHIFT_CI
24+
925
ENV ES_PATH_CONF=/etc/elasticsearch/ \
1026
ES_HOME=/usr/share/elasticsearch \
1127
ES_VER=6.8.1.redhat-00006 \
@@ -14,16 +30,17 @@ ENV ES_PATH_CONF=/etc/elasticsearch/ \
1430
JAVA_VER=11 \
1531
JAVA_HOME=/usr/lib/jvm/jre \
1632
NODE_QUORUM=1 \
17-
PROMETHEUS_EXPORTER_VER=6.8.1.0-redhat-1 \
33+
PROMETHEUS_EXPORTER_VER=6.8.1.0 \
1834
OPENDISTRO_VER=0.10.0.4-redhat-00001 \
1935
PLUGIN_LOGLEVEL=INFO \
2036
RECOVER_AFTER_NODES=1 \
2137
RECOVER_EXPECTED_NODES=1 \
2238
RECOVER_AFTER_TIME=5m \
2339
DHE_TMP_KEY_SIZE=2048 \
24-
RELEASE_STREAM=prod
40+
RELEASE_STREAM=prod \
41+
OPENSHIFT_CI=${OPENSHIFT_CI:-false}
2542

26-
ARG MAVEN_REPO_URL=file:///artifacts/
43+
ARG MAVEN_REPO_URL=${MAVEN_REPO_URL:-file:///artifacts/}
2744

2845
RUN packages="java-${JAVA_VER}-openjdk-headless \
2946
python36 python3-pyyaml \
@@ -44,19 +61,17 @@ RUN mkdir /artifacts
4461
# In an OSBS build, this will COPY artifacts from fetch-artifacts-koji.yaml. In a CI build, it will just
4562
# copy the README.MD.
4663
COPY artifacts/* /artifacts
64+
COPY *.zip /
4765
RUN /var/tmp/install-es.sh
4866

4967
ADD sgconfig/ ${HOME}/sgconfig/
5068
ADD index_templates/ ${ES_HOME}/index_templates/
5169
ADD index_patterns/ ${ES_HOME}/index_patterns/
5270
ADD init/ ${ES_HOME}/init/
5371
ADD probe/ ${ES_HOME}/probe/
54-
ADD init.sh run.sh prep-install* install.sh ci-env.sh ${HOME}/
72+
ADD init.sh run.sh ci-env.sh install.sh ${HOME}/
5573
COPY utils/** /usr/local/bin/
5674

57-
ARG PROMETHEUS_EXPORTER_URL=${MAVEN_REPO_URL}org/elasticsearch/plugin/prometheus/prometheus-exporter/${PROMETHEUS_EXPORTER_VER}/prometheus-exporter-${PROMETHEUS_EXPORTER_VER}.zip
58-
ARG OPENDISTRO_URL=${MAVEN_REPO_URL}com/amazon/opendistroforelasticsearch/opendistro_security/${OPENDISTRO_VER}/opendistro_security-${OPENDISTRO_VER}.zip
59-
6075
RUN ${HOME}/install.sh && rm -rf /artifacts
6176

6277
WORKDIR ${HOME}

elasticsearch/ci-env.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
set -o xtrace
44

5+
#PROMETHEUS_EXPORTER_URL=${PROMETHEUS_EXPORTER_URL:-$MAVEN_REPO_URL/org/elasticsearch/plugin/prometheus/prometheus-exporter/$PROMETHEUS_EXPORTER_VER/prometheus-exporter-$PROMETHEUS_EXPORTER_VER.zip}
6+
PROMETHEUS_EXPORTER_URL=file:///prometheus-exporter-$PROMETHEUS_EXPORTER_VER.zip
7+
OPENDISTRO_URL=${OPENDISTRO_URL:-$MAVEN_REPO_URL/com/amazon/opendistroforelasticsearch/opendistro_security/$OPENDISTRO_VER/opendistro_security-$OPENDISTRO_VER.zip}
8+
59
if [[ "${OPENSHIFT_CI:-}" == "true" ]]; then
610
# This flag is set during CI runs. If no ARG was passed in,
711
# default to maven.org.
8-
export RELEASE_STREAM=origin
9-
export ES_VER=6.8.1
10-
export PROMETHEUS_EXPORTER_VER=6.8.1.0
11-
export OPENDISTRO_VER=0.10.1.0
12-
export MAVEN_REPO_URL="https://repo1.maven.org/maven2/"
13-
export PROMETHEUS_EXPORTER_URL=https://github.com/vvanholl/elasticsearch-prometheus-exporter/releases/download/6.8.1.0/prometheus-exporter-6.8.1.0.zip
14-
export OPENDISTRO_URL=https://github.com/jcantrill/security/releases/download/v0.10.1.0/opendistro_security-0.10.1.0.zip
12+
export ES_ARCHIVE_URL=https://github.com/openshift/origin-aggregated-logging/releases/download/elasticsearch-oss-$ES_VER/elasticsearch-oss-$ES_VER.zip
13+
export OPENDISTRO_URL=https://github.com/openshift/origin-aggregated-logging/releases/download/opendistro_security-$OPENDISTRO_VER/opendistro_security-$OPENDISTRO_VER.zip
14+
export PROMETHEUS_EXPORTER_URL=https://github.com/vvanholl/elasticsearch-prometheus-exporter/releases/download/$PROMETHEUS_EXPORTER_VER/prometheus-exporter-$PROMETHEUS_EXPORTER_VER.zip
1515
fi
16+
es_plugins=($OPENDISTRO_URL $PROMETHEUS_EXPORTER_URL)

elasticsearch/dummy.zip

Whitespace-only changes.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
- nvr: org.elasticsearch-elasticsearch-6.8.1.redhat_00006-1
2-
- nvr: org.elasticsearch.plugin.prometheus-elasticsearch-prometheus-exporter-6.8.1.0_redhat_1-2
32
- nvr: com.amazon.opendistroforelasticsearch-opendistro_security-0.10.0.4_redhat_00001-1
4-

elasticsearch/install-es.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ cd /var/tmp
1212
ES_ARCHIVE_URL=${ES_ARCHIVE_URL:-${MAVEN_REPO_URL}org/elasticsearch/distribution/zip/elasticsearch-oss/${ES_VER}/elasticsearch-oss-${ES_VER}.zip}
1313
curl -L -v -s -o es.zip ${ES_ARCHIVE_URL}
1414
unzip es.zip
15+
mv elasticsearch-$(echo $ES_VER | cut -d'.' -f1-3) elasticsearch-${ES_VER}
1516
pushd elasticsearch-${ES_VER}
1617
mkdir -p ${ES_HOME}/bin
1718
install -p -m 755 bin/elasticsearch bin/elasticsearch-cli bin/elasticsearch-keystore \
@@ -44,4 +45,4 @@ chmod u+rwx,g+rwx ${ES_HOME}/logs
4445
mkdir -p /var/run/elasticsearch
4546
chmod u+rwx,g+rwx /var/run/elasticsearch
4647
mkdir /elasticsearch && chmod og+w /elasticsearch
47-
rm -rf elasticsearch-${ES_VER} es.zip extra-jvm.options
48+
rm -rf elasticsearch-$(echo $ES_VER | cut -d'.' -f1-3) es.zip extra-jvm.options

elasticsearch/install.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ source $(dirname "$0")/ci-env.sh
66

77
ln -s /usr/local/bin/logging ${HOME}/logging
88

9-
source ${HOME}/prep-install.${RELEASE_STREAM}
10-
119
echo "removing module: ingest-geoip"
1210
rm -rf ${ES_HOME}/modules/ingest-geoip
1311

elasticsearch/prep-install.origin

Lines changed: 0 additions & 11 deletions
This file was deleted.

elasticsearch/prep-install.prod

Lines changed: 0 additions & 7 deletions
This file was deleted.

elasticsearch/sources

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SHA512 (prometheus-exporter-6.8.1.0.zip) = 46ebce3ae296836917fcfafbfd5142e1bdd2747847a1d9f62129c37ed72440a8a084f56001a7ad269c84c6ff36f3e4da971caa1a5bf548c2f3d7a180bc45a0f6

hack/build-component-image.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,9 @@ echo "-
2828
echo "Building image $dir - this may take a few minutes until you see any output..."
2929
echo "- -"
3030
echo "----------------------------------------------------------------------------------------------------------------"
31-
podman build -f $dfpath -t "$fullimagename" $dir
31+
buildargs=""
32+
if [ "$dir" = "elasticsearch" ] ; then
33+
buildargs="--build-arg OPENSHIFT_CI=true"
34+
fi
35+
36+
podman build $buildargs -f $dfpath -t "$fullimagename" $dir

hack/build-images.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,17 +304,12 @@ if [ "${PUSH_ONLY:-false}" = false ] ; then
304304
mountarg=""
305305
fi
306306

307-
suffix=""
308-
if [ "$img" = "logging-elasticsearch6" ] ; then
309-
suffix=".origin"
310-
fi
311-
312307
echo "----------------------------------------------------------------------------------------------------------------"
313308
echo "- -"
314309
echo "Building image $img - this may take a few minutes until you see any output..."
315310
echo "- -"
316311
echo "----------------------------------------------------------------------------------------------------------------"
317-
$IMAGE_BUILDER build $IMAGE_BUILDER_OPTS $mountarg -f $dfpath$suffix -t "$fullimagename" $dir
312+
$(pwd)/hack/build-component-image.sh $dir $fullimagename
318313
dir=""
319314
img=""
320315
done

kibana/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile.rhel8

0 commit comments

Comments
 (0)