@Experimental public class TillerInstaller extends Object
helm init
command.
In general, this class follows the logic as expressed in the
install.go
source code from the Helm project,
problematic or not. The intent is to have an installer, usable as
an idiomatic Java library, that behaves just like helm
init
.
Note: This class is experimental and its API is subject to change without notice.
init()
,
The
install.go
source code from the Helm projectModifier and Type | Class and Description |
---|---|
static class |
TillerInstaller.ImagePullPolicy
An
enum representing valid values for a Kubernetes imagePullPolicy field. |
Modifier and Type | Field and Description |
---|---|
static String |
VERSION
The version of Tiller to install.
|
Constructor and Description |
---|
TillerInstaller()
Creates a new
TillerInstaller , using a new DefaultKubernetesClient . |
TillerInstaller(KubernetesClient kubernetesClient)
Creates a new
TillerInstaller . |
TillerInstaller(KubernetesClient kubernetesClient,
String tillerNamespace)
Creates a new
TillerInstaller . |
Modifier and Type | Method and Description |
---|---|
protected Container |
createContainer(String imageName,
TillerInstaller.ImagePullPolicy imagePullPolicy,
int maxHistory,
String namespace,
boolean tls,
boolean verifyTls) |
protected Container |
createContainer(String imageName,
TillerInstaller.ImagePullPolicy imagePullPolicy,
String namespace,
boolean tls,
boolean verifyTls) |
protected Deployment |
createDeployment(String namespace,
String deploymentName,
Map<String,String> labels,
Map<String,String> nodeSelector,
String serviceAccountName,
String imageName,
TillerInstaller.ImagePullPolicy imagePullPolicy,
int maxHistory,
boolean hostNetwork,
boolean tls,
boolean verifyTls) |
protected Deployment |
createDeployment(String namespace,
String deploymentName,
Map<String,String> labels,
String serviceAccountName,
String imageName,
TillerInstaller.ImagePullPolicy imagePullPolicy,
boolean hostNetwork,
boolean tls,
boolean verifyTls) |
protected DeploymentSpec |
createDeploymentSpec(Map<String,String> labels,
Map<String,String> nodeSelector,
String serviceAccountName,
String imageName,
TillerInstaller.ImagePullPolicy imagePullPolicy,
int maxHistory,
String namespace,
boolean hostNetwork,
boolean tls,
boolean verifyTls) |
protected DeploymentSpec |
createDeploymentSpec(Map<String,String> labels,
String serviceAccountName,
String imageName,
TillerInstaller.ImagePullPolicy imagePullPolicy,
String namespace,
boolean hostNetwork,
boolean tls,
boolean verifyTls) |
protected Secret |
createSecret(String namespace,
URI tlsKeyUri,
URI tlsCertUri,
URI tlsCaCertUri,
Map<String,String> labels) |
protected Service |
createService(String namespace,
String serviceName,
Map<String,String> labels) |
protected ServiceSpec |
createServiceSpec(Map<String,String> labels) |
void |
init() |
void |
init(boolean upgrade) |
void |
init(boolean upgrade,
long tillerConnectionTimeout) |
void |
init(boolean upgrade,
String namespace,
String deploymentName,
String serviceName,
Map<String,String> labels,
Map<String,String> nodeSelector,
String serviceAccountName,
String imageName,
TillerInstaller.ImagePullPolicy imagePullPolicy,
int maxHistory,
boolean hostNetwork,
boolean tls,
boolean verifyTls,
URI tlsKeyUri,
URI tlsCertUri,
URI tlsCaCertUri,
long tillerConnectionTimeout)
|
void |
init(boolean upgrade,
String namespace,
String deploymentName,
String serviceName,
Map<String,String> labels,
String serviceAccountName,
String imageName,
TillerInstaller.ImagePullPolicy imagePullPolicy,
boolean hostNetwork,
boolean tls,
boolean verifyTls,
URI tlsKeyUri,
URI tlsCertUri,
URI tlsCaCertUri)
Deprecated.
|
void |
install() |
void |
install(String namespace,
String deploymentName,
String serviceName,
Map<String,String> labels,
Map<String,String> nodeSelector,
String serviceAccountName,
String imageName,
TillerInstaller.ImagePullPolicy imagePullPolicy,
int maxHistory,
boolean hostNetwork,
boolean tls,
boolean verifyTls,
URI tlsKeyUri,
URI tlsCertUri,
URI tlsCaCertUri) |
void |
install(String namespace,
String deploymentName,
String serviceName,
Map<String,String> labels,
String serviceAccountName,
String imageName,
TillerInstaller.ImagePullPolicy imagePullPolicy,
boolean hostNetwork,
boolean tls,
boolean verifyTls,
URI tlsKeyUri,
URI tlsCertUri,
URI tlsCaCertUri) |
protected boolean |
isTillerPodReady(String namespace,
Map<String,String> labels,
long timeoutInMilliseconds)
Returns
true if there is a running Tiller pod that is
Ready , waiting for a particular amount of time for this
result. |
protected static String |
normalizeDeploymentName(String deploymentName) |
protected static String |
normalizeImageName(String imageName) |
protected static Map<String,String> |
normalizeLabels(Map<String,String> labels) |
protected String |
normalizeNamespace(String namespace) |
protected static String |
normalizeServiceAccountName(String serviceAccountName) |
protected static String |
normalizeServiceName(String serviceName) |
protected <T extends HttpClientAware & KubernetesClient> |
ping(String namespace,
Map<String,String> labels,
long timeoutInMilliseconds)
If the supplied
timeoutInMilliseconds is zero or greater,
waits for there to be a Ready Tiller pod and then
contacts its health endpoint. |
void |
upgrade() |
void |
upgrade(String namespace,
String deploymentName,
String serviceName,
String serviceAccountName,
String imageName,
TillerInstaller.ImagePullPolicy imagePullPolicy,
Map<String,String> labels) |
void |
upgrade(String namespace,
String deploymentName,
String serviceName,
String serviceAccountName,
String imageName,
TillerInstaller.ImagePullPolicy imagePullPolicy,
Map<String,String> labels,
boolean force) |
public static final String VERSION
public TillerInstaller()
TillerInstaller
, using a new DefaultKubernetesClient
.public TillerInstaller(KubernetesClient kubernetesClient)
TillerInstaller
.kubernetesClient
- the KubernetesClient
to use to
communicate with Kubernetes; must not be null
tillerNamespace
- the namespace into which to install
Tiller; may be null
in which case the value of the TILLER_NAMESPACE
environment variable will be used—if that
is null
then kube-system
will be used insteadNullPointerException
- if kubernetesClient
is
null
TillerInstaller(KubernetesClient, String)
public TillerInstaller(KubernetesClient kubernetesClient, String tillerNamespace)
TillerInstaller
.kubernetesClient
- the KubernetesClient
to use to
communicate with Kubernetes; must not be null
tillerNamespace
- the namespace into which to install
Tiller; may be null
in which case the value of the TILLER_NAMESPACE
environment variable will be used—if that
is null
then kube-system
will be used insteadNullPointerException
- if kubernetesClient
is
null
public void init()
public void init(boolean upgrade)
public void init(boolean upgrade, long tillerConnectionTimeout)
@Deprecated public void init(boolean upgrade, String namespace, String deploymentName, String serviceName, Map<String,String> labels, String serviceAccountName, String imageName, TillerInstaller.ImagePullPolicy imagePullPolicy, boolean hostNetwork, boolean tls, boolean verifyTls, URI tlsKeyUri, URI tlsCertUri, URI tlsCaCertUri) throws IOException
init(boolean, String, String,
String, Map, Map, String, String, ImagePullPolicy, int, boolean,
boolean, boolean, URI, URI, URI, long)
method instead.upgrade
is
false
, or upgrading the Tiller
installation if upgrade
is true
and a newer
version of Tiller is available.upgrade
- whether or not to attempt an upgrade if Tiller is
already installednamespace
- the Kubernetes namespace into which Tiller will
be installed, if it is not already installed; may be null
in which case a default will be useddeploymentName
- the name that the Kubernetes Deployment
representing Tiller will have; may be null
; tiller-deploy
by defaultserviceName
- the name that the Kubernetes Service
representing Tiller will have; may be null
; tiller-deploy
(yes, tiller-deploy
) by defaultlabels
- the Kubernetes Labels that will be applied to
various Kubernetes resources representing Tiller; may be null
in which case a Map
consisting of a label of app
with a value of helm
and a label of name
with a value of tiller
will be used insteadserviceAccountName
- the name of the Kubernetes Service
Account that Tiller should use; may be null
in which case
the default Service Account will be used insteadimageName
- the name of the Docker image that contains the
Tiller code; may be null
in which case the Java String
"gcr.io/kubernetes-helm/tiller:v" + "2.8.2"
will be used insteadimagePullPolicy
- an TillerInstaller.ImagePullPolicy
specifying how
the Tiller image should be pulled; may be null
in which
case TillerInstaller.ImagePullPolicy.IF_NOT_PRESENT
will be used insteadhostNetwork
- the value to be used for the hostNetwork
property of the Tiller Pod's PodSpec
tls
- whether Tiller's conversations with Kubernetes will be
encrypted using TLSverifyTls
- whether, if and only if tls
is true
, additional TLS-related verification will be performedtlsKeyUri
- a URI
to the public key used during TLS
communication with Kubernetes; may be null
if tls
is false
tlsCertUri
- a URI
to the certificate used during
TLS communication with Kubernetes; may be null
if tls
is false
tlsCaCertUri
- a URI
to the certificate authority
used during TLS communication with Kubernetes; may be null
if tls
is false
IOException
- if a communication error occursinit(boolean, String, String, String, Map, Map, String,
String, ImagePullPolicy, int, boolean, boolean, boolean, URI,
URI, URI, long)
,
install(String, String, String, Map, Map, String, String,
ImagePullPolicy, int, boolean, boolean, boolean, URI, URI, URI)
,
upgrade(String, String, String, String, String,
ImagePullPolicy, Map)
public void init(boolean upgrade, String namespace, String deploymentName, String serviceName, Map<String,String> labels, Map<String,String> nodeSelector, String serviceAccountName, String imageName, TillerInstaller.ImagePullPolicy imagePullPolicy, int maxHistory, boolean hostNetwork, boolean tls, boolean verifyTls, URI tlsKeyUri, URI tlsCertUri, URI tlsCaCertUri, long tillerConnectionTimeout) throws IOException
upgrade
is
false
, or upgrading the Tiller
installation if upgrade
is true
and a newer
version of Tiller is available.upgrade
- whether or not to attempt an upgrade if Tiller is
already installednamespace
- the Kubernetes namespace into which Tiller will
be installed, if it is not already installed; may be null
in which case a default will be useddeploymentName
- the name that the Kubernetes Deployment
representing Tiller will have; may be null
; tiller-deploy
by defaultserviceName
- the name that the Kubernetes Service
representing Tiller will have; may be null
; tiller-deploy
(yes, tiller-deploy
) by defaultlabels
- the Kubernetes Labels that will be applied to
various Kubernetes resources representing Tiller; may be null
in which case a Map
consisting of a label of app
with a value of helm
and a label of name
with a value of tiller
will be used insteadnodeSelector
- a Map
representing labels that will
be written as a node selector; may be null
serviceAccountName
- the name of the Kubernetes Service
Account that Tiller should use; may be null
in which case
the default Service Account will be used insteadimageName
- the name of the Docker image that contains the
Tiller code; may be null
in which case the Java String
"gcr.io/kubernetes-helm/tiller:v" + "2.8.2"
will be used insteadimagePullPolicy
- an TillerInstaller.ImagePullPolicy
specifying how
the Tiller image should be pulled; may be null
in which
case TillerInstaller.ImagePullPolicy.IF_NOT_PRESENT
will be used insteadmaxHistory
- the maximum number of release versions stored
per release; a value that is less than or equal to zero means
there is effectively no limithostNetwork
- the value to be used for the hostNetwork
property of the Tiller Pod's PodSpec
tls
- whether Tiller's conversations with Kubernetes will be
encrypted using TLSverifyTls
- whether, if and only if tls
is true
, additional TLS-related verification will be performedtlsKeyUri
- a URI
to the public key used during TLS
communication with Kubernetes; may be null
if tls
is false
tlsCertUri
- a URI
to the certificate used during
TLS communication with Kubernetes; may be null
if tls
is false
tlsCaCertUri
- a URI
to the certificate authority
used during TLS communication with Kubernetes; may be null
if tls
is false
tillerConnectionTimeout
- the number of milliseconds to wait
for a Tiller pod to become ready; if less than 0
no wait
will occurIOException
- if a communication error occursinstall(String, String, String, Map, Map, String, String,
ImagePullPolicy, int, boolean, boolean, boolean, URI, URI, URI)
,
upgrade(String, String, String, String, String,
ImagePullPolicy, Map)
public void install()
public void install(String namespace, String deploymentName, String serviceName, Map<String,String> labels, String serviceAccountName, String imageName, TillerInstaller.ImagePullPolicy imagePullPolicy, boolean hostNetwork, boolean tls, boolean verifyTls, URI tlsKeyUri, URI tlsCertUri, URI tlsCaCertUri) throws IOException
IOException
public void install(String namespace, String deploymentName, String serviceName, Map<String,String> labels, Map<String,String> nodeSelector, String serviceAccountName, String imageName, TillerInstaller.ImagePullPolicy imagePullPolicy, int maxHistory, boolean hostNetwork, boolean tls, boolean verifyTls, URI tlsKeyUri, URI tlsCertUri, URI tlsCaCertUri) throws IOException
IOException
public void upgrade()
public void upgrade(String namespace, String deploymentName, String serviceName, String serviceAccountName, String imageName, TillerInstaller.ImagePullPolicy imagePullPolicy, Map<String,String> labels)
public void upgrade(String namespace, String deploymentName, String serviceName, String serviceAccountName, String imageName, TillerInstaller.ImagePullPolicy imagePullPolicy, Map<String,String> labels, boolean force)
protected Service createService(String namespace, String serviceName, Map<String,String> labels)
protected Deployment createDeployment(String namespace, String deploymentName, Map<String,String> labels, String serviceAccountName, String imageName, TillerInstaller.ImagePullPolicy imagePullPolicy, boolean hostNetwork, boolean tls, boolean verifyTls)
protected Deployment createDeployment(String namespace, String deploymentName, Map<String,String> labels, Map<String,String> nodeSelector, String serviceAccountName, String imageName, TillerInstaller.ImagePullPolicy imagePullPolicy, int maxHistory, boolean hostNetwork, boolean tls, boolean verifyTls)
protected Secret createSecret(String namespace, URI tlsKeyUri, URI tlsCertUri, URI tlsCaCertUri, Map<String,String> labels) throws IOException
IOException
protected DeploymentSpec createDeploymentSpec(Map<String,String> labels, String serviceAccountName, String imageName, TillerInstaller.ImagePullPolicy imagePullPolicy, String namespace, boolean hostNetwork, boolean tls, boolean verifyTls)
protected DeploymentSpec createDeploymentSpec(Map<String,String> labels, Map<String,String> nodeSelector, String serviceAccountName, String imageName, TillerInstaller.ImagePullPolicy imagePullPolicy, int maxHistory, String namespace, boolean hostNetwork, boolean tls, boolean verifyTls)
protected Container createContainer(String imageName, TillerInstaller.ImagePullPolicy imagePullPolicy, String namespace, boolean tls, boolean verifyTls)
protected Container createContainer(String imageName, TillerInstaller.ImagePullPolicy imagePullPolicy, int maxHistory, String namespace, boolean tls, boolean verifyTls)
protected ServiceSpec createServiceSpec(Map<String,String> labels)
protected final String normalizeNamespace(String namespace)
protected final <T extends HttpClientAware & KubernetesClient> void ping(String namespace, Map<String,String> labels, long timeoutInMilliseconds) throws MalformedURLException
timeoutInMilliseconds
is zero or greater,
waits for there to be a Ready
Tiller pod and then
contacts its health endpoint.
If the Tiller pod is healthy this method will return normally.
namespace
- the namespace housing Tiller; may be null
in which case a default will be usedlabels
- the Kubernetes labels that will be used to find
running Tiller pods; may be null
in which case a Map
consisting of a label of app
with a value of helm
and a label of name
with a value of tiller
will be used insteadtimeoutInMilliseconds
- the number of milliseconds to wait
for a Tiller pod to become ready; if less than 0
no wait
will occur and this method will return immediatelyKubernetesClientException
- if there was a problem
connecting to KubernetesMalformedURLException
- if there was a problem
forwarding a port to TillerTillerPollingDeadlineExceededException
- if Tiller could
not be contacted in timeTillerUnavailableException
- if Tiller was not healthyprotected final boolean isTillerPodReady(String namespace, Map<String,String> labels, long timeoutInMilliseconds)
true
if there is a running Tiller pod that is
Ready
, waiting for a particular amount of time for this
result.namespace
- the namespace housing Tiller; may be null
in which case a default will be used insteadlabels
- labels identifying Tiller pods; may be null
in which case a default set will be used insteadtimeoutInMilliseconds
- the number of milliseconds to wait
for a result; if 0
, this method will block and wait
forever; if less than 0
this method will take no action
and will return false
true
if there is a running Tiller pod that is
Ready
; false
otherwiseKubernetesClientException
- if there was a problem
communicating with Kubernetesprotected static final Map<String,String> normalizeLabels(Map<String,String> labels)
protected static final String normalizeDeploymentName(String deploymentName)
protected static final String normalizeImageName(String imageName)
protected static final String normalizeServiceAccountName(String serviceAccountName)
protected static final String normalizeServiceName(String serviceName)
Copyright © 2017–2018, microBean. All rights reserved.