Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#2 #1
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
Uh oh!
There was an error while loading. Please reload this page.
#2 #1
Changes from 1 commit
d440699672209fde01a8dfa2ae9db31b5872ced61923db600aca65c6900bc1ff489388a4be9810ebb0c09e7bad01e46f92b142157ec6f9711b36f1424ef7fb0053e1590ae98d698b9a07a82e93223df5dcc976f621e1fc72c9c862cbaa729b2d022622df95398909c36039b13d2c3de709e78c18ef167aa36c1a6de4feaea2166ec416cd1f1d9338b0be5aa27297ae0b24d3dbff0501bdbb4d83b3417b7e8c1a0c2c2a86b93df3cde9efb62e76b0121462bba2c10020a5d775a173fe451a644afb070dedf433ef736a3409f07c5063e5b4aea99d2849b6f2422dc047af5af86e0481977dc2246501452ea1d7db655d6a53d2824f143af1d3ef0ef1b3cc88d7fada28f20d3714df53818d9786ce63352d6f4c388bc7703b46299d2971b46f413bf7691534065efdadc4bd3eed8fb8f27ae18cb0c0270a9a322daeba6567fc4495d8cfb5ccf0d90da7dce4fee39c7c0b08b0a9352e219e69bce17758f225e01737d459a75c18a78a9049dbe53e13092d72cb9763bc0498dbc11146c8ef923c5a0d113f4bda715747cf9de11d354fcaaf7236e75c0cad59b56e9c6c8e909cb9a6f74dc8a6be92c2f0039dfaf233e77fa4e7d867c7e274298f363ba5849adf596ebe6e0596e8ab8ef7bac50aa594ac4f5264164baa01c86d16b98d48803b4c059ebc7967c6e07aee2dcaa49f02f878116f2c3e1b9368fd08f53d2669b4d9a76f23a1a64e36a0b77a78ecb6dc04cb2d776befb221d03a893ea22c5aa54dbd32b501c9acc26a97e8e5b05966524827fa95a4afe1d3f802224861f6e6899f71e8da03545ce797971ed54d8b8f8258478f91c698008f9cf599cde428155485fe129a7c8f0c5585c57776f299b42fda85bf95f27c08eb6772060db2deef6021145f1a2655aca8243fbf764a3489a529f997be04be9f0c32cfd3ee58dadb7bd6d54ac78bcc33952cfe71e93a01fcba2bf67f70141953fa381bce4de0425fc4369074f6a92044b33b79c6689e2c7e09034913b1bd3d61aec966beb6e9884984f1aa2890096fe3286e0559f232cb5086078b891f94bf474a8d635ff1b9b006e798592cc84ebf4bfb290c30a59c3c23ff7f6efe008ad13ab48f95ad4735301bff7e6c6f909fa4a1e1055c94395860a07704c911384897572505e0f4f200ce11d00f24c6fdfd7ac9c1b62e43bcb1b43b6005ba75571bf1a99ade1de3418aceb9643e4e853e7dc82699932196030875d62a98File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
## What changes were proposed in this pull request? * Allows to refer a secret as an env var. * Introduces new config properties in the form: spark.kubernetes{driver,executor}.secretKeyRef.ENV_NAME=name:key ENV_NAME is case sensitive. * Updates docs. * Adds required unit tests. ## How was this patch tested? Manually tested and confirmed that the secrets exist in driver's and executor's container env. Also job finished successfully. First created a secret with the following yaml: ``` apiVersion: v1 kind: Secret metadata: name: test-secret data: username: c3RhdnJvcwo= password: Mzk1MjgkdmRnN0pi ------- $ echo -n 'stavros' | base64 c3RhdnJvcw== $ echo -n '39528$vdg7Jb' | base64 MWYyZDFlMmU2N2Rm ``` Run a job as follows: ```./bin/spark-submit \ --master k8s://http://localhost:9000 \ --deploy-mode cluster \ --name spark-pi \ --class org.apache.spark.examples.SparkPi \ --conf spark.executor.instances=1 \ --conf spark.kubernetes.container.image=skonto/spark:k8envs3 \ --conf spark.kubernetes.driver.secretKeyRef.MY_USERNAME=test-secret:username \ --conf spark.kubernetes.driver.secretKeyRef.My_password=test-secret:password \ --conf spark.kubernetes.executor.secretKeyRef.MY_USERNAME=test-secret:username \ --conf spark.kubernetes.executor.secretKeyRef.My_password=test-secret:password \ local:///opt/spark/examples/jars/spark-examples_2.11-2.4.0-SNAPSHOT.jar 10000 ``` Secret loaded correctly at the driver container:  Also if I log into the exec container: kubectl exec -it spark-pi-1526555613156-exec-1 bash bash-4.4# env > SPARK_EXECUTOR_MEMORY=1g > SPARK_EXECUTOR_CORES=1 > LANG=C.UTF-8 > HOSTNAME=spark-pi-1526555613156-exec-1 > SPARK_APPLICATION_ID=spark-application-1526555618626 > **MY_USERNAME=stavros** > > JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk > KUBERNETES_PORT_443_TCP_PROTO=tcp > KUBERNETES_PORT_443_TCP_ADDR=10.100.0.1 > JAVA_VERSION=8u151 > KUBERNETES_PORT=tcp://10.100.0.1:443 > PWD=/opt/spark/work-dir > HOME=/root > SPARK_LOCAL_DIRS=/var/data/spark-b569b0ae-b7ef-4f91-bcd5-0f55535d3564 > KUBERNETES_SERVICE_PORT_HTTPS=443 > KUBERNETES_PORT_443_TCP_PORT=443 > SPARK_HOME=/opt/spark > SPARK_DRIVER_URL=spark://CoarseGrainedSchedulerspark-pi-1526555613156-driver-svc.default.svc:7078 > KUBERNETES_PORT_443_TCP=tcp://10.100.0.1:443 > SPARK_EXECUTOR_POD_IP=9.0.9.77 > TERM=xterm > SPARK_EXECUTOR_ID=1 > SHLVL=1 > KUBERNETES_SERVICE_PORT=443 > SPARK_CONF_DIR=/opt/spark/conf > PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin > JAVA_ALPINE_VERSION=8.151.12-r0 > KUBERNETES_SERVICE_HOST=10.100.0.1 > **My_password=39528$vdg7Jb** > _=/usr/bin/env > Author: Stavros Kontopoulos <[email protected]> Closes apache#21317 from skonto/k8s-fix-env-secrets.Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Uh oh!
There was an error while loading. Please reload this page.