412 Commits

Author SHA1 Message Date
Sean Eagan
6b96bbf28d Correctly identify latest release
This fixes the following issues with listing releases from tiller,
which could cause Armada to be confused about the state of the
latest release, and do the wrong thing.

- Was not filtering out old releases, so we could find both a
  FAILED and DEPLOYED release for the same chart. When this is the
  case it likely means the FAILED release is the latest, since
  otherwise armada would have purged the release (and all its
  history) upon seeing the FAILED release in a previous run.
  The issue is that after the purge it would try to upgrade
  rather than re-install, since it also sees the old DEPLOYED
  release. Also if a release gets manually fixed (DEPLOYED)
  outside of armada, armada still sees the old FAILED release,
  and will purge the fixed release.
- Was only fetching DEPLOYED and FAILED releases from tiller, so if
  the latest release has another status Armada won't see it at all.

This changes to:

- Fetch releases with all statuses.
- Filter out old releases.
- Raise an error if latest release has status other than DEPLOYED
  or FAILED, since it's not clear what other action to take in
  this scenario.

Change-Id: I84712c1486c19d2bba302bf3420df916265ba70c
2018-10-19 09:14:15 -05:00
Zuul
f30c68e627 Merge "Fix log message formatting error" 2018-10-19 02:21:35 +00:00
Zuul
e1179a8ba8 Merge "api: Update entrypoint script with proper quotes" 2018-10-18 15:38:41 +00:00
Zuul
5476454e4a Merge "api: Replace conflicting environment variable" 2018-10-18 15:38:40 +00:00
Sean Eagan
5e7c36d2a1 Avoid bug in tiller when both sorting and paging releases
The tiller list releases command has a bug when using sorting
and paging simultaneously. Armada was passing sorting parameters,
but it doesn't really care about the order, so this removes the
sorting parameters to avoid the tiller issue.

Change-Id: If8349a8093d4b79d5e056d988b710372705eb669
2018-10-17 14:47:16 -05:00
Felipe Monteiro
501d1e13b3 Remove redundant pep8 job from .zuul.yaml
This patch set drops a redundant pep8 job from .zuul.yaml.
openstack-tox-pep8 is already as a job, so
airship-armada-lint-pep8 can be dropped.

Change-Id: Iaaa0c8d34a2de93b7f105f7c686951df4e3b6824
2018-10-17 09:13:58 -04:00
Zuul
6078774b34 Merge "chore: Combine pep8 with whitespace linter" 2018-10-16 13:57:35 +00:00
Zuul
ed46e18e06 Merge "trivial: Drop empty dir armada/tests/unit/cli.py" 2018-10-16 13:15:04 +00:00
Sean Eagan
6a744d77ea Fix list releases paging
Fix an issue where release paging failed to break out of the loop when no
releases were found in tiller.

Change-Id: I4a25e58a7f6bdd88941f7f87cba2a0aee261f8be
2018-10-15 16:30:35 -05:00
Felipe Monteiro
57ad3828b4 trivial: Drop empty dir armada/tests/unit/cli.py
This patch set is trivial: Drops armada/tests/unit/cli.py
because it is empty. This way it is apparent that Armada
needs CLI unit tests. When they are added this folder
can be re-recreated.

Change-Id: Ice9669aa5b21191d4de646b9035a135a2722a2f9
2018-10-15 20:38:28 +01:00
Sean Eagan
28f919d60f Fix log message formatting error
Logging does not support new style format strings.

Change-Id: I8fcdb8a1034066a41a46ba3a6fc45dd3b0257c99
2018-10-15 08:55:25 -05:00
Felipe Monteiro
0aa0935c7c chore: Combine pep8 with whitespace linter
This patch set combines whitespace linter and pep8 together
(as both do code linting) into the same job by dropping the
.zuul.yaml whitespace-linter job and rolling it up into the
same pep8 tox.ini check, just like Deckhand [0].

[0] 0462b7b929/tox.ini (L106)

Change-Id: I31ed60adfd431157ffc96a0f4d5d77d54af37352
2018-10-14 17:52:32 -04:00
Sean Eagan
e149afdcbe Use paging to list releases from tiller
Tiller has a non-configurable gRPC max response message size. If the
list releases response reaches this size it silently truncates the
results to be below this size. Thus for armada to be able to reliably
get back all the releases it requests, this patchset implements paging
with what should be a small enough page size to avoid the truncation.

Change-Id: Ic2de85f6eabcea8655b18b411b79a863160b0c81
2018-10-12 21:28:22 -05:00
Felipe Monteiro
aa07ae72d5 fix: Fix controller enforcing a nonexistent policy
This patch set corrects in an issue in Armada's
"TestReleasesManifestController" in which a nonexistent policy
"armada:tests_manifest" is getting enforced; note that it is
nowhere to be found among Armada's actual policies:

[0] http://codesearch.openstack.org/?q=tests_manifest&i=nope&files=&repos=airship-armada
[1] https://github.com/openstack/airship-armada/blob/master/armada/common/policies/service.py
[2] 9fad5cff0a/etc/armada/policy.yaml (L28)

As [2] demonstrates, the policy is actually called
"armada:test_manifest" NOT "armada:tests_manifest" (with an "s").

The root cause is related to how Armada is calling oslo.policy;
this will be fixed in a follow up (by root cause, the fact that
this issue is allowed to exist in the first place without an
error getting thrown somehwere).

Change-Id: I3e424e657e7d11e7968359d7a9ed13fa5d3e0896
2018-10-12 18:07:12 +01:00
Drew Walters
fd0588243b api: Update entrypoint script with proper quotes
While authoring [0], a shell check utility revealed potentially
dangerous usage of quoting in the API entrypoint script. This commit
fixes the quoting to avoid unintentional shell globbing/splitting.

[0] https://review.openstack.org/#/c/609096/

Depends-On: https://review.openstack.org/#/c/609096/
Change-Id: I92877c5c83ea970d5c261e4a9b6a15c58ffc07e5
2018-10-10 16:39:26 +00:00
Drew Walters
183e37541d api: Replace conflicting environment variable
The Armada API relies on an environment variable, `ARMADA_API_PORT`,
to start uWSGI with the desired port; however, it conflicts with an
environment variable already in use. This causes the `entrypoint.sh`
script to use the wrong port value for uWSGI when using user-specified
`armada_api` values through Helm (i.e. the port is already set and the
`entrypoint.sh` script does not fallback on its default value). This
commit adds missing uWSGI configuration values to the Armada chart
values and changes their names to avoid potential conflicts.

Change-Id: I00ae3431e36593956705dcdb887025d688d804df
2018-10-10 16:39:13 +00:00
Sean Eagan
9fad5cff0a Add chart API to wait on k8s resource types/labels
This adds a `wait.resources` key to chart documents which allows
waiting on a list of k8s type+labels configurations to wait on.
Initially supported types are pods, jobs, deployments, daemonsets, and
statefulsets. The behavior for controller types is similar to that of
`kubectl rollout status`.

If `wait.resources` is omitted, it waits on pods and jobs (if any exist)
as before.

The existing `wait.labels` key still have the same behavior, but if
`wait.resources` is also included, the labels are added to each resource
wait in that array. Thus they serve to specify base labels that apply
to all resources in the release, so as to not have to duplicate them.
This may also be useful later for example to use them as labels to wait
for when deleting a chart.

Controller types additionaly have a `min_ready` field which
represents the minimum amount of pods of the controller which must
be ready in order for the controller to be considered ready. The value
can either be an integer or a percent string e.g. "80%", similar to e.g.
`maxUnavailable` in k8s. Default is "100%".

This also wraps up moving the rest of the wait code into its own module.

Change-Id: If72881af0c74e8f765bbb57ac5ffc8d709cd3c16
2018-10-05 16:48:32 -05:00
Zuul
d1ecac2f6b Merge "trivial: Fix README documentation badge" 2018-10-04 20:44:51 +00:00
Zuul
924ecc1a8f Merge "Parallelize unsequenced chart group deployments" 2018-10-03 19:34:52 +00:00
Sean Eagan
d229d52292 Parallelize unsequenced chart group deployments
This changes unsequenced chart group deployments, such that each chart
in the group is deployed in parallel, including the install/upgrade,
wait, and tests.

Previously, whether and when to wait was entangled with whether or not
the chart group was sequenced, since running helm install/upgrade's
native wait (which cannot be run later) and armada's labels based wait,
delayed (or even prevented in the case of failure) the next chart from
being deployed, which is the intention for sequenced, but not for
unsequenced. With this patchset, sequencing and waiting are now
orthogonal. Hence we can now allow the user to explictly specify whether
to wait, which this patchset does for the case of helm's native wait
via a new `wait.native.enabled` flag, which defaults to true.

Previously, armada's labels-based wait sometimes occurred both between
charts and at the end of the chart group. It now occurs once directly
after chart deployment.

Previously, passing armada's --wait was documented to be equivalent to
forcing sequencing of chart groups, however helm tests did not run in
sequence as they normally would with sequenced chart groups, they now
do.

Since chart deploys can now occur in parallel, log messages for each
become interleaved, and thus when armada is deploying a chart, log
messages are updated to contain identifying information about which
chart deployment they are for.

Change-Id: I9d13245c40887712333aaccfb044dcdc4b83988e
2018-10-03 10:27:49 -05:00
Felipe Monteiro
d678f55ba4 trivial: Fix README documentation badge
This patch set fixes the README badge which isn't rendering
correctly (e.g. [0]). Thus it has been changed to [1].

[0] https://github.com/openstack/airship-armada
[1] https://readthedocs.org/projects/airship-armada/badge/?version=latest

Change-Id: Ife5cffb8536f4c7f7b6292313a66d165f23739c5
2018-10-02 18:35:58 -05:00
Zuul
daa5863c07 Merge "Remove unused service from tiller chart" 2018-10-01 18:24:08 +00:00
Zuul
12b4babe06 Merge "fix: Armada exceptions documentation incorrectly rendering" 2018-09-27 20:35:38 +00:00
Mark Burnett
eb7c112d2e Remove unused service from tiller chart
Change-Id: I398969076753b9f659319162fb24ac99abdbc62c
2018-09-27 10:41:15 -05:00
Zuul
beb4739c55 Merge "Clean up and refactor wait logic" 2018-09-27 15:18:57 +00:00
Zuul
4800d230c4 Merge "add python 3.6 unit test job" 2018-09-26 15:15:23 +00:00
Sean Eagan
a9d55ab052 Clean up and refactor wait logic
This patchset changes the wait logic as follows:

- Move wait logic to own module
- Add framework for waiting on arbitrary resource types
- Unify pod and job wait logic using above framework
- Pass resource_version to k8s watch API for cleaner event tracking
- Only sleep for `k8s_wait_attempt_sleep` when successes not met
- Update to use k8s apps_v1 API where applicable
- Allow passing kwargs to k8s APIs
- Logging cleanups

This is in preparation for adding wait logic for other types of resources
and new wait configurations.

Change-Id: I92e12fe5e0dc8e79c5dd5379799623cf3f471082
2018-09-25 12:48:25 -05:00
Zuul
7c1d81f86c Merge "Fix: git commit id labels on images" 2018-09-25 16:45:38 +00:00
Zuul
902188ae32 Merge "Minor: drop AT&T from authors" 2018-09-25 13:39:58 +00:00
Roman Gorshunov
0640ee77cd Minor: drop AT&T from authors
Dropping 'AT&T' from authors.

Change-Id: Ia76650f3ad42ebdceb0e5eca4a26286ef9216d4b
2018-09-25 11:41:10 +02:00
Roman Gorshunov
eee43c42a8 Unify publishing of docs
Unified publishing to the readthedocs with other Airship projects.

Change-Id: Ibce2e138abbc9b3c08d213dcfa6358ca8134c898
2018-09-24 17:10:29 +02:00
Zuul
c4982fb500 Merge "Fix: various documentation and URL fixes" 2018-09-24 14:13:15 +00:00
Roman Gorshunov
09f099e5b2 Fix: various documentation and URL fixes
1) UCP -> Airship
2) readthedocs.org -> readthedocs.io (there is redirect)
3) http -> https
4) attcomdev -> airshipit (repo on quay.io)
5) att-comdev -> openstack/airship-* (repo on github/openstack git)
6) many URLs have been verified and adjusted to be current
7) no need for 'en/latest/' path in URL of the RTD
8) added more info to some setup.cfg and setup.py files
9) ucp-integration docs are now in airship-in-a-bottle
10) various other minor fixes

Change-Id: I1e2d133a701dc2dade5bfcbdab5c0950cbe7eed5
2018-09-24 12:53:27 +02:00
Felipe Monteiro
6ab741b6e3 fix: Armada exceptions documentation incorrectly rendering
This patch set changes Armada's exceptions documentation
(contained underneath operators guide) because it isn't rendering
correctly as a list table on RTD (the autoexception information
is missing) [0].

The easy fix is to change the tabularized view (list table)
into basically a series of autoexception classes which sufficiently
captures the level of detail required, anyway.

Note that running `tox -e docs` locally and opening the resulting
index.html page appears to work -- but not when hosted on RTD.

[0] https://airship-armada.readthedocs.io/en/latest/operations/exceptions/guide-exceptions.html

Change-Id: Id7e6730ff1d57e609e8fc4f636645ea8667bd425
2018-09-23 15:32:07 +00:00
Felipe Monteiro
2f4f36a8ca add python 3.6 unit test job
This is a mechanically generated patch to add a unit test job running
under Python 3.6 as part of the python3-first goal.

See the python3-first goal document for details:
https://governance.openstack.org/tc/goals/stein/python3-first.html

Change-Id: I99bd1097c3da97e77f33059a6adab41c45f53906
Story: #2002586
2018-09-21 21:05:33 +01:00
Zuul
03b4c0ee2a Merge "Fix for get manifest" 2018-09-21 13:18:09 +00:00
Roman Gorshunov
b6358d24b9 Fix: git commit id labels on images
1) Use OCI Image Specs for labels instead of custom 'commit-id=xxxxx'
   or legacy "Label Schema"
2) Fix missing git commit id labels on images (.revision)
3) Add human-readable title (.title) of the image, URL (.url), and
   a few other properties (annotations) according to the latest Specs

Change-Id: I7029d7caf521c7f56c1046fff9ecdd4e81090618
2018-09-21 03:31:12 +02:00
Matt McEuen
90618f549c Add release uuid to pods and rc objects
This PS adds the ability to attach a release uuid to pods and rc
objects as desired.  This can be used, for example, to force an
artificial manifest change in CICD scenarios, for upgradability
testing purposes.

Change-Id: I77147ca778d70ee6337c609185bbe421c040376a
2018-09-14 15:25:49 -05:00
anthony.bellino
cb57588968 Fix for get manifest
In some use cases, some site level docs are only included in specific
manifests. This is so sites can call out what they want deployed, however
currently Armada is checking for all documents to exist and leads
to an invalid manifest exception.

This PS removes the '.build_charts_deps()' and 'build_chart_groups()' calls
in 'get_manifest()' so that only chart documents, and chart group documents
are built after finding them within 'build_armada_manfiest()' and
'build_chart_group()'. 'build_armada_manifest()' will now throw the
related 'Could not find chart group... exception' for related chart
and chart group issues.  Additional subclass exceptions were added along
with adding traceback to capture the chained exceptions.

Change-Id: Idc8a75b290ac0afb1e177203535b012d589b708f
2018-09-14 15:27:03 +00:00
Zuul
51b1bb8a7a Merge "fix(indent): correct values.yaml" 2018-09-12 15:14:44 +00:00
Tin Lam
fb9b297d78 fix(indent): correct values.yaml
This patch set provides a trivial update to correct the yaml indentation.

Change-Id: I16797d0db330a4ebddb335d7a7bff254bbd9ae8c
Signed-off-by: Tin Lam <tin@irrational.io>
2018-09-11 23:29:46 -05:00
anthony.bellino
63e63a3c30 Fix for yapf v0.24.0
This PS fixes yapf v0.24.0 errors. Also updates tox.ini
and test-requirements.txt accordingly.

Change-Id: If1dd0e51d328ad976bf0a7bfd512425c4da4ac0a
2018-09-11 20:39:25 +00:00
Sean Eagan
80e513219b Correct docs-on-readthedocs to work with RTD publish
This patch set follows the guide [0] to leverage
the Zuul template [1] for correctly publishing RTD
doc changes via openstackci. Accordingly, all the
old code for doing this has been removed.

[0]
http://lists.openstack.org/pipermail/openstack-dev/2018-August/132836.html
[1]
https://docs.openstack.org/infra/openstack-zuul-jobs/project-templates.html#project_template-docs-on-readthedocs

Change-Id: Ibb38c5a420a2b06c0872840e054f7edc0b717cf6
2018-09-10 21:44:29 +00:00
Sean Eagan
c6dbf3344d Pin yapf version
The output with yapf version 0.24.0 has some changes which are in
conflict with the flake8 E126 rule. Hence pinning to <=0.23.0 for now.

Change-Id: I80b4094673eeca6dddc4fde0c324e0f5d9ec5d99
2018-09-10 15:28:56 -05:00
Sean Eagan
9c3ebe68c7 Move to tiller v2.10.0
- Update Helm to v2.10.0
- Update hapi protoc gen files

Change-Id: Ibcf813e4d79df104e972fae9f9328fb49b403649
2018-08-28 17:07:31 -05:00
Zuul
f807c3a1ec Merge "fix(chart): Update Keystone API ports" 2018-08-27 15:07:17 +00:00
Andreas Jaeger
785242eb2a Add venv tox environment
Some OpenStack CI jobs need the venv tox environment to run, add it.

Change-Id: Id044c887f7b79c31391cf27a124a3f065f48b052
2018-08-24 21:23:29 +02:00
Drew Walters
e5a09bd37b fix(chart): Update Keystone API ports
This change modifies the internal Keystone API port in the Armada chart
from 80 to 5000 and removes the default admin port to match the
Keystone chart provided by OpenStack-Helm.

Change-Id: I689a3b2df36cca4a2f23385fdb294e0017bc7f35
2018-08-23 22:11:41 +00:00
Zuul
85eae69036 Merge "Release diffing: split out, add unit tests, include name" 2018-08-23 13:57:11 +00:00
Sean Eagan
b79c4cd411 Release diffing: split out, add unit tests, include name
This makes the following changes to release diffing:

* Move into own handler.
* Add unit tests.
* Include `chart.metadata.name` (from Chart.yaml / dependency dir name)
  since that can affect the values passed to dependency charts, and
  it's sometimes used by templates via `{{ .Chart.name }}` in ways
  which may necessitate an upgrade.

Change-Id: I241384971ed85e5658d71348fee2d6320bbb3c45
2018-08-22 11:29:03 -05:00