[KYUUBI #5045] Initialize EXECUTOR_POD_NAME_PREFIX_MAX_LENGTH before using

### _Why are the changes needed?_
I came cross an issue that is the the value of EXECUTOR_POD_NAME_PREFIX_MAX_LENGTH is 0 when the param is accessed in generateExecutorPodNamePrefixForK8s method.

I tried to move the EXECUTOR_POD_NAME_PREFIX_MAX_LENGTH ahead of generateExecutorPodNamePrefixForK8s method. Then, I found this issue was gone.

So is it necessary to declare the EXECUTOR_POD_NAME_PREFIX_MAX_LENGTH variable before the method definition?

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [ ] [Run test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests) locally before make a pull request

Closes #5045 from zhaohehuhu/Improvement.

Closes #5045

c74732f0c [hezhao2] recover the blank line
99aa14b0c [hezhao2] fix the code style
29929a2cb [hezhao2]  declare EXECUTOR_POD_NAME_PREFIX_MAX_LENGTH param before generateExecutorPodNamePrefixForK8s method

Authored-by: hezhao2 <hezhao2@cisco.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
hezhao2 2023-07-13 12:09:41 +08:00 committed by Cheng Pan
parent a8f134e3c6
commit da4af2aee7

View File

@ -165,6 +165,10 @@ object SparkSQLEngine extends Logging {
private val sparkSessionCreated = new AtomicBoolean(false)
// Kubernetes pod name max length - '-exec-' - Int.MAX_VALUE.length
// 253 - 10 - 6
val EXECUTOR_POD_NAME_PREFIX_MAX_LENGTH = 237
SignalRegister.registerLogger(logger)
setupConf()
@ -391,8 +395,4 @@ object SparkSQLEngine extends Logging {
s"kyuubi-${UUID.randomUUID()}"
}
}
// Kubernetes pod name max length - '-exec-' - Int.MAX_VALUE.length
// 253 - 10 - 6
val EXECUTOR_POD_NAME_PREFIX_MAX_LENGTH = 237
}