Browse Source

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
changes/20/570020/1
Marshall Margenau 2 years ago
parent
commit
e1b64d200b
32 changed files with 277 additions and 255 deletions
  1. +0
    -1
      .dockerignore
  2. +27
    -0
      .editorconfig
  3. +4
    -1
      .gitignore
  4. +0
    -22
      .travis.yml
  5. +33
    -36
      CODE_OF_CONDUCT.rst
  6. +13
    -13
      CONTRIBUTING.rst
  7. +5
    -5
      Dockerfile
  8. +0
    -4
      Makefile
  9. +0
    -9
      OWNERS
  10. +2
    -4
      README.rst
  11. +13
    -13
      armada/cli/apply.py
  12. +22
    -13
      armada/cli/delete.py
  13. +27
    -17
      armada/cli/test.py
  14. +27
    -17
      armada/cli/tiller.py
  15. +7
    -4
      armada/cli/validate.py
  16. +2
    -2
      armada/common/policies/tiller.py
  17. +3
    -3
      armada/conf/default.py
  18. +5
    -5
      armada/exceptions/api_exceptions.py
  19. +10
    -10
      armada/exceptions/tiller_exceptions.py
  20. +5
    -4
      armada/handlers/armada.py
  21. +14
    -9
      armada/shell.py
  22. +2
    -2
      armada/utils/source.py
  23. +0
    -1
      charts/armada/templates/job-ks-user.yaml
  24. +0
    -1
      charts/armada/templates/secret-keystone-env.yaml
  25. +1
    -1
      charts/tiller/values.yaml
  26. +16
    -17
      controller.sh
  27. +3
    -3
      docs/source/commands/apply.rst
  28. +0
    -1
      etc/armada/policy.yaml
  29. +2
    -2
      plugin.yaml
  30. +2
    -4
      setup.cfg
  31. +18
    -18
      tools/helm_tk.sh
  32. +14
    -13
      tox.ini

+ 0
- 1
.dockerignore View File

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

+ 27
- 0
.editorconfig 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

+ 4
- 1
.gitignore View File

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

# IDEs
.idea/
.vscode/

+ 0
- 22
.travis.yml 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

+ 33
- 36
CODE_OF_CONDUCT.rst View File

@@ -5,10 +5,10 @@ Our Pledge
----------

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our
project and our community a harassment-free experience for everyone,
regardless of age, body size, disability, ethnicity, gender identity and
expression, level of experience, nationality, personal appearance, race,
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
education, socio-economic status, nationality, personal appearance, race,
religion, or sexual identity and orientation.

Our Standards
@@ -25,54 +25,51 @@ include:

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual
attention or advances
- Trolling, insulting/derogatory comments, and personal or political
attacks
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others’ private information, such as a physical or
electronic address, without explicit permission
- Publishing others’ private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

Our Responsibilities
--------------------

Project maintainers are responsible for clarifying the standards of
acceptable behavior and are expected to take appropriate and fair
corrective action in response to any instances of unacceptable behavior.
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit,
or reject comments, commits, code, wiki edits, issues, and other
contributions that are not aligned to this Code of Conduct, or to ban
temporarily or permanently any contributor for other behaviors that they
deem inappropriate, threatening, offensive, or harmful.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

Scope
-----

This Code of Conduct applies both within project spaces and in public
spaces when an individual is representing the project or its community.
Examples of representing a project or community include using an
official project e-mail address, posting via an official social media
account, or acting as an appointed representative at an online or
offline event. Representation of a project may be further defined and
clarified by project maintainers.
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

Enforcement
-----------

Instances of abusive, harassing, or otherwise unacceptable behavior may
be reported by contacting the project team. The
project team will review and investigate all complaints, and will
respond in a way that it deems appropriate to the circumstances. The
project team is obligated to maintain confidentiality with regard to the
reporter of an incident. Further details of specific enforcement
policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in
good faith may face temporary or permanent repercussions as determined
by other members of the project’s leadership.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project’s leadership.

Attribution
-----------


+ 13
- 13
CONTRIBUTING.rst View File

@@ -7,7 +7,7 @@ involved in contributing to Armada.
Code of Conduct
---------------
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
before contributing.

@@ -37,12 +37,12 @@ the issue type.
+=============+===============================================================+
| bug | Indicates a confirmed bug or other unexpected behavior |
+-------------+---------------------------------------------------------------+
| ehancement | Feature request |
| enhancement | Feature request |
+-------------+---------------------------------------------------------------+
| question | Indicates a question |
+-------------+---------------------------------------------------------------+
| docs | Assigned to issues indicating missing or incomplete |
| | documenation |
| | documentation |
+-------------+---------------------------------------------------------------+
| duplicate | Assigned to issues that are duplicates of previously reported |
| | issues |
@@ -83,9 +83,9 @@ readme.html#getting-started>`_
Armada accepts patches through GerritHub changes. Each commit pushed to
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
intial patch set that shows all of the revised changes. When a Gerrit change is
amended, a new patch set is created to show the differences from the previous
patch set.
initial patch set that shows all of the revised changes. When a Gerrit change
is amended, a new patch set is created to show the differences from the
previous patch set.

The general workflow for submitting a change is:

@@ -114,7 +114,7 @@ installed. Git-review can be installed using Python

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

@@ -138,7 +138,7 @@ connecting-to-github-with-ssh/>`_.

If you require authentication over HTTPS, you will need to generate an
`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

.. 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
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.

Below is a list of possible types:
@@ -201,7 +201,7 @@ Below is a list of possible types:

.. 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.

An commit message for a change that adds a new API endpoint might resemble the
@@ -218,7 +218,7 @@ following example:
.. NOTE::

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
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
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

.. code-block:: bash
@@ -304,5 +304,5 @@ and conforms to the PEP8 style guide, execute:
.. code-block:: bash

tox -e pep8
tox -e py27,py35
tox -e py35
tox -e coverage

+ 5
- 5
Dockerfile View File

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

EXPOSE 8000



+ 0
- 4
Makefile View File

@@ -62,7 +62,6 @@ check-tox:
images: check-docker
docker build --rm -t ${IMAGE} .


.PHONY: dry-run
dry-run: clean
tools/helm_tk.sh $(HELM)
@@ -107,10 +106,7 @@ helm_lint:
@tools/helm_tk.sh $(HELM)
$(HELM) lint $(CHART)


.PHONY: charts
charts: clean
$(HELM) dep up $(CHART)
$(HELM) package $(CHART)



+ 0
- 9
OWNERS View File

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

+ 2
- 4
README.rst View File

@@ -1,7 +1,7 @@
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
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
number of charts::

$ armada apply examples/openstack-helm.yaml [--debug-loggging ]
$ armada apply examples/openstack-helm.yaml [ --debug ]

Which should output something like this::

@@ -121,7 +121,5 @@ Further Reading

.. |Docker Repository on Quay| image:: https://quay.io/repository/attcomdev/armada/status
: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
:target: http://armada-helm.readthedocs.io/

+ 13
- 13
armada/cli/apply.py View File

@@ -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,


+ 22
- 13
armada/cli/delete.py View File

@@ -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"


@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)
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)
@click.pass_context
def delete_charts(ctx, manifest, releases, no_purge, tiller_host, tiller_port):
DeleteChartManifest(


+ 27
- 17
armada/cli/test.py View File

@@ -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,


+ 27
- 17
armada/cli/tiller.py View File

@@ -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"


@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)
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 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):


+ 7
- 4
armada/cli/validate.py View File

@@ -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()


+ 2
- 2
armada/common/policies/tiller.py View File

@@ -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'}]),
]



+ 3
- 3
armada/conf/default.py View File

@@ -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',


+ 5
- 5
armada/exceptions/api_exceptions.py View File

@@ -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.'

+ 10
- 10
armada/exceptions/tiller_exceptions.py View File

@@ -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):


+ 5
- 4
armada/handlers/armada.py View File

@@ -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]:


+ 14
- 9
armada/shell.py View File

@@ -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):
"""


+ 2
- 2
armada/utils/source.py View File

@@ -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)


+ 0
- 1
charts/armada/templates/job-ks-user.yaml View File

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


+ 0
- 1
charts/armada/templates/secret-keystone-env.yaml View File

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


+ 1
- 1
charts/tiller/values.yaml View File

@@ -24,7 +24,7 @@ images:
pull_policy: "IfNotPresent"

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
# tiller is stable with multiple instances.
replicas: 1


+ 16
- 17
controller.sh View File

@@ -7,31 +7,30 @@ clean_container(){
}

readlink(){
(
cd $(dirname $1)
echo $PWD/$(basename $1)
)
(
cd $(dirname $1)
echo $PWD/$(basename $1)
)
}

# Check to see if the aramada container exists
if [ -n "$( sudo docker ps -a | grep quay.io/attcomdev/armada )" ]; then
echo "Armada container already exists..."
clean_container armada
echo "Armada container already exists..."
clean_container armada
fi

# Check to see if the user is trying to apply a chart
if [ $1 = "apply" ]; then
# TODO Handle erroneous or missing inputs
# Bring up a new armada container with passed in yaml mounted to the 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 exec armada armada apply $(readlink $2)
# TODO Handle erroneous or missing inputs
# Bring up a new armada container with passed in yaml mounted to the 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 exec armada armada apply $(readlink $2)
else
# For any other command the chart does not need to be mounted to the container
# Bring up a new 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 exec armada armada "$@"
# For any other command the chart does not need to be mounted to the container
# Bring up a new 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 exec armada armada "$@"
fi
clean_container armada


+ 3
- 3
docs/source/commands/apply.rst View File

@@ -24,7 +24,7 @@ Commands

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

@@ -50,7 +50,7 @@ Commands
--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.
--debug Enable debug logging.
--help Show this message and exit.

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
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
manifest and execute an ``armada apply`` with the ``--enable-chart-cleanup`` flag.


+ 0
- 1
etc/armada/policy.yaml View File

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


+ 2
- 2
plugin.yaml View File

@@ -1,8 +1,8 @@
name: "armada"
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: |-
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:
$ helm armada tiller --status
$ helm armada apply /examples/openstack-helm.yaml


+ 2
- 4
setup.cfg View File

@@ -1,6 +1,6 @@
[metadata]
name = armada
summary = tool for managing multiple chart ocherstartion lifecycle
summary = tool for managing multiple chart orchestration lifecycle
description-file = README.rst

author = armada team
@@ -11,8 +11,6 @@ classifier =
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5

@@ -43,7 +41,7 @@ console_scripts =
oslo.config.opts =
armada.conf = armada.conf.opts:list_opts
oslo.policy.policies =
armada = armada.common.policies:list_rules
armada = armada.common.policies:list_rules

[pbr]
warnerrors = True


+ 18
- 18
tools/helm_tk.sh View File

@@ -20,26 +20,26 @@ HELM=$1
set -x

function helm_serve {
if [[ -d "$HOME/.helm" ]]; then
echo ".helm directory found"
else
${HELM} init --client-only
fi
if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then
${HELM} serve & > /dev/null
while [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; do
sleep 1
echo "Waiting for Helm Repository"
done
else
echo "Helm serve already running"
fi
if [[ -d "$HOME/.helm" ]]; then
echo ".helm directory found"
else
${HELM} init --client-only
fi
if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then
${HELM} serve & > /dev/null
while [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; do
sleep 1
echo "Waiting for Helm Repository"
done
else
echo "Helm serve already running"
fi

if ${HELM} repo list | grep -q "^stable" ; then
${HELM} repo remove stable
fi
if ${HELM} repo list | grep -q "^stable" ; then
${HELM} repo remove stable
fi

${HELM} repo add local http://localhost:8879/charts
${HELM} repo add local http://localhost:8879/charts
}

mkdir -p build


+ 14
- 13
tox.ini View File

@@ -4,47 +4,48 @@ envlist = py35, pep8, coverage, bandit

[testenv]
deps=
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
passenv=HTTP_PROXY HTTPS_PROXY http_proxy https_proxy NO_PROXY no_proxy
setenv=
VIRTUAL_ENV={envdir}
basepython = python3.5
usedevelop = True
install_command = pip install {opts} {packages}
whitelist_externals = find
flake8
whitelist_externals =
find
flake8
commands =
find . -type f -name "*.pyc" -delete
python -V
{toxinidir}/tools/run-unit-tests.sh {posargs}
find . -type f -name "*.pyc" -delete
python -V
{toxinidir}/tools/run-unit-tests.sh {posargs}

[testenv:docs]
commands =
python setup.py build_sphinx
python setup.py build_sphinx

[testenv:genconfig]
commands =
oslo-config-generator --config-file=etc/armada/config-generator.conf
oslo-config-generator --config-file=etc/armada/config-generator.conf

[testenv:genpolicy]
commands =
oslopolicy-sample-generator --config-file=etc/armada/policy-generator.conf
oslopolicy-sample-generator --config-file=etc/armada/policy-generator.conf

[testenv:pep8]
commands =
flake8 {posargs}
flake8 {posargs}

[testenv:bandit]
commands =
bandit -r armada -x armada/tests -n 5
bandit -r armada -x armada/tests -n 5

[testenv:coverage]
passenv=http_proxy https_proxy no_proxy HTTP_PROXY HTTPS_PROXY NO_PROXY
setenv=
VIRTUAL_ENV={envdir}
commands =
python -m pytest \
python -m pytest \
--cov-branch \
--cov-report term-missing:skip-covered \
--cov-config .coveragerc \


Loading…
Cancel
Save