-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-22953][K8S] Avoids adding duplicated secret volumes when init-container is used #20148
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 all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ import org.mockito.Mockito._ | |
| import org.scalatest.{BeforeAndAfter, BeforeAndAfterEach} | ||
|
|
||
| import org.apache.spark.{SparkConf, SparkFunSuite} | ||
| import org.apache.spark.deploy.k8s.{InitContainerBootstrap, MountSecretsBootstrap, PodWithDetachedInitContainer} | ||
| import org.apache.spark.deploy.k8s.{InitContainerBootstrap, MountSecretsBootstrap, PodWithDetachedInitContainer, SecretVolumeUtils} | ||
| import org.apache.spark.deploy.k8s.Config._ | ||
| import org.apache.spark.deploy.k8s.Constants._ | ||
|
|
||
|
|
@@ -165,17 +165,19 @@ class ExecutorPodFactorySuite extends SparkFunSuite with BeforeAndAfter with Bef | |
|
|
||
| val factory = new ExecutorPodFactory( | ||
| conf, | ||
| None, | ||
| Some(secretsBootstrap), | ||
| Some(initContainerBootstrap), | ||
| Some(secretsBootstrap)) | ||
| val executor = factory.createExecutorPod( | ||
| "1", "dummy", "dummy", Seq[(String, String)](), driverPod, Map[String, Int]()) | ||
|
|
||
| assert(executor.getSpec.getVolumes.size() === 1) | ||
| assert(SecretVolumeUtils.podHasVolume(executor, "secret1-volume")) | ||
| assert(SecretVolumeUtils.containerHasVolume( | ||
| executor.getSpec.getContainers.get(0), "secret1-volume", "/var/secret1")) | ||
| assert(executor.getSpec.getInitContainers.size() === 1) | ||
| assert(executor.getSpec.getInitContainers.get(0).getVolumeMounts.get(0).getName | ||
| === "secret1-volume") | ||
| assert(executor.getSpec.getInitContainers.get(0).getVolumeMounts.get(0) | ||
| .getMountPath === "/var/secret1") | ||
| assert(SecretVolumeUtils.containerHasVolume( | ||
|
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. It might be better to change
Contributor
Author
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. Done. 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. Thanks! We also need check volumes' num in pod spec.
Contributor
Author
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. Done. 93e1d64. |
||
| executor.getSpec.getInitContainers.get(0), "secret1-volume", "/var/secret1")) | ||
|
|
||
| checkOwnerReferences(executor, driverPodUid) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A note on this change: it seems double quotes get literally added. With the double quotes appended explicitly here, when running SparkPi with an argument 5, an NumberFormatException will be thrown complaining that
""5""is not parsable. So the explicit double quotes are not really needed.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for calling this out - let's try and test this using an integration test as well in https://github.com/apache-spark-on-k8s/spark-integration/. Would be good to put in manual integration testing results here until we have the PRB automation figured out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will add one to the PR under review.