feat(tiller): adding namespace flag

Adding tiller-namespace (tn) flag to allow for setting specific tiller namespace

Updated:
- Armada API
- Test API
- Tiller API
- Armada handler
- Tiller handler
- cli/apply
- cli/test
- cli/tiller

Change-Id: I3a18d6ec2ce2f771c9349d6b337537f193f6c73d
This commit is contained in:
Roadrunner2058 2017-12-13 19:37:02 +00:00 committed by Felipe Monteiro
parent 722d6122b6
commit ded826d3d1
15 changed files with 228 additions and 96 deletions

View File

@ -16,6 +16,7 @@ import json
import yaml import yaml
import falcon import falcon
from oslo_config import cfg
from armada import api from armada import api
from armada.common import policy from armada.common import policy
@ -24,6 +25,8 @@ from armada.handlers.armada import Armada
from armada.handlers.document import ReferenceResolver from armada.handlers.document import ReferenceResolver
from armada.handlers.override import Override from armada.handlers.override import Override
CONF = cfg.CONF
class Apply(api.BaseResource): class Apply(api.BaseResource):
"""Controller for installing and updating charts defined in an Armada """Controller for installing and updating charts defined in an Armada
@ -78,8 +81,11 @@ class Apply(api.BaseResource):
dry_run=req.get_param_as_bool('dry_run'), dry_run=req.get_param_as_bool('dry_run'),
wait=req.get_param_as_bool('wait'), wait=req.get_param_as_bool('wait'),
timeout=req.get_param_as_int('timeout') or 3600, timeout=req.get_param_as_int('timeout') or 3600,
tiller_host=req.get_param('tiller_host', default=None), tiller_host=req.get_param('tiller_host'),
tiller_port=req.get_param_as_int('tiller_port') or 44134, tiller_port=req.get_param_as_int(
'tiller_port') or CONF.tiller_port,
tiller_namespace=req.get_param(
'tiller_namespace', default=CONF.tiller_namespace),
target_manifest=req.get_param('target_manifest') target_manifest=req.get_param('target_manifest')
) )

View File

@ -15,6 +15,7 @@
import json import json
import falcon import falcon
from oslo_config import cfg
from armada import api from armada import api
from armada.common import policy from armada.common import policy
@ -23,6 +24,8 @@ from armada.handlers.tiller import Tiller
from armada.handlers.manifest import Manifest from armada.handlers.manifest import Manifest
from armada.utils.release import release_prefix from armada.utils.release import release_prefix
CONF = cfg.CONF
class Test(api.BaseResource): class Test(api.BaseResource):
''' '''
@ -33,9 +36,12 @@ class Test(api.BaseResource):
def on_get(self, req, resp, release): def on_get(self, req, resp, release):
try: try:
self.logger.info('RUNNING: %s', release) self.logger.info('RUNNING: %s', release)
opts = req.params tiller = Tiller(
tiller = Tiller(tiller_host=opts.get('tiller_host', None), tiller_host=req.get_param('tiller_host'),
tiller_port=opts.get('tiller_port', None)) tiller_port=req.get_param_as_int(
'tiller_port') or CONF.tiller_port,
tiller_namespace=req.get_param(
'tiller_namespace', default=CONF.tiller_namespace))
tiller_resp = tiller.testing_release(release) tiller_resp = tiller.testing_release(release)
msg = { msg = {
'result': '', 'result': '',
@ -77,8 +83,12 @@ class Tests(api.BaseResource):
@policy.enforce('armada:tests_manifest') @policy.enforce('armada:tests_manifest')
def on_post(self, req, resp): def on_post(self, req, resp):
try: try:
tiller = Tiller(tiller_host=req.get_param('tiller_host', None), tiller = Tiller(
tiller_port=req.get_param('tiller_port', None)) tiller_host=req.get_param('tiller_host'),
tiller_port=req.get_param_as_int(
'tiller_port') or CONF.tiller_port,
tiller_namespace=req.get_param(
'tiller_namespace', default=CONF.tiller_namespace))
documents = self.req_yaml(req) documents = self.req_yaml(req)
target_manifest = req.get_param('target_manifest', None) target_manifest = req.get_param('target_manifest', None)

View File

@ -15,11 +15,14 @@
import json import json
import falcon import falcon
from oslo_config import cfg
from armada import api from armada import api
from armada.common import policy from armada.common import policy
from armada.handlers.tiller import Tiller from armada.handlers.tiller import Tiller
CONF = cfg.CONF
class Status(api.BaseResource): class Status(api.BaseResource):
@policy.enforce('tiller:get_status') @policy.enforce('tiller:get_status')
@ -28,10 +31,12 @@ class Status(api.BaseResource):
get tiller status get tiller status
''' '''
try: try:
opts = req.params
tiller = Tiller( tiller = Tiller(
tiller_host=opts.get('tiller_host', None), tiller_host=req.get_param('tiller_host'),
tiller_port=opts.get('tiller_port', None)) tiller_port=req.get_param_as_int(
'tiller_port') or CONF.tiller_port,
tiller_namespace=req.get_param(
'tiller_namespace', default=CONF.tiller_namespace))
message = { message = {
'tiller': { 'tiller': {
@ -54,14 +59,15 @@ class Status(api.BaseResource):
class Release(api.BaseResource): class Release(api.BaseResource):
@policy.enforce('tiller:get_release') @policy.enforce('tiller:get_release')
def on_get(self, req, resp): def on_get(self, req, resp):
''' '''Controller for listing Tiller releases.
get tiller releases
''' '''
try: try:
# Get tiller releases tiller = Tiller(
opts = req.params tiller_host=req.get_param('tiller_host'),
tiller = Tiller(tiller_host=opts.get('tiller_host', None), tiller_port=req.get_param_as_int(
tiller_port=opts.get('tiller_port', None)) 'tiller_port') or CONF.tiller_port,
tiller_namespace=req.get_param(
'tiller_namespace', default=CONF.tiller_namespace))
releases = {} releases = {}
for release in tiller.list_releases(): for release in tiller.list_releases():

View File

@ -91,11 +91,16 @@ SHORT_DESC = "command install manifest charts"
type=str, type=str,
default=[]) default=[])
@click.option('--tiller-host', @click.option('--tiller-host',
help="Tiller host IP.") help="Tiller host IP.",
default=None)
@click.option('--tiller-port', @click.option('--tiller-port',
help="Tiller host port.", help="Tiller host port.",
type=int, type=int,
default=44134) default=CONF.tiller_port)
@click.option('--tiller-namespace', '-tn',
help="Tiller namespace.",
type=str,
default=CONF.tiller_namespace)
@click.option('--timeout', @click.option('--timeout',
help="Specifies time to wait for charts to deploy.", help="Specifies time to wait for charts to deploy.",
type=int, type=int,
@ -120,20 +125,33 @@ SHORT_DESC = "command install manifest charts"
@click.pass_context @click.pass_context
def apply_create(ctx, locations, api, disable_update_post, disable_update_pre, def apply_create(ctx, locations, api, disable_update_post, disable_update_pre,
dry_run, enable_chart_cleanup, set, tiller_host, tiller_port, dry_run, enable_chart_cleanup, set, tiller_host, tiller_port,
timeout, values, wait, target_manifest, debug): tiller_namespace, timeout, values, wait, target_manifest,
debug):
if debug: if debug:
CONF.debug = debug CONF.debug = debug
ApplyManifest(ctx, locations, api, disable_update_post, disable_update_pre, ApplyManifest(ctx, locations, api, disable_update_post, disable_update_pre,
dry_run, enable_chart_cleanup, set, tiller_host, tiller_port, dry_run, enable_chart_cleanup, set, tiller_host, tiller_port,
timeout, values, wait, target_manifest).invoke() tiller_namespace, timeout, values, wait,
target_manifest).invoke()
class ApplyManifest(CliAction): class ApplyManifest(CliAction):
def __init__(self, ctx, locations, api, disable_update_post, def __init__(self,
disable_update_pre, dry_run, enable_chart_cleanup, set, ctx,
tiller_host, tiller_port, timeout, values, wait, locations,
api,
disable_update_post,
disable_update_pre,
dry_run,
enable_chart_cleanup,
set,
tiller_host,
tiller_port,
tiller_namespace,
timeout,
values,
wait,
target_manifest): target_manifest):
super(ApplyManifest, self).__init__() super(ApplyManifest, self).__init__()
self.ctx = ctx self.ctx = ctx
@ -147,6 +165,7 @@ class ApplyManifest(CliAction):
self.set = set self.set = set
self.tiller_host = tiller_host self.tiller_host = tiller_host
self.tiller_port = tiller_port self.tiller_port = tiller_port
self.tiller_namespace = tiller_namespace
self.timeout = timeout self.timeout = timeout
self.values = values self.values = values
self.wait = wait self.wait = wait
@ -182,10 +201,19 @@ class ApplyManifest(CliAction):
return return
armada = Armada( armada = Armada(
documents, self.disable_update_pre, self.disable_update_post, documents,
self.enable_chart_cleanup, self.dry_run, self.set, self.wait, disable_update_pre=self.disable_update_pre,
self.timeout, self.tiller_host, self.tiller_port, self.values, disable_update_post=self.disable_update_post,
self.target_manifest) enable_chart_cleanup=self.enable_chart_cleanup,
dry_run=self.dry_run,
set_ovr=self.set,
wait=self.wait,
timeout=self.timeout,
tiller_host=self.tiller_host,
tiller_port=self.tiller_port,
tiller_namespace=self.tiller_namespace,
values=self.values,
target_manifest=self.target_manifest)
resp = armada.sync() resp = armada.sync()
self.output(resp) self.output(resp)
@ -202,6 +230,7 @@ class ApplyManifest(CliAction):
'enable_chart_cleanup': self.enable_chart_cleanup, 'enable_chart_cleanup': self.enable_chart_cleanup,
'tiller_host': self.tiller_host, 'tiller_host': self.tiller_host,
'tiller_port': self.tiller_port, 'tiller_port': self.tiller_port,
'tiller_namespace': self.tiller_namespace,
'timeout': self.timeout, 'timeout': self.timeout,
'wait': self.wait 'wait': self.wait
} }

View File

@ -15,6 +15,7 @@
import yaml import yaml
import click import click
from oslo_config import cfg
from armada.cli import CliAction from armada.cli import CliAction
from armada import const from armada import const
@ -22,6 +23,8 @@ from armada.handlers.manifest import Manifest
from armada.handlers.tiller import Tiller from armada.handlers.tiller import Tiller
from armada.utils.release import release_prefix from armada.utils.release import release_prefix
CONF = cfg.CONF
@click.group() @click.group()
def test(): def test():
@ -53,22 +56,28 @@ SHORT_DESC = "command test releases"
@test.command(name='test', help=DESC, short_help=SHORT_DESC) @test.command(name='test', help=DESC, short_help=SHORT_DESC)
@click.option('--file', help='armada manifest', type=str) @click.option('--file', help='armada manifest', type=str)
@click.option('--release', help='helm release', type=str) @click.option('--release', help='helm release', type=str)
@click.option('--tiller-host', help="Tiller Host IP") @click.option('--tiller-host', help="Tiller Host IP", default=None)
@click.option( @click.option(
'--tiller-port', help="Tiller host Port", type=int, default=44134) '--tiller-port', help="Tiller Host Port", type=int,
default=CONF.tiller_port)
@click.option(
'--tiller-namespace', '-tn', help="Tiller Namespace", type=str,
default=CONF.tiller_namespace)
@click.option('--target-manifest', @click.option('--target-manifest',
help=('The target manifest to run. Required for specifying ' help=('The target manifest to run. Required for specifying '
'which manifest to run when multiple are available.'), 'which manifest to run when multiple are available.'),
default=None) default=None)
@click.pass_context @click.pass_context
def test_charts(ctx, file, release, tiller_host, tiller_port, target_manifest): def test_charts(ctx, file, release, tiller_host, tiller_port, tiller_namespace,
target_manifest):
TestChartManifest( TestChartManifest(
ctx, file, release, tiller_host, tiller_port).invoke() ctx, file, release, tiller_host, tiller_port, tiller_namespace,
target_manifest).invoke()
class TestChartManifest(CliAction): class TestChartManifest(CliAction):
def __init__(self, ctx, file, release, tiller_host, tiller_port, def __init__(self, ctx, file, release, tiller_host, tiller_port,
target_manifest): tiller_namespace, target_manifest):
super(TestChartManifest, self).__init__() super(TestChartManifest, self).__init__()
self.ctx = ctx self.ctx = ctx
@ -76,11 +85,14 @@ class TestChartManifest(CliAction):
self.release = release self.release = release
self.tiller_host = tiller_host self.tiller_host = tiller_host
self.tiller_port = tiller_port self.tiller_port = tiller_port
self.tiller_namespace = tiller_namespace
self.target_manifest = target_manifest self.target_manifest = target_manifest
def invoke(self): def invoke(self):
tiller = Tiller( tiller = Tiller(
tiller_host=self.tiller_host, tiller_port=self.tiller_port) tiller_host=self.tiller_host,
tiller_port=self.tiller_port,
tiller_namespace=self.tiller_namespace)
known_release_names = [release[0] for release in tiller.list_charts()] known_release_names = [release[0] for release in tiller.list_charts()]
if self.release: if self.release:
@ -102,7 +114,8 @@ class TestChartManifest(CliAction):
client = self.ctx.obj.get('CLIENT') client = self.ctx.obj.get('CLIENT')
query = { query = {
'tiller_host': self.tiller_host, 'tiller_host': self.tiller_host,
'tiller_port': self.tiller_port 'tiller_port': self.tiller_port,
'tiller_namespace': self.tiller_namespace
} }
resp = client.get_test_release(release=self.release, resp = client.get_test_release(release=self.release,
query=query) query=query)
@ -148,7 +161,8 @@ class TestChartManifest(CliAction):
client = self.ctx.obj.get('CLIENT') client = self.ctx.obj.get('CLIENT')
query = { query = {
'tiller_host': self.tiller_host, 'tiller_host': self.tiller_host,
'tiller_port': self.tiller_port 'tiller_port': self.tiller_port,
'tiller_namespace': self.tiller_namespace
} }
with open(self.filename, 'r') as f: with open(self.filename, 'r') as f:

View File

@ -14,10 +14,13 @@
import click import click
from oslo_config import cfg
from armada.cli import CliAction from armada.cli import CliAction
from armada.handlers.tiller import Tiller from armada.handlers.tiller import Tiller
CONF = cfg.CONF
@click.group() @click.group()
def tiller(): def tiller():
@ -47,28 +50,37 @@ SHORT_DESC = "command gets tiller infromation"
@tiller.command(name='tiller', help=DESC, short_help=SHORT_DESC) @tiller.command(name='tiller', help=DESC, short_help=SHORT_DESC)
@click.option('--tiller-host', help="Tiller host ip", default=None) @click.option('--tiller-host', help="Tiller host ip", default=None)
@click.option( @click.option(
'--tiller-port', help="Tiller host port", type=int, default=44134) '--tiller-port', help="Tiller host port", type=int,
default=CONF.tiller_port)
@click.option(
'--tiller-namespace', '-tn', help="Tiller namespace", type=str,
default=CONF.tiller_namespace)
@click.option('--releases', help="list of deployed releses", is_flag=True) @click.option('--releases', help="list of deployed releses", is_flag=True)
@click.option('--status', help="Status of Armada services", is_flag=True) @click.option('--status', help="Status of Armada services", is_flag=True)
@click.pass_context @click.pass_context
def tiller_service(ctx, tiller_host, tiller_port, releases, status): def tiller_service(ctx, tiller_host, tiller_port, tiller_namespace, releases,
TillerServices(ctx, tiller_host, tiller_port, releases, status).invoke() status):
TillerServices(ctx, tiller_host, tiller_port, tiller_namespace, releases,
status).invoke()
class TillerServices(CliAction): class TillerServices(CliAction):
def __init__(self, ctx, tiller_host, tiller_port, releases, status): def __init__(self, ctx, tiller_host, tiller_port, tiller_namespace,
releases, status):
super(TillerServices, self).__init__() super(TillerServices, self).__init__()
self.ctx = ctx self.ctx = ctx
self.tiller_host = tiller_host self.tiller_host = tiller_host
self.tiller_port = tiller_port self.tiller_port = tiller_port
self.tiller_namespace = tiller_namespace
self.releases = releases self.releases = releases
self.status = status self.status = status
def invoke(self): def invoke(self):
tiller = Tiller( tiller = Tiller(
tiller_host=self.tiller_host, tiller_port=self.tiller_port) tiller_host=self.tiller_host, tiller_port=self.tiller_port,
tiller_namespace=self.tiller_namespace)
if self.status: if self.status:
if not self.ctx.obj.get('api', False): if not self.ctx.obj.get('api', False):
@ -78,7 +90,8 @@ class TillerServices(CliAction):
client = self.ctx.obj.get('CLIENT') client = self.ctx.obj.get('CLIENT')
query = { query = {
'tiller_host': self.tiller_host, 'tiller_host': self.tiller_host,
'tiller_port': self.tiller_port 'tiller_port': self.tiller_port,
'tiller_namespace': self.tiller_namespace
} }
resp = client.get_status(query=query) resp = client.get_status(query=query)
tiller_status = resp.get('tiller').get('state', False) tiller_status = resp.get('tiller').get('state', False)
@ -97,7 +110,8 @@ class TillerServices(CliAction):
client = self.ctx.obj.get('CLIENT') client = self.ctx.obj.get('CLIENT')
query = { query = {
'tiller_host': self.tiller_host, 'tiller_host': self.tiller_host,
'tiller_port': self.tiller_port 'tiller_port': self.tiller_port,
'tiller_namespace': self.tiller_namespace
} }
resp = client.get_releases(query=query) resp = client.get_releases(query=query)
for namespace in resp.get('releases'): for namespace in resp.get('releases'):

View File

@ -76,6 +76,11 @@ The Keystone project domain name used for authentication.
default='kube-system', default='kube-system',
help=utils.fmt('Namespace for the tiller pod.')), help=utils.fmt('Namespace for the tiller pod.')),
cfg.IntOpt(
'tiller_port',
default=44134,
help=utils.fmt('Port for the tiller pod.')),
cfg.ListOpt( cfg.ListOpt(
'tiller_release_roles', 'tiller_release_roles',
default=['admin'], default=['admin'],

View File

@ -53,7 +53,8 @@ class Armada(object):
wait=False, wait=False,
timeout=DEFAULT_TIMEOUT, timeout=DEFAULT_TIMEOUT,
tiller_host=None, tiller_host=None,
tiller_port=44134, tiller_port=None,
tiller_namespace=None,
values=None, values=None,
target_manifest=None): target_manifest=None):
''' '''
@ -67,11 +68,17 @@ class Armada(object):
:param bool dry_run: Run charts without installing them. :param bool dry_run: Run charts without installing them.
:param bool wait: Wait until all charts are deployed. :param bool wait: Wait until all charts are deployed.
:param int timeout: Specifies time to wait for charts to deploy. :param int timeout: Specifies time to wait for charts to deploy.
:param str tiller_host: Tiller host IP. :param str tiller_host: Tiller host IP. Default is None.
:param int tiller_port: Tiller host port. :param int tiller_port: Tiller host port. Default is
``CONF.tiller_port``.
:param str tiller_namespace: Tiller host namespace. Default is
``CONF.tiller_namespace``.
:param str target_manifest: The target manifest to run. Useful for :param str target_manifest: The target manifest to run. Useful for
specifying which manifest to run when multiple are available. specifying which manifest to run when multiple are available.
''' '''
tiller_port = tiller_port or CONF.tiller_port
tiller_namespace = tiller_namespace or CONF.tiller_namespace
self.disable_update_pre = disable_update_pre self.disable_update_pre = disable_update_pre
self.disable_update_post = disable_update_post self.disable_update_post = disable_update_post
self.enable_chart_cleanup = enable_chart_cleanup self.enable_chart_cleanup = enable_chart_cleanup
@ -79,7 +86,9 @@ class Armada(object):
self.overrides = set_ovr self.overrides = set_ovr
self.wait = wait self.wait = wait
self.timeout = timeout self.timeout = timeout
self.tiller = Tiller(tiller_host=tiller_host, tiller_port=tiller_port) self.tiller = Tiller(
tiller_host=tiller_host, tiller_port=tiller_port,
tiller_namespace=tiller_namespace)
self.values = values self.values = values
self.documents = file self.documents = file
self.config = None self.config = None

View File

@ -34,7 +34,6 @@ from armada.handlers.k8s import K8s
from armada.utils.release import release_prefix from armada.utils.release import release_prefix
from armada.utils.release import label_selectors from armada.utils.release import label_selectors
TILLER_PORT = 44134
TILLER_VERSION = b'2.5.0' TILLER_VERSION = b'2.5.0'
TILLER_TIMEOUT = 300 TILLER_TIMEOUT = 300
GRPC_EPSILON = 60 GRPC_EPSILON = 60
@ -48,9 +47,8 @@ RUNTEST_SUCCESS = 9
# limit is exhausted with just 10 releases # limit is exhausted with just 10 releases
MAX_MESSAGE_LENGTH = 429496729 MAX_MESSAGE_LENGTH = 429496729
LOG = logging.getLogger(__name__)
CONF = cfg.CONF CONF = cfg.CONF
LOG = logging.getLogger(__name__)
class Tiller(object): class Tiller(object):
@ -59,10 +57,11 @@ class Tiller(object):
service over gRPC service over gRPC
''' '''
def __init__(self, tiller_host=None, tiller_port=TILLER_PORT): def __init__(self, tiller_host=None, tiller_port=None,
tiller_namespace=None):
self.tiller_host = tiller_host self.tiller_host = tiller_host
self.tiller_port = tiller_port self.tiller_port = tiller_port or CONF.tiller_port
self.tiller_namespace = tiller_namespace or CONF.tiller_namespace
# init k8s connectivity # init k8s connectivity
self.k8s = K8s() self.k8s = K8s()
@ -103,8 +102,10 @@ class Tiller(object):
Returns tiller pod using the tiller pod labels specified in the Armada Returns tiller pod using the tiller pod labels specified in the Armada
config config
''' '''
pods = self.k8s.get_namespace_pod( pods = None
CONF.tiller_namespace, CONF.tiller_pod_labels).items namespace = self._get_tiller_namespace()
pods = self.k8s.get_namespace_pod(namespace,
CONF.tiller_pod_labels).items
# No tiller pods found # No tiller pods found
if not pods: if not pods:
raise ex.TillerPodNotFoundException(CONF.tiller_pod_labels) raise ex.TillerPodNotFoundException(CONF.tiller_pod_labels)
@ -129,7 +130,10 @@ class Tiller(object):
def _get_tiller_port(self): def _get_tiller_port(self):
'''Stub method to support arbitrary ports in the future''' '''Stub method to support arbitrary ports in the future'''
return TILLER_PORT return self.tiller_port
def _get_tiller_namespace(self):
return self.tiller_namespace
def tiller_status(self): def tiller_status(self):
''' '''

View File

@ -43,7 +43,7 @@ class ArmadaControllerTest(base.BaseControllerTest):
'wait': 'false', 'wait': 'false',
'timeout': '100'} 'timeout': '100'}
armada_options = { expected_armada_options = {
'disable_update_pre': False, 'disable_update_pre': False,
'disable_update_post': False, 'disable_update_post': False,
'enable_chart_cleanup': False, 'enable_chart_cleanup': False,
@ -52,6 +52,7 @@ class ArmadaControllerTest(base.BaseControllerTest):
'timeout': 100, 'timeout': 100,
'tiller_host': None, 'tiller_host': None,
'tiller_port': 44134, 'tiller_port': 44134,
'tiller_namespace': 'kube-system',
'target_manifest': None 'target_manifest': None
} }
@ -76,7 +77,8 @@ class ArmadaControllerTest(base.BaseControllerTest):
self.assertEqual('application/json', result.headers['content-type']) self.assertEqual('application/json', result.headers['content-type'])
mock_resolver.resolve_reference.assert_called_with([payload_url]) mock_resolver.resolve_reference.assert_called_with([payload_url])
mock_armada.assert_called_with([{'foo': 'bar'}], **armada_options) mock_armada.assert_called_with([{'foo': 'bar'}],
**expected_armada_options)
mock_armada.return_value.sync.assert_called() mock_armada.return_value.sync.assert_called()
def test_armada_apply_no_href(self): def test_armada_apply_no_href(self):

View File

@ -42,7 +42,9 @@ class TillerControllerTest(base.BaseControllerTest):
self.assertEqual(expected, result.json) self.assertEqual(expected, result.json)
self.assertEqual('application/json', result.headers['content-type']) self.assertEqual('application/json', result.headers['content-type'])
mock_tiller.assert_called_once_with(tiller_host=None, tiller_port=None) mock_tiller.assert_called_once_with(
tiller_host=None, tiller_port=44134,
tiller_namespace='kube-system')
@mock.patch.object(tiller_controller, 'Tiller') @mock.patch.object(tiller_controller, 'Tiller')
def test_get_tiller_status_with_params(self, mock_tiller): def test_get_tiller_status_with_params(self, mock_tiller):
@ -56,7 +58,8 @@ class TillerControllerTest(base.BaseControllerTest):
result = self.app.simulate_get('/api/v1.0/status', result = self.app.simulate_get('/api/v1.0/status',
params_csv=False, params_csv=False,
params={'tiller_host': 'fake_host', params={'tiller_host': 'fake_host',
'tiller_port': '98765'}) 'tiller_port': '98765',
'tiller_namespace': 'fake_ns'})
expected = { expected = {
'tiller': {'version': 'fake_verson', 'state': 'fake_status'} 'tiller': {'version': 'fake_verson', 'state': 'fake_status'}
} }
@ -64,7 +67,8 @@ class TillerControllerTest(base.BaseControllerTest):
self.assertEqual(expected, result.json) self.assertEqual(expected, result.json)
self.assertEqual('application/json', result.headers['content-type']) self.assertEqual('application/json', result.headers['content-type'])
mock_tiller.assert_called_once_with(tiller_host='fake_host', mock_tiller.assert_called_once_with(tiller_host='fake_host',
tiller_port='98765') tiller_port=98765,
tiller_namespace='fake_ns')
@mock.patch.object(tiller_controller, 'Tiller') @mock.patch.object(tiller_controller, 'Tiller')
def test_tiller_releases(self, mock_tiller): def test_tiller_releases(self, mock_tiller):
@ -87,7 +91,9 @@ class TillerControllerTest(base.BaseControllerTest):
} }
self.assertEqual(expected, result.json) self.assertEqual(expected, result.json)
mock_tiller.assert_called_once_with(tiller_host=None, tiller_port=None) mock_tiller.assert_called_once_with(
tiller_host=None, tiller_port=44134,
tiller_namespace='kube-system')
mock_tiller.return_value.list_releases.assert_called_once_with() mock_tiller.return_value.list_releases.assert_called_once_with()
@mock.patch.object(tiller_controller, 'Tiller') @mock.patch.object(tiller_controller, 'Tiller')
@ -108,14 +114,16 @@ class TillerControllerTest(base.BaseControllerTest):
result = self.app.simulate_get('/api/v1.0/releases', result = self.app.simulate_get('/api/v1.0/releases',
params_csv=False, params_csv=False,
params={'tiller_host': 'fake_host', params={'tiller_host': 'fake_host',
'tiller_port': '98765'}) 'tiller_port': '98765',
'tiller_namespace': 'fake_ns'})
expected = { expected = {
'releases': {'bar_namespace': ['foo'], 'qux_namespace': ['baz']} 'releases': {'bar_namespace': ['foo'], 'qux_namespace': ['baz']}
} }
self.assertEqual(expected, result.json) self.assertEqual(expected, result.json)
mock_tiller.assert_called_once_with(tiller_host='fake_host', mock_tiller.assert_called_once_with(tiller_host='fake_host',
tiller_port='98765') tiller_port=98765,
tiller_namespace='fake_ns')
mock_tiller.return_value.list_releases.assert_called_once_with() mock_tiller.return_value.list_releases.assert_called_once_with()

View File

@ -31,23 +31,27 @@ Commands
$ armada apply examples/simple.yaml --values examples/simple-ovr-values.yaml $ armada apply examples/simple.yaml --values examples/simple-ovr-values.yaml
Options: Options:
--api Contacts service endpoint. --api Contacts service endpoint.
--disable-update-post Disable post-update Tiller operations. --disable-update-post Disable post-update Tiller operations.
--disable-update-pre Disable pre-update Tiller operations. --disable-update-pre Disable pre-update Tiller operations.
--dry-run Run charts without installing them. --dry-run Run charts without installing them.
--enable-chart-cleanup Clean up unmanaged charts. --enable-chart-cleanup Clean up unmanaged charts.
--set TEXT Use to override Armada Manifest values. Accepts --set TEXT Use to override Armada Manifest values.
overrides that adhere to the format <key>=<value> Accepts overrides that adhere to the format
--tiller-host TEXT Tiller host IP. <key>=<value>
--tiller-port INTEGER Tiller host port. --tiller-host TEXT Tiller host IP.
--timeout INTEGER Specifies time to wait for charts to deploy. --tiller-port INTEGER Tiller host port.
-f, --values TEXT Use to override multiple Armada Manifest values by -tn, --tiller-namespace TEXT Tiller namespace.
reading overrides from a values.yaml-type file. --timeout INTEGER Specifies time to wait for charts to deploy.
--wait Wait until all charts deployed. -f, --values TEXT Use to override multiple Armada Manifest
--target-manifest TEXT The target manifest to run. Required for specifying values by reading overrides from a
which manifest to run when multiple are available. values.yaml-type file.
--debug / --no-debug Enable or disable debugging. --wait Wait until all charts deployed.
--help Show this message and exit. --target-manifest TEXT The target manifest to run. Required for
specifying which manifest to run when multiple
are available.
--debug / --no-debug Enable or disable debugging.
--help Show this message and exit.
Synopsis Synopsis
-------- --------

View File

@ -24,14 +24,15 @@ Commands
$ armada test --release blog-1 $ armada test --release blog-1
Options: Options:
--file TEXT armada manifest --file TEXT armada manifest
--release TEXT helm release --release TEXT helm release
--tiller-host TEXT Tiller Host IP --tiller-host TEXT Tiller Host IP
--tiller-port INTEGER Tiller host Port --tiller-port INTEGER Tiller Host Port
--help Show this message and exit. -tn, --tiller-namespace TEXT Tiller Namespace
--target-manifest TEXT The target manifest to run. Required for specifying --target-manifest TEXT The target manifest to run. Required for
which manifest to run when multiple are available. specifying which manifest to run when multiple
are available.
--help Show this message and exit.
Synopsis Synopsis
-------- --------

View File

@ -22,11 +22,12 @@ Commands
$ armada tiller --status $ armada tiller --status
Options: Options:
--tiller-host TEXT Tiller host ip --tiller-host TEXT Tiller host ip
--tiller-port INTEGER Tiller host port --tiller-port INTEGER Tiller host port
--releases list of deployed releases -tn, --tiller-namespace TEXT Tiller namespace
--status Status of Armada services --releases list of deployed releses
--help Show this message and exit. --status Status of Armada services
--help Show this message and exit.
Synopsis Synopsis
-------- --------

View File

@ -32,9 +32,15 @@
# Labels for the tiller pod. (string value) # Labels for the tiller pod. (string value)
#tiller_pod_labels = app=helm,name=tiller #tiller_pod_labels = app=helm,name=tiller
# Host for the tiller pod. (string value)
#tiller_host = localhost
# Namespace for the tiller pod. (string value) # Namespace for the tiller pod. (string value)
#tiller_namespace = kube-system #tiller_namespace = kube-system
# Port for the tiller pod. (integer value)
#tiller_port = 44134
# IDs of approved API access roles. (list value) # IDs of approved API access roles. (list value)
#tiller_release_roles = admin #tiller_release_roles = admin
@ -345,7 +351,10 @@
# in the cache. If ENCRYPT, token data is encrypted and authenticated in the # in the cache. If ENCRYPT, token data is encrypted and authenticated in the
# cache. If the value is not one of these options or empty, auth_token will # cache. If the value is not one of these options or empty, auth_token will
# raise an exception on initialization. (string value) # raise an exception on initialization. (string value)
# Allowed values: None, MAC, ENCRYPT # Possible values:
# None - <No description provided>
# MAC - <No description provided>
# ENCRYPT - <No description provided>
#memcache_security_strategy = None #memcache_security_strategy = None
# (Optional, mandatory if memcache_security_strategy is defined) This string is # (Optional, mandatory if memcache_security_strategy is defined) This string is
@ -441,6 +450,14 @@
# From oslo.policy # From oslo.policy
# #
# This option controls whether or not to enforce scope when evaluating
# policies. If ``True``, the scope of the token used in the request is compared
# to the ``scope_types`` of the policy being enforced. If the scopes do not
# match, an ``InvalidScope`` exception will be raised. If ``False``, a message
# will be logged informing operators that policies are being invoked with
# mismatching scope. (boolean value)
#enforce_scope = false
# The file that defines policies. (string value) # The file that defines policies. (string value)
#policy_file = policy.json #policy_file = policy.json
@ -456,7 +473,9 @@
# Content Type to send and receive data for REST based policy check (string # Content Type to send and receive data for REST based policy check (string
# value) # value)
# Allowed values: application/x-www-form-urlencoded, application/json # Possible values:
# application/x-www-form-urlencoded - <No description provided>
# application/json - <No description provided>
#remote_content_type = application/x-www-form-urlencoded #remote_content_type = application/x-www-form-urlencoded
# server identity verification for REST based policy check (boolean value) # server identity verification for REST based policy check (boolean value)