- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.3k
Adds support for readiness probe #1322
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
          
     Open
      
      
            geanpalacios
  wants to merge
  1
  commit into
  jenkinsci:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
geanpalacios:add-readiness-probe-support
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
  
    
      
          
            100 changes: 100 additions & 0 deletions
          
          100 
        
  src/main/java/org/csanchez/jenkins/plugins/kubernetes/ContainerReadinessProbe.java
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| package org.csanchez.jenkins.plugins.kubernetes; | ||
|  | ||
| import hudson.Extension; | ||
| import hudson.model.AbstractDescribableImpl; | ||
| import hudson.model.Descriptor; | ||
| import org.jenkinsci.Symbol; | ||
| import org.kohsuke.stapler.DataBoundConstructor; | ||
|  | ||
| import java.io.Serializable; | ||
|  | ||
| /** | ||
| * Created by geanpalacios on 15/02/23. | ||
| */ | ||
| public class ContainerReadinessProbe extends AbstractDescribableImpl<ContainerReadinessProbe> implements Serializable { | ||
| private String execArgs; | ||
| private int timeoutSeconds; | ||
| private int initialDelaySeconds; | ||
| private int failureThreshold; | ||
| private int periodSeconds; | ||
| private int successThreshold; | ||
|  | ||
| @DataBoundConstructor | ||
| public ContainerReadinessProbe(String execArgs, int timeoutSeconds, int initialDelaySeconds, int failureThreshold, int periodSeconds, int successThreshold) { | ||
| this.execArgs = execArgs; | ||
| this.timeoutSeconds = timeoutSeconds; | ||
| this.initialDelaySeconds = initialDelaySeconds; | ||
| this.failureThreshold = failureThreshold; | ||
| this.periodSeconds = periodSeconds; | ||
| this.successThreshold = successThreshold; | ||
| } | ||
|  | ||
| public String getExecArgs() { | ||
| return execArgs; | ||
| } | ||
|  | ||
| public void setExecArgs(String execArgs) { | ||
| this.execArgs = execArgs; | ||
| } | ||
|  | ||
| public int getTimeoutSeconds() { | ||
| return timeoutSeconds; | ||
| } | ||
|  | ||
| public void setTimeoutSeconds(int timeoutSeconds) { | ||
| this.timeoutSeconds = timeoutSeconds; | ||
| } | ||
|  | ||
| public int getInitialDelaySeconds() { | ||
| return initialDelaySeconds; | ||
| } | ||
|  | ||
| public void setInitialDelaySeconds(int initialDelaySeconds) { | ||
| this.initialDelaySeconds = initialDelaySeconds; | ||
| } | ||
|  | ||
| public int getFailureThreshold() { | ||
| return failureThreshold; | ||
| } | ||
|  | ||
| public void setFailureThreshold(int failureThreshold) { | ||
| this.failureThreshold = failureThreshold; | ||
| } | ||
|  | ||
| public int getPeriodSeconds() { | ||
| return periodSeconds; | ||
| } | ||
|  | ||
| public void setPeriodSeconds(int periodSeconds) { | ||
| this.periodSeconds = periodSeconds; | ||
| } | ||
|  | ||
| public int getSuccessThreshold() { | ||
| return successThreshold; | ||
| } | ||
|  | ||
| public void setSuccessThreshold(int successThreshold) { | ||
| this.successThreshold = successThreshold; | ||
| } | ||
|  | ||
| @Override | ||
| public String toString() { | ||
| return "ContainerReadinessProbe{" + | ||
| "execArgs='" + execArgs + '\'' + | ||
| ", timeoutSeconds=" + timeoutSeconds + | ||
| ", initialDelaySeconds=" + initialDelaySeconds + | ||
| ", failureThreshold=" + failureThreshold + | ||
| ", periodSeconds=" + periodSeconds + | ||
| ", successThreshold=" + successThreshold + | ||
| '}'; | ||
| } | ||
|  | ||
| @Extension | ||
| @Symbol("containerReadinessProbe") | ||
| public static class DescriptorImpl extends Descriptor<ContainerReadinessProbe> { | ||
| @Override | ||
| public String getDisplayName() { | ||
| return "Container Readiness Probe"; | ||
| } | ||
| } | ||
| } | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
  
    
      
          
            30 changes: 30 additions & 0 deletions
          
          30 
        
  ...in/resources/org/csanchez/jenkins/plugins/kubernetes/ContainerReadinessProbe/config.jelly
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <!-- | ||
| Config page | ||
| --> | ||
| <?jelly escape-by-default='true'?> | ||
| <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" | ||
| xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
| <f:entry field="execArgs" title="${%Exec action}"> | ||
| <f:textbox/> | ||
| </f:entry> | ||
|  | ||
| <f:entry field="initialDelaySeconds" title="${%Initial Delay Seconds}"> | ||
| <f:textbox/> | ||
| </f:entry> | ||
|  | ||
| <f:entry field="timeoutSeconds" title="${%Timeout Seconds}"> | ||
| <f:textbox/> | ||
| </f:entry> | ||
|  | ||
| <f:entry field="failureThreshold" title="${%Failure Threshold}"> | ||
| <f:textbox/> | ||
| </f:entry> | ||
|  | ||
| <f:entry field="periodSeconds" title="${%Period Seconds}"> | ||
| <f:textbox/> | ||
| </f:entry> | ||
|  | ||
| <f:entry field="successThreshold" title="${%Success Threshold}"> | ||
| <f:textbox/> | ||
| </f:entry> | ||
| </j:jelly> | 
        
          
  
    
      
          
            28 changes: 28 additions & 0 deletions
          
          28 
        
  ...s/org/csanchez/jenkins/plugins/kubernetes/ContainerReadinessProbe/config_zh_CN.properties
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # The MIT License | ||
| # | ||
| # Copyright (c) 2018, Alauda | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included in | ||
| # all copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| # THE SOFTWARE. | ||
|  | ||
| Exec\ action= | ||
| Initial\ Delay\ Seconds= | ||
| Timeout\ Seconds= | ||
| Failure\ Threshold= | ||
| Period\ Seconds= | ||
| Success\ Threshold= | 
        
          
  
    
      
          
            1 change: 1 addition & 0 deletions
          
          1 
        
  ...ources/org/csanchez/jenkins/plugins/kubernetes/ContainerReadinessProbe/help-execArgs.html
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Command executed by the readiness probe. | 
        
          
  
    
      
          
            5 changes: 5 additions & 0 deletions
          
          5 
        
  ...rg/csanchez/jenkins/plugins/kubernetes/ContainerReadinessProbe/help-failureThreshold.html
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <p> | ||
| When a Pod starts and the probe fails, Kubernetes will try <em>failureThreshold</em> times before giving up.<br/> | ||
| Giving up in case of liveness probe means restarting the container.<br/> | ||
| In case of readiness probe the Pod will be marked Unready. Defaults to 3. Minimum value is 1. | ||
| </p> | 
        
          
  
    
      
          
            1 change: 1 addition & 0 deletions
          
          1 
        
  ...csanchez/jenkins/plugins/kubernetes/ContainerReadinessProbe/help-initialDelaySeconds.html
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Number of seconds after the container has started before liveness or readiness probes are initiated. Defaults to 0 seconds. Minimum value is 0. | 
        
          
  
    
      
          
            3 changes: 3 additions & 0 deletions
          
          3 
        
  ...s/org/csanchez/jenkins/plugins/kubernetes/ContainerReadinessProbe/help-periodSeconds.html
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <p> | ||
| How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. | ||
| </p> | 
        
          
  
    
      
          
            1 change: 1 addition & 0 deletions
          
          1 
        
  ...rg/csanchez/jenkins/plugins/kubernetes/ContainerReadinessProbe/help-successThreshold.html
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Minimum value is 1. | 
        
          
  
    
      
          
            1 change: 1 addition & 0 deletions
          
          1 
        
  .../org/csanchez/jenkins/plugins/kubernetes/ContainerReadinessProbe/help-timeoutSeconds.html
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
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 identical to
ContainerLivenessProbe.I would suggest to rename
ContainerLivenessProbetoContainerProbe, and add a compatibility alias as documented in http://www.jenkins.io/doc/developer/persistence/backward-compatibility/#rename-a-class