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

[SPARK-42395][K8S]The code logic of the configmap max size validation lacks extra content #39967

Closed
wants to merge 8 commits into from

Conversation

nineinfra
Copy link
Contributor

@nineinfra nineinfra commented Feb 10, 2023

[SPARK-42395][K8S]The code logic of the configmap max size validation lacks extra content

What changes were proposed in this pull request?

This PR aims to add the extra content of the configmap into the configmap max size validation

In each configmap, Spark adds an extra content in a fixed format,this extra content of the configmap is as belows:
spark.kubernetes.namespace: default
spark.properties: |
#Java properties built from Kubernetes config map with name: spark-exec-b47b438630eec12d-conf-map
#Wed Feb 08 20:10:19 CST 2023
spark.kubernetes.namespace=default

The example specific content comes from the command output:
kubectl get cm spark-exec-b47b438630eec12d-conf-map -o yaml
apiVersion: v1
data:
spark.kubernetes.namespace: default
spark.properties: |
#Java properties built from Kubernetes config map with name: spark-exec-b47b438630eec12d-conf-map
#Wed Feb 08 20:10:19 CST 2023
spark.kubernetes.namespace=default
immutable: true
kind: ConfigMap
metadata:
creationTimestamp: "2023-02-08T12:14:13Z"
labels:
spark-app-selector: spark-9c4a3cc1d752491cba899135d8fbf492
spark-role: executor
name: spark-exec-b47b438630eec12d-conf-map
namespace: default
resourceVersion: "62638833"
uid: 28f7bbd1-38aa-4e8e-b715-9cc8eb047074

Why are the changes needed?

If no chanages,there may be a problem like jira SPARK-42344

Does this PR introduce any user-facing change?

The major of this pr is the same to the jira SPARK-42344.

How was this patch tested?

Local test
TEST CASE 1:
1.mock a file named log4j.properties in spark home directory

2.the file name length is 16,and the extra content size is 163.
set the size of the log4j.properties to:
1048576 - 163 -16 = 1048397

3.truncate the file to 1048397
truncate -s 1048397 log4j.properties
ls -l
-rwxr-xr-x 1 root root 1048397 Feb 9 16:13 log4j.properties

4.test with the commond spark-submit with arg :
--conf
spark.home=/home/work/code/apache/spark-github/dist

5.Test expectations:
The configmap is not include the content log4j.properties.Because the size is just equal to 1048576.
There is only one data in configmap spark-exec-d09ef186354c6ebe-conf-map
kubectl get cm
NAME DATA AGE
ingress-traefik 1 203d
kube-root-ca.crt 1 227d
spark-exec-d09ef186354c6ebe-conf-map 1 33s
spark-standalone-exporter 1 203d
spark-standalone-graphite-mapping 1 203d

kubectl get cm spark-exec-e33068863475c9ee-conf-map -o yaml
apiVersion: v1
data:
spark.properties: |
#Java properties built from Kubernetes config map with name: spark-exec-e33068863475c9ee-conf-map
#Thu Feb 09 12:36:20 CST 2023
spark.kubernetes.namespace=default
immutable: true
kind: ConfigMap
metadata:
creationTimestamp: "2023-02-09T04:36:20Z"
labels:
spark-app-selector: spark-8e68465119bd411ba0b0cc797abe294c
spark-role: executor
name: spark-exec-e33068863475c9ee-conf-map
namespace: default
resourceVersion: "62889868"
uid: ba8d7f31-a4c5-42fd-9aba-a02b73eb37bc

TEST CASE 2:
1.the file name length is 16,and the extra content size is 163.
set the size of the log4j.properties to:
1048576 - 163 - 16 - 1= 1048396

2.truncate the file to 1048396
truncate -s 1048396 log4j.properties
ls -l
-rwxr-xr-x 1 root root 1048396 Feb 9 16:32 log4j.properties

3.test with the commond spark-submit with arg :
--conf
spark.home=/home/work/code/apache/spark-github/dist

4.Test expectations:
The configmap is include the content log4j.properties.
There is 2 datas in the configmap spark-exec-1d90d186354e63ee-conf-map
kubectl get cm
NAME DATA AGE
ingress-traefik 1 203d
kube-root-ca.crt 1 227d
spark-exec-1d90d186354e63ee-conf-map 2 52s
spark-standalone-exporter 1 203d
spark-standalone-graphite-mapping 1 203d

@nineinfra
Copy link
Contributor Author

Could you please review this pr? @dongjoon-hyun @LuciferYang
Thanks!

@nineinfra
Copy link
Contributor Author

Can I take your free time to help me to review this pr please?@dongjoon-hyun @HyukjinKwon @srowen @LuciferYang

@srowen
Copy link
Member

srowen commented Feb 18, 2023

I don't know enough about K8S to review this. Seems harmless

@nineinfra
Copy link
Contributor Author

Thanks for review!

@nineinfra
Copy link
Contributor Author

Can you help recommend others to the review? @srowen

@nineinfra
Copy link
Contributor Author

Can anyone else help review this PR? @viirya
Thanks!

@github-actions
Copy link

github-actions bot commented Jun 1, 2023

We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!

@github-actions github-actions bot added the Stale label Jun 1, 2023
@github-actions github-actions bot closed this Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants