[feat] Add tiller-host and -port options to apply

This allows the use of a standalone tiller service.
This commit is contained in:
Mark Burnett 2017-07-25 16:28:12 -05:00 committed by Alexis Rivera DeLa Torre
parent d187c839ab
commit 721b6de6bf
3 changed files with 18 additions and 6 deletions

View File

@ -25,6 +25,8 @@ def applyCharts(args):
args.dry_run,
args.wait,
args.timeout,
args.tiller_host,
args.tiller_port,
args.debug_logging)
armada.sync()
@ -49,6 +51,10 @@ class ApplyChartsCommand(cmd.Command):
parser.add_argument('--timeout', action='store', type=int,
default=3600, help='Specifies time to wait'
' for charts to deploy')
parser.add_argument('--tiller-host', action='store', type=str,
help='Specify the tiller host')
parser.add_argument('--tiller-port', action='store', type=int,
default=44134, help='Specify the tiller port')
return parser
def take_action(self, parsed_args):

View File

@ -46,6 +46,8 @@ class Armada(object):
dry_run=False,
wait=False,
timeout=DEFAULT_TIMEOUT,
tiller_host=None,
tiller_port=44134,
debug=False):
'''
Initialize the Armada Engine and establish
@ -58,7 +60,7 @@ class Armada(object):
self.wait = wait
self.timeout = timeout
self.config = yaml.load(config)
self.tiller = Tiller()
self.tiller = Tiller(tiller_host=tiller_host, tiller_port=tiller_port)
self.debug = debug
# Set debug value

View File

@ -49,8 +49,10 @@ class Tiller(object):
service over gRPC
'''
def __init__(self):
def __init__(self, tiller_host=None, tiller_port=TILLER_PORT):
self.tiller_host = tiller_host
self.tiller_port = tiller_port
# init k8s connectivity
self.k8s = K8s()
@ -74,9 +76,8 @@ class Tiller(object):
Return a tiller channel
'''
tiller_ip = self._get_tiller_ip()
tiller_port = self._get_tiller_port()
return grpc.insecure_channel(
'%s:%s' % (tiller_ip, tiller_port),
'%s:%s' % (tiller_ip, self.tiller_port),
options=[
('grpc.max_send_message_length', MAX_MESSAGE_LENGTH),
('grpc.max_receive_message_length', MAX_MESSAGE_LENGTH)
@ -96,8 +97,11 @@ class Tiller(object):
'''
Returns the tiller pod's IP address by searching all namespaces
'''
pod = self._get_tiller_pod()
return pod.status.pod_ip
if self.tiller_host:
return self.tiller_host
else:
pod = self._get_tiller_pod()
return pod.status.pod_ip
def _get_tiller_port(self):
'''Stub method to support arbitrary ports in the future'''