Skip to content

Commit 0eb7e98

Browse files
committed
feat(drycc-addons): add spark
1 parent 883d78f commit 0eb7e98

30 files changed

Lines changed: 4636 additions & 3 deletions

addons/index.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ entries:
2323
zookeeper:
2424
- version: 3.9
2525
description: "Apache ZooKeeper is an effort to develop and maintain an open-source server which enables highly reliable distributed coordination."
26+
spark:
27+
- version: 3.4
28+
description: "Apache Spark is a multi-language engine for executing data engineering, data science, and machine learning on single-node machines or clusters."

addons/minio/2023/chart/minio/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ networkPolicy:
843843
## listening on. When true, MinIO® will accept connections from any source (with the correct destination port).
844844
##
845845
allowExternal: false
846-
allowLocalNamespace: true
846+
allowCurrentNamespace: true
847847
allowNamespaces: []
848848
## @param networkPolicy.extraFromClauses Allows to add extra 'from' clauses to the NetworkPolicy
849849
extraFromClauses: {}

addons/postgresql/15/chart/postgresql/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ networkPolicy:
955955
## @param networkPolicy.enabled Enable network policies
956956
##
957957
enabled: true
958-
allowLocalNamespace: true
958+
allowCurrentNamespace: true
959959
allowNamespaces: []
960960
## @param networkPolicy.metrics.enabled Enable network policies for metrics (prometheus)
961961
## @param networkPolicy.metrics.namespaceSelector [object] Monitoring namespace selector labels. These labels will be used to identify the prometheus' namespace.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright VMware, Inc.
2+
# SPDX-License-Identifier: APACHE-2.0
3+
4+
annotations:
5+
category: Infrastructure
6+
licenses: Apache-2.0
7+
images: |
8+
- name: spark
9+
image: registry.drycc.cc/drycc-addons/spark:3.4
10+
apiVersion: v2
11+
appVersion: 3.4.1
12+
dependencies:
13+
- name: common
14+
repository: oci://registry.drycc.cc/charts
15+
version: ~1.1.3
16+
description: Apache Spark is a high-performance engine for large-scale computing tasks, such as data processing, machine learning and real-time data streaming. It includes APIs for Java, Python, Scala and R.
17+
home: https://bitnami.com
18+
icon: https://bitnami.com/assets/stacks/spark/img/spark-stack-220x234.png
19+
keywords:
20+
- apache
21+
- spark
22+
maintainers:
23+
- name: VMware, Inc.
24+
url: https://github.com/bitnami/charts
25+
name: spark
26+
sources:
27+
- https://github.com/bitnami/charts/tree/main/bitnami/spark
28+
version: 7.2.1

addons/spark/3.4/chart/spark/README.md

Lines changed: 483 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
CHART NAME: {{ .Chart.Name }}
2+
CHART VERSION: {{ .Chart.Version }}
3+
APP VERSION: {{ .Chart.AppVersion }}
4+
5+
** Please be patient while the chart is being deployed **
6+
7+
{{- if .Values.diagnosticMode.enabled }}
8+
The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with:
9+
10+
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }}
11+
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }}
12+
13+
Get the list of pods by executing:
14+
15+
kubectl get pods --namespace {{ include "common.names.namespace" . }} -l app.kubernetes.io/instance={{ .Release.Name }}
16+
17+
Access the pod you want to debug by executing
18+
19+
kubectl exec --namespace {{ include "common.names.namespace" . }} -ti <NAME OF THE POD> -- bash
20+
21+
In order to replicate the container startup scripts execute this command:
22+
23+
/opt/bitnami/scripts/spark/entrypoint.sh /opt/bitnami/scripts/spark/run.sh
24+
25+
{{- else }}
26+
27+
1. Get the Spark master WebUI URL by running these commands:
28+
{{- if .Values.ingress.enabled }}
29+
30+
export HOSTNAME=$(kubectl get ingress --namespace {{ include "common.names.namespace" . }} {{ printf "%s-ingress" (include "common.names.fullname" .) }} -o jsonpath='{.spec.rules[0].host}')
31+
echo "Spark-master URL: http://$HOSTNAME/"
32+
33+
{{- else -}}
34+
{{- if contains "NodePort" .Values.service.type }}
35+
36+
export NODE_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.spec.ports[?(@.name=='http')].nodePort}" services {{ printf "%s-master-svc" (include "common.names.fullname" .) }})
37+
export NODE_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
38+
echo http://$NODE_IP:$NODE_PORT
39+
40+
{{- else if contains "LoadBalancer" .Values.service.type }}
41+
42+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
43+
You can watch the status of by running 'kubectl get --namespace {{ include "common.names.namespace" . }} svc -w {{ printf "%s-master-svc" (include "common.names.fullname" .) }}'
44+
45+
export SERVICE_IP=$(kubectl get --namespace {{ include "common.names.namespace" . }} svc {{ printf "%s-master-svc" (include "common.names.fullname" .) }} -o jsonpath="{.status.loadBalancer.ingress[0]['ip', 'hostname'] }")
46+
echo http://$SERVICE_IP:{{ .Values.service.ports.http }}
47+
48+
{{- else if contains "ClusterIP" .Values.service.type }}
49+
50+
kubectl port-forward --namespace {{ include "common.names.namespace" . }} svc/{{ printf "%s-master-svc" (include "common.names.fullname" .) }} {{ default "80" .Values.service.ports.http }}:{{ default "80" .Values.service.ports.http }}
51+
echo "Visit http://127.0.0.1:{{ .Values.service.ports.http }} to use your application"
52+
53+
{{- end }}
54+
{{- end }}
55+
56+
2. Submit an application to the cluster:
57+
58+
To submit an application to the cluster the spark-submit script must be used. That script can be
59+
obtained at https://github.com/apache/spark/tree/master/bin. Also you can use kubectl run.
60+
61+
{{- if or (eq "NodePort" .Values.service.type) (eq "LoadBalancer" .Values.service.type) }}
62+
63+
Run the commands below to obtain the master IP and submit your application.
64+
{{- end }}
65+
66+
export EXAMPLE_JAR=$(kubectl exec -ti --namespace {{ include "common.names.namespace" . }} {{ printf "%s-worker-0" (include "common.names.fullname" .) }} -- find examples/jars/ -name 'spark-example*\.jar' | tr -d '\r')
67+
{{- if eq "NodePort" .Values.service.type }}
68+
export SUBMIT_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.spec.ports[?(@.name=='cluster')].nodePort}" services {{ printf "%s-master-svc" (include "common.names.fullname" .) }})
69+
export SUBMIT_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
70+
71+
kubectl run --namespace {{ include "common.names.namespace" . }} {{ printf "%s-client" (include "common.names.fullname" .) }} --rm --tty -i --restart='Never' \
72+
--image {{ template "spark.image" . }} \
73+
-- spark-submit --master spark://$SUBMIT_IP:$SUBMIT_PORT \
74+
--class org.apache.spark.examples.SparkPi \
75+
--deploy-mode cluster \
76+
$EXAMPLE_JAR 1000
77+
78+
{{- else if eq "LoadBalancer" .Values.service.type }}
79+
export SUBMIT_IP=$(kubectl get --namespace {{ include "common.names.namespace" . }} svc {{ printf "%s-master-svc" (include "common.names.fullname" .) }} -o jsonpath="{.status.loadBalancer.ingress[0]['ip', 'hostname'] }")
80+
81+
kubectl run --namespace {{ include "common.names.namespace" . }} {{ printf "%s-client" (include "common.names.fullname" .) }} --rm --tty -i --restart='Never' \
82+
--image {{ template "spark.image" . }} \
83+
-- spark-submit --master spark://$SUBMIT_IP:{{ .Values.service.ports.cluster }} \
84+
--deploy-mode cluster \
85+
--class org.apache.spark.examples.SparkPi \
86+
$EXAMPLE_JAR 1000
87+
88+
{{- else }}
89+
90+
kubectl exec -ti --namespace {{ include "common.names.namespace" . }} {{ printf "%s-worker-0" (include "common.names.fullname" .) }} -- spark-submit --master spark://{{ printf "%s-master-svc" (include "common.names.fullname" .) }}:{{ .Values.service.ports.cluster }} \
91+
--class org.apache.spark.examples.SparkPi \
92+
$EXAMPLE_JAR 5
93+
94+
** IMPORTANT: When submit an application from outside the cluster service type should be set to the NodePort or LoadBalancer. **
95+
96+
{{- end }}
97+
98+
** IMPORTANT: When submit an application the --master parameter should be set to the service IP, if not, the application will not resolve the master. **
99+
{{- end }}
100+
101+
{{ include "spark.checkRollingTags" . }}
102+
{{ include "spark.validateValues" . }}
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
{{/*
2+
Copyright VMware, Inc.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{- /* vim: set filetype=mustache: */}}
7+
8+
{{/*
9+
Return the proper Spark image name
10+
*/}}
11+
{{- define "spark.image" -}}
12+
{{- include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) -}}
13+
{{- end -}}
14+
15+
{{/*
16+
Return the proper Docker Image Registry Secret Names
17+
*/}}
18+
{{- define "spark.imagePullSecrets" -}}
19+
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image) "global" .Values.global) -}}
20+
{{- end -}}
21+
22+
{{/*
23+
Create the name of the service account to use
24+
*/}}
25+
{{- define "spark.serviceAccountName" -}}
26+
{{- if .Values.serviceAccount.create -}}
27+
{{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
28+
{{- else -}}
29+
{{ default "default" .Values.serviceAccount.name }}
30+
{{- end -}}
31+
{{- end -}}
32+
33+
{{/* Get the secret for passwords */}}
34+
{{- define "spark.passwordsSecretName" -}}
35+
{{- if .Values.security.passwordsSecretName -}}
36+
{{- printf "%s" .Values.security.passwordsSecretName -}}
37+
{{- else }}
38+
{{- printf "%s-secret" (include "common.names.fullname" .) -}}
39+
{{- end }}
40+
{{- end -}}
41+
42+
{{/*
43+
Return the secret containing Spark TLS certificates
44+
*/}}
45+
{{- define "spark.tlsSecretName" -}}
46+
{{- $secretName := coalesce .Values.security.ssl.existingSecret .Values.security.certificatesSecretName -}}
47+
{{- if $secretName -}}
48+
{{- printf "%s" (tpl $secretName $) -}}
49+
{{- else -}}
50+
{{- printf "%s-crt" (include "common.names.fullname" .) -}}
51+
{{- end -}}
52+
{{- end -}}
53+
54+
{{/*
55+
Return true if a TLS secret object should be created
56+
*/}}
57+
{{- define "spark.createTlsSecret" -}}
58+
{{- if and .Values.security.ssl.autoGenerated .Values.security.ssl.enabled (not .Values.security.ssl.existingSecret) (not .Values.security.certificatesSecretName) }}
59+
{{- true -}}
60+
{{- end -}}
61+
{{- end -}}
62+
63+
{{/* Check if there are rolling tags in the images */}}
64+
{{- define "spark.checkRollingTags" -}}
65+
{{- include "common.warnings.rollingTag" .Values.image -}}
66+
{{- end -}}
67+
68+
{{/* Validate values of Spark - Incorrect extra volume settings */}}
69+
{{- define "spark.validateValues.extraVolumes" -}}
70+
{{- if and (.Values.worker.extraVolumes) (not .Values.worker.extraVolumeMounts) -}}
71+
spark: missing-worker-extra-volume-mounts
72+
You specified worker extra volumes but no mount points for them. Please set
73+
the extraVolumeMounts value
74+
{{- end -}}
75+
{{- end -}}
76+
77+
{/* Validate values of Spark - number of workers must be greater than 0 */}}
78+
{{- define "spark.validateValues.workerCount" -}}
79+
{{- $replicaCount := int .Values.worker.replicaCount }}
80+
{{- if lt $replicaCount 1 -}}
81+
spark: workerCount
82+
Worker replicas must be greater than 0!!
83+
Please set a valid worker count size (--set worker.replicaCount=X)
84+
{{- end -}}
85+
{{- end -}}
86+
87+
{{/* Validate values of Spark - Security SSL enabled */}}
88+
{{- define "spark.validateValues.security.ssl" -}}
89+
{{- if and .Values.security.ssl.enabled (not .Values.security.ssl.autoGenerated) (not .Values.security.ssl.existingSecret) (not .Values.security.certificatesSecretName) }}
90+
spark: security.ssl.enabled
91+
In order to enable Security SSL, you also need to provide
92+
an existing secret containing the Keystore and Truststore or
93+
enable auto-generated certificates.
94+
{{- end -}}
95+
{{- end -}}
96+
97+
{{/*
98+
Compile all warnings into a single message, and call fail.
99+
*/}}
100+
{{- define "spark.validateValues" -}}
101+
{{- $messages := list -}}
102+
{{- $messages := append $messages (include "spark.validateValues.extraVolumes" .) -}}
103+
{{- $messages := append $messages (include "spark.validateValues.workerCount" .) -}}
104+
{{- $messages := append $messages (include "spark.validateValues.security.ssl" .) -}}
105+
{{- $messages := without $messages "" -}}
106+
{{- $message := join "\n" $messages -}}
107+
108+
{{- if $message -}}
109+
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
110+
{{- end -}}
111+
{{- end -}}
112+
113+
{{/*
114+
Get the initialization scripts volume name.
115+
*/}}
116+
{{- define "spark.initScripts" -}}
117+
{{- printf "%s-init-scripts" (include "common.names.fullname" .) -}}
118+
{{- end -}}
119+
120+
{{/*
121+
Get the initialization scripts ConfigMap name.
122+
*/}}
123+
{{- define "spark.initScriptsCM" -}}
124+
{{- printf "%s" .Values.initScriptsCM -}}
125+
{{- end -}}
126+
127+
{{/*
128+
Get the initialization scripts Secret name.
129+
*/}}
130+
{{- define "spark.initScriptsSecret" -}}
131+
{{- printf "%s" .Values.initScriptsSecret -}}
132+
{{- end -}}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{- /*
2+
Copyright VMware, Inc.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{- range .Values.extraDeploy }}
7+
---
8+
{{ include "common.tplvalues.render" (dict "value" . "context" $) }}
9+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- /*
2+
Copyright VMware, Inc.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
apiVersion: v1
7+
kind: Service
8+
metadata:
9+
name: {{ printf "%s-headless" (include "common.names.fullname" .) }}
10+
namespace: {{ include "common.names.namespace" . | quote }}
11+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
12+
{{- if or .Values.service.headless.annotations .Values.commonAnnotations }}
13+
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.service.headless.annotations .Values.commonAnnotations ) "context" . ) }}
14+
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
15+
{{- end }}
16+
spec:
17+
type: ClusterIP
18+
clusterIP: None
19+
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{{- /*
2+
Copyright VMware, Inc.
3+
SPDX-License-Identifier: APACHE-2.0
4+
*/}}
5+
6+
{{- if .Values.worker.autoscaling.enabled }}
7+
apiVersion: {{ include "common.capabilities.hpa.apiVersion" ( dict "context" $ ) }}
8+
kind: HorizontalPodAutoscaler
9+
metadata:
10+
name: {{ printf "%s-autoscaler" (include "common.names.fullname" .) }}
11+
namespace: {{ include "common.names.namespace" . | quote }}
12+
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
13+
app.kubernetes.io/component: worker-autoscaler
14+
{{- if .Values.commonAnnotations }}
15+
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
16+
{{- end }}
17+
spec:
18+
scaleTargetRef:
19+
apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
20+
kind: statefulset
21+
name: {{ printf "%s-worker" (include "common.names.fullname" .) }}
22+
minReplicas: {{ .Values.worker.autoscaling.minReplicas }}
23+
maxReplicas: {{ .Values.worker.autoscaling.maxReplicas }}
24+
metrics:
25+
{{- if .Values.worker.autoscaling.targetMemory }}
26+
- type: Resource
27+
resource:
28+
name: memory
29+
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
30+
targetAverageUtilization: {{ .Values.worker.autoscaling.targetMemory }}
31+
{{- else }}
32+
target:
33+
type: Utilization
34+
averageUtilization: {{ .Values.worker.autoscaling.targetMemory }}
35+
{{- end }}
36+
{{- end }}
37+
{{- if .Values.worker.autoscaling.targetCPU }}
38+
- type: Resource
39+
resource:
40+
name: cpu
41+
{{- if semverCompare "<1.23-0" (include "common.capabilities.kubeVersion" .) }}
42+
targetAverageUtilization: {{ .Values.worker.autoscaling.targetCPU }}
43+
{{- else }}
44+
target:
45+
type: Utilization
46+
averageUtilization: {{ .Values.worker.autoscaling.targetCPU }}
47+
{{- end }}
48+
{{- end }}
49+
{{- end }}

0 commit comments

Comments
 (0)