Commit Graph

225 Commits

Author SHA1 Message Date
Ruslan Aliev d9e2248172 Add configurable support of armada-operator for armada-api
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Change-Id: I76fb41062d152bf360a85d781c19ab5b204769b8
2024-02-12 11:09:18 -06:00
Sergiy Markin cdcdbd292d Airflow stable 2.6.2
This PS updates python modules and code to match Airflow 2.6.2:

- bionic py36 gates  were removed
- python code corrected to match new modules versions
- selection of python modules versions was perfoemed based on
  airflow-2.6.2 constraints
- airskiff deploy pipeline was aligned with latest in treasuremap v1.9

Change-Id: If6f57325339995216d2553c7a5ff56e7673b5acc
2023-08-19 00:37:37 +00:00
Sergiy Markin 386a686e69 [focal] Python modules sync with Airship project
- armada-airskiff-deploy is voting gate again
- fixed falcon.API deprecation - -> falcon.App
- fixed collections.abc.defaultdict not found error
- fixed tox4 requirements
- implemented requirements-frozen.txt approach to make allike as other
  Airship projects
- uplifted docker version in the image building and publishing gate

Change-Id: I337ec07cd6d082acabd9ad65dd9eefb728a43b12
2023-04-21 23:49:14 +00:00
SPEARS, DUSTIN (ds443n) 099de8aaf4 Bump k8s client to v25.3.0
Bumping k8s client to v25.3.0
Cronjob batch v1beta1 no longer available in k8s 1.25
Update tox.ini file to be compatible with v4

Change-Id: Iac79c52c97c9ef1223ae8d502da1572ef8d068fa
2023-01-18 11:25:05 -05:00
Phil Sphicas c5d39f27ca Create lock CRD as apiextensions.k8s.io/v1 object
Kubernetes v1.22 stopped serving the apiextensions.k8s.io/v1beta1 API
version of CustomResourceDefinition.

This change ensures that the locks.armada.process CRD is created using
the apiextensions.k8s.io/v1 API.

The kubernetes client package is also updated to take advantage of the
dynamic client.

Change-Id: Icd518ab5cbb78e8b15f63d19c51b5f5b9a67e995
2022-03-09 16:36:40 -08:00
francisy 790af88d61 Remove diff
Getting rid of logs that will show diff in results

Change-Id: I8994506f517928c1a945b794e72b2b7cbb960ab7
2021-12-09 10:47:50 -05:00
francisy 82a138f11b Remove Log Info
Passwords are shown in logs that need to be removed

Change-Id: I0be2d53c9e613ecb4b4f62c5164266fbaa596944
2021-12-08 13:32:17 -05:00
Sean Eagan b5b519f66a Fix list_release_ids()
Change-Id: I8ad7c95a11e74858803d779e99afda6670a3f198
2021-10-07 22:56:11 -05:00
Sean Eagan 862c289e4b Fix dependency symlink idempotency
Previously, existing dependency symlinks were causing
FileExistsErrors. This simplifies the logic to ensure
they do get deleted before being recreated. It also
moves to erroring if a chart's `charts` directory is
not a directory, since this is something a chart author
ought to fix, since it needs to be a directory in order
to add dependency sub-directories to it.

Change-Id: I7cc1d50f2bf09602866ce2cf13a4d6c8f6e118ce
2021-10-05 12:59:48 -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
Sean Eagan 5f1ffbbbbe Revert "Airship 2 support features"
This reverts commit c75898cd6a.

Airship 2 ended up using the Flux helm-controller instead:
https://github.com/fluxcd/helm-controller

So this is no longer needed. Removing it to get rid of tech
debt to ease introduction of Helm 3 support.

This retains the part of the commit which extracts the
chart download logic to its own handler as this is still useful.

Change-Id: Icb468be2d4916620fd78df250fd038ab58840182
2021-09-30 17:22:16 -05:00
DeJaeger, Darren (dd118r) 9aadc14777 Armada improved logging, uplift dependency
This PS:

1) Looks to improve specific logging in Armada, so that
it's easier to debug deployment related issues
2) Uplifts the k8s Python dependency to 12.0.0
3) Enforces 'watch' timeouts more strictly, as the call to
the Kubernetes Python watch function seemed unreliable.
4) Adds a field selector to the 'watch' stream to look for
the DELETE action to have been completed on the specific
pod/job/cronjob, rather than looking across the whole
namespace or via labels. This will narrow what the watch
is looking at, making the logs less busy.

Change-Id: I1952b0db32fb0b56ffffcddeae0532beb5a27b67
2021-06-24 10:53:06 -04:00
DeJaeger, Darren (dd118r) 8e947c720c Improve release upgrade "diff" debug log readability
This adds the release name to the beginning of the diff debug
log so that it's easier to correlate which diffs belong to which
components when reading the Armada logs.

Change-Id: If096f049a8057a46951ea70f2223a7a987636f5c
2021-06-03 11:21:06 -04:00
Thiago Brito 1e5d781fe9 Fixing Armada waits for Evicted pods undefinetly
In the occasion of a pod being evicted due to low resource availability,
armada keeps waiting for the Evicted pod to be ready. This commit
removes that behavior since Kubernetes will spun up a new pod.

Story: 2008645
Task: 41906
Signed-off-by: Thiago Brito <thiago.brito@windriver.com>
Change-Id: I7263eebe357b0952375d538555536dc9f7cceff4
2021-03-22 16:45:08 -03:00
KAVVA, JAGAN MOHAN REDDY (jk330k) 36efc4828d Move Tiller version to 2.16.9
Update Helm chart for Armada to use Tiller version 2.16.9.

depends on: https://review.opendev.org/#/c/749497/

Change-Id: I16f7a5e8e571f067154e79a5f2ceb18be7d8db2d
2020-09-17 10:48:44 -05:00
Yadav, Satender (sy336r) ce353b61f0 Adding space in logger warning message
This commit will fix below warning message.

 "Post upgrade actions are ignored by Armadaand will not affect deployment.:

Change-Id: I1a8397aa892815bdc96f94a8e49280a4b73a484c
2020-08-28 10:39:01 -05:00
Nishant Kumar 88c200fc18 [chart_deploy] Handle unknow chart status in a more resilient manner
In cases when chart is in a pending state and last deployment age
for chart is less than the chart wait timeout, armada can consume
all the retries without attempting to purge and re-install the
chart.

This PS addresses the above issue by waiting for the chart until
the wait timeout is met and then proceeding ahead with usual
armada process of purging and re-installing the chart if the status
is not DEPLOYED.

Other code changes in this PS is just re-arranging the existing logic to
fix some edge cases and solve pep8 issues.

Change-Id: Id11d0fb06201264015b3064a43e83903f99a30b1
2020-07-30 17:19:11 +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
Phil Sphicas 6b2c7245de Reestablish watch and retry wait for some errors
Armada uses a Kubernetes watch to implement its chart wait logic. This
can be a fairly long-lived connection to the Kubernetes API server, and
is vulnerable to disruption (if, for example, the kubernetes apiserver
chart is being upgraded).

This change allows Armada to retry the wait for some specific errors,
including the establishment of a new watch, until the overall chart
timeout is reached.

https://github.com/kubernetes-client/python/issues/972
urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))

Change-Id: I3e68a54becadd5b2a2343960a120bdc3de8e8515
2020-04-19 18:54:03 +00:00
Phil Sphicas ae1281d874 Fix: wait.resources: [] should disable waits
The mechanism to disable waits is to explictly set
    wait.resources: []

After a recent update [https://review.opendev.org/#/c/697728/], this
configuration results in the default waits (pods and jobs).

This change restores the original functionality.

Change-Id: If5d09f649ca037855c88f928aee6b4dc35ca8b48
2020-04-19 18:54:03 +00:00
Sean Eagan c75898cd6a Airship 2 support features
Airship 2 is using Argo for workflow management, rather
than the builtin Armada workflow functionality. Hence, this
adds an apply_chart CLI command to apply a single chart at
a time, so that Argo can manage the higher level orchestration.

Airship 2 is also using kubernetes as opposed to Deckhand as the
document store. Hence this adds an ArmadaChart kubernetes CRD,
which can be consumed by the apply_chart CLI command. The chart
`dependencies` feature is intentionally not supported by the CRD,
as there are additional complexities to make that work, and ideally
this feature should be deprecated as charts should be building in
there dependencies before consumption by Armada.

Functional tests are included to excercise these features
against a minikube cluster.

Change-Id: I2bbed83d6d80091322a7e60b918a534188467239
2020-03-25 13:56:32 -05:00
Sean Eagan 268d7a3958 Move kubernetes client to >=11.0.0
This version had a breaking api change [0], which this
aligns with. This version also adds support for kubernetes
1.14 and 1.15 apis.

[0]: https://github.com/kubernetes-client/python/blob/master/CHANGELOG.md#v1100

Change-Id: I01866bd5739e4eebb3166cb583d07efb046360aa
2020-03-20 08:49:45 -05:00
Tin Lam 253da9331f [LOG] Fix log message
This patch set adds in a missing space in a log message so it can be more
easily parsed, as the previous fields were separated by space.

Change-Id: I96cceb644c8193909a91fb42e13c43db0f83ba8d
Signed-off-by: Tin Lam <tin@irrational.io>
2020-01-31 21:50:30 -06:00
Phil Sphicas 6a9b3bf9c9 Fix: Use Foreground deletion
Armada intends to use `propagationPolicy: Foreground` when deleting
resources. However, the empty V1DeleteOptions object in the body of the
delete API call takes priority over the propogation_policy specified as
a query param, resulting in the per-resouce default. For Job and CronJob
resources, the default is Orphan, and for others it is Background.

This change includes the desired propogation_policy in V1DeleteOptions.

Reference: https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/#setting-the-cascading-deletion-policy

Change-Id: Iffee12b426ba1e7741eb5bd687ca1b2c11cb071d
2019-11-14 16:12:43 +00:00
Sean Eagan aa75c3eb45 fix: Align template file naming with Helm CLI
Armada has previously named template files relative to the
`templates` dir, whereas the Helm CLI names them relative
to the chart root. This causes `include`s of these templates
to fail.

This change fixes this, for armada/Chart/v2 docs only, since it
is a breaking change, as some charts may have already aligned
with the existing Armada behavior. When updating a release
previously deployed with armada/Chart/v1, the fixed template
names alone will not cause the release to be updated, as the
diff logic accounts for this.

Change-Id: I243073ca4c2e1edbcb0d8f649475f568fc7c818f
2019-10-03 20:32:43 +00:00
Sphicas, Phil (ps3910) 4e76d15eda Allow proxy_server use for chart tarball downloads
Currently the chart `source` schema allows for a proxy server to be
specified, but it is only used for git repos. This patchset allows
the `proxy_server` to also be used for tarball url sources.

Change-Id: I6f90d056fa46f596b1fb248b6c596c58b6513d64
2019-09-17 14:56:08 -07:00
Drew Walters 764e99e325 handlers: Remove dry-run functionality
Armada's dry-run option is incomplete, no longer maintained, and offers
little value for the complexity required to maintain it.

This commit is the final in a series of changes to remove the dry-run
feature. Specifically, this change removes the functionality associated
with the dry-run feature.

Story: 2005121

Change-Id: I7dfe5ab27511debe2b8ac01f8e0a696c6126a9f7
Signed-off-by: Drew Walters <andrew.walters@att.com>
2019-09-05 16:29:04 +00:00
Sean Eagan 5d2447560b Support builtin chart dependencies
This adds support for using the same builtin chart dependencies [0]
as `helm install|upgrade ...` would use.

[0]: https://helm.sh/docs/developing_charts/#chart-dependencies

Change-Id: Ifc541dc273fa2a5c5b4e43125f468ea3fdb0f379
2019-08-22 08:13:03 -05:00
Sean Eagan 0721ed43aa Implement Prometheus metric integration
This implements Prometheus metric integration, including metric
definition, collection, and exportation.

End user documentation for supported metric data and exportation
interface is included.

Change-Id: Ia0837f28073d6cd8e0220ac84cdd261b32704ae4
2019-08-15 16:12:17 +00:00
Robert Church 8a1638098f Fix --enable-chart-cleanup option
The current logic to find valid releases is incorrect resulting in zero
valid releases being found and all currently installed chart releases
with the release_prefix being removed.

The data passed to this method is a list of chart groups with the
following format:
[{'data':
  {'chart_group':
    [{'data':
        {'chart_name': 'ingress',
         'release': 'kube-system-ingress'
  ...

This update adapts the code to the expected format of the data provided.

Change-Id: Ib285cdf21283b8ec73d583fb107ba49514a9dda7
Signed-off-by: Robert Church <robert.church@windriver.com>
2019-07-31 23:54:49 -04: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 b5432ea394 Fix statefulset wait null pointer scenario
The `rollingUpdate` key is not always defined, hence need to guard
against this.

Change-Id: Ieaae680b724621fe5e5e46533c293427ecd697bc
2019-06-26 13:20:50 -05:00
Jerry Sun df68a90e05 Fix unauthenticated requests to create locks
Kubernetes requests to create locks in the lock_and_thread decorator
were being done without the bearer token. This creates authentication
errors when communicating with a Kubernetes cluster configured with
an external auth backend. This commit uses the bearer token when
creating the Kubernetes client used to create a lock object for
lock_and_thread

The bearer token is obtained from the tiller object passed to the
function being decorated by lock_and_thread. Currently, all functions
decorated by lock_and_thread passes a tiller object to obtain a token
from. If no tiller object is found in the params, this will be logged
to assist with potential debugging in the future. An exception is not
thrown because a Kubernetes cluster without external auth can be used
without passing any bearer tokens around.

Change-Id: Ic9329c2f605cb508750065ebd0c756869be94199
Signed-off-by: Jerry Sun <jerry.sun@windriver.com>
2019-06-11 15:04:04 -04:00
Sean Eagan e51db14add Revert "Move to helm 2.14"
There is a breaking change in helm 2.14.0 [0]. This is expected to be fixed in helm 2.14.1, reverting until we can update to that.

[0]: https://github.com/helm/helm/issues/5750

This reverts commit 89d98fb827.

Change-Id: Ica6d51b5c67a26c356804fd69d466e88ad5c216b
2019-06-05 20:11:53 +00:00
Sean Eagan 89d98fb827 Move to helm 2.14
Change-Id: I6439650076b289d3983e119c06181baf6562ccc3
2019-05-17 11:50:19 -05:00
Sean Eagan 5ffa12fabe [v2 docs] Overhaul wait API
See the v1-v2 migration guide updates in this commit for details.

Change-Id: I6a8a69f8392e8065eda039597278c7dfe593a4fd
2019-05-13 16:52:44 +00:00
Sean Eagan 64cab4788f [v2 docs] Move `upgrade.no_hooks` to `upgrade.options.no_hooks`
This is just a basic Helm CLI option, so this moves it to be alongside
the rest of the upgrade options.

Change-Id: I4cbb4f3bfe60240d793a30f7a7d58705024f633c
2019-04-24 15:49:03 +00:00
Zuul 573b3885e0 Merge "Move to kubernetes python client 9.0.0" 2019-04-23 14:01:26 +00:00
Sean Eagan 8a50591dbf Introduce v2 docs
This introduces v2 docs in order to allow users to opt in to
breaking changes, while still supporting v1 docs for a time
so folks can migrate. At some point v1 doc support will be
removed.

This initial version of v2 docs is experimental. Further
breaking changes will be made before v2 docs are finalized.

A v1-v2 migration guide is included in the documentation.

This also refactors the internal data model to include the full
document structure, such as `metadata` and `schema`, so that
different behavior can be acheived for v1, v2, etc.

Change-Id: Ia0d44ff4276ef4c27f78706ab02c88aa421a307f
2019-04-16 10:15:21 -05:00
Sean Eagan 9a43213198 Fix log message
Change-Id: I552b031e4f23a394853b46ff73dc53a0fecbdb39
2019-04-09 15:23:09 -05:00
Tin Lam 353b52f92b Fix an Armada wait error
Under some wait condition, Armada returns a tuple that contains an extraneous
element that causes a python error. This patch set fixes that so the method
always return a 2-tuple instead sometimes a 3-tuple.

Change-Id: I4c4dfcf03e63f03ad2adc083d39909cf4b47a27f
Signed-off-by: Tin Lam <tin@irrational.io>
2019-04-09 01:16:13 +00:00
Sean Eagan 0a87c5a16a Move to kubernetes python client 9.0.0
This version [0] makes the adal package optional [1], which also
removes its dependency on the cryptography package.

It also fixes a thread pool issue [2] allowing us to remove the
workaround we had in place.

[0]: https://github.com/kubernetes-client/python/blob/master/CHANGELOG.md#v900
[1]: https://github.com/kubernetes-client/python-base/pull/108
[2]: https://github.com/kubernetes-client/gen/pull/91

Change-Id: I55aa8b97483b118fbde7e11df817ad8330da9bf1
2019-04-05 15:01:57 -05:00
Drew Walters e75bb2d90e wait: Fix deployment progress deadline message
If a progress deadline is exceeded while waiting on deployments, Armada
returns three values when two are expected, resulting in a ValueError
exception. This change properly formats the return value.

Change-Id: I49e6c2a022b3bb9bf8d6a01cd2ef261f52eaa426
2019-04-03 15:46:12 +00:00
Drew Walters 12f4e8d2c3 tools: Update Helm to v2.13.1
Helm v2.13.1 has been released [0], and is the next version of Helm
Armada is compatible with. Currently, Armada is not compatible with the
latest version of Helm toolkit due to a divergence caused in Helm v2.13.
This change uplifts Helm to v2.13.1 to restore compatibility with the
latest version of Helm toolkit.

[0] https://github.com/helm/helm/releases/tag/v2.13.1

Change-Id: Ieaf2475562c56530b6ec69c6a43611b4b47b7c83
2019-03-28 15:19:28 +00:00
Michael Beaver 48920224cc Support in Armada for locking Tiller
This creates a new mechanism in Armada to enable functions to only be
run once across multiple instances of Armada working with the same
Kubernetes cluster. This is accomplished by utilizing custom resources
via the Kubernetes API.

This also introduces new config defaults that can be used to configure
the lock timeout, expiration, and update interval.

Some notes on how the lock works:
    * Functions to be locked can add the new decorator
        * The optional name parameter can be used to create multiple
          types of locks which can coexist
    * If the lock is unable to be acquired before the timeout a new
      exception is raised
    * The lock is updated regularly while the decorated function is
      still running
    * If a lock already exists it will only be overwritten if the
      duration since its last update is longer than the expiration time

For now this locking method is being used for components that require
write access to Tiller so that simultaneous write operations are
avoided.

Change-Id: Iee07da9a233ee2e2a54c6bc4881185388b377c05
2019-03-22 13:56:50 -05:00
Nishant kumar c132915dcc Enable Armada to acquire Tiller IP from config file
This adds a new configuration default to specify the Tiller host IP.
This is important to be able to configure in environments where
Armada is unable to find a Tiller pod.

Change-Id: I12fd9fbd16f2b591620e566affcf19f859ed1855
2019-03-11 12:39:39 -05:00
Zuul 20e270a58b Merge "Exclude generated objects from wait logic" 2019-03-08 20:51:26 +00:00