-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from aagumin/feature/mtls
Feature/mtls
- Loading branch information
Showing
11 changed files
with
174 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,3 +166,4 @@ cython_debug/ | |
|
||
# custom values file | ||
charts/values.yaml | ||
charts/values-st2.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
FROM eclipse-temurin:17 as builder | ||
|
||
ENV MAVEN_OPTS="-Xss64m -Xmx2g -XX:ReservedCodeCacheSize=1g" | ||
ENV SPARK_VERSION=3.5.3 | ||
ENV SPARK_HOME=/opt/spark | ||
ENV SPARK_TGZ_URL=https://archive.apache.org/dist/spark/spark-${SPARK_VERSION}/spark-${SPARK_VERSION}.tgz | ||
|
||
WORKDIR /opt | ||
|
||
RUN apt-get update; \ | ||
apt-get install -y wget patch gettext-base gnupg2 bash tini libc6 libpam-modules krb5-user libnss3 procps net-tools gosu libnss-wrapper; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
RUN set -ex; \ | ||
mkdir -p $SPARK_HOME; \ | ||
wget -nv -O /opt/spark.tgz "$SPARK_TGZ_URL"; \ | ||
tar -zxf /opt/spark.tgz --strip-components=1 --directory=$SPARK_HOME; \ | ||
rm /opt/spark.tgz | ||
|
||
|
||
WORKDIR $SPARK_HOME | ||
|
||
COPY mtls/spark-40909.patch . | ||
RUN patch -p1 < $SPARK_HOME/spark-40909.patch | ||
|
||
RUN ./dev/make-distribution.sh \ | ||
--name spark-mtls \ | ||
-Pconnect \ | ||
-Pkubernetes \ | ||
-Phadoop-3 \ | ||
-Phadoop-cloud \ | ||
-Pparquet-provided \ | ||
-Phive \ | ||
-Phive-thriftserver | ||
|
||
## IMPORTANT! We must delete the spark-connect-commom jar from the jars directory! | ||
## see: https://issues.apache.org/jira/browse/SPARK-45201 | ||
#RUN rm "${SPARK_HOME}/jars/spark-connect-common_${SCALA_VERSION}-${SPARK_VERSION}.jar" | ||
FROM python:3.10.14-slim-bookworm | ||
ARG spark_uid=185 | ||
ENV SPARK_HOME=/opt/spark | ||
|
||
RUN apt-get update; \ | ||
apt-get install -y --no-install-recommends openjdk-17-jre tini procps gettext-base maven gettext-base curl; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
RUN groupadd --system --gid=${spark_uid} spark && \ | ||
useradd --system --uid=${spark_uid} --gid=spark spark | ||
|
||
COPY --from=builder /opt/spark/dist/ ${SPARK_HOME}/ | ||
|
||
RUN chown -R spark:spark ${SPARK_HOME}/ | ||
|
||
RUN cp ${SPARK_HOME}/kubernetes/dockerfiles/spark/entrypoint.sh /opt/entrypoint.sh; \ | ||
chmod a+x /opt/entrypoint.sh; \ | ||
cp ${SPARK_HOME}/kubernetes/dockerfiles/spark/decom.sh /opt/decom.sh; \ | ||
chmod a+x /opt/decom.sh | ||
|
||
COPY mtls/scripts/wait_for_istio_sidecar.sh /opt/scripts/wait_for_istio_sidecar.sh | ||
RUN chmod +x /opt/scripts/wait_for_istio_sidecar.sh | ||
|
||
COPY mtls/scripts/stop_istio_sidecar.sh /opt/scripts/stop_istio_sidecar.sh | ||
RUN chmod +x /opt/scripts/stop_istio_sidecar.sh | ||
|
||
# switch to spark user | ||
|
||
WORKDIR /opt | ||
COPY docker/pom.xml . | ||
|
||
RUN mvn validate | ||
|
||
RUN mvn install | ||
|
||
RUN mvn dependency:copy-dependencies package | ||
|
||
USER spark | ||
WORKDIR /home/spark | ||
|
||
COPY docker/requirements.txt . | ||
RUN pip install -r requirements.txt | ||
|
||
ENTRYPOINT ["/opt/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
# Define the namespace and pod name where the Istio sidecar is running | ||
|
||
# Function to stop the Istio sidecar | ||
stop_istio_sidecar() { | ||
echo "Stopping Istio sidecar for pod" | ||
|
||
# Send a termination signal to the istio-proxy sidecar | ||
curl -sf -XPOST 127.0.0.1:15000/quitquitquit | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "Istio sidecar stopped successfully." | ||
else | ||
echo "Failed to stop Istio sidecar." | ||
fi | ||
} | ||
|
||
# Call the function to stop the sidecar | ||
stop_istio_sidecar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# Function to check if the Istio sidecar is ready | ||
is_sidecar_ready() { | ||
# Check if the sidecar proxy (Envoy) is running and ready | ||
curl -s http://localhost:15000/ready | grep "LIVE" | ||
} | ||
|
||
# Wait for the sidecar proxy to be ready | ||
echo "Waiting for Istio sidecar to be ready..." | ||
until is_sidecar_ready; do | ||
echo "Sidecar not ready yet. Waiting..." | ||
sleep 3 | ||
done | ||
|
||
echo "Istio sidecar is ready." |
Oops, something went wrong.