-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-44906][K8S] Make Kubernetes[Driver|Executor]Conf.annotations substitute annotations instead of feature steps
#42600
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 2 commits
ec776f3
529187a
a422aa1
be10416
796659f
74635dc
1bfe492
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 |
|---|---|---|
|
|
@@ -116,7 +116,10 @@ private[spark] class KubernetesDriverConf( | |
| } | ||
|
|
||
| override def annotations: Map[String, String] = { | ||
| KubernetesUtils.parsePrefixedKeyValuePairs(sparkConf, KUBERNETES_DRIVER_ANNOTATION_PREFIX) | ||
| KubernetesUtils.parsePrefixedKeyValuePairs(sparkConf, KUBERNETES_DRIVER_ANNOTATION_PREFIX).map { | ||
| case(k, v) => | ||
| (k, Utils.substituteAppNExecIds(v, appId, "")) | ||
| } | ||
| } | ||
|
|
||
| def serviceLabels: Map[String, String] = { | ||
|
|
@@ -188,6 +191,7 @@ private[spark] class KubernetesExecutorConf( | |
|
|
||
| override def annotations: Map[String, String] = { | ||
| KubernetesUtils.parsePrefixedKeyValuePairs(sparkConf, KUBERNETES_EXECUTOR_ANNOTATION_PREFIX) | ||
| .map { case (k, v) => (k, Utils.substituteAppNExecIds(v, appId, "")) } | ||
|
Member
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. where is the executorId?
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. sry, missing the |
||
| } | ||
|
|
||
| override def secretNamesToMountPaths: Map[String, String] = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ import org.apache.spark.deploy.k8s.Config._ | |
| import org.apache.spark.deploy.k8s.Constants._ | ||
| import org.apache.spark.deploy.k8s.submit._ | ||
| import org.apache.spark.resource.ResourceProfile.DEFAULT_RESOURCE_PROFILE_ID | ||
| import org.apache.spark.util.Utils | ||
|
|
||
| class KubernetesConfSuite extends SparkFunSuite { | ||
|
|
||
|
|
@@ -42,7 +43,9 @@ class KubernetesConfSuite extends SparkFunSuite { | |
| "customLabel2Key" -> "customLabel2Value") | ||
| private val CUSTOM_ANNOTATIONS = Map( | ||
| "customAnnotation1Key" -> "customAnnotation1Value", | ||
| "customAnnotation2Key" -> "customAnnotation2Value") | ||
| "customAnnotation2Key" -> "customAnnotation2Value", | ||
| "customAnnotation3Key" -> "{{APP_ID}}", | ||
| "customAnnotation4Key" -> "{{EXECUTOR_ID}}") | ||
| private val SECRET_NAMES_TO_MOUNT_PATHS = Map( | ||
| "secret1" -> "/mnt/secrets/secret1", | ||
| "secret2" -> "/mnt/secrets/secret2") | ||
|
|
@@ -93,7 +96,10 @@ class KubernetesConfSuite extends SparkFunSuite { | |
| SPARK_APP_NAME_LABEL -> KubernetesConf.getAppNameLabel(conf.appName), | ||
| SPARK_ROLE_LABEL -> SPARK_POD_DRIVER_ROLE) ++ | ||
| CUSTOM_LABELS) | ||
| assert(conf.annotations === CUSTOM_ANNOTATIONS) | ||
| assert(conf.annotations === CUSTOM_ANNOTATIONS.map { | ||
| case (k, v) => | ||
| (k, Utils.substituteAppNExecIds(v, conf.appId, "")) | ||
|
Member
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. You can merge it into one line. - case (k, v) =>
- (k, Utils.substituteAppNExecIds(v, conf.appId, ""))
+ case (k, v) => (k, Utils.substituteAppNExecIds(v, conf.appId, "")) |
||
| }) | ||
| assert(conf.secretNamesToMountPaths === SECRET_NAMES_TO_MOUNT_PATHS) | ||
| assert(conf.secretEnvNamesToKeyRefs === SECRET_ENV_VARS) | ||
| assert(conf.environment === CUSTOM_ENVS) | ||
|
|
@@ -161,7 +167,10 @@ class KubernetesConfSuite extends SparkFunSuite { | |
| SPARK_APP_NAME_LABEL -> KubernetesConf.getAppNameLabel(conf.appName), | ||
| SPARK_ROLE_LABEL -> SPARK_POD_EXECUTOR_ROLE, | ||
| SPARK_RESOURCE_PROFILE_ID_LABEL -> DEFAULT_RESOURCE_PROFILE_ID.toString) ++ CUSTOM_LABELS) | ||
| assert(conf.annotations === CUSTOM_ANNOTATIONS) | ||
| assert(conf.annotations === CUSTOM_ANNOTATIONS.map { | ||
| case (k, v) => | ||
| (k, Utils.substituteAppNExecIds(v, conf.appId, EXECUTOR_ID)) | ||
|
Member
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. ditto |
||
| }) | ||
| assert(conf.secretNamesToMountPaths === SECRET_NAMES_TO_MOUNT_PATHS) | ||
| assert(conf.secretEnvNamesToKeyRefs === SECRET_ENV_VARS) | ||
| } | ||
|
|
||
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.
If you don't mind, shall we use the consistent short style like
KubernetesExecutorConf, @zwangsheng ?