Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix vulnerabilities in docker image #109

Merged
merged 2 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ RUN curl -L https://archive.apache.org/dist/pinot/apache-pinot-$PINOT_VERSION/ap
mv apache-pinot-$PINOT_VERSION-bin $PINOT_HOME && \
rm -rf $PINOT_HOME/examples && \
rm -rf $PINOT_HOME/lib/* && \
rm -rf $PINOT_HOME/plugins/*
rm -rf $PINOT_HOME/plugins/* && \
rm -rf $PINOT_HOME/plugins-external/*

# Fetch jar
RUN curl -L -o $PINOT_HOME/lib/pinot-all-${JITPACK_TAG}-shaded.jar \
https://jitpack.io/com/github/${JITPACK_REPO}/pinot-distribution/${JITPACK_TAG}/pinot-distribution-${JITPACK_TAG}-shaded.jar

# Fetch plugin jars
RUN for artifactId in pinot-kafka-2.0 pinot-kinesis pinot-thrift pinot-json pinot-parquet pinot-orc pinot-csv pinot-confluent-avro pinot-avro pinot-protobuf pinot-batch-ingestion-standalone pinot-batch-ingestion-hadoop pinot-batch-ingestion-spark pinot-hdfs pinot-adls pinot-gcs pinot-s3 pinot-minion-builtin-tasks pinot-segment-uploader-default pinot-segment-writer-file-based pinot-dropwizard pinot-yammer; do \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the following 3 plugins having critical vulnerabilities:

  1. pinot-input-format/pinot-orc
  2. pinot-input-format/pinot-parquet
  3. pinot-batch-ingestion/pinot-batch-ingestion-spark

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming we are not using them?

RUN for artifactId in pinot-kafka-2.0 pinot-kinesis pinot-thrift pinot-json pinot-csv pinot-confluent-avro pinot-avro pinot-protobuf pinot-batch-ingestion-standalone pinot-batch-ingestion-hadoop pinot-hdfs pinot-adls pinot-gcs pinot-s3 pinot-minion-builtin-tasks pinot-segment-uploader-default pinot-segment-writer-file-based pinot-dropwizard pinot-yammer; do \
curl -L -o $PINOT_HOME/plugins/${artifactId}-${JITPACK_TAG}-shaded.jar \
https://jitpack.io/com/github/${JITPACK_REPO}/${artifactId}/${JITPACK_TAG}/${artifactId}-${JITPACK_TAG}-shaded.jar; \
done

FROM openjdk:11-jre-slim
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openjdk images are deprecated. docker-library/openjdk#505

FROM eclipse-temurin:11-jre-jammy
LABEL maintainer="Hypertrace https://www.hypertrace.org/"

ENV PINOT_HOME=/opt/pinot
Expand Down
22 changes: 18 additions & 4 deletions helm/templates/controller/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,19 @@ spec:
exitCode=1
i=0
while [ $i -le {{ .Values.zookeeper.retries }} ]; do
bin/zookeeper-shell.sh ZooKeeper -server {{ include "zookeeper.url" . | quote }} create {{ .Values.zookeeper.path | quote }} ""
bin/zookeeper-shell.sh ZooKeeper -server {{ include "zookeeper.url" . | quote }} ls {{ .Values.zookeeper.path | quote }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new image returns error if the node already exist in zookeeper.

WatchedEvent state:SyncConnected type:None path:null
Node already exists: /pinot
[2022-10-20 16:45:45,596] ERROR Exiting JVM with code 1 (org.apache.zookeeper.util.ServiceUtils)

updated script to first check the node before creating it.

if [ $? -eq 0 ]; then
exitCode=0
break
else
bin/zookeeper-shell.sh ZooKeeper -server {{ include "zookeeper.url" . | quote }} create {{ .Values.zookeeper.path | quote }} ""
if [ $? -eq 0 ]; then
exitCode=0
break
fi
sleep {{ .Values.zookeeper.retryInterval }}
i=`expr $i + 1`
fi
sleep {{ .Values.zookeeper.retryInterval }}
i=`expr $i + 1`
done
exit $exitCode
{{- end }}
Expand Down Expand Up @@ -133,9 +139,15 @@ spec:
- name: log-config
configMap:
name: {{ include "pinot.controller.fullname" . }}-log-config
{{- if not .Values.controller.persistence.enabled }}
{{- if .Values.controller.persistence.existingClaim }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if existingClaim is defined, it will be used instead of creating a new PVC.

- name: pinot-controller-storage
persistentVolumeClaim:
claimName: {{ .Values.controller.persistence.existingClaim | quote }}
{{- else }}
{{- if not .Values.controller.persistence.enabled }}
- name: pinot-controller-storage
emptyDir: {}
{{- end }}
{{- end }}
{{- if eq .Values.cluster.storage.scheme "gs" }}
- name: gcs-iam-secret
Expand Down Expand Up @@ -163,6 +175,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.controller.persistence.enabled }}
{{- if not .Values.controller.persistence.existingClaim }}
volumeClaimTemplates:
- metadata:
name: pinot-controller-storage
Expand All @@ -179,5 +192,6 @@ spec:
resources:
requests:
storage: {{ .Values.controller.persistence.size | quote}}
{{- end }}
{{- end }}
{{- end }}
13 changes: 7 additions & 6 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ controller:
size: 2Gi
mountPath: /var/pinot/controller/data
storageClass: "standard"
existingClaim: ""

data:
dir: /var/pinot/controller/data
Expand Down Expand Up @@ -130,7 +131,7 @@ controller:
port: 7071
image:
repository: hypertrace/prometheus-jmx-exporter
tag: 0.1.0
tag: 0.1.1
pullPolicy: IfNotPresent
resources:
requests:
Expand Down Expand Up @@ -246,7 +247,7 @@ broker:
port: 7071
image:
repository: hypertrace/prometheus-jmx-exporter
tag: 0.1.0
tag: 0.1.1
pullPolicy: IfNotPresent
resources:
requests:
Expand Down Expand Up @@ -352,7 +353,7 @@ minion:
port: 7071
image:
repository: hypertrace/prometheus-jmx-exporter
tag: 0.1.0
tag: 0.1.1
pullPolicy: IfNotPresent
resources:
requests:
Expand Down Expand Up @@ -457,7 +458,7 @@ server:
port: 7071
image:
repository: hypertrace/prometheus-jmx-exporter
tag: 0.1.0
tag: 0.1.1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pullPolicy: IfNotPresent
resources:
requests:
Expand Down Expand Up @@ -565,7 +566,7 @@ zookeeper:
retries: 10
retryInterval: 5
image:
repository: "solsson/kafka"
tag: "2.1.0@sha256:ac3f06d87d45c7be727863f31e79fbfdcb9c610b51ba9cf03c75a95d602f15e1"
repository: "hypertrace/kafka"
tag: "0.2.0"
pullPolicy: IfNotPresent
pullSecret: ""