-
-
Notifications
You must be signed in to change notification settings - Fork 3
[Merged by Bors] - Spark history server #187
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
Changes from 32 commits
91f5936
0fc5125
e5044f4
057f37c
a5abf76
34c3dd5
e587200
79ea167
8362df5
8f593c2
9d2c661
c82335c
dfb7d7b
16ff530
0027f45
a9622f7
6e26cb7
2895ab4
b2765f8
3c99f0d
935d9bf
21a20c3
6cec93c
9b382ba
977eb05
bfbc8dd
3b04da8
d14788a
d9c76c4
ad26663
918a2dd
2d20012
a21bc75
6af52e6
3070945
ae9e5d4
e211669
213e223
1650f09
b3158b1
664e6ec
f308142
1fd5ebb
bd49457
30479f5
149bc1f
91bb1df
6ab2278
685b292
2c843b7
9037986
3f95292
e0c7d8c
2de8ee4
fe169a1
702b828
5bc89dd
78210d5
3e5d845
12cb8d9
73aad65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ rules: | |
- "" | ||
resources: | ||
- configmaps | ||
- persistentvolumeclaims | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems weird but it is what it is |
||
- pods | ||
- secrets | ||
- serviceaccounts | ||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ rules: | |
- "" | ||
resources: | ||
- configmaps | ||
- persistentvolumeclaims | ||
- pods | ||
- secrets | ||
- serviceaccounts | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6@sha256:c5ffdf5938d73283cec018f2adf59f0ed9f8c376d93e415a27b16c3c6aad6f45 AS chef | ||
LABEL maintainer="Stackable GmbH" | ||
|
||
# https://github.com/hadolint/hadolint/wiki/DL4006 | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
# Update image and install everything needed for Rustup & Rust | ||
RUN microdnf update --disablerepo=* --enablerepo=ubi-8-appstream-rpms --enablerepo=ubi-8-baseos-rpms -y \ | ||
&& rm -rf /var/cache/yum \ | ||
&& microdnf install --disablerepo=* --enablerepo=ubi-8-appstream-rpms --enablerepo=ubi-8-baseos-rpms curl findutils gcc gcc-c++ make cmake openssl-devel pkg-config systemd-devel unzip -y \ | ||
&& rm -rf /var/cache/yum | ||
|
||
WORKDIR /opt/protoc | ||
RUN PROTOC_VERSION=21.5 \ | ||
ARCH=$(arch | sed 's/^aarch64$/aarch_64/') \ | ||
&& curl --location --output protoc.zip "https://repo.stackable.tech/repository/packages/protoc/protoc-${PROTOC_VERSION}-linux-${ARCH}.zip" \ | ||
&& unzip protoc.zip \ | ||
&& rm protoc.zip | ||
ENV PROTOC=/opt/protoc/bin/protoc | ||
WORKDIR / | ||
|
||
# IMPORTANT | ||
# If you change the toolchain version here, make sure to also change the "rust_version" | ||
# property in operator-templating/repositories.yaml | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.63.0 \ | ||
&& . $HOME/.cargo/env \ | ||
&& cargo install cargo-chef --locked | ||
|
||
WORKDIR /src | ||
|
||
FROM chef AS planner | ||
|
||
COPY . . | ||
RUN . $HOME/.cargo/env && cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM chef AS builder | ||
|
||
COPY --from=planner /src/recipe.json recipe.json | ||
|
||
# Build dependencies - this is the caching Docker layer! | ||
RUN . $HOME/.cargo/env && cargo chef cook --release --recipe-path recipe.json | ||
|
||
# Build application | ||
COPY . . | ||
RUN . $HOME/.cargo/env && cargo build --release | ||
|
||
WORKDIR /app | ||
|
||
# Copy the "interesting" files into /app. | ||
RUN find /src/target/release \ | ||
-regextype egrep \ | ||
# The interesting binaries are all directly in ${BUILD_DIR}. | ||
-maxdepth 1 \ | ||
# Well, binaries are executable. | ||
-executable \ | ||
# Well, binaries are files. | ||
-type f \ | ||
# Filter out tests. | ||
! -regex ".*\-[a-fA-F0-9]{16,16}$" \ | ||
# Copy the matching files into /app. | ||
-exec cp {} /app \; | ||
|
||
RUN echo "The following files will be copied to the runtime image: $(ls /app)" | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi-minimal AS operator | ||
|
||
ARG VERSION | ||
ARG RELEASE="1" | ||
|
||
LABEL name="Stackable Operator for Apache Spark-on-Kubernetes" \ | ||
maintainer="[email protected]" \ | ||
vendor="Stackable GmbH" \ | ||
version="${VERSION}" \ | ||
release="${RELEASE}" \ | ||
summary="Deploy and manage Apache Spark-on-Kubernetes clusters." \ | ||
description="Deploy and manage Apache Spark-on-Kubernetes clusters." | ||
|
||
RUN microdnf install -y yum \ | ||
&& yum -y update-minimal --security --sec-severity=Important --sec-severity=Critical \ | ||
&& yum clean all \ | ||
&& microdnf clean all | ||
|
||
COPY LICENSE /licenses/LICENSE | ||
|
||
COPY --from=builder /app/stackable-spark-k8s-operator / | ||
COPY deploy/config-spec/properties.yaml /etc/stackable/spark-k8s-operator/config-spec/properties.yaml | ||
|
||
RUN groupadd -g 1000 stackable && adduser -u 1000 -g stackable -c 'Stackable Operator' stackable | ||
|
||
USER stackable:stackable | ||
|
||
ENTRYPOINT ["/stackable-spark-k8s-operator"] | ||
CMD ["run"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
apiVersion: spark.stackable.tech/v1alpha1 | ||
kind: SparkApplication | ||
metadata: | ||
name: spark-pi-s3-1 | ||
spec: | ||
version: "1.0" | ||
sparkImage: docker.stackable.tech/stackable/spark-k8s:3.3.0-stackable0.3.0 | ||
sparkImagePullPolicy: IfNotPresent | ||
mode: cluster | ||
mainClass: org.apache.spark.examples.SparkPi | ||
mainApplicationFile: s3a://my-bucket/spark-examples_2.12-3.3.0.jar | ||
s3bucket: # <1> | ||
inline: | ||
bucketName: my-bucket | ||
connection: | ||
inline: | ||
host: test-minio | ||
port: 9000 | ||
accessStyle: Path | ||
credentials: | ||
secretClass: s3-credentials-class # <2> | ||
logFileDirectory: # <3> | ||
s3: | ||
prefix: eventlogs/ # <4> | ||
bucket: | ||
inline: | ||
bucketName: spark-logs # <5> | ||
connection: | ||
inline: | ||
host: test-minio | ||
port: 9000 | ||
accessStyle: Path | ||
credentials: | ||
secretClass: history-credentials-class # <6> | ||
executor: | ||
instances: 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
apiVersion: spark.stackable.tech/v1alpha1 | ||
kind: SparkHistoryServer | ||
metadata: | ||
name: spark-history | ||
spec: | ||
image: | ||
productVersion: 3.3.0 | ||
stackableVersion: 0.3.0 | ||
logFileDirectory: # <1> | ||
sbernauer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
s3: | ||
prefix: eventlogs/ # <2> | ||
bucket: # <3> | ||
inline: | ||
bucketName: spark-logs | ||
connection: | ||
inline: | ||
host: test-minio | ||
port: 9000 | ||
accessStyle: Path | ||
credentials: | ||
secretClass: s3-credentials-class | ||
razvan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sparkConf: # <4> | ||
nodes: | ||
roleGroups: | ||
cleaner: | ||
replicas: 1 # <5> | ||
config: | ||
cleaner: true # <6> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
* xref:usage.adoc[] | ||
* xref:job_dependencies.adoc[] | ||
* xref:rbac.adoc[] | ||
* xref:history_server.adoc[] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
= Spark History Server | ||
|
||
== Overview | ||
|
||
The Stackable Spark-on-Kubernetes operator runs Apache Spark workloads in a Kubernetes cluster, whereby driver- and executor-pods are created for the duration of the job and then terminated. One or more Spark History Server instances can be deployed independently of `SparkApplication` jobs and used as an end-point for spark logging, so that job information can be viewed once the job pods are no longer available. | ||
|
||
== Deployment | ||
|
||
The example below demonstrates how to set up the history server running in one Pod with scheduled cleanups of the event logs. The event logs are loaded from an S3 bucket named `spark-logs` and the folder `eventlogs/`. The credentials for this bucket are provided by the secret class `s3-credentials-class`. For more details on how the Stackable Data Platform manages S3 resources see the xref:home:concepts:s3.adoc[S3 resources] page. | ||
|
||
|
||
[source,yaml] | ||
---- | ||
include::example$example-history-server.yaml[] | ||
---- | ||
|
||
<1> The location of the event logs. Must be a S3 bucket. Future implementations might add support for other shared filesystems such as HDFS. | ||
<2> Folder within the S3 bucket where the log files are located. This is folder is required and mus exist before setting up the history server. | ||
razvan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<3> The S3 bucket definition, here provided in-line. | ||
<4> Additional gistory server configuration properties can be provided here as a map. For possible properties see: https://spark.apache.org/docs/latest/monitoring.html#spark-history-server-configuration-options | ||
razvan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<5> This deployment has only one Pod. Multiple history servers can be started, all reading the same event logs by increasing the relica count. | ||
razvan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<6> This history server will automatically clean up old log files by using default properties. You can change any of these by using the `sparkConf` map. | ||
|
||
NOTE: Only one role group can have scheduled cleanups enabled (`cleaner: true`) and this role group can have a maximum replica of 1. | ||
razvan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
== Application configuration | ||
|
||
|
||
The example below demonstrates how to configure Spark applications store log events to a S3 bucket. | ||
razvan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
[source,yaml] | ||
---- | ||
include::example$example-history-app.yaml[] | ||
---- | ||
|
||
<1> Location of the data that is being processed by the application. | ||
<2> Credentials used to access the data above. | ||
<3> Instruct the operator to configure the application with logging enabled. | ||
<4> Folder to store logs. This must match the prefix used by the history server. | ||
<5> Bucket to store logs. This must match the bucket used by the history server. | ||
<6> Not used by the application! The operator will ignore this and use the credentials from the `s3bucket` to store event logs. | ||
|
||
|
||
|
||
== History Web UI | ||
|
||
The history exposes a user console on port 18080. By setting up port-forwarding on 18080 this UI can be opened in a browser to show running and completed jobs: | ||
razvan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
image::history-server-ui.png[History Server Console] | ||
|
Uh oh!
There was an error while loading. Please reload this page.