Commit Graph

50 Commits

Author SHA1 Message Date
SPEARS, DUSTIN (ds443n) 0e9d828fe6 Update armada to focal
Update kubernetes client to v26.1.0
Updating armada to focal base image
Remove xenial and opensuse dockerfiles
Update tox python from py35 to py38
Add apparmor for docker build
Uplift HTK chart version 0.2.52
Bumping up some python dependencies to get in sync with shipyard
Added clear-firewall role for airskiff-deploy playbook

Change-Id: If06a3f60466702d05a21c24a7cb8041bed41507a
2023-03-20 11:30:37 -04:00
Ruslan Aliev 379c88d619 Bump helm to v3.9.4 and k8s client to 24.2.0
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Change-Id: I55d7b34e7525fe6359157d0fa042332a91ac9c95
2022-09-19 11:21:50 -05:00
Sean Eagan a5730f8db8 Remove Tiller
For now we leave the tiller status enpdpoint, until
Shipyard has had a release to stop depending on it [0].

[0]: https://review.opendev.org/c/airship/shipyard/+/802718

Signed-off-by: Sean Eagan <seaneagan1@gmail.com>
Change-Id: If8a02d7118f6840fdbbe088b4086aee9a18ababb
2021-10-05 02:41:32 +00:00
Sean Eagan 68747d0815 Use helm 3 CLI as backend
Helm 3 breaking changes (likely non-exhaustive):

- crd-install hook removed and replaced with crds directory in
  chart where all CRDs defined in it will be installed before
  any rendering of the chart
- test-failure hook annotation value removed, and test-success
  deprecated. Use test instead
- `--force` no longer handles recreating resources which
  cannot be updated due to e.g. immutability [0]
- `--recreate-pods` removed, use declarative approach instead [1]

[0]: https://github.com/helm/helm/issues/7082
[1]: https://helm.sh/docs/howto/charts_tips_and_tricks/#automatically-roll-deployments

Signed-off-by: Sean Eagan <seaneagan1@gmail.com>
Change-Id: I20ff40ba55197de3d37e5fd647e7d2524a53248f
2021-10-04 21:40:26 -05:00
Sean Eagan 8c5e5c7d24 Remove unused commands
This removes release rollback/delete functionality. This functionality
was likely not being used and thus was likely not working.

This primary driver for this change is to ease introduction of Helm 3
support. Particularly to avoid having to make API changes related to
the namespacing of helm releases in Helm 3.

This also removes the swagger api documentation as it was not
maintained.

Change-Id: I7edb1c449d43690c87e5bb24726a9fcaf428c00b
2021-09-30 17:22:16 -05:00
Sean Eagan 58c0df5201 Extract pre-update actions out of tiller handler
This is a pre-requisite for Helm 3 integration, so that these
actions run regardless of whether we are going through the
tiller handler.

Change-Id: I97d7bcc823d11b527fcdaa7967fcab62af1c8161
2021-09-30 17:22:16 -05:00
DeJaeger, Darren (dd118r) e9a2309e0a Changes for new version of falcon
Moving to falcon 3.0.0+ brings in some changes to the response
object. One of those is the deprecation of the "body" response
field. This PS attempts to get ahead and make the necessary
changes to no longer use deprecated fields.

Change-Id: Iac5d8cd2c658c337dfe7937db8124f3107d77e91
2021-06-24 15:02:42 +00:00
DODDA, PRATEEK REDDY (pd2839) bbfe30e4a4 Address PEP8 Failures in Armada
Flake8 version recently updated to include new PEP8 rules. Some of
the codebase is not compliant with the new rules.

Change-Id: Ieb9de200535b6e3fd743e1c0f2e851e81cae79f3
2020-05-29 18:02:11 -05:00
HUGHES, ALEXANDER (ah8742) b787c418e3 Standardize Armada code with YAPF
From recently merged document updates in [0] there is a desire to
standardize the Airship project python codebase.  This is the effort
to do so for the Armada project.

[0] https://review.opendev.org/#/c/671291/

Change-Id: I4fe916d6e330618ea3a1fccfa4bdfdfabb9ffcb2
2019-07-31 10:16:15 -05:00
Sean Eagan 2310ddbc2c Remediate releases stuck in non-DEPLOYED statuses
Armada remediates releases stuck in FAILED status, if not protected,
by purging and re-installing them. This implements the same for other
non-DEPLOYED statuses. For these statuses it guards this with a best
effort determination of whether a previous deployment of the release,
either through armada or the helm CLI, is likely still pending based
on whether it was last deployed within the chart's wait timeout. If
it is deemed likely pending an error is raised, however this
condition will eventually expire on future runs allowing for
eventual remediation.

Reasons why a release may get stuck in statuses other than DEPLOYED
or FAILED include:

1. tiller crashed mid-deployment
2. tiller could not reach kubernetes to update the release state
3. running `helm delete <rel>` (without --purge) (DELETED status)

Change-Id: Ia89cd59f056103dde47980a149c07a2984c4bbb4
2019-01-18 23:06:01 +00:00
Sean Eagan 7af22df7dc Implement tiller gRPC channel clean up
We have seen issues with dangling threads in Armada. This is likely due to
a bug [0] in the version of gRPC that we were pinned to.

This patchset:

- moves us to the latest versions of the gRPC python libraries which add
  a new `channel.close()` method to cleanup channels.
- implements the python context manager api in the tiller handler
- uses the context manager api to explicitly scope tiller channel creation
  and cleanup to each Armada API and CLI call.

This also fixes a couples issues with error handling introduced in [1].

[0]: https://github.com/grpc/grpc/issues/14338
[1]: https://review.openstack.org/#/c/610384

Change-Id: I2577a20fc76c397aa33157dc12a0e1d36f49733e
2018-11-12 13:32:52 -06:00
Zuul df7f8f7b7f Merge "Merge disparate base exception classes/logic together" 2018-10-29 16:49:59 +00:00
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
Felipe Monteiro 8927c12f21 Merge disparate base exception classes/logic together
This patch set consolidates two distinct/disparate base exception
classes together. Currently, Armada has base exceptions in
armada/errors.py and armada/exceptions/base_exceptions.py --
the former of which is a port from Shipyard and the latter of
which is "old-school" Armada code.

The problem is that the two implementations are completely
separate and different. Not only that, but Armada doesn't even
appear to be using armada.errors which it should be as it implements
the canonical UCP standard around error handling.

So this patch set merges the two implementations together. Note,
however, that Armada still doesn't use the same base exception
for all its exceptions which is not ideal because -- again --
Armada should be making use of the UCP error handling logic. This
is seen in the inheritance differentiation between `ArmadaBaseException`
which inherits from Exception and `ArmadaAPIException` which inherits
from `falcon.HTTPError`.

More work is needed to ensure that each exception actually has
an appropriate status code and that said status code is getting
bubbled up to the end user/client/other server as appropriate.

Change-Id: I7cf22fcbba4164f11fb01d9445ac575a14a5c3ab
2018-10-13 19:06:45 -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
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
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
Zuul beb4739c55 Merge "Clean up and refactor wait logic" 2018-09-27 15:18:57 +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
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
Sean Eagan 5c5ddf8e8c Move to semantic diffing of charts
We were seeing false positives when diffing charts to determine
whether an upgrade was necessary. Previously we were serializing the
charts and values and diffing those, but these serializations often
output things in different and non-deterministic order, hence the
false positives. This removes the ordering concerns by puttings things
in maps instead of lists, and comparing those semantically rather than
via serialization. This also improves the diff output to be easier to
read. It also stops caring about diffs in Chart.yaml.

Change-Id: I4c92c2e7c814178c374623ea52d717bdb9f72b11
2018-08-20 16:04:11 -05:00
Marshall Margenau c7c7dc671c Removing dead code.
Change-Id: I7121a6d29691cf8d3e779f2afe9ada7d263c6c9d
2018-07-18 16:04:26 -05:00
Marshall Margenau f235512d57 Adding yapf config, plus formatted code.
- Adding yapf diff to pep8 target
- Adding yapf tox target to do actual format

** The rest of this PS contains formatted code only, no other changes

Change-Id: Idfef60f53565add2d0cf65bb8e5b91072cf0aded
2018-06-22 14:56:04 -05:00
Sean Eagan d91dd8ad70 Fix and overhaul helm test integration
The helm test integration was severely broken, this fixes it by:

* correctly handle tiller test call response
* removes unnecessary call to tiller to get release content
* removes unnecessary call to k8s to check for test pod completion
* moves common logic into a test handler
* adds test coverage for the above
* adds logging for test results streamed from tiller

Change-Id: I09062387a1abc2fc3f6960f987c97248d9e1cb69
2018-06-21 14:41:52 -05:00
Marshall Margenau 6546139155 Implement `protected` parameter
The `protected` parameter will be used to signify that we should
never purge a release in FAILED status. You can specify the
`continue_processing` param to either skip the failed release and
continue on, or to halt armada execution immediately.

- Add protected param to Chart schema and documentation.
- Implement protection logic.
- Moved purging of FAILED releases out of pre-flight and into sync
  for finer control over protected params. This means failed
  releases are now purged one at a time instead of all up front.
- Added purge and protected charts to final client `msg` return.

- Fix: Added missing dry-run protection in tiller delete resources.

Change-Id: Ia893a486d22cc1022b542ab7c22f58af12025523
2018-06-17 20:04:53 -05:00
Sean Eagan 571c0b77f9 Add command to rollback release to CLI and API
This adds a command to the CLI and API to rollback a release name to a
specified version.

Change-Id: Ie1434da42ccc75c658b7bde7164b3f4c909be7c4
2018-06-06 09:40:31 -05:00
Felipe Monteiro 46bf741e5d [trivial] Remove unused KnownReleasesException
This patchset simply removes the unused KnownReleasesException
from the code as well as its reference in documentation. This
exception was previously removed because it wasn't needed.

Change-Id: Ie98227e14dd493f083a10a211ec2913af6625df3
2018-05-16 18:56:30 +00:00
Marshall Margenau dc508d5012 fix(timeouts): Address timeout handling issues
- fixing wait handling in multiple areas
      -- wait for deleted pods before continuing Apply update
      -- cleaning up and delineating wait for charts vs chartgroups
      -- timeout exceptions to stop execution
    - api/cli 'timeout' param now applies to all Charts
    - api/cli 'wait' param now applies to all Charts
    - update some docs
    - several TODOs to be addressed in future PS

Closes #199

Change-Id: I5a697508ce6027e9182f3f1f61757319a3ed3593
2018-05-01 08:45:56 -05:00
Felipe Monteiro 950c6012ab Fix chartbuilder get_files raising UnicodeDecodeError
This adds better exception handling ang logging to
_append_file_to_result helper in get_files. When reading
arbitrary file data and attempting to encode to utf-8
this can cause UnicodeDecodeError to be raised.

However, Armada will not skip over such files; it will
raise an exception with appropriate details instead.

Closes #195
Closes #196

Change-Id: Id7c32c17e351d1ffe042e3755c116c36b6380223
2018-03-22 17:13:58 -05:00
Marshall Margenau 3430283865 feat(logging): Enhance logging and update grpcio
Enhance request logging (and scrub sensitive headers)
Enhance Tiller logging
Update grpcio, unpin from 1.6.0rc1

Plus a couple typo fixes
Plus a couple unused vars

Change-Id: I8afd679f6716c6e1af234a59ac44ba1fdc73cdc8
2018-03-09 11:36:57 -05:00
Felipe Monteiro e4a4d2ea68 Add validation logic to Test endpoints
This PS adds validation logic recently implemented in
armada.utils.validate [0] for validating documents and
Armada-generated Manifests to the Test and Tests controller classes.

Also refactors some exception handling for both controller classes to
better bubble up the appropriate exception.

Finally unit tests have been added for the Armada Test controller
to verify above changes work.

[0] https://review.gerrithub.io/#/c/378700/

Change-Id: I01f73c1778bf7c2e38032d5fddabd327c013edbb
2018-02-25 17:57:04 -05:00
gardlt 3b879fc846 Improved document validation
BREAKING CHANGE: Armada will no longer support
recursive monolithic documents such that a Manifest
fully defines ChartGroups inline and ChartGroups
fully define Charts inline. Only name-based references
to other documents is supported.

- Author document schemas in standalone
  JSON schema files
- Update validation to return all failures available
- Removed unit tests for support of recursive monolithic
  documents

Change-Id: Idb91fa552d3d7a3d7d525609d505fe7380443238
2018-02-23 11:11:09 -05:00
Mark Burnett e0b04e829b Fix: Issue where Armada hangs waiting for pods
This also hopefully provides better logging when waiting for pods.

Closes #194

Change-Id: I3704ff004c35c8ecf90555d16e42f15d24284492
2018-02-15 16:02:21 -06:00
One-Fine-Day 3e1d9894e9 Lint, Manifest, Override, Source, & Tiller Armada Exception Documentation
ARMADA-239: Documentation for validation error codes for Armada

3 of 3 commits (Inital Setup and Remaining Exceptions are in seperate commits)

-guide-exceptions.rst contains the files to include in the documentation.
-docs/.../exceptions files contains the format and content of the documenation.
-armada/exceptions files were modified in their comments in order to utilize the
 sphinx-directed method.

Please Note: If the exception is not raised anywhere, it is not included in the
             documentation.

Change-Id: Ie093cb3252b199bfc7fcd62284501e573d89ed8a
2018-02-13 15:37:31 -06:00
drewwalters96 5b75f0a9b4 feat(source): Add support for SSH key authentication
- Add support for SSH key auth using existing config file value
- Add authentication exceptions
- Remove redundant git error handling from Armada handler

Closes #169

Change-Id: Ia0f61e0b74893289bb90560a743a243393d89c56
2018-02-13 16:10:34 -05:00
One-Fine-Day 1d31b183a2 Armada, Base, & Chartbuilder Armada Exception Documentation
ARMADA-239: Documentation for validation error codes for Armada

2 of 3 commits (Inital Setup and Remaining Exceptions are in seperate commits)

-guide-exceptions.rst contains the files to include in the documentation.
-docs/.../exceptions files contains the format and content of the documenation.
-armada/exceptions files were modified in their comments in order to utilize the
 sphinx-directed method.
-conf.py was modified to indicate the full path for the autoexpection to work
 when merged.

Please Note: If the exception is not raised anywhere, it is not included in the
             documentation.

Change-Id: I6ddd598bfbb26cdd6ff33682844b0739c440d662
2018-02-13 11:12:51 -06:00
One-Fine-Day 8b7d1f241b Index, Guide, & Api Armada Exception Documentation
ARMADA-239: Documentation for validation error codes for Armada

1 of 3 Commits (Remaining Exception Documentation are in separate commits)

-guide-exceptions.rst contains the files to include in the documentation.
-docs/.../exceptions files contains the format and content of the documenation.
-armada/exceptions files were modified in their comments in order to utilize the
 sphinx-directed method.
-Some files were modified to fix typos.

Please Note: If the exception is not raised anywhere, it is not included in the
             documentation.

Change-Id: Icfe45f7b8fe116a0adab14e7f9919b46b022f169
2018-02-13 10:01:27 -05:00
Marshall Margenau e1b64d200b 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
2018-02-12 10:27:11 -05:00
Marshall Margenau c117b945ad feat(proxy): add proxy support to armada/Chart/v1 for git clone
Support proxy for installing armada/Chart/v1, as data.source.proxy_server when data.source.type = 'git'.

Closes #191

Change-Id: I9bfd7dbd63c86f65b24b27bd5eec547f862e2311
2018-02-01 20:49:46 -06:00
Felipe Monteiro 093b5d2296 bug(manifest): Allow specific manifest to be specified
This PS allows users to specify the manifest file to use
by the Armada handler by introducing a new flag called
`target_manifest`. This flag was added to the API and
CLI.

A foundation of unit tests for the manifest handler
is included in this PS. Most of the coverage is aimed
at checking the various success and failure cases
surrounding the new target_manifest feature.

Also updates documentation to convey information about
the new flag and clean up some documentation formatting
inconsistencies and typos.

Change-Id: I1d5a3ecc1e99b6479438d0ee5490610178be34fe
2018-01-25 16:29:18 -05:00
drewwalters96 76906751f6 feat(tiller): Enhance Tiller pod search with labels
- Add labels to Tiller pod searching
- Add Tiller pod labels to default config options
- Add exception for case when Tiller pod cannot be found using labels
- Add exception for case when Tiller pod is not in running state
- Update exception documentation

Closes #172

Change-Id: I7e54c4b4a60638bca1073457c256030344832ef9
2017-12-05 15:53:31 -05:00
gardlt 7b26e59422 feat(cli): using-click-framework
- using click framework
- added api client
- allow interactions between code and service endpoints
- documention on the command line
- updated gitignore

Change-Id: Ibe359025f5b35606d876c29fa88e04048f276cc8
2017-11-02 20:59:57 +00:00
drewwalters96 be8e86351f feat(manifest): ability to override manifest value
- Add --set flag to override manifest values from CLI
- Add --values flag to override manifest values from values file
- Add support to override manifests values with API values option

Closes #146

Change-Id: Iefa14e4d3005aab3ee803ffb65dfe1a867507c0e
2017-11-02 00:03:41 +00:00
gardlt cba78d1d03 style(armada): converting py2 to py3
- Format code to python 3.5
- using absoulute paths

Change-Id: I7414b5de915429c2c7f85b99f2ab91f395c62121
2017-10-10 19:55:20 +00:00
Pete Birley 746cbd0bd8 Fix(linting): Make Armada pep8 compliant
This patch set makes Armada pep8 compliant. Note the hapi/** is
autogenerated and therefore should be excluded from linting.

Change-Id: I123eefb543f9bd9cf0bc6bd98ed95646d8d72cc3
2017-09-29 11:46:58 -04:00
gardlt bb26131ce2 feat(api): policy enforcement and api standard
- enhanced logging
- created base structure
- updated docs
- PasteDeploy auth
- Oslo Policy

Closes #107

Change-Id: I805863c57f17fcfb26dac5d03efb165e4be49a4e
2017-09-20 21:54:39 +00:00
Alexis Rivera De La Torre d5f4378731 feat(armada): adding helm testing framework
- added helm test framework to armada
- added helm test status

Closes #151

Change-Id: I417cae04b4595ad0d4fd05889d90c83907607c47
2017-09-20 21:54:39 +00:00
Omar Rivera 498cf6c98f Fix oslo_config and oslo_log configurations
* Ensure that configurations are done via the global `cfg` object
* Ensure that the logger is configure through the global object
* Upload a configuration sample file with DEFAULT section having
  the armada.conf and oslo_log namespace
2017-08-07 21:43:32 -05:00
Tim Heyer 4554cac0d9 [Feat] Support remote tarball as chart source
-Add functionality to download a tarball from a URL, decompress/extract
 the archive, and use as a chart source
-Compartmentalized functionality to later support extracting, but not
 downloading, local tarballs
-Refactor specific git utils to general source utils
-Small exception handling bug fix
2017-08-02 15:12:12 -05:00
drewwalters96 96661239cb [Feat] Add common error/exception handling
- Add main exception handler
- Add more detailed, individual exceptions for common Armada failure points
- Add exception documentation
2017-07-27 16:22:16 -05:00