dongjoon-hyun commented on PR #58343: URL: https://github.com/apache/spark/pull/58343#issuecomment-5441168805
Thanks for the fix, @LuciferYang. I went through the diagnosis and ran the suite locally. **Verification** `build/sbt -Pkubernetes 'kubernetes/testOnly *ExecutorKubernetesCredentialsFeatureStepSuite'` passes all 5 tests, and `kubernetes/scalastyle` / `kubernetes/Test/scalastyle` are clean. I also reproduced the mutation you described. Reverting the guard to master's `Option(spec.getServiceAccount)` turns exactly the two new tests red (`"[executor]-name" did not equal "[template]-name"`) and leaves the three existing ones green, so the new tests pin the fix without touching the existing contract. The root cause checks out: `loadPodFromTemplate` parses the template client side, so no `SetDefaults_PodSpec` runs, and a template that only sets `spec.serviceAccountName` reaches the step with `spec.serviceAccount == null`. **Two things worth discussing** 1. Consider including the WARN in this PR instead of deferring it to SPARK-59053. SPARK-58872 added a warning for a situation that already existed on the driver side; this PR is different in that it *introduces* the case where `spark.kubernetes.authenticate.executor.serviceAccountName` is set and silently has no effect. Since the account an executor runs as decides its RBAC, a silent flip is hard to trace from the user's side, so I would rather ship the warning together with the behavior change. 2. Consider extracting the two-field read into `KubernetesUtils`. `DriverKubernetesCredentialsFeatureStep` now carries the same "prefer `serviceAccountName`, treat empty as unset" rule, and a helper such as `def podServiceAccount(pod: SparkPod): Option[String]` would keep it in one place and be reusable by the follow-up. Related: it is worth deciding explicitly how far this should be backported. Executor pods that used to run as the configured account will now run as the one the template names, and without the warning above users have nothing pointing at the change. **Minor, take or leave** - In the pod template table, the `serviceAccount` and `serviceAccountName` rows repeat the same long paragraph, and the "Modified value" column now holds a sentence rather than a value. Keeping that column short and putting the executor rule only in the description would read better. - `templateServiceAccount`'s value is never used, only `isEmpty`, so the `serviceAccountName`-first ordering has no effect today. Extracting the helper above resolves this naturally. - `KUBERNETES_EXECUTOR_SERVICE_ACCOUNT_NAME`'s `.doc(...)` in `Config.scala` still carries the old wording that you corrected in `running-on-kubernetes.md`. - The new tests set only the executor config. One case with only `spark.kubernetes.authenticate.driver.serviceAccountName` set would pin the `.orElse(driverServiceAccount)` path as well. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
