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:
Marshall Margenau 2018-02-02 16:20:58 -06:00
parent 69bc0c9995
commit e1b64d200b
32 changed files with 272 additions and 250 deletions

View File

@ -4,7 +4,6 @@ examples
CODE_OF_CONDUCT.rst CODE_OF_CONDUCT.rst
ChangeLog ChangeLog
LICENSE LICENSE
OWNERS
etc/armada/armada.conf etc/armada/armada.conf
etc/armada/policy.yaml etc/armada/policy.yaml
charts/* charts/*

27
.editorconfig Normal file
View File

@ -0,0 +1,27 @@
# EditorConfig is awesome: http://EditorConfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.py]
# Armada uses PEP8 line length of 79
# Note: for VS Code, set "editor.rulers":[79] in your workspace settings
max_line_length = 79
[*.{yml,yaml}]
indent_size = 2
[Makefile]
indent_style = tab
[*.md]
# Note: VS Code may not honor the following setting
# See: https://github.com/editorconfig/editorconfig-vscode/issues/153
trim_trailing_whitespace = false

5
.gitignore vendored
View File

@ -105,4 +105,7 @@ AUTHORS
ChangeLog ChangeLog
etc/armada/armada.conf etc/armada/armada.conf
etc/armada/policy.yaml etc/armada/policy.yaml
.editorconfig
# IDEs
.idea/
.vscode/

View File

@ -1,22 +0,0 @@
language: python
sudo: required
python:
- "2.7"
before_install:
- pip install -r test-requirements.txt
- pip install -r requirements.txt
- pip install tox
install:
- pip install -e .
script:
- flake8
- armada -h
- nosetests -w armada/tests/unit --cover-package=armada --with-coverage --cover-tests
# after_success:
# - codecov

View File

@ -5,10 +5,10 @@ Our Pledge
---------- ----------
In the interest of fostering an open and welcoming environment, we as In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our contributors and maintainers pledge to making participation in our project and
project and our community a harassment-free experience for everyone, our community a harassment-free experience for everyone, regardless of age, body
regardless of age, body size, disability, ethnicity, gender identity and size, disability, ethnicity, gender identity and expression, level of experience,
expression, level of experience, nationality, personal appearance, race, education, socio-economic status, nationality, personal appearance, race,
religion, or sexual identity and orientation. religion, or sexual identity and orientation.
Our Standards Our Standards
@ -25,54 +25,51 @@ include:
Examples of unacceptable behavior by participants include: Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual - The use of sexualized language or imagery and unwelcome sexual attention or
attention or advances advances
- Trolling, insulting/derogatory comments, and personal or political - Trolling, insulting/derogatory comments, and personal or political attacks
attacks
- Public or private harassment - Public or private harassment
- Publishing others private information, such as a physical or - Publishing others private information, such as a physical or electronic
electronic address, without explicit permission address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a - Other conduct which could reasonably be considered inappropriate in a
professional setting professional setting
Our Responsibilities Our Responsibilities
-------------------- --------------------
Project maintainers are responsible for clarifying the standards of Project maintainers are responsible for clarifying the standards of acceptable
acceptable behavior and are expected to take appropriate and fair behavior and are expected to take appropriate and fair corrective action in
corrective action in response to any instances of unacceptable behavior. response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, Project maintainers have the right and responsibility to remove, edit, or
or reject comments, commits, code, wiki edits, issues, and other reject comments, commits, code, wiki edits, issues, and other contributions
contributions that are not aligned to this Code of Conduct, or to ban that are not aligned to this Code of Conduct, or to ban temporarily or
temporarily or permanently any contributor for other behaviors that they permanently any contributor for other behaviors that they deem inappropriate,
deem inappropriate, threatening, offensive, or harmful. threatening, offensive, or harmful.
Scope Scope
----- -----
This Code of Conduct applies both within project spaces and in public This Code of Conduct applies both within project spaces and in public spaces
spaces when an individual is representing the project or its community. when an individual is representing the project or its community. Examples of
Examples of representing a project or community include using an representing a project or community include using an official project e-mail
official project e-mail address, posting via an official social media address, posting via an official social media account, or acting as an appointed
account, or acting as an appointed representative at an online or representative at an online or offline event. Representation of a project may be
offline event. Representation of a project may be further defined and further defined and clarified by project maintainers.
clarified by project maintainers.
Enforcement Enforcement
----------- -----------
Instances of abusive, harassing, or otherwise unacceptable behavior may Instances of abusive, harassing, or otherwise unacceptable behavior may be
be reported by contacting the project team. The reported by contacting the project team. All
project team will review and investigate all complaints, and will complaints will be reviewed and investigated and will result in a response that
respond in a way that it deems appropriate to the circumstances. The is deemed necessary and appropriate to the circumstances. The project team is
project team is obligated to maintain confidentiality with regard to the obligated to maintain confidentiality with regard to the reporter of an incident.
reporter of an incident. Further details of specific enforcement Further details of specific enforcement policies may be posted separately.
policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in Project maintainers who do not follow or enforce the Code of Conduct in good
good faith may face temporary or permanent repercussions as determined faith may face temporary or permanent repercussions as determined by other
by other members of the projects leadership. members of the projects leadership.
Attribution Attribution
----------- -----------

View File

@ -7,7 +7,7 @@ involved in contributing to Armada.
Code of Conduct Code of Conduct
--------------- ---------------
By contributing to Armada, you are agreeing to uphold the By contributing to Armada, you are agreeing to uphold the
`Contributor Convenant Code of Conduct <https://github.com/att-comdev/armada/ `Contributor Covenant Code of Conduct <https://github.com/att-comdev/armada/
blob/master/CODE_OF_CONDUCT.rst>`_. Please familiarize yourself with it blob/master/CODE_OF_CONDUCT.rst>`_. Please familiarize yourself with it
before contributing. before contributing.
@ -37,12 +37,12 @@ the issue type.
+=============+===============================================================+ +=============+===============================================================+
| bug | Indicates a confirmed bug or other unexpected behavior | | bug | Indicates a confirmed bug or other unexpected behavior |
+-------------+---------------------------------------------------------------+ +-------------+---------------------------------------------------------------+
| ehancement | Feature request | | enhancement | Feature request |
+-------------+---------------------------------------------------------------+ +-------------+---------------------------------------------------------------+
| question | Indicates a question | | question | Indicates a question |
+-------------+---------------------------------------------------------------+ +-------------+---------------------------------------------------------------+
| docs | Assigned to issues indicating missing or incomplete | | docs | Assigned to issues indicating missing or incomplete |
| | documenation | | | documentation |
+-------------+---------------------------------------------------------------+ +-------------+---------------------------------------------------------------+
| duplicate | Assigned to issues that are duplicates of previously reported | | duplicate | Assigned to issues that are duplicates of previously reported |
| | issues | | | issues |
@ -83,9 +83,9 @@ readme.html#getting-started>`_
Armada accepts patches through GerritHub changes. Each commit pushed to Armada accepts patches through GerritHub changes. Each commit pushed to
GerritHub is recognized as a "change" (the equivalent of a GitHub pull GerritHub is recognized as a "change" (the equivalent of a GitHub pull
request). When a change is pushed to GerritHub for review, it contains an request). When a change is pushed to GerritHub for review, it contains an
intial patch set that shows all of the revised changes. When a Gerrit change is initial patch set that shows all of the revised changes. When a Gerrit change
amended, a new patch set is created to show the differences from the previous is amended, a new patch set is created to show the differences from the
patch set. previous patch set.
The general workflow for submitting a change is: The general workflow for submitting a change is:
@ -114,7 +114,7 @@ installed. Git-review can be installed using Python
pip install git-review pip install git-review
Git-review can also be intalled on Ubuntu by executing: Git-review can also be installed on Ubuntu by executing:
.. code-block:: bash .. code-block:: bash
@ -138,7 +138,7 @@ connecting-to-github-with-ssh/>`_.
If you require authentication over HTTPS, you will need to generate an If you require authentication over HTTPS, you will need to generate an
`HTTPS password <https://review.gerrithub.io/#/settings/http-password>`_. `HTTPS password <https://review.gerrithub.io/#/settings/http-password>`_.
Once you have generated an HTTPS passowrd, add the repository to your remote Once you have generated an HTTPS password, add the repository to your remote
repositories repositories
.. code-block:: bash .. code-block:: bash
@ -178,7 +178,7 @@ Armada uses Karma inspired `Semantic Commit Messages
In the above template, `TYPE` refers to the type of change, `SCOPE` refers to In the above template, `TYPE` refers to the type of change, `SCOPE` refers to
the area where the change occurs (i.e. api, cli, source), `TITLE` is the title the area where the change occurs (i.e. api, cli, source), `TITLE` is the title
of the commit message, `DESCRIPTION` is a desription of the change, and of the commit message, `DESCRIPTION` is a description of the change, and
`ISSUE-REFERENCE` is a link to the GitHub issue the change addresses. `ISSUE-REFERENCE` is a link to the GitHub issue the change addresses.
Below is a list of possible types: Below is a list of possible types:
@ -201,7 +201,7 @@ Below is a list of possible types:
.. NOTE:: .. NOTE::
The scope component of a commit message may be ommited if the change The scope component of a commit message may be committed if the change
covers more than a single component of Armada. covers more than a single component of Armada.
An commit message for a change that adds a new API endpoint might resemble the An commit message for a change that adds a new API endpoint might resemble the
@ -218,7 +218,7 @@ following example:
.. NOTE:: .. NOTE::
It is necessary to leave a blank line between the commit title and It is necessary to leave a blank line between the commit title and
desciption in order for a change to appear properly on GerritHub. description in order for a change to appear properly on GerritHub.
Since each commit is represented as a "change" in GerritHub, multiple commits Since each commit is represented as a "change" in GerritHub, multiple commits
should be squashed into one commit before pushing to GerritHub for review. To should be squashed into one commit before pushing to GerritHub for review. To
@ -241,7 +241,7 @@ Your change will now be visible on GerritHub for review. In order to amend your
change after pushing it for review, you will need to create additional change after pushing it for review, you will need to create additional
patch sets. patch sets.
In order to create an additional patch set, modify your exisiting commit and In order to create an additional patch set, modify your existing commit and
push your new changes for review push your new changes for review
.. code-block:: bash .. code-block:: bash
@ -304,5 +304,5 @@ and conforms to the PEP8 style guide, execute:
.. code-block:: bash .. code-block:: bash
tox -e pep8 tox -e pep8
tox -e py27,py35 tox -e py35
tox -e coverage tox -e coverage

View File

@ -12,17 +12,17 @@ RUN pip3 install -r /tmp/requirements.txt
COPY . /armada COPY . /armada
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
netbase \ netbase \
curl \ curl \
git && \ git && \
useradd -u 1000 -g users -d /armada armada && \ useradd -u 1000 -g users -d /armada armada && \
chown -R armada:users /armada && \ chown -R armada:users /armada && \
mv /armada/etc/armada /etc/ && \ mv /armada/etc/armada /etc/ && \
cd /armada && \ cd /armada && \
python3 setup.py install && \ python3 setup.py install && \
rm -rf \ rm -rf \
/root/.cache \ /root/.cache \
/var/lib/apt/lists/* /var/lib/apt/lists/*
EXPOSE 8000 EXPOSE 8000

View File

@ -62,7 +62,6 @@ check-tox:
images: check-docker images: check-docker
docker build --rm -t ${IMAGE} . docker build --rm -t ${IMAGE} .
.PHONY: dry-run .PHONY: dry-run
dry-run: clean dry-run: clean
tools/helm_tk.sh $(HELM) tools/helm_tk.sh $(HELM)
@ -107,10 +106,7 @@ helm_lint:
@tools/helm_tk.sh $(HELM) @tools/helm_tk.sh $(HELM)
$(HELM) lint $(CHART) $(HELM) lint $(CHART)
.PHONY: charts .PHONY: charts
charts: clean charts: clean
$(HELM) dep up $(CHART) $(HELM) dep up $(CHART)
$(HELM) package $(CHART) $(HELM) package $(CHART)

9
OWNERS
View File

@ -1,9 +0,0 @@
reviewers:
- alanmeadows
- v1k0d3n
- intlabs
- wilkers-steve
- larryrensing
approvers:
- alanmeadows
- v1k0d3n

View File

@ -1,7 +1,7 @@
Armada Armada
====== ======
|Docker Repository on Quay| |Build Status| |Doc Status| |Docker Repository on Quay| |Doc Status|
Armada is a tool for managing multiple Helm charts with dependencies by Armada is a tool for managing multiple Helm charts with dependencies by
centralizing all configurations in a single Armada YAML and providing centralizing all configurations in a single Armada YAML and providing
@ -83,7 +83,7 @@ Usage
To run Armada, simply supply it with your YAML-based intention for any To run Armada, simply supply it with your YAML-based intention for any
number of charts:: number of charts::
$ armada apply examples/openstack-helm.yaml [--debug-loggging ] $ armada apply examples/openstack-helm.yaml [ --debug ]
Which should output something like this:: Which should output something like this::
@ -121,7 +121,5 @@ Further Reading
.. |Docker Repository on Quay| image:: https://quay.io/repository/attcomdev/armada/status .. |Docker Repository on Quay| image:: https://quay.io/repository/attcomdev/armada/status
:target: https://quay.io/repository/attcomdev/armada :target: https://quay.io/repository/attcomdev/armada
.. |Build Status| image:: https://travis-ci.org/att-comdev/armada.svg?branch=master
:target: https://travis-ci.org/att-comdev/armada
.. |Doc Status| image:: https://readthedocs.org/projects/armada-helm/badge/?version=latest .. |Doc Status| image:: https://readthedocs.org/projects/armada-helm/badge/?version=latest
:target: http://armada-helm.readthedocs.io/ :target: http://armada-helm.readthedocs.io/

View File

@ -33,11 +33,11 @@ def apply():
DESC = """ 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 The apply argument must be relative path to Armada Manifest. Executing apply
commnad once will install all charts defined in manifest. Re-executing apply command once will install all charts defined in manifest. Re-executing apply
commnad will execute upgrade. command will execute upgrade.
To see how to create an Armada manifest: To see how to create an Armada manifest:
http://armada-helm.readthedocs.io/en/latest/operations/ http://armada-helm.readthedocs.io/en/latest/operations/
@ -51,7 +51,7 @@ To obtain override manifest:
\b \b
$ armada apply examples/simple.yaml \ $ armada apply examples/simple.yaml \
--set manifest:simple-armada:relase_name="wordpress" --set manifest:simple-armada:release_name="wordpress"
\b \b
or 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', @apply.command(name='apply',
help=DESC, help=DESC,
short_help=SHORT_DESC) short_help=SHORT_DESC)
@click.argument('locations', nargs=-1) @click.argument('locations',
nargs=-1)
@click.option('--api', @click.option('--api',
help="Contacts service endpoint.", help="Contacts service endpoint.",
is_flag=True) is_flag=True)
@ -105,8 +106,7 @@ SHORT_DESC = "command install manifest charts"
help="Specifies time to wait for charts to deploy.", help="Specifies time to wait for charts to deploy.",
type=int, type=int,
default=3600) default=3600)
@click.option('--values', @click.option('--values', '-f',
'-f',
help=("Use to override multiple Armada Manifest values by " help=("Use to override multiple Armada Manifest values by "
"reading overrides from a values.yaml-type file."), "reading overrides from a values.yaml-type file."),
multiple=True, multiple=True,
@ -116,12 +116,12 @@ SHORT_DESC = "command install manifest charts"
help="Wait until all charts deployed.", help="Wait until all charts deployed.",
is_flag=True) is_flag=True)
@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.option('--debug/--no-debug', @click.option('--debug',
help='Enable or disable debugging.', help="Enable debug logging.",
default=False) is_flag=True)
@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,

View File

@ -36,7 +36,7 @@ This command deletes releases.
The delete command will delete the releases either via a manifest The delete command will delete the releases either via a manifest
or by targeting specific releases. 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 $ 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) @delete.command(name='delete',
@click.option('--manifest', help='Armada manifest file', type=str) help=DESC,
@click.option( short_help=SHORT_DESC)
'--releases', help='Comma-separated list of release names', type=str) @click.option('--manifest',
@click.option( help="Armada Manifest file.",
'--no-purge', help="Deletes release without purge option", is_flag=True) type=str)
@click.option('--tiller-host', help="Tiller Host IP") @click.option('--releases',
@click.option( help="Comma-separated list of release names.",
'--tiller-port', help="Tiller host Port", type=int, default=44134) 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 @click.pass_context
def delete_charts(ctx, manifest, releases, no_purge, tiller_host, tiller_port): def delete_charts(ctx, manifest, releases, no_purge, tiller_host, tiller_port):
DeleteChartManifest( DeleteChartManifest(

View File

@ -34,13 +34,13 @@ def test():
DESC = """ 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 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 $ 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) @test.command(name='test',
@click.option('--file', help='armada manifest', type=str) help=DESC,
@click.option('--release', help='helm release', type=str) short_help=SHORT_DESC)
@click.option('--tiller-host', help="Tiller Host IP", default=None) @click.option('--file',
@click.option( help="Armada manifest.",
'--tiller-port', help="Tiller Host Port", type=int, type=str)
default=CONF.tiller_port) @click.option('--release',
@click.option( help="Helm release.",
'--tiller-namespace', '-tn', help="Tiller Namespace", type=str, type=str)
default=CONF.tiller_namespace) @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', @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, tiller_namespace, def test_charts(ctx, file, release, tiller_host, tiller_port, tiller_namespace,

View File

@ -30,33 +30,43 @@ def tiller():
DESC = """ 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 $ armada tiller --releases
To obtain tiller service status/information: To obtain Tiller service status/information:
$ armada tiller --status $ 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) @tiller.command(name='tiller',
@click.option('--tiller-host', help="Tiller host ip", default=None) help=DESC,
@click.option( short_help=SHORT_DESC)
'--tiller-port', help="Tiller host port", type=int, @click.option('--tiller-host',
default=CONF.tiller_port) help="Tiller host IP.",
@click.option( default=None)
'--tiller-namespace', '-tn', help="Tiller namespace", type=str, @click.option('--tiller-port',
default=CONF.tiller_namespace) help="Tiller host port.",
@click.option('--releases', help="list of deployed releses", is_flag=True) type=int,
@click.option('--status', help="Status of Armada services", is_flag=True) 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 @click.pass_context
def tiller_service(ctx, tiller_host, tiller_port, tiller_namespace, releases, def tiller_service(ctx, tiller_host, tiller_port, tiller_namespace, releases,
status): status):

View File

@ -30,7 +30,7 @@ def validate():
DESC = """ DESC = """
This command validates Armada Manifest This command validates an Armada Manifest.
The validate argument must be a relative path to 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) @validate.command(name='validate',
@click.argument('locations', nargs=-1) help=DESC,
short_help=SHORT_DESC)
@click.argument('locations',
nargs=-1)
@click.pass_context @click.pass_context
def validate_manifest(ctx, locations): def validate_manifest(ctx, locations):
ValidateManifest(ctx, locations).invoke() ValidateManifest(ctx, locations).invoke()

View File

@ -19,13 +19,13 @@ tiller_policies = [
policy.DocumentedRuleDefault( policy.DocumentedRuleDefault(
name=base.TILLER % 'get_status', name=base.TILLER % 'get_status',
check_str=base.RULE_ADMIN_REQUIRED, check_str=base.RULE_ADMIN_REQUIRED,
description='Get tiller status', description='Get Tiller status',
operations=[{'path': '/api/v1.0/status/', 'method': 'GET'}]), operations=[{'path': '/api/v1.0/status/', 'method': 'GET'}]),
policy.DocumentedRuleDefault( policy.DocumentedRuleDefault(
name=base.TILLER % 'get_release', name=base.TILLER % 'get_release',
check_str=base.RULE_ADMIN_REQUIRED, check_str=base.RULE_ADMIN_REQUIRED,
description='Get tiller release', description='Get Tiller release',
operations=[{'path': '/api/v1.0/releases/', 'method': 'GET'}]), operations=[{'path': '/api/v1.0/releases/', 'method': 'GET'}]),
] ]

View File

@ -69,17 +69,17 @@ The Keystone project domain name used for authentication.
cfg.StrOpt( cfg.StrOpt(
'tiller_pod_labels', 'tiller_pod_labels',
default='app=helm,name=tiller', default='app=helm,name=tiller',
help=utils.fmt('Labels for the tiller pod.')), help=utils.fmt('Labels for the Tiller pod.')),
cfg.StrOpt( cfg.StrOpt(
'tiller_namespace', 'tiller_namespace',
default='kube-system', default='kube-system',
help=utils.fmt('Namespace for the tiller pod.')), help=utils.fmt('Namespace for the Tiller pod.')),
cfg.IntOpt( cfg.IntOpt(
'tiller_port', 'tiller_port',
default=44134, default=44134,
help=utils.fmt('Port for the tiller pod.')), help=utils.fmt('Port for the Tiller pod.')),
cfg.ListOpt( cfg.ListOpt(
'tiller_release_roles', 'tiller_release_roles',

View File

@ -24,28 +24,28 @@ class ApiException(base.ArmadaBaseException):
class ApiBaseException(ApiException): class ApiBaseException(ApiException):
'''Exception that occurs during chart cleanup.''' '''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): class ApiJsonException(ApiException):
'''Exception that occurs during chart cleanup.''' '''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): class ClientUnauthorizedError(ApiException):
'''Exception that occurs during chart cleanup.''' '''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): class ClientForbiddenError(ApiException):
'''Exception that occurs during chart cleanup.''' '''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): class ClientError(ApiException):
'''Exception that occurs during chart cleanup.''' '''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.'

View File

@ -18,20 +18,20 @@ from armada.exceptions.base_exception import ArmadaBaseException as ex
class TillerException(ex): class TillerException(ex):
'''Base class for Tiller exceptions and error handling.''' '''Base class for Tiller exceptions and error handling.'''
message = 'An unknown Tiller error occured.' message = 'An unknown Tiller error occurred.'
class TillerServicesUnavailableException(TillerException): class TillerServicesUnavailableException(TillerException):
'''Exception for tiller services unavailable.''' '''Exception for Tiller services unavailable.'''
message = 'Tiller services unavailable.' message = 'Tiller services unavailable.'
class ChartCleanupException(TillerException): class ChartCleanupException(TillerException):
'''Exception that occures during chart cleanup.''' '''Exception that occurs during chart cleanup.'''
def __init__(self, chart_name): 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) chart_name)
super(ChartCleanupException, self).__init__(message) super(ChartCleanupException, self).__init__(message)
@ -39,7 +39,7 @@ class ChartCleanupException(TillerException):
class ListChartsException(TillerException): class ListChartsException(TillerException):
'''Exception that occurs when listing charts''' '''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): class PostUpdateJobDeleteException(TillerException):
@ -98,9 +98,9 @@ class ReleaseException(TillerException):
class ChannelException(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): class GetReleaseStatusException(TillerException):
@ -129,15 +129,15 @@ class TillerPodNotFoundException(TillerException):
''' '''
def __init__(self, labels): 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) super(TillerPodNotFoundException, self).__init__(message)
class TillerPodNotRunningException(TillerException): 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): class TillerVersionException(TillerException):

View File

@ -184,9 +184,10 @@ class Armada(object):
if repo_branch not in repos: if repo_branch not in repos:
try: try:
LOG.info('Cloning repo: %s branch: %s', *repo_branch) logstr = 'Cloning repo: {} branch: {}'.format(*repo_branch)
if proxy_server: 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) repo_dir = source.git_clone(*repo_branch, proxy_server)
except Exception: except Exception:
raise source_exceptions.GitException( raise source_exceptions.GitException(
@ -216,7 +217,7 @@ class Armada(object):
def sync(self): def sync(self):
''' '''
Syncronize Helm with the Armada Config(s) Synchronize Helm with the Armada Config(s)
''' '''
msg = {'install': [], 'upgrade': [], 'diff': []} msg = {'install': [], 'upgrade': [], 'diff': []}
@ -235,7 +236,7 @@ class Armada(object):
raise armada_exceptions.KnownReleasesException() raise armada_exceptions.KnownReleasesException()
for release in known_releases: 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]) release[1])
for entry in self.config[const.KEYWORD_ARMADA][const.KEYWORD_GROUPS]: for entry in self.config[const.KEYWORD_ARMADA][const.KEYWORD_GROUPS]:

View File

@ -30,15 +30,20 @@ CONF = cfg.CONF
@click.group() @click.group()
@click.option( @click.option('--debug',
'--debug/--no-debug', help='Enable or disable debugging', default=False) help="Enable debug logging",
@click.option( is_flag=True)
'--api/--no-api', help='Execute service endpoints. (requires url option)', @click.option('--api/--no-api',
default=False) help="Execute service endpoints. (requires url option)",
@click.option( default=False)
'--url', help='Armada Service Endpoint', envvar='HOST', default=None) @click.option('--url',
@click.option( help="Armada Service Endpoint",
'--token', help='Keystone Service Token', envvar='TOKEN', default=None) envvar='HOST',
default=None)
@click.option('--token',
help="Keystone Service Token",
envvar='TOKEN',
default=None)
@click.pass_context @click.pass_context
def main(ctx, debug, api, url, token): def main(ctx, debug, api, url, token):
""" """

View File

@ -47,11 +47,11 @@ def git_clone(repo_url, ref='master', proxy_server=None):
try: try:
if proxy_server: 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, repo = Repo.clone_from(repo_url, _tmp_dir,
config='http.proxy=%s' % proxy_server) config='http.proxy=%s' % proxy_server)
else: else:
LOG.info('Cloning [%s]', repo_url) LOG.debug('Cloning [%s]', repo_url)
repo = Repo.clone_from(repo_url, _tmp_dir) repo = Repo.clone_from(repo_url, _tmp_dir)
repo.remotes.origin.fetch(ref) repo.remotes.origin.fetch(ref)

View File

@ -65,4 +65,3 @@ spec:
name: armada-bin name: armada-bin
defaultMode: 0555 defaultMode: 0555
{{- end }} {{- end }}

View File

@ -28,4 +28,3 @@ data:
{{- tuple $userClass "internal" $envAll | include "helm-toolkit.snippets.keystone_secret_openrc" | indent 2 -}} {{- tuple $userClass "internal" $envAll | include "helm-toolkit.snippets.keystone_secret_openrc" | indent 2 -}}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -24,7 +24,7 @@ images:
pull_policy: "IfNotPresent" pull_policy: "IfNotPresent"
deployment: deployment:
# NOTE: CUrrent replica is hard-coded to 1. This is a placeholder variable # NOTE: Current replica is hard-coded to 1. This is a placeholder variable
# for future usage. Updates will be made to the chart when we know that # for future usage. Updates will be made to the chart when we know that
# tiller is stable with multiple instances. # tiller is stable with multiple instances.
replicas: 1 replicas: 1

View File

@ -7,31 +7,30 @@ clean_container(){
} }
readlink(){ readlink(){
( (
cd $(dirname $1) cd $(dirname $1)
echo $PWD/$(basename $1) echo $PWD/$(basename $1)
) )
} }
# Check to see if the aramada container exists # Check to see if the aramada container exists
if [ -n "$( sudo docker ps -a | grep quay.io/attcomdev/armada )" ]; then if [ -n "$( sudo docker ps -a | grep quay.io/attcomdev/armada )" ]; then
echo "Armada container already exists..." echo "Armada container already exists..."
clean_container armada clean_container armada
fi fi
# Check to see if the user is trying to apply a chart # Check to see if the user is trying to apply a chart
if [ $1 = "apply" ]; then if [ $1 = "apply" ]; then
# TODO Handle erroneous or missing inputs # TODO Handle erroneous or missing inputs
# Bring up a new armada container with passed in yaml mounted to the container # Bring up a new armada container with passed in yaml mounted to the container
echo "Creating an Armada container..." echo "Creating an Armada container..."
docker run -d --net host -p 8000:8000 --name armada -v $(readlink $(dirname $2)):$(readlink $(dirname $2)) -v ~/.kube/config:/armada/.kube/config -v ~/.kube/plugins/armada/examples/:/examples quay.io/attcomdev/armada:latest docker run -d --net host -p 8000:8000 --name armada -v $(readlink $(dirname $2)):$(readlink $(dirname $2)) -v ~/.kube/config:/armada/.kube/config -v ~/.kube/plugins/armada/examples/:/examples quay.io/attcomdev/armada:latest
docker exec armada armada apply $(readlink $2) docker exec armada armada apply $(readlink $2)
else else
# For any other command the chart does not need to be mounted to the container # For any other command the chart does not need to be mounted to the container
# Bring up a new armada container # Bring up a new armada container
echo "Creating an Armada container..." echo "Creating an Armada container..."
docker run -d --net host -p 8000:8000 --name armada -v ~/.kube/config:/armada/.kube/config -v ~/.kube/plugins/armada/examples/:/examples quay.io/attcomdev/armada:latest docker run -d --net host -p 8000:8000 --name armada -v ~/.kube/config:/armada/.kube/config -v ~/.kube/plugins/armada/examples/:/examples quay.io/attcomdev/armada:latest
docker exec armada armada "$@" docker exec armada armada "$@"
fi fi
clean_container armada clean_container armada

View File

@ -24,7 +24,7 @@ Commands
To obtain override manifest: To obtain override manifest:
$ armada apply examples/simple.yaml --set manifest:simple-armada:relase_name="wordpress" $ armada apply examples/simple.yaml --set manifest:simple-armada:release_name="wordpress"
or or
@ -50,7 +50,7 @@ Commands
--target-manifest TEXT The target manifest to run. Required for --target-manifest TEXT The target manifest to run. Required for
specifying which manifest to run when multiple specifying which manifest to run when multiple
are available. are available.
--debug / --no-debug Enable or disable debugging. --debug Enable debug logging.
--help Show this message and exit. --help Show this message and exit.
Synopsis Synopsis
@ -61,7 +61,7 @@ that it will deploy into the tiller service in your Kubernetes cluster.
Executing the ``armada apply`` again on existing armada deployment will start Executing the ``armada apply`` again on existing armada deployment will start
an update of the armada deployed charts. an update of the armada deployed charts.
``armada apply armada-manifest.yaml [--debug-logging]`` ``armada apply armada-manifest.yaml [--debug]``
If you remove ``armada/Charts/v1`` from the ``armada/ChartGroups/v1`` in the armada If you remove ``armada/Charts/v1`` from the ``armada/ChartGroups/v1`` in the armada
manifest and execute an ``armada apply`` with the ``--enable-chart-cleanup`` flag. manifest and execute an ``armada apply`` with the ``--enable-chart-cleanup`` flag.

View File

@ -30,4 +30,3 @@
# Get tiller release # Get tiller release
# GET /api/v1.0/releases/ # GET /api/v1.0/releases/
#"tiller:get_release": "rule:admin_required" #"tiller:get_release": "rule:admin_required"

View File

@ -1,8 +1,8 @@
name: "armada" name: "armada"
version: "0.0.3" version: "0.0.3"
usage: "Manages multiple helm charts with a centralized armada yaml" usage: "Manages multiple Helm charts with a centralized Armada yaml"
description: |- description: |-
This plugin provides helm access to armada. A tool for managing multiple helm charts with dependencies by centralizing all configurations in a single Armada yaml and providing lifecycle hooks for all helm releases This plugin provides Helm access to Armada. A tool for managing multiple Helm charts with dependencies by centralizing all configurations in a single Armada yaml and providing lifecycle hooks for all Helm releases
usage: usage:
$ helm armada tiller --status $ helm armada tiller --status
$ helm armada apply /examples/openstack-helm.yaml $ helm armada apply /examples/openstack-helm.yaml

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = armada name = armada
summary = tool for managing multiple chart ocherstartion lifecycle summary = tool for managing multiple chart orchestration lifecycle
description-file = README.rst description-file = README.rst
author = armada team author = armada team
@ -11,8 +11,6 @@ classifier =
License :: OSI Approved :: Apache Software License License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux Operating System :: POSIX :: Linux
Programming Language :: Python Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.5
@ -43,7 +41,7 @@ console_scripts =
oslo.config.opts = oslo.config.opts =
armada.conf = armada.conf.opts:list_opts armada.conf = armada.conf.opts:list_opts
oslo.policy.policies = oslo.policy.policies =
armada = armada.common.policies:list_rules armada = armada.common.policies:list_rules
[pbr] [pbr]
warnerrors = True warnerrors = True

View File

@ -20,26 +20,26 @@ HELM=$1
set -x set -x
function helm_serve { function helm_serve {
if [[ -d "$HOME/.helm" ]]; then if [[ -d "$HOME/.helm" ]]; then
echo ".helm directory found" echo ".helm directory found"
else else
${HELM} init --client-only ${HELM} init --client-only
fi fi
if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then
${HELM} serve & > /dev/null ${HELM} serve & > /dev/null
while [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; do while [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; do
sleep 1 sleep 1
echo "Waiting for Helm Repository" echo "Waiting for Helm Repository"
done done
else else
echo "Helm serve already running" echo "Helm serve already running"
fi fi
if ${HELM} repo list | grep -q "^stable" ; then if ${HELM} repo list | grep -q "^stable" ; then
${HELM} repo remove stable ${HELM} repo remove stable
fi fi
${HELM} repo add local http://localhost:8879/charts ${HELM} repo add local http://localhost:8879/charts
} }
mkdir -p build mkdir -p build

27
tox.ini
View File

@ -4,47 +4,48 @@ envlist = py35, pep8, coverage, bandit
[testenv] [testenv]
deps= deps=
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
passenv=HTTP_PROXY HTTPS_PROXY http_proxy https_proxy NO_PROXY no_proxy passenv=HTTP_PROXY HTTPS_PROXY http_proxy https_proxy NO_PROXY no_proxy
setenv= setenv=
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
basepython = python3.5 basepython = python3.5
usedevelop = True usedevelop = True
install_command = pip install {opts} {packages} install_command = pip install {opts} {packages}
whitelist_externals = find whitelist_externals =
flake8 find
flake8
commands = commands =
find . -type f -name "*.pyc" -delete find . -type f -name "*.pyc" -delete
python -V python -V
{toxinidir}/tools/run-unit-tests.sh {posargs} {toxinidir}/tools/run-unit-tests.sh {posargs}
[testenv:docs] [testenv:docs]
commands = commands =
python setup.py build_sphinx python setup.py build_sphinx
[testenv:genconfig] [testenv:genconfig]
commands = commands =
oslo-config-generator --config-file=etc/armada/config-generator.conf oslo-config-generator --config-file=etc/armada/config-generator.conf
[testenv:genpolicy] [testenv:genpolicy]
commands = commands =
oslopolicy-sample-generator --config-file=etc/armada/policy-generator.conf oslopolicy-sample-generator --config-file=etc/armada/policy-generator.conf
[testenv:pep8] [testenv:pep8]
commands = commands =
flake8 {posargs} flake8 {posargs}
[testenv:bandit] [testenv:bandit]
commands = commands =
bandit -r armada -x armada/tests -n 5 bandit -r armada -x armada/tests -n 5
[testenv:coverage] [testenv:coverage]
passenv=http_proxy https_proxy no_proxy HTTP_PROXY HTTPS_PROXY NO_PROXY passenv=http_proxy https_proxy no_proxy HTTP_PROXY HTTPS_PROXY NO_PROXY
setenv= setenv=
VIRTUAL_ENV={envdir} VIRTUAL_ENV={envdir}
commands = commands =
python -m pytest \ python -m pytest \
--cov-branch \ --cov-branch \
--cov-report term-missing:skip-covered \ --cov-report term-missing:skip-covered \
--cov-config .coveragerc \ --cov-config .coveragerc \