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-22953][K8S] Avoids adding duplicated secret volumes when init-container is used #20159

Closed
wants to merge 1 commit into from

Conversation

liyinan926
Copy link
Contributor

What changes were proposed in this pull request?

User-specified secrets are mounted into both the main container and init-container (when it is used) in a Spark driver/executor pod, using the MountSecretsBootstrap. Because MountSecretsBootstrap always adds new secret volumes for the secrets to the pod, the same secret volumes get added twice, one when mounting the secrets to the main container, and the other when mounting the secrets to the init-container. This PR fixes the issue by separating MountSecretsBootstrap.mountSecrets out into two methods: addSecretVolumes for adding secret volumes to a pod and mountSecrets for mounting secret volumes to a container, respectively. addSecretVolumes is only called once for each pod, whereas mountSecrets is called individually for the main container and the init-container (if it is used).

Ref: apache-spark-on-k8s#594.

How was this patch tested?

Unit tested and manually tested.

@vanzin This replaces #20148.
@hex108 @foxish @kimoonkim

@SparkQA
Copy link

SparkQA commented Jan 4, 2018

Test build #85702 has finished for PR 20159 at commit c5d5a2d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin
Copy link
Contributor

vanzin commented Jan 4, 2018

Merging to master / 2.3.

asfgit pushed a commit that referenced this pull request Jan 4, 2018
…container is used

## What changes were proposed in this pull request?

User-specified secrets are mounted into both the main container and init-container (when it is used) in a Spark driver/executor pod, using the `MountSecretsBootstrap`. Because `MountSecretsBootstrap` always adds new secret volumes for the secrets to the pod, the same secret volumes get added twice, one when mounting the secrets to the main container, and the other when mounting the secrets to the init-container. This PR fixes the issue by separating `MountSecretsBootstrap.mountSecrets` out into two methods: `addSecretVolumes` for adding secret volumes to a pod and `mountSecrets` for mounting secret volumes to a container, respectively. `addSecretVolumes` is only called once for each pod, whereas `mountSecrets` is called individually for the main container and the init-container (if it is used).

Ref: apache-spark-on-k8s#594.

## How was this patch tested?
Unit tested and manually tested.

vanzin This replaces #20148.
hex108 foxish kimoonkim

Author: Yinan Li <[email protected]>

Closes #20159 from liyinan926/master.

(cherry picked from commit e288fc8)
Signed-off-by: Marcelo Vanzin <[email protected]>
@asfgit asfgit closed this in e288fc8 Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants