style(armada): quality of life and cleanup
- adding .editorconfig file - minor cleanup in various files related to .editorconfig - typos, whitespace, etc. - other general housekeeping items on the codebase Change-Id: I104f8dcb06aafb180da12f7ee4c0ded41fc07b9d
This commit is contained in:
@@ -33,11 +33,11 @@ def apply():
|
||||
|
||||
|
||||
DESC = """
|
||||
This command install and updates charts defined in armada manifest
|
||||
This command installs and updates charts defined in Armada manifest.
|
||||
|
||||
The apply argument must be relative path to Armada Manifest. Executing apply
|
||||
commnad once will install all charts defined in manifest. Re-executing apply
|
||||
commnad will execute upgrade.
|
||||
command once will install all charts defined in manifest. Re-executing apply
|
||||
command will execute upgrade.
|
||||
|
||||
To see how to create an Armada manifest:
|
||||
http://armada-helm.readthedocs.io/en/latest/operations/
|
||||
@@ -51,7 +51,7 @@ To obtain override manifest:
|
||||
|
||||
\b
|
||||
$ armada apply examples/simple.yaml \
|
||||
--set manifest:simple-armada:relase_name="wordpress"
|
||||
--set manifest:simple-armada:release_name="wordpress"
|
||||
|
||||
\b
|
||||
or
|
||||
@@ -62,13 +62,14 @@ To obtain override manifest:
|
||||
|
||||
"""
|
||||
|
||||
SHORT_DESC = "command install manifest charts"
|
||||
SHORT_DESC = "Command installs manifest charts."
|
||||
|
||||
|
||||
@apply.command(name='apply',
|
||||
help=DESC,
|
||||
short_help=SHORT_DESC)
|
||||
@click.argument('locations', nargs=-1)
|
||||
@click.argument('locations',
|
||||
nargs=-1)
|
||||
@click.option('--api',
|
||||
help="Contacts service endpoint.",
|
||||
is_flag=True)
|
||||
@@ -105,8 +106,7 @@ SHORT_DESC = "command install manifest charts"
|
||||
help="Specifies time to wait for charts to deploy.",
|
||||
type=int,
|
||||
default=3600)
|
||||
@click.option('--values',
|
||||
'-f',
|
||||
@click.option('--values', '-f',
|
||||
help=("Use to override multiple Armada Manifest values by "
|
||||
"reading overrides from a values.yaml-type file."),
|
||||
multiple=True,
|
||||
@@ -116,12 +116,12 @@ SHORT_DESC = "command install manifest charts"
|
||||
help="Wait until all charts deployed.",
|
||||
is_flag=True)
|
||||
@click.option('--target-manifest',
|
||||
help=('The target manifest to run. Required for specifying '
|
||||
'which manifest to run when multiple are available.'),
|
||||
help=("The target manifest to run. Required for specifying "
|
||||
"which manifest to run when multiple are available."),
|
||||
default=None)
|
||||
@click.option('--debug/--no-debug',
|
||||
help='Enable or disable debugging.',
|
||||
default=False)
|
||||
@click.option('--debug',
|
||||
help="Enable debug logging.",
|
||||
is_flag=True)
|
||||
@click.pass_context
|
||||
def apply_create(ctx, locations, api, disable_update_post, disable_update_pre,
|
||||
dry_run, enable_chart_cleanup, set, tiller_host, tiller_port,
|
||||
|
||||
@@ -36,7 +36,7 @@ This command deletes releases.
|
||||
The delete command will delete the releases either via a manifest
|
||||
or by targeting specific releases.
|
||||
|
||||
To delete all the releases that are created by the armada manifest:
|
||||
To delete all the releases that are created by the Armada manifest:
|
||||
|
||||
$ armada delete --manifest examples/simple.yaml
|
||||
|
||||
@@ -50,18 +50,27 @@ To delete releases by the name:
|
||||
|
||||
"""
|
||||
|
||||
SHORT_DESC = "command delete releases"
|
||||
SHORT_DESC = "Command deletes releases."
|
||||
|
||||
|
||||
@delete.command(name='delete', help=DESC, short_help=SHORT_DESC)
|
||||
@click.option('--manifest', help='Armada manifest file', type=str)
|
||||
@click.option(
|
||||
'--releases', help='Comma-separated list of release names', type=str)
|
||||
@click.option(
|
||||
'--no-purge', help="Deletes release without purge option", is_flag=True)
|
||||
@click.option('--tiller-host', help="Tiller Host IP")
|
||||
@click.option(
|
||||
'--tiller-port', help="Tiller host Port", type=int, default=44134)
|
||||
@delete.command(name='delete',
|
||||
help=DESC,
|
||||
short_help=SHORT_DESC)
|
||||
@click.option('--manifest',
|
||||
help="Armada Manifest file.",
|
||||
type=str)
|
||||
@click.option('--releases',
|
||||
help="Comma-separated list of release names.",
|
||||
type=str)
|
||||
@click.option('--no-purge',
|
||||
help="Deletes release without purge option.",
|
||||
is_flag=True)
|
||||
@click.option('--tiller-host',
|
||||
help="Tiller host IP.")
|
||||
@click.option('--tiller-port',
|
||||
help="Tiller host port.",
|
||||
type=int,
|
||||
default=44134)
|
||||
@click.pass_context
|
||||
def delete_charts(ctx, manifest, releases, no_purge, tiller_host, tiller_port):
|
||||
DeleteChartManifest(
|
||||
|
||||
@@ -34,13 +34,13 @@ def test():
|
||||
|
||||
|
||||
DESC = """
|
||||
This command test deployed charts
|
||||
This command tests deployed charts.
|
||||
|
||||
The tiller command uses flags to obtain information from tiller services.
|
||||
The tiller command uses flags to obtain information from Tiller services.
|
||||
The test command will run the release chart tests either via a the manifest or
|
||||
by targetings a relase.
|
||||
by targeting a release.
|
||||
|
||||
To test armada deployed releases:
|
||||
To test Armada deployed releases:
|
||||
|
||||
$ armada test --file examples/simple.yaml
|
||||
|
||||
@@ -50,22 +50,32 @@ To test release:
|
||||
|
||||
"""
|
||||
|
||||
SHORT_DESC = "command test releases"
|
||||
SHORT_DESC = "Command tests releases."
|
||||
|
||||
|
||||
@test.command(name='test', help=DESC, short_help=SHORT_DESC)
|
||||
@click.option('--file', help='armada manifest', type=str)
|
||||
@click.option('--release', help='helm release', type=str)
|
||||
@click.option('--tiller-host', help="Tiller Host IP", default=None)
|
||||
@click.option(
|
||||
'--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)
|
||||
@test.command(name='test',
|
||||
help=DESC,
|
||||
short_help=SHORT_DESC)
|
||||
@click.option('--file',
|
||||
help="Armada manifest.",
|
||||
type=str)
|
||||
@click.option('--release',
|
||||
help="Helm release.",
|
||||
type=str)
|
||||
@click.option('--tiller-host',
|
||||
help="Tiller host IP.",
|
||||
default=None)
|
||||
@click.option('--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',
|
||||
help=('The target manifest to run. Required for specifying '
|
||||
'which manifest to run when multiple are available.'),
|
||||
help=("The target manifest to run. Required for specifying "
|
||||
"which manifest to run when multiple are available."),
|
||||
default=None)
|
||||
@click.pass_context
|
||||
def test_charts(ctx, file, release, tiller_host, tiller_port, tiller_namespace,
|
||||
|
||||
@@ -30,33 +30,43 @@ def tiller():
|
||||
|
||||
|
||||
DESC = """
|
||||
This command gets tiller information
|
||||
This command gets Tiller information
|
||||
|
||||
The tiller command uses flags to obtain information from tiller services
|
||||
The tiller command uses flags to obtain information from Tiller services
|
||||
|
||||
To obtain armada deployed releases:
|
||||
To obtain Armada deployed releases:
|
||||
|
||||
$ armada tiller --releases
|
||||
|
||||
To obtain tiller service status/information:
|
||||
To obtain Tiller service status/information:
|
||||
|
||||
$ armada tiller --status
|
||||
|
||||
"""
|
||||
|
||||
SHORT_DESC = "command gets tiller infromation"
|
||||
SHORT_DESC = "Command gets Tiller information."
|
||||
|
||||
|
||||
@tiller.command(name='tiller', help=DESC, short_help=SHORT_DESC)
|
||||
@click.option('--tiller-host', help="Tiller host ip", default=None)
|
||||
@click.option(
|
||||
'--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('--status', help="Status of Armada services", is_flag=True)
|
||||
@tiller.command(name='tiller',
|
||||
help=DESC,
|
||||
short_help=SHORT_DESC)
|
||||
@click.option('--tiller-host',
|
||||
help="Tiller host IP.",
|
||||
default=None)
|
||||
@click.option('--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 releases.",
|
||||
is_flag=True)
|
||||
@click.option('--status',
|
||||
help="Status of Armada services.",
|
||||
is_flag=True)
|
||||
@click.pass_context
|
||||
def tiller_service(ctx, tiller_host, tiller_port, tiller_namespace, releases,
|
||||
status):
|
||||
|
||||
@@ -30,7 +30,7 @@ def validate():
|
||||
|
||||
|
||||
DESC = """
|
||||
This command validates Armada Manifest
|
||||
This command validates an Armada Manifest.
|
||||
|
||||
The validate argument must be a relative path to Armada manifest
|
||||
|
||||
@@ -38,11 +38,14 @@ The validate argument must be a relative path to Armada manifest
|
||||
|
||||
"""
|
||||
|
||||
SHORT_DESC = "command validates Armada Manifest"
|
||||
SHORT_DESC = "Command validates Armada Manifest."
|
||||
|
||||
|
||||
@validate.command(name='validate', help=DESC, short_help=SHORT_DESC)
|
||||
@click.argument('locations', nargs=-1)
|
||||
@validate.command(name='validate',
|
||||
help=DESC,
|
||||
short_help=SHORT_DESC)
|
||||
@click.argument('locations',
|
||||
nargs=-1)
|
||||
@click.pass_context
|
||||
def validate_manifest(ctx, locations):
|
||||
ValidateManifest(ctx, locations).invoke()
|
||||
|
||||
@@ -19,13 +19,13 @@ tiller_policies = [
|
||||
policy.DocumentedRuleDefault(
|
||||
name=base.TILLER % 'get_status',
|
||||
check_str=base.RULE_ADMIN_REQUIRED,
|
||||
description='Get tiller status',
|
||||
description='Get Tiller status',
|
||||
operations=[{'path': '/api/v1.0/status/', 'method': 'GET'}]),
|
||||
|
||||
policy.DocumentedRuleDefault(
|
||||
name=base.TILLER % 'get_release',
|
||||
check_str=base.RULE_ADMIN_REQUIRED,
|
||||
description='Get tiller release',
|
||||
description='Get Tiller release',
|
||||
operations=[{'path': '/api/v1.0/releases/', 'method': 'GET'}]),
|
||||
]
|
||||
|
||||
|
||||
@@ -69,17 +69,17 @@ The Keystone project domain name used for authentication.
|
||||
cfg.StrOpt(
|
||||
'tiller_pod_labels',
|
||||
default='app=helm,name=tiller',
|
||||
help=utils.fmt('Labels for the tiller pod.')),
|
||||
help=utils.fmt('Labels for the Tiller pod.')),
|
||||
|
||||
cfg.StrOpt(
|
||||
'tiller_namespace',
|
||||
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.')),
|
||||
help=utils.fmt('Port for the Tiller pod.')),
|
||||
|
||||
cfg.ListOpt(
|
||||
'tiller_release_roles',
|
||||
|
||||
@@ -24,28 +24,28 @@ class ApiException(base.ArmadaBaseException):
|
||||
class ApiBaseException(ApiException):
|
||||
'''Exception that occurs during chart cleanup.'''
|
||||
|
||||
message = 'There was an error listing the helm chart releases.'
|
||||
message = 'There was an error listing the Helm chart releases.'
|
||||
|
||||
|
||||
class ApiJsonException(ApiException):
|
||||
'''Exception that occurs during chart cleanup.'''
|
||||
|
||||
message = 'There was an error listing the helm chart releases.'
|
||||
message = 'There was an error listing the Helm chart releases.'
|
||||
|
||||
|
||||
class ClientUnauthorizedError(ApiException):
|
||||
'''Exception that occurs during chart cleanup.'''
|
||||
|
||||
message = 'There was an error listing the helm chart releases.'
|
||||
message = 'There was an error listing the Helm chart releases.'
|
||||
|
||||
|
||||
class ClientForbiddenError(ApiException):
|
||||
'''Exception that occurs during chart cleanup.'''
|
||||
|
||||
message = 'There was an error listing the helm chart releases.'
|
||||
message = 'There was an error listing the Helm chart releases.'
|
||||
|
||||
|
||||
class ClientError(ApiException):
|
||||
'''Exception that occurs during chart cleanup.'''
|
||||
|
||||
message = 'There was an error listing the helm chart releases.'
|
||||
message = 'There was an error listing the Helm chart releases.'
|
||||
|
||||
@@ -18,20 +18,20 @@ from armada.exceptions.base_exception import ArmadaBaseException as ex
|
||||
class TillerException(ex):
|
||||
'''Base class for Tiller exceptions and error handling.'''
|
||||
|
||||
message = 'An unknown Tiller error occured.'
|
||||
message = 'An unknown Tiller error occurred.'
|
||||
|
||||
|
||||
class TillerServicesUnavailableException(TillerException):
|
||||
'''Exception for tiller services unavailable.'''
|
||||
'''Exception for Tiller services unavailable.'''
|
||||
|
||||
message = 'Tiller services unavailable.'
|
||||
|
||||
|
||||
class ChartCleanupException(TillerException):
|
||||
'''Exception that occures during chart cleanup.'''
|
||||
'''Exception that occurs during chart cleanup.'''
|
||||
|
||||
def __init__(self, chart_name):
|
||||
message = 'An error occred during cleanup while removing {}'.format(
|
||||
message = 'An error occurred during cleanup while removing {}'.format(
|
||||
chart_name)
|
||||
super(ChartCleanupException, self).__init__(message)
|
||||
|
||||
@@ -39,7 +39,7 @@ class ChartCleanupException(TillerException):
|
||||
class ListChartsException(TillerException):
|
||||
'''Exception that occurs when listing charts'''
|
||||
|
||||
message = 'There was an error listing the helm chart releases.'
|
||||
message = 'There was an error listing the Helm chart releases.'
|
||||
|
||||
|
||||
class PostUpdateJobDeleteException(TillerException):
|
||||
@@ -98,9 +98,9 @@ class ReleaseException(TillerException):
|
||||
|
||||
|
||||
class ChannelException(TillerException):
|
||||
'''Exception that occurs during a failed GRPC channel creation'''
|
||||
'''Exception that occurs during a failed gRPC channel creation'''
|
||||
|
||||
message = 'Failed to create GRPC channel.'
|
||||
message = 'Failed to create gRPC channel.'
|
||||
|
||||
|
||||
class GetReleaseStatusException(TillerException):
|
||||
@@ -129,15 +129,15 @@ class TillerPodNotFoundException(TillerException):
|
||||
'''
|
||||
|
||||
def __init__(self, labels):
|
||||
message = 'Could not find tiller pod with labels "{}"'.format(labels)
|
||||
message = 'Could not find Tiller pod with labels "{}"'.format(labels)
|
||||
|
||||
super(TillerPodNotFoundException, self).__init__(message)
|
||||
|
||||
|
||||
class TillerPodNotRunningException(TillerException):
|
||||
'''Exception that occurs when no tiller pod is found in a running state'''
|
||||
'''Exception that occurs when no Tiller pod is found in a running state'''
|
||||
|
||||
message = 'No tiller pods found in running state'
|
||||
message = 'No Tiller pods found in running state'
|
||||
|
||||
|
||||
class TillerVersionException(TillerException):
|
||||
|
||||
@@ -184,9 +184,10 @@ class Armada(object):
|
||||
|
||||
if repo_branch not in repos:
|
||||
try:
|
||||
LOG.info('Cloning repo: %s branch: %s', *repo_branch)
|
||||
logstr = 'Cloning repo: {} branch: {}'.format(*repo_branch)
|
||||
if proxy_server:
|
||||
LOG.info('Using proxy to clone: %s', proxy_server)
|
||||
logstr += ' proxy: {}'.format(proxy_server)
|
||||
LOG.info(logstr)
|
||||
repo_dir = source.git_clone(*repo_branch, proxy_server)
|
||||
except Exception:
|
||||
raise source_exceptions.GitException(
|
||||
@@ -216,7 +217,7 @@ class Armada(object):
|
||||
|
||||
def sync(self):
|
||||
'''
|
||||
Syncronize Helm with the Armada Config(s)
|
||||
Synchronize Helm with the Armada Config(s)
|
||||
'''
|
||||
|
||||
msg = {'install': [], 'upgrade': [], 'diff': []}
|
||||
@@ -235,7 +236,7 @@ class Armada(object):
|
||||
raise armada_exceptions.KnownReleasesException()
|
||||
|
||||
for release in known_releases:
|
||||
LOG.debug("Release %s, Version %s found on tiller", release[0],
|
||||
LOG.debug("Release %s, Version %s found on Tiller", release[0],
|
||||
release[1])
|
||||
|
||||
for entry in self.config[const.KEYWORD_ARMADA][const.KEYWORD_GROUPS]:
|
||||
|
||||
@@ -30,15 +30,20 @@ CONF = cfg.CONF
|
||||
|
||||
|
||||
@click.group()
|
||||
@click.option(
|
||||
'--debug/--no-debug', help='Enable or disable debugging', default=False)
|
||||
@click.option(
|
||||
'--api/--no-api', help='Execute service endpoints. (requires url option)',
|
||||
default=False)
|
||||
@click.option(
|
||||
'--url', help='Armada Service Endpoint', envvar='HOST', default=None)
|
||||
@click.option(
|
||||
'--token', help='Keystone Service Token', envvar='TOKEN', default=None)
|
||||
@click.option('--debug',
|
||||
help="Enable debug logging",
|
||||
is_flag=True)
|
||||
@click.option('--api/--no-api',
|
||||
help="Execute service endpoints. (requires url option)",
|
||||
default=False)
|
||||
@click.option('--url',
|
||||
help="Armada Service Endpoint",
|
||||
envvar='HOST',
|
||||
default=None)
|
||||
@click.option('--token',
|
||||
help="Keystone Service Token",
|
||||
envvar='TOKEN',
|
||||
default=None)
|
||||
@click.pass_context
|
||||
def main(ctx, debug, api, url, token):
|
||||
"""
|
||||
|
||||
@@ -47,11 +47,11 @@ def git_clone(repo_url, ref='master', proxy_server=None):
|
||||
|
||||
try:
|
||||
if proxy_server:
|
||||
LOG.info('Cloning [%s] with proxy [%s]', repo_url, proxy_server)
|
||||
LOG.debug('Cloning [%s] with proxy [%s]', repo_url, proxy_server)
|
||||
repo = Repo.clone_from(repo_url, _tmp_dir,
|
||||
config='http.proxy=%s' % proxy_server)
|
||||
else:
|
||||
LOG.info('Cloning [%s]', repo_url)
|
||||
LOG.debug('Cloning [%s]', repo_url)
|
||||
repo = Repo.clone_from(repo_url, _tmp_dir)
|
||||
|
||||
repo.remotes.origin.fetch(ref)
|
||||
|
||||
Reference in New Issue
Block a user