-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
add activeDeadlineSeconds to Pod template #221
Conversation
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.
Thanks!
It would need updated docs in the readme, inline help (help-*.html in src/main/resources//org/csanchez/jenkins/plugins/kubernetes
), and pipeline support with a test in KubernetesPipelineTest
public int getIdleMinutes() { | ||
return idleMinutes; | ||
} | ||
public int getIdleMinutes() { return idleMinutes; } |
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.
can you keep current formatting (Eclipse/Java defaults will do)
As requested, added documentation, pipeline support and test for it. |
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.
Pipeline also needs documentation (jelly and html) for the "generator".
Small test improvements suggested.
|
||
r.waitForMessage("podTemplate", b); | ||
|
||
PodTemplate deadlineTemplate = null; |
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.
PodTemplate deadlineTemplate = cloud.getTemplates().stream().filter(x -> x.getLabel() == "deadline").findAny().get();
assertEquals(3600, deadlineTemplate.getDeadlineSeconds());
stage('Run') { | ||
container('busybox') { | ||
sh """ | ||
echo "Hello from container!" |
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.
Would it make sense to use a shorter deadline and a sleep
(longer than the deadline) here, so that you can assert in the test that the "Hello from container" is not printed, i.e. the deadline actually works?
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.
Yes, that would actually make more sense. Modified.
@@ -161,6 +162,15 @@ public void setSlaveConnectTimeout(int slaveConnectTimeout) { | |||
this.slaveConnectTimeout = slaveConnectTimeout; | |||
} | |||
|
|||
public int getDeadlineSeconds() { |
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.
Needs to be added to PodTemplateStep/config.jelly
(and the corresponding help html field) so that the "pipeline syntax" generator includes this.
You can also use a number field for this, see ContainerLogStep/config.jelly
.
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.
Changed to number field and added to PodTemplateStep/config.jelly
so that field apperas in Pipeline syntax. Thanks for the tips!
@@ -52,6 +52,10 @@ | |||
<f:textbox/> | |||
</f:entry> | |||
|
|||
<f:entry field="deadlineSecondsStr" title="${%Time in seconds for Pod deadline}"> | |||
<f:textbox/> |
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 can also use a number field for this, see ContainerLogStep/config.jelly
.
…ields to number fields
@tanskann sorry for the delay. Could you fix the checks, please? I will then check this again and probably merge it. |
@marvinthepa I don't have access to the CI which posts the check status. I guess @carlossg does? |
sorry, I didn’t see that there was a error in the check, I assumed this was just a merge error. I will run the tests locally and merge if they work. |
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 will check what happened with the PR build instance, but there is a mismatch here between activeDeadlineSeconds
and deadlineSeconds
Why not just use activeDeadlineSeconds
everywhere as K8S API does ?
@carlossg good point. Renamed. |
… an apparently unfounded assertion, and failed to stop the build.
Adds activeDeadlineSeconds to Pod template. We are using 2 quotas for our projects, one for long running pods and one for time bound and we want jenkins slaves to use time bound quota rather than long running.