Class KubernetesCloud

    • Field Detail

      • DEFAULT_MAX_REQUESTS_PER_HOST

        public static final int DEFAULT_MAX_REQUESTS_PER_HOST
        See Also:
        Constant Field Values
      • DEFAULT_WAIT_FOR_POD_SEC

        public static final Integer DEFAULT_WAIT_FOR_POD_SEC
      • DEFAULT_POD_LABELS

        @Deprecated
        public static final Map<String,​String> DEFAULT_POD_LABELS
        Deprecated.
        label for all pods started by the plugin
      • DEFAULT_RETENTION_TIMEOUT_MINUTES

        public static final int DEFAULT_RETENTION_TIMEOUT_MINUTES
        Default timeout for idle workers that don't correctly indicate exit.
        See Also:
        Constant Field Values
      • DEFAULT_READ_TIMEOUT_SECONDS

        public static final int DEFAULT_READ_TIMEOUT_SECONDS
        See Also:
        Constant Field Values
      • DEFAULT_CONNECT_TIMEOUT_SECONDS

        public static final int DEFAULT_CONNECT_TIMEOUT_SECONDS
        See Also:
        Constant Field Values
    • Constructor Detail

      • KubernetesCloud

        @DataBoundConstructor
        public KubernetesCloud​(String name)
      • KubernetesCloud

        public KubernetesCloud​(@NonNull
                               String name,
                               @NonNull
                               KubernetesCloud source)
        Copy constructor. Allows to create copies of the original kubernetes cloud. Since it's a singleton by design, this method also allows specifying a new name.
        Parameters:
        name - Name of the cloud to be created
        source - Source Kubernetes cloud implementation
        Since:
        0.13
    • Method Detail

      • isUseJenkinsProxy

        public boolean isUseJenkinsProxy()
      • setUseJenkinsProxy

        @DataBoundSetter
        public void setUseJenkinsProxy​(boolean useJenkinsProxy)
      • isUsageRestricted

        public boolean isUsageRestricted()
      • setUsageRestricted

        @DataBoundSetter
        public void setUsageRestricted​(boolean usageRestricted)
      • getRetentionTimeout

        public int getRetentionTimeout()
      • setRetentionTimeout

        @DataBoundSetter
        public void setRetentionTimeout​(int retentionTimeout)
      • getDefaultsProviderTemplate

        public String getDefaultsProviderTemplate()
      • setDefaultsProviderTemplate

        @DataBoundSetter
        public void setDefaultsProviderTemplate​(String defaultsProviderTemplate)
      • getAllTemplates

        @NonNull
        public List<PodTemplate> getAllTemplates()
        Returns all pod templates for this cloud including the dynamic ones.
        Returns:
        all pod templates for this cloud including the dynamic ones.
      • setTemplates

        @DataBoundSetter
        public void setTemplates​(@NonNull
                                 List<PodTemplate> templates)
      • getServerUrl

        public String getServerUrl()
      • setServerUrl

        @DataBoundSetter
        public void setServerUrl​(@NonNull
                                 String serverUrl)
      • getServerCertificate

        public String getServerCertificate()
      • setServerCertificate

        @DataBoundSetter
        public void setServerCertificate​(String serverCertificate)
      • isSkipTlsVerify

        public boolean isSkipTlsVerify()
      • setSkipTlsVerify

        @DataBoundSetter
        public void setSkipTlsVerify​(boolean skipTlsVerify)
      • isAddMasterProxyEnvVars

        public boolean isAddMasterProxyEnvVars()
      • setAddMasterProxyEnvVars

        @DataBoundSetter
        public void setAddMasterProxyEnvVars​(boolean addMasterProxyEnvVars)
      • getNamespace

        public String getNamespace()
      • setNamespace

        @DataBoundSetter
        public void setNamespace​(String namespace)
      • getJnlpregistry

        public String getJnlpregistry()
      • setJnlpregistry

        @DataBoundSetter
        public void setJnlpregistry​(String jnlpregistry)
      • isRestrictedPssSecurityContext

        public boolean isRestrictedPssSecurityContext()
      • setRestrictedPssSecurityContext

        @DataBoundSetter
        public void setRestrictedPssSecurityContext​(boolean restrictedPssSecurityContext)
      • getJenkinsUrl

        @CheckForNull
        public String getJenkinsUrl()
      • setCapOnlyOnAlivePods

        @DataBoundSetter
        @Deprecated
        public void setCapOnlyOnAlivePods​(boolean capOnlyOnAlivePods)
        Deprecated.
      • isCapOnlyOnAlivePods

        @Deprecated
        public boolean isCapOnlyOnAlivePods()
        Deprecated.
      • getJenkinsUrlOrNull

        @CheckForNull
        public String getJenkinsUrlOrNull()
        Jenkins URL to be used by agents launched by this cloud.

        Tries in order:

        1. an explicitly configured URL (getJenkinsUrl())
        2. the system property or environment variable KUBERNETES_JENKINS_URL, unless isWebSocket() mode and getCredentialsId() is defined
        3. JenkinsLocationConfiguration.getUrl()
        Returns:
        Jenkins URL to be used by agents launched by this cloud. Always ends with a trailing slash. Null if no Jenkins URL could be computed.
      • isWebSocket

        public boolean isWebSocket()
      • setWebSocket

        @DataBoundSetter
        public void setWebSocket​(boolean webSocket)
      • isDirectConnection

        public boolean isDirectConnection()
      • setDirectConnection

        @DataBoundSetter
        public void setDirectConnection​(boolean directConnection)
      • setJenkinsUrl

        @DataBoundSetter
        public void setJenkinsUrl​(String jenkinsUrl)
      • getJenkinsTunnel

        public String getJenkinsTunnel()
      • setJenkinsTunnel

        @DataBoundSetter
        public void setJenkinsTunnel​(String jenkinsTunnel)
      • getCredentialsId

        public String getCredentialsId()
      • setCredentialsId

        @DataBoundSetter
        public void setCredentialsId​(String credentialsId)
      • getContainerCap

        public int getContainerCap()
      • setContainerCapStr

        @DataBoundSetter
        public void setContainerCapStr​(String containerCapStr)
      • setContainerCap

        public void setContainerCap​(Integer containerCap)
      • getContainerCapStr

        public String getContainerCapStr()
      • getReadTimeout

        public int getReadTimeout()
      • setReadTimeout

        @DataBoundSetter
        public void setReadTimeout​(int readTimeout)
      • getConnectTimeout

        public int getConnectTimeout()
      • getPodLabels

        @NonNull
        public List<PodLabel> getPodLabels()
        Labels for all pods started by the plugin
      • setPodLabels

        @DataBoundSetter
        public void setPodLabels​(@CheckForNull
                                 List<PodLabel> labels)
        Set Pod labels for all pods started by the plugin.
      • setMaxRequestsPerHostStr

        @DataBoundSetter
        public void setMaxRequestsPerHostStr​(String maxRequestsPerHostStr)
      • setMaxRequestsPerHost

        @DataBoundSetter
        public void setMaxRequestsPerHost​(int maxRequestsPerHost)
      • getMaxRequestsPerHostStr

        public String getMaxRequestsPerHostStr()
      • getMaxRequestsPerHost

        public int getMaxRequestsPerHost()
      • setConnectTimeout

        @DataBoundSetter
        public void setConnectTimeout​(int connectTimeout)
      • getPodRetention

        public PodRetention getPodRetention()
        Gets the global pod retention policy for the plugin.
      • setPodRetention

        @DataBoundSetter
        public void setPodRetention​(PodRetention podRetention)
        Set the global pod retention policy for the plugin.
        Parameters:
        podRetention - the pod retention policy for the plugin.
      • connect

        public io.fabric8.kubernetes.client.KubernetesClient connect()
                                                              throws org.jenkinsci.plugins.kubernetes.auth.KubernetesAuthException,
                                                                     IOException
        Connects to Kubernetes.
        Returns:
        Kubernetes client.
        Throws:
        org.jenkinsci.plugins.kubernetes.auth.KubernetesAuthException
        IOException
      • replaceTemplate

        public void replaceTemplate​(PodTemplate oldTemplate,
                                    PodTemplate newTemplate)
        Description copied from interface: PodTemplateGroup
        Replaces the old template with the new template.
        Specified by:
        replaceTemplate in interface PodTemplateGroup
        Parameters:
        oldTemplate - the old template to replace
        newTemplate - the new template to replace with
      • getTemplate

        @CheckForNull
        public PodTemplate getTemplate​(@CheckForNull
                                       Label label)
        Gets PodTemplate that has the matching Label.
        Parameters:
        label - label to look for in templates
        Returns:
        the template
      • getTemplateById

        @CheckForNull
        public PodTemplate getTemplateById​(@NonNull
                                           String id)
      • getUnwrappedTemplate

        public PodTemplate getUnwrappedTemplate​(PodTemplate podTemplate)
        Unwraps the given pod template.
        Parameters:
        podTemplate - the pod template to unwrap.
        Returns:
        the unwrapped pod template
      • getTemplatesFor

        public List<PodTemplate> getTemplatesFor​(@CheckForNull
                                                 Label label)
        Gets all PodTemplates that have the matching Label.
        Parameters:
        label - label to look for in templates
        Returns:
        list of matching templates
      • addDynamicTemplate

        public void addDynamicTemplate​(PodTemplate t)
        Add a dynamic pod template. Won't be displayed in UI, and persisted separately from the cloud instance.
        Parameters:
        t - the template to add
      • removeDynamicTemplate

        public void removeDynamicTemplate​(PodTemplate t)
        Remove a dynamic pod template.
        Parameters:
        t - the template to remove
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getWaitForPodSec

        public Integer getWaitForPodSec()
      • setWaitForPodSec

        @DataBoundSetter
        public void setWaitForPodSec​(Integer waitForPodSec)
      • getTemplateDescriptor

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public PodTemplate.DescriptorImpl getTemplateDescriptor()