Skip to content
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

Merged
merged 5 commits into from
Oct 16, 2017

Conversation

wilderbridge
Copy link
Contributor

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.

Copy link
Contributor

@carlossg carlossg left a 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; }
Copy link
Contributor

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)

@wilderbridge
Copy link
Contributor Author

As requested, added documentation, pipeline support and test for it.

Copy link
Contributor

@marvinthepa marvinthepa left a 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;
Copy link
Contributor

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!"
Copy link
Contributor

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?

Copy link
Contributor Author

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() {
Copy link
Contributor

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.

Copy link
Contributor Author

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/>
Copy link
Contributor

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.

@marvinthepa
Copy link
Contributor

@tanskann sorry for the delay. Could you fix the checks, please? I will then check this again and probably merge it.

@wilderbridge
Copy link
Contributor Author

@marvinthepa I don't have access to the CI which posts the check status. I guess @carlossg does?

@marvinthepa
Copy link
Contributor

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.

Copy link
Contributor

@carlossg carlossg left a 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 ?

@wilderbridge
Copy link
Contributor Author

@carlossg good point. Renamed.

@carlossg carlossg merged commit 72ecd23 into jenkinsci:master Oct 16, 2017
jglick added a commit to jglick/kubernetes-plugin that referenced this pull request Nov 25, 2019
… an apparently unfounded assertion, and failed to stop the build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants