-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-24551][K8S] Add integration tests for secrets #21652
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
Conversation
f0d59cc
to
7602dbc
Compare
@foxish @liyinan926 @erikerlandson pls review. |
Kubernetes integration test starting |
Kubernetes integration test status failure |
Test build #92408 has finished for PR 21652 at commit
|
Kubernetes integration test starting |
Test build #92409 has finished for PR 21652 at commit
|
Kubernetes integration test status failure |
@foxish @erikerlandson I got this failure: "namespaces "59da2249348347a39391b4389ab418ab" not found." |
@felixcheung @liyinan926 @ssuchter review pls. |
jenkins, retest this please |
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.
Looks like a great start. I like that we're now getting the output from pod exec
and validating it.
@@ -74,10 +76,12 @@ private[spark] class KubernetesSuite extends SparkFunSuite | |||
testBackend = IntegrationTestBackendFactory.getTestBackend | |||
testBackend.initialize() | |||
kubernetesTestComponents = new KubernetesTestComponents(testBackend.getKubernetesClient) | |||
createTestSecret() |
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.
I'm wondering if we should add these tests to a separate class? This file is growing in size and we can separate them out a bit for better code understanding.
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.
You are right probably we should. Ok let me try do this.
runSparkPiAndVerifyCompletion( | ||
driverPodChecker = (driverPod: Pod) => { | ||
doBasicDriverPodCheck(driverPod) | ||
checkSecrets(driverPod) |
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.
nit: indentation
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.
will fix.
.withTTY() | ||
.exec(cmd.toArray: _*) | ||
// wait to get some result back | ||
Thread.sleep(1000) |
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.
This is a pretty quick timeout. Is there some way to have a longer timeout but to return instantly if the watch command exits? E.g. some kind of "join" method call on the watch instance that itself has a timeout?
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.
Ok will have a look. It does work because I guess its minikube and it is fast, I didn't see any issues. But might be a problem don't know.
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.
@ssuchter I tried the approach here: https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecLoopExample.java
and also mentioned here:
https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecPipesExample.java#L60
Latches were not useful to me. The examples there use the timeout approach (actually I recall that I looked at the examples before writing the code here).
The ideal approach would be to check continuously on the watch output on a future (eg. look what this class does: https://github.com/fabric8io/kubernetes-client/blob/9b2128ca5f2362991c99640d8a0325d60741644c/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/InputStreamPumper.java) and wait until it completes with some time out. But that didnt work well so far for me.
So I guess that sleep is the most easy solution.
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.
This overall looks pretty nice, thanks! I had just a couple questions - please take a look.
@@ -74,10 +76,12 @@ private[spark] class KubernetesSuite extends SparkFunSuite | |||
testBackend = IntegrationTestBackendFactory.getTestBackend | |||
testBackend.initialize() | |||
kubernetesTestComponents = new KubernetesTestComponents(testBackend.getKubernetesClient) | |||
createTestSecret() |
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.
Should this be done before every test, or just the one that is using the secrets?
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.
I guess we can add it before the specific test. My rationale was that this is something I require before the tests are run.
} | ||
|
||
override def afterAll(): Unit = { | ||
testBackend.cleanUp() | ||
deleteTestSecret() |
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.
Same question about every test versus just one of them.
Kubernetes integration test starting |
Kubernetes integration test status failure |
Test build #92538 has finished for PR 21652 at commit
|
}, | ||
appArgs = Array("1000") // give it enough time for all execs to be visible | ||
) | ||
} finally { |
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.
@ssuchter moved the secret creation in here. I had the idea of using before and after and checking for a flag to identify the current test (scalatest with FunSuite does not give you that AFAIK) but I think this is cleaner.
Kubernetes integration test starting |
Test build #92610 has finished for PR 21652 at commit
|
Kubernetes integration test status success |
9bd17b3
to
9de4a7a
Compare
@foxish @ssuchter I refactored the tests in different classes. There are some clear benefits now. |
Kubernetes integration test starting |
Test build #93199 has finished for PR 21652 at commit
|
test this please |
Kubernetes integration test starting |
Kubernetes integration test status failure |
Test build #93204 has finished for PR 21652 at commit
|
test this please (i tied this build to amp-jenkins-staging-worker-02 to unblock things) |
Kubernetes integration test starting |
Kubernetes integration test status failure |
argh fixing 02 again and will retrigger then once it's done. i'm really sorry that things have been so flaky recently. |
Test build #93205 has finished for PR 21652 at commit
|
test this please |
Kubernetes integration test starting |
Test build #93206 has finished for PR 21652 at commit
|
Kubernetes integration test status success |
@shaneknapp thanks, @srowen @foxish gentle ping. |
@@ -16,7 +16,7 @@ | |||
*/ | |||
package org.apache.spark.deploy.k8s.integrationtest | |||
|
|||
package object constants { | |||
object TestConstants { |
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.
I removed the package objects and replaced them with normal ones. The package statement was not ok and their naming convention was not following scala rules.
Kubernetes integration test starting |
Test build #93228 has finished for PR 21652 at commit
|
Kubernetes integration test status success |
Kubernetes integration test starting |
Kubernetes integration test status success |
@@ -135,7 +135,7 @@ BASEDOCKERFILE= | |||
PYDOCKERFILE= | |||
NOCACHEARG= | |||
BUILD_PARAMS= | |||
while getopts f:mr:t:n:b: option | |||
while getopts f:p:mr:t:n:b: option |
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.
@debasishg spotted this.
Test build #93298 has finished for PR 21652 at commit
|
@felixcheung @srowen may I have a merge pls? |
Merged to master |
What changes were proposed in this pull request?
How was this patch tested?
Manually by checking that secrets were added to the containers and by tuning the tests.