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
This commit is contained in:
Sean Eagan 2021-07-19 14:11:05 -05:00
parent 58c0df5201
commit 8c5e5c7d24
20 changed files with 1 additions and 1743 deletions

View File

@ -2,7 +2,6 @@ doc
charts
examples
releasenotes
swagger
tools
.editorconfig
.gitreview

View File

@ -1,59 +0,0 @@
# Copyright 2018 The Armada Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import json
import falcon
from oslo_config import cfg
from armada import api
from armada.common import policy
from armada.handlers.lock import lock_and_thread, LockException
CONF = cfg.CONF
class Rollback(api.BaseResource):
"""Controller for performing a rollback of a release
"""
@policy.enforce('armada:rollback_release')
def on_post(self, req, resp, release):
try:
with self.get_tiller(req, resp) as tiller:
msg = self.handle(req, release, tiller)
resp.text = json.dumps({
'message': msg,
})
resp.content_type = 'application/json'
resp.status = falcon.HTTP_200
except LockException as e:
self.return_error(resp, falcon.HTTP_409, message=str(e))
except Exception as e:
self.logger.exception('Caught unexpected exception')
err_message = 'Failed to rollback release: {}'.format(e)
self.error(req.context, err_message)
self.return_error(resp, falcon.HTTP_500, message=err_message)
@lock_and_thread()
def handle(self, req, release, tiller):
tiller.rollback_release(
release,
req.get_param_as_int('version') or 0,
wait=req.get_param_as_bool('wait'),
timeout=req.get_param_as_int('timeout') or 0,
force=req.get_param_as_bool('force'),
recreate_pods=req.get_param_as_bool('recreate_pods'))
return 'Rollback of {} complete.'.format(release)

View File

@ -23,7 +23,6 @@ from armada.api.controller.armada import Apply
from armada.api.middleware import AuthMiddleware
from armada.api.middleware import ContextMiddleware
from armada.api.middleware import LoggingMiddleware
from armada.api.controller.rollback import Rollback
from armada.api.controller.test import TestReleasesReleaseNameController
from armada.api.controller.test import TestReleasesManifestController
from armada.api.controller.health import Health
@ -64,7 +63,6 @@ def create(enable_middleware=CONF.middleware):
(HEALTH_PATH, Health()),
('apply', Apply()),
('releases', Release()),
('rollback/{release}', Rollback()),
('status', Status()),
('tests', TestReleasesManifestController()),
('test/{release}', TestReleasesReleaseNameController()),

View File

@ -1,158 +0,0 @@
# Copyright 2017 The Armada Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import click
from oslo_config import cfg
import yaml
from armada.cli import CliAction
from armada import const
from armada.handlers.chart_delete import ChartDelete
from armada.handlers.lock import lock_and_thread
from armada.handlers.manifest import Manifest
from armada.handlers.tiller import Tiller
from armada.utils.release import release_prefixer
CONF = cfg.CONF
@click.group()
def delete():
""" Delete releases by targeting specific releases or via a manifest file.
"""
DESC = """
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:
$ armada delete --manifest examples/simple.yaml
To delete releases by the name:
$ armada delete --releases blog-1
or
$ armada delete --releases blog-1,blog-2,blog-3
"""
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.", default=None)
@click.option(
'--tiller-port', help="Tiller host port.", type=int, default=None)
@click.option('--bearer-token', help="User Bearer token.", default=None)
@click.option('--debug', help="Enable debug logging.", is_flag=True)
@click.pass_context
def delete_charts(
ctx, manifest, releases, no_purge, tiller_host, tiller_port,
bearer_token, debug):
CONF.debug = debug
DeleteChartManifest(
ctx, manifest, releases, no_purge, tiller_host, tiller_port,
bearer_token).safe_invoke()
class DeleteChartManifest(CliAction):
def __init__(
self, ctx, manifest, releases, no_purge, tiller_host, tiller_port,
bearer_token):
super(DeleteChartManifest, self).__init__()
self.ctx = ctx
self.manifest = manifest
self.releases = releases
self.purge = not no_purge
self.tiller_host = tiller_host
self.tiller_port = tiller_port
self.bearer_token = bearer_token
def invoke(self):
with Tiller(tiller_host=self.tiller_host, tiller_port=self.tiller_port,
bearer_token=self.bearer_token) as tiller:
self.handle(tiller)
@lock_and_thread()
def handle(self, tiller):
known_release_names = [release[0] for release in tiller.list_charts()]
if self.releases:
target_releases = [
r.strip() for r in self.releases.split(',')
if r.strip() in known_release_names
]
if not target_releases:
self.logger.info("There's no release to delete.")
return
if not self.ctx.obj.get('api', False):
for r in target_releases:
self.logger.info("Deleting release %s", r)
tiller.delete_release(r, purge=self.purge)
else:
raise NotImplementedError()
if self.manifest:
target_deletes = []
with open(self.manifest) as f:
documents = list(yaml.safe_load_all(f.read()))
try:
armada_obj = Manifest(documents).get_manifest()
prefix = armada_obj.get(const.KEYWORD_DATA).get(
const.KEYWORD_PREFIX)
for group in armada_obj.get(const.KEYWORD_DATA).get(
const.KEYWORD_GROUPS):
for ch in group.get(const.KEYWORD_DATA).get(
const.KEYWORD_CHARTS):
chart = ch.get(const.KEYWORD_DATA)
release_name = release_prefixer(
prefix, chart.get('release'))
if release_name in known_release_names:
target_deletes.append((chart, release_name))
except yaml.YAMLError as e:
mark = e.problem_mark
self.logger.info(
"While parsing the manifest file, %s. "
"Error position: (%s:%s)", e.problem, mark.line + 1,
mark.column + 1)
if not target_deletes:
self.logger.info("There's no release to delete.")
return
if not self.ctx.obj.get('api', False):
for chart, release in target_deletes:
chart_delete = ChartDelete(
chart, release, tiller, purge=self.purge)
chart_delete.delete()
else:
raise NotImplementedError()

View File

@ -1,130 +0,0 @@
# Copyright 2018 The Armada Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import click
from oslo_config import cfg
from armada.cli import CliAction
from armada.handlers.lock import lock_and_thread
from armada.handlers.tiller import Tiller
CONF = cfg.CONF
@click.group()
def rollback():
""" Rollback a helm release
"""
DESC = """
This command performs a rollback on the specified release.
To rollback a release, run:
\b
$ armada rollback --release my_release
"""
SHORT_DESC = "Command performs a release rollback."
@rollback.command(name='rollback', help=DESC, short_help=SHORT_DESC)
@click.option('--release', help="Release to rollback.", type=str)
@click.option(
'--version',
help="Version of release to rollback to. 0 represents the "
"previous release",
type=int,
default=0)
@click.option('--tiller-host', help="Tiller host IP.", default=None)
@click.option(
'--tiller-port', help="Tiller host port.", type=int, default=None)
@click.option(
'--tiller-namespace',
'-tn',
help="Tiller namespace.",
type=str,
default=None)
@click.option(
'--timeout',
help="Specifies time to wait for rollback to complete.",
type=int,
default=0)
@click.option(
'--wait',
help=("Wait until rollback is complete before returning."),
is_flag=True)
@click.option(
'--force',
help=("Force resource update through delete/recreate if"
" needed."),
is_flag=True)
@click.option(
'--recreate-pods',
help=("Restarts pods for the resource if applicable."),
is_flag=True)
@click.option('--bearer-token', help=("User bearer token."), default=None)
@click.option('--debug', help="Enable debug logging.", is_flag=True)
@click.pass_context
def rollback_charts(
ctx, release, version, tiller_host, tiller_port, tiller_namespace,
timeout, wait, force, recreate_pods, bearer_token, debug):
CONF.debug = debug
Rollback(
ctx, release, version, tiller_host, tiller_port, tiller_namespace,
timeout, wait, force, recreate_pods, bearer_token).safe_invoke()
class Rollback(CliAction):
def __init__(
self, ctx, release, version, tiller_host, tiller_port,
tiller_namespace, timeout, wait, force, recreate_pods,
bearer_token):
super(Rollback, self).__init__()
self.ctx = ctx
self.release = release
self.version = version
self.tiller_host = tiller_host
self.tiller_port = tiller_port
self.tiller_namespace = tiller_namespace
self.timeout = timeout
self.wait = wait
self.force = force
self.recreate_pods = recreate_pods
self.bearer_token = bearer_token
def invoke(self):
with Tiller(tiller_host=self.tiller_host, tiller_port=self.tiller_port,
tiller_namespace=self.tiller_namespace,
bearer_token=self.bearer_token) as tiller:
response = self.handle(tiller)
self.output(response)
@lock_and_thread()
def handle(self, tiller):
return tiller.rollback_release(
self.release,
self.version,
wait=self.wait,
timeout=self.timeout,
force=self.force,
recreate_pods=self.recreate_pods)
def output(self, response):
self.logger.info('Rollback of %s complete.', self.release)

View File

@ -123,15 +123,6 @@ class ArmadaClient(object):
return resp.json()
def post_rollback_release(self, release, query=None, timeout=None):
endpoint = self._set_endpoint('1.0', 'rollback/{}'.format(release))
resp = self.session.get(endpoint, query=query, timeout=timeout)
self._check_response(resp)
return resp.json()
def get_test_release(self, release=None, query=None, timeout=None):
endpoint = self._set_endpoint('1.0', 'test/{}'.format(release))

View File

@ -47,16 +47,6 @@ armada_policies = [
'path': '/api/v1.0/tests/',
'method': 'POST'
}]),
policy.DocumentedRuleDefault(
name=base.ARMADA % 'rollback_release',
check_str=base.RULE_ADMIN_REQUIRED,
description='Rollback release',
operations=[
{
'path': '/api/v1.0/rollback/{release}',
'method': 'POST'
}
]),
]

View File

@ -113,16 +113,6 @@ class GetReleaseContentException(TillerException):
super(GetReleaseContentException, self).__init__(message)
class RollbackReleaseException(TillerException):
'''Exception that occurs during a failed Release Rollback'''
def __init__(self, release, version):
message = 'Failed to rollback release {} to version {}'.format(
release, version)
super(RollbackReleaseException, self).__init__(message)
class TillerPodNotFoundException(TillerException):
'''
Exception that occurs when a tiller pod cannot be found using the labels

View File

@ -20,7 +20,6 @@ from hapi.services.tiller_pb2 import GetVersionRequest
from hapi.services.tiller_pb2 import InstallReleaseRequest
from hapi.services.tiller_pb2 import ListReleasesRequest
from hapi.services.tiller_pb2_grpc import ReleaseServiceStub
from hapi.services.tiller_pb2 import RollbackReleaseRequest
from hapi.services.tiller_pb2 import TestReleaseRequest
from hapi.services.tiller_pb2 import UninstallReleaseRequest
from hapi.services.tiller_pb2 import UpdateReleaseRequest
@ -564,44 +563,6 @@ class Tiller(object):
status = self.get_release_status(release)
raise ex.ReleaseException(release, status, 'Delete')
def rollback_release(
self,
release_name,
version,
wait=False,
timeout=None,
force=False,
recreate_pods=False):
'''
Rollback a helm release.
'''
timeout = self._check_timeout(wait, timeout)
LOG.debug(
'Helm rollback of release=%s, version=%s, '
'wait=%s, timeout=%s', release_name, version, wait, timeout)
try:
stub = ReleaseServiceStub(self.channel)
rollback_request = RollbackReleaseRequest(
name=release_name,
version=version,
wait=wait,
timeout=timeout,
force=force,
recreate=recreate_pods)
rollback_msg = stub.RollbackRelease(
rollback_request,
timeout + GRPC_EPSILON,
metadata=self.metadata)
LOG.debug('RollbackRelease= %s', rollback_msg)
return
except Exception:
LOG.exception('Error while rolling back tiller release.')
raise ex.RollbackReleaseException(release_name, version)
def _check_timeout(self, wait, timeout):
if timeout is None or timeout <= 0:
if wait:

View File

@ -19,8 +19,6 @@ from oslo_config import cfg
from oslo_log import log
from armada.cli.apply import apply_create
from armada.cli.delete import delete_charts
from armada.cli.rollback import rollback_charts
from armada.cli.test import test_charts
from armada.cli.tiller import tiller_service
from armada.cli.validate import validate_manifest
@ -49,8 +47,6 @@ def main(ctx, debug, api, url, token):
\b
$ armada apply
$ armada delete
$ armada rollback
$ armada test
$ armada tiller
$ armada validate
@ -88,8 +84,6 @@ def main(ctx, debug, api, url, token):
main.add_command(apply_create)
main.add_command(delete_charts)
main.add_command(rollback_charts)
main.add_command(test_charts)
main.add_command(tiller_service)
main.add_command(validate_manifest)

View File

@ -1,90 +0,0 @@
# Copyright 2017 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an 'AS IS' BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import json
import mock
from armada import api
from armada.common.policies import base as policy_base
from armada.tests import test_utils
from armada.tests.unit.api import base
from armada.api.controller import rollback
@mock.patch.object(
rollback.Rollback, 'handle', rollback.Rollback.handle.__wrapped__)
class RollbackReleaseControllerTest(base.BaseControllerTest):
@mock.patch.object(api, 'Tiller')
def test_rollback_controller_pass(self, mock_tiller):
rules = {'armada:rollback_release': '@'}
self.policy.set_rules(rules)
m_tiller = mock_tiller.return_value
m_tiller.__enter__.return_value = m_tiller
rollback_release = m_tiller.rollback_release
rollback_release.return_value = None
release = 'test-release'
version = '2'
wait = 'true'
timeout = '123'
force = 'true'
recreate_pods = 'true'
resp = self.app.simulate_post(
'/api/v1.0/rollback/{}'.format(release),
params={
'version': version,
'wait': wait,
'timeout': timeout,
'force': force,
'recreate_pods': recreate_pods
})
mock_tiller.assert_called_once()
rollback_release.assert_called_once_with(
release, 2, wait=True, timeout=123, force=True, recreate_pods=True)
self.assertEqual(200, resp.status_code)
self.assertEqual(
'Rollback of test-release complete.',
json.loads(resp.text)['message'])
m_tiller.__exit__.assert_called()
@test_utils.attr(type=['negative'])
class RollbackReleaseControllerNegativeTest(base.BaseControllerTest):
@mock.patch.object(api, 'Tiller')
def test_rollback_controller_tiller_exc_return_500(self, mock_tiller):
rules = {'armada:rollback_release': '@'}
self.policy.set_rules(rules)
mock_tiller.side_effect = Exception
resp = self.app.simulate_post('/api/v1.0/rollback/fake-release')
self.assertEqual(500, resp.status_code)
@test_utils.attr(type=['negative'])
class RollbackReleaseControllerNegativeRbacTest(base.BaseControllerTest):
def test_rollback_release_insufficient_permissions(self):
"""Tests the GET /api/v1.0/rollback/{release} endpoint returns 403
following failed authorization.
"""
rules = {'armada:rollback_release': policy_base.RULE_ADMIN_REQUIRED}
self.policy.set_rules(rules)
resp = self.app.simulate_post('/api/v1.0/rollback/fake-release')
self.assertEqual(403, resp.status_code)

View File

@ -18,7 +18,6 @@ policy_data = """
"armada:validate_manifest": "rule:admin_required"
"armada:test_release": "rule:admin_required"
"armada:test_manifest": "rule:admin_required"
"armada:rollback_release": "rule:admin_required"
"tiller:get_status": "rule:admin_required"
"tiller:get_release": "rule:admin_required"
"""

View File

@ -381,51 +381,6 @@ class TillerTestCase(base.ArmadaTestCase):
tiller_obj.timeout,
metadata=tiller_obj.metadata)
@mock.patch('armada.handlers.tiller.K8s')
@mock.patch('armada.handlers.tiller.grpc')
@mock.patch.object(tiller, 'RollbackReleaseRequest')
@mock.patch.object(tiller, 'ReleaseServiceStub')
def test_rollback_release(
self, mock_release_service_stub, mock_rollback_release_request, _,
__):
mock_release_service_stub.return_value.RollbackRelease\
.return_value = {}
tiller_obj = tiller.Tiller('host', '8080', None)
release = 'release'
version = 0
wait = True
timeout = 123
recreate_pods = True
force = True
self.assertIsNone(
tiller_obj.rollback_release(
release,
version,
wait=wait,
timeout=timeout,
force=force,
recreate_pods=recreate_pods))
mock_rollback_release_request.assert_called_once_with(
name=release,
version=version,
wait=wait,
timeout=timeout,
force=force,
recreate=recreate_pods)
mock_release_service_stub.assert_called_once_with(tiller_obj.channel)
rollback_release_stub = mock_release_service_stub.return_value. \
RollbackRelease
rollback_release_stub.assert_called_once_with(
mock_rollback_release_request.return_value,
timeout + tiller.GRPC_EPSILON,
metadata=tiller_obj.metadata)
@mock.patch('armada.handlers.tiller.K8s')
@mock.patch('armada.handlers.tiller.grpc')
@mock.patch('armada.handlers.tiller.Config')

View File

@ -197,7 +197,6 @@ conf:
service_role: 'role:service'
admin_viewer: 'role:admin_ucp_viewer or rule:service_or_admin'
'armada:create_endpoints': 'rule:admin_required'
'armada:rollback_release': 'rule:admin_required'
'armada:test_manifest': 'rule:admin_required'
'armada:test_release': 'rule:admin_required'
'armada:validate_manifest': 'rule:admin_viewer'

View File

@ -11,7 +11,6 @@ Commands Guide
:caption: Contents:
apply.rst
rollback.rst
test.rst
tiller.rst
validate.rst

View File

@ -1,32 +0,0 @@
Armada - Rollback
=================
Commands
--------
.. code:: bash
Usage: armada rollback [OPTIONS]
This command performs a rollback on the specified release.
To rollback a release, run:
$ armada rollback --release my_release
Options:
--release TEXT Release to rollback.
--tiller-host TEXT Tiller Host IP
--tiller-port INTEGER Tiller Host Port
-tn, --tiller-namespace TEXT Tiller Namespace
--timeout INTEGER Tiller Host IP
--version INTEGER Version of release to rollback to. 0 represents the previous release
--wait Version of release to rollback to. 0 represents the previous release
--bearer-token User bearer token
--help Show this message and exit.
Synopsis
--------
The rollback command will perform helm rollback on the release.

View File

@ -109,12 +109,6 @@ b. Helm Install
docker exec armada armada test --file=/examples/openstack-helm.yaml
8. Rolling back Releases:
.. code:: bash
docker exec armada armada rollback --release=armada-keystone
Overriding Manifest Values
--------------------------
It is possible to override manifest values from the command line using the
@ -245,6 +239,4 @@ like openstack-keystone.
The bearer token option is available for the following commands
armada apply,
armada delete,
armada tiller,
armada rollback
armada tiller

View File

@ -26,10 +26,6 @@
# POST /api/v1.0/tests/
#"armada:test_manifest": "rule:admin_required"
# Rollback release
# POST /api/v1.0/rollback/{release}
#"armada:rollback_release": "rule:admin_required"
# Get Tiller status
# GET /api/v1.0/status/
#"tiller:get_status": "rule:admin_viewer"

View File

@ -1,506 +0,0 @@
swagger: "2.0"
# TODO(lamt) This file is using the (old) swagger 2.0 Spec. As OAS
# (OpenAPI Specification) 3.0 is available, this file should be
# used as a reference and for tools that are not yet OAS 3.0 compatible.
info:
title: Armada
version: 0.1.0
description: |
Armada provides operators a way to deploy or upgrade collection of helm
charts using a single command.
contact:
name: Airship community
url: https://www.airshipit.org/
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
basePath: /
schemes:
- http
- https
consumes:
- application/json
paths:
/versions:
get:
description: Returns list of all supported versions of Armada. Currently this returns a static value.
operationId: getVersions
responses:
'200':
$ref: "#/responses/response-get-versions"
/api/v1.0/health:
get:
description: Returns the health of the system. [TO BE IMPLEMENTED]
operationId: getHealth
parameters:
- $ref: "#/parameters/x-auth-token"
responses:
'204':
description: Indicates the system is healthy. This is currently the default return.
'503':
description: Indicates the system is not healthy. This is not yet implemented.
/api/v1.0/releases:
get:
description: Returns list of Tiller releases
operationId: getReleases
parameters:
- $ref: "#/parameters/x-auth-token"
- $ref: "#/parameters/tiller-host"
- $ref: "#/parameters/tiller-port"
- $ref: "#/parameters/tiller-namespace"
responses:
'200':
$ref: "#/responses/response-get-releases"
'401':
$ref: "#/responses/err-no-auth"
'403':
$ref: "#/responses/err-forbidden"
'500':
$ref: "#/responses/err-server-error"
/api/v1.0/status:
get:
description: Returns the status of Tiller
operationId: getStatus
parameters:
- $ref: "#/parameters/x-auth-token"
- $ref: "#/parameters/tiller-host"
- $ref: "#/parameters/tiller-port"
- $ref: "#/parameters/tiller-namespace"
responses:
'200':
$ref: "#/responses/response-get-status"
'401':
$ref: "#/responses/err-no-auth"
'403':
$ref: "#/responses/err-forbidden"
'500':
$ref: "#/responses/err-server-error"
/api/v1.0/apply:
post:
description: Install or upgrade using an Armada manifest
operationId: postApplyManifest
consumes:
- application/json
- application/x-yaml
parameters:
- $ref: "#/parameters/x-auth-token"
- $ref: "#/parameters/content-type"
- $ref: "#/parameters/tiller-host"
- $ref: "#/parameters/tiller-port"
- $ref: "#/parameters/tiller-namespace"
- $ref: "#/parameters/target-manifest"
- $ref: "#/parameters/disable-update-pre"
- $ref: "#/parameters/disable-update-post"
- $ref: "#/parameters/enable-chart-cleanup"
- $ref: "#/parameters/wait"
- $ref: "#/parameters/timeout"
- name: request_body
in: body
description: Body containing the manifest hrefs JSON or YAML and a set of overrides
schema:
type: object
properties:
hrefs:
type: object
description: JSON or YAML representation of the manifest being processed.
overrides:
type: object
description: Set of overrides
responses:
'200':
$ref: "#/responses/response-post-apply"
'400':
$ref: "#/responses/err-bad-request"
'401':
$ref: "#/responses/err-no-auth"
'403':
$ref: "#/responses/err-forbidden"
'415':
$ref: "#/responses/err-unsupported-media-type"
'500':
$ref: "#/responses/err-server-error"
/api/v1.0/tests:
post:
description: Test manifest releases
operationId: postTests
consumes:
- application/json
- application/x-yaml
parameters:
- $ref: "#/parameters/x-auth-token"
- $ref: "#/parameters/tiller-host"
- $ref: "#/parameters/tiller-port"
- $ref: "#/parameters/tiller-namespace"
- $ref: "#/parameters/target-manifest"
# TODO(lamt) This needs to be cleaned up better when migrating to 3.x swagger
- name: request_body
in: body
description: JSON or YAML representation of the manifest being processed.
schema:
type: object
responses:
'200':
$ref: "#/responses/response-post-tests"
'400':
$ref: "#/responses/err-bad-request"
'401':
$ref: "#/responses/err-no-auth"
'403':
$ref: "#/responses/err-forbidden"
'500':
$ref: "#/responses/err-server-error"
/api/v1.0/test/{release_name}:
post:
description: Test specified release name
operationId: postTestReleaseName
parameters:
- name: release_name
in: path
required: true
description: Name of the release to be tested
type: string
- $ref: "#/parameters/x-auth-token"
- $ref: "#/parameters/tiller-host"
- $ref: "#/parameters/tiller-port"
- $ref: "#/parameters/tiller-namespace"
responses:
'200':
$ref: "#/responses/response-post-test-release"
'401':
$ref: "#/responses/err-no-auth"
'403':
$ref: "#/responses/err-forbidden"
'500':
$ref: "#/responses/err-server-error"
/api/v1.0/rollback/{release_name}:
post:
description: Rollback the specified release name
operationId: postRollbackReleaseName
parameters:
- name: release_name
in: path
required: true
description: Name of the release to be rolled back
type: string
- name: version
in: query
required: false
type: integer
description: Version number of release to rollback to. 0 represents
the previous version
default: 0
- $ref: "#/parameters/x-auth-token"
- $ref: "#/parameters/tiller-host"
- $ref: "#/parameters/tiller-port"
- $ref: "#/parameters/tiller-namespace"
- $ref: "#/parameters/wait"
- $ref: "#/parameters/timeout"
- $ref: "#/parameters/force"
- $ref: "#/parameters/recreate-pods"
responses:
'200':
$ref: "#/responses/response-post-rollback-release"
'401':
$ref: "#/responses/err-no-auth"
'403':
$ref: "#/responses/err-forbidden"
'500':
$ref: "#/responses/err-server-error"
/api/v1.0/validatedesign:
post:
description: Validate a design
operationId: postValidateDesign
consumes:
- application/json
- application/x-yaml
parameters:
- $ref: "#/parameters/x-auth-token"
# TODO(lamt) This needs to be cleaned up better when migrating to 3.x swagger
- name: request_body
in: body
description: JSON or YAML representation of the manifest being processed.
schema:
type: object
responses:
'200':
$ref: "#/responses/response-post-validatedesign"
'400':
$ref: "#/responses/err-bad-request"
'401':
$ref: "#/responses/err-no-auth"
'403':
$ref: "#/responses/err-forbidden"
parameters:
x-auth-token:
in: header
name: X-Auth-Token
required: false
type: string
description: A fernet keystone bearer token used for authentication and authorization
content-type:
in: header
name: Content-Type
required: true
type: string
tiller-host:
in: query
name: tiller_host
required: false
type: string
description: Hostname of the Tiller server
default: None
tiller-port:
in: query
name: tiller_port
required: false
type: integer
description: Port number of the Tiller server. Default is the value of `CONF.tiller_port`.
tiller-namespace:
in: query
name: tiller_namespace
required: false
type: string
description: Tiller namespace. Default is the value of `CONF.tiller_namespace`
target-manifest:
in: query
name: target_manifest
required: false
type: string
description: Specifies the manifest to target if there are multiples.
disable-update-pre:
in: query
name: disable_update_pre
required: false
type: boolean
default: False
disable-update-post:
in: query
name: disable_update_post
required: false
type: boolean
default: False
enable-chart-cleanup:
in: query
name: enable_chart_cleanup
required: false
type: boolean
default: False
wait:
in: query
name: wait
required: false
type: boolean
description: Specifies whether Tiller should wait until the action is
complete before returning.
timeout:
in: query
name: timeout
required: false
type: integer
description: Specifies time in seconds Tiller should wait for the action to
complete before timing out.
default: 3600
force:
in: query
name: force
required: false
type: boolean
description: Specifies whether to force resource update through
delete/recreate if needed.
default: False
recreate-pods:
in: query
name: recreate_pods
required: false
type: boolean
description: Specifies whether to restart pods for the resource if
applicable.
default: False
responses:
# HTTP error responses
err-bad-request:
description: 400 Bad request
err-no-auth:
description: 401 Not authorized
err-forbidden:
description: 403 Forbidden
err-not-found:
description: 404 Not found
err-not-allowed:
description: 405 Method not allowed
err-unsupported-media-type:
description: |
415 Unsupported Media Type
Mime type needs to be application/json or application/x-yaml.
err-server-error:
description: 500 Internal Server Error
# API responses
response-post-apply:
description: Response of application of an Armada manifest
schema:
allOf:
- $ref: "#/definitions/applyresult"
response-post-rollback-release:
description: Response of a rollback of a specified release name
schema:
allOf:
- $ref: "#/definitions/rollbackresult"
example:
message: "Rollback of release xyz complete"
response-post-test-release:
description: Response of a test of a specified release name
schema:
allOf:
- $ref: "#/definitions/testresult"
example:
message: "MESSAGE: No test found"
result: "FAILED: <reason>"
response-post-validatedesign:
description: Response of a validation check
schema:
allOf:
- $ref: "#/definitions/base-response"
example:
kind: Status
apiVersion: v1.0
reason: Validation
metadata: {}
details: []
status: Success
message: Armada validations succeeded.
code: 200
response-post-tests:
description: Response of all tests
schema:
allOf:
- $ref: "#/definitions/base-response"
example:
kind: Status
apiVersion: v1.0
reason: Validation
metadata: {}
details: []
status: Failure
message: Failed to validate documents or generate Armada Manifest from documents..
code: 400
response-get-releases:
description: Response of all namespaces and releases contained within
schema:
allOf:
- $ref: "#/definitions/releases"
example:
namespace-one:
- release-A
- release-B
namespace-two:
- other-release-X
- other-release-Y
response-get-versions:
description: Response of getting Armada versions
schema:
allOf:
- $ref: "#/definitions/versions"
example:
v1.0:
path: /api/v1.0
status: stable
response-get-status:
description: Response of Tiller statuses
schema:
allOf:
- $ref: "#/definitions/status"
example:
tiller:
state: True
version: 0.1.0
definitions:
status:
type: object
properties:
tiller:
type: object
properties:
state:
type: boolean
version:
type: string
metadata:
type: object
additionalProperties:
type: string
detail:
type: object
properties:
errorCount:
type: integer
messageList:
type: array
items:
type: string
applyresult:
type: object
properties:
message:
type: object
properties:
install:
type: array
items:
type: string
upgrade:
type: array
items:
type: string
diff:
type: object
additionalProperties:
type: string
rollbackresult:
type: object
properties:
message:
type: string
testresult:
type: object
properties:
message:
type: string
result:
type: string
releases:
type: object
additionalProperties:
type: array
items:
type: string
versions:
type: object
additionalProperties:
$ref: "#/definitions/version"
version:
type: object
properties:
path:
type: string
status:
type: string
base-response:
type: object
properties:
kind:
type: string
apiVersion:
type: string
reason:
type: string
metadata:
$ref: "#/definitions/metadata"
details:
$ref: "#/definitions/detail"
status:
type: string
message:
type: string
code:
type: integer

View File

@ -1,630 +0,0 @@
openapi: 3.0.0
info:
title: Armada
version: 0.1.6
description: |
Armada provides operators a way to deploy or upgrade collections of helm
charts using a single command.
contact:
name: Airship community
url: https://www.airshipit.org/
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
paths:
/versions:
get:
tags:
- Versions
description: Returns list of all supported versions of Armada.
operationId: getVersions
responses:
'200':
$ref: "#/components/responses/response-get-versions"
options:
tags:
- Versions
operationId: optVersions
responses:
'200':
$ref: "#/components/responses/response-options"
/api/v1.0/health:
get:
tags:
- Health
description: Returns the health of the system. [TODO]
operationId: getHealth
parameters:
- $ref: "#/components/parameters/x-auth-token"
responses:
'204':
description: Indicates the system is healthy. This is currently the default return.
'503':
description: Indicates the system is not healthy. This is not explicitly returned.
options:
tags:
- Health
operationId: optHealth
responses:
'200':
$ref: "#/components/responses/response-options"
/api/v1.0/releases:
get:
tags:
- Releases
description: Returns list of Tiller releases
operationId: getReleases
parameters:
- $ref: "#/components/parameters/x-auth-token"
- $ref: "#/components/parameters/tiller-host"
- $ref: "#/components/parameters/tiller-port"
- $ref: "#/components/parameters/tiller-namespace"
responses:
'200':
$ref: "#/components/responses/response-get-releases"
'401':
$ref: "#/components/responses/err-no-auth"
'403':
$ref: "#/components/responses/err-forbidden"
'500':
$ref: "#/components/responses/err-server-error"
options:
tags:
- Releases
operationId: optReleases
responses:
'200':
$ref: "#/components/responses/response-options"
/api/v1.0/status:
get:
tags:
- Status
description: Returns the status of Tiller
operationId: getStatus
parameters:
- $ref: "#/components/parameters/x-auth-token"
- $ref: "#/components/parameters/tiller-host"
- $ref: "#/components/parameters/tiller-port"
- $ref: "#/components/parameters/tiller-namespace"
responses:
'200':
$ref: "#/components/responses/response-get-status"
'401':
$ref: "#/components/responses/err-no-auth"
'403':
$ref: "#/components/responses/err-forbidden"
'500':
$ref: "#/components/responses/err-server-error"
options:
tags:
- Status
operationId: optStatus
responses:
'200':
$ref: "#/components/responses/response-options"
/api/v1.0/apply:
post:
tags:
- Apply
description: Install or upgrade using an Armada manifest
operationId: postApplyManifest
parameters:
- $ref: "#/components/parameters/x-auth-token"
- $ref: "#/components/parameters/tiller-host"
- $ref: "#/components/parameters/tiller-port"
- $ref: "#/components/parameters/tiller-namespace"
- $ref: "#/components/parameters/target-manifest"
- $ref: "#/components/parameters/disable-update-pre"
- $ref: "#/components/parameters/disable-update-post"
- $ref: "#/components/parameters/enable-chart-cleanup"
- $ref: "#/components/parameters/wait"
- $ref: "#/components/parameters/timeout"
requestBody:
$ref: "#/components/requestBodies/apply-body"
responses:
'200':
$ref: "#/components/responses/response-post-apply"
'400':
$ref: "#/components/responses/err-bad-request"
'401':
$ref: "#/components/responses/err-no-auth"
'403':
$ref: "#/components/responses/err-forbidden"
'415':
$ref: "#/components/responses/err-unsupported-media-type"
'500':
$ref: "#/components/responses/err-server-error"
options:
tags:
- Apply
operationId: optApply
responses:
'200':
$ref: "#/components/responses/response-options"
/api/v1.0/tests:
post:
tags:
- Tests
description: Test manifest releases
operationId: postTests
parameters:
- $ref: "#/components/parameters/x-auth-token"
- $ref: "#/components/parameters/tiller-host"
- $ref: "#/components/parameters/tiller-port"
- $ref: "#/components/parameters/tiller-namespace"
- $ref: "#/components/parameters/target-manifest"
- $ref: "#/components/parameters/enable-all"
requestBody:
$ref: "#/components/requestBodies/manifest-body"
responses:
'200':
$ref: "#/components/responses/response-post-tests"
'400':
$ref: "#/components/responses/err-bad-request"
'401':
$ref: "#/components/responses/err-no-auth"
'403':
$ref: "#/components/responses/err-forbidden"
'500':
$ref: "#/components/responses/err-server-error"
options:
tags:
- Tests
operationId: optTests
responses:
'200':
$ref: "#/components/responses/response-options"
/api/v1.0/test/{release_name}:
post:
tags:
- Tests
description: Test specified release name
operationId: postTestReleaseName
parameters:
- $ref: "#/components/parameters/release-name"
- $ref: "#/components/parameters/x-auth-token"
- $ref: "#/components/parameters/tiller-host"
- $ref: "#/components/parameters/tiller-port"
- $ref: "#/components/parameters/tiller-namespace"
responses:
'200':
$ref: "#/components/responses/response-post-test-release"
'401':
$ref: "#/components/responses/err-no-auth"
'403':
$ref: "#/components/responses/err-forbidden"
'500':
$ref: "#/components/responses/err-server-error"
options:
tags:
- Tests
operationId: optTestReleaseName
parameters:
- $ref: "#/components/parameters/release-name"
responses:
'200':
$ref: "#/components/responses/response-options"
/api/v1.0/rollback/{release_name}:
post:
tags:
- Rollback
description: Rollback the specified release name
operationId: postRollbackReleaseName
parameters:
- $ref: "#/components/parameters/release-name"
- $ref: "#/components/parameters/release-version"
- $ref: "#/components/parameters/x-auth-token"
- $ref: "#/components/parameters/tiller-host"
- $ref: "#/components/parameters/tiller-port"
- $ref: "#/components/parameters/tiller-namespace"
- $ref: "#/components/parameters/wait"
- $ref: "#/components/parameters/timeout"
- $ref: "#/components/parameters/force"
- $ref: "#/components/parameters/recreate-pods"
responses:
'200':
$ref: "#/components/responses/response-post-rollback-release"
'401':
$ref: "#/components/responses/err-no-auth"
'403':
$ref: "#/components/responses/err-forbidden"
'500':
$ref: "#/components/responses/err-server-error"
options:
tags:
- Rollback
operationId: optRollbackReleaseName
parameters:
- $ref: "#/components/parameters/release-name"
responses:
'200':
$ref: "#/components/responses/response-options"
/api/v1.0/validatedesign:
post:
tags:
- Validate Design
description: Validate a design
operationId: postValidateDesign
parameters:
- $ref: "#/components/parameters/x-auth-token"
requestBody:
$ref: "#/components/requestBodies/manifest-body"
responses:
'200':
$ref: "#/components/responses/response-post-validatedesign"
'400':
$ref: "#/components/responses/err-bad-request"
'401':
$ref: "#/components/responses/err-no-auth"
'403':
$ref: "#/components/responses/err-forbidden"
options:
tags:
- Validate Design
operationId: optValidateDesign
responses:
'200':
$ref: "#/components/responses/response-options"
components:
parameters:
x-auth-token:
in: header
name: X-Auth-Token
required: false
description: A Keystone fernet bearer token used for authentication and authorization
schema:
type: string
release-name:
in: path
name: release_name
required: true
description: Name of the release to be acted upon
schema:
type: string
release-version:
in: query
name: version
required: false
description: "Version number of release to rollback to. 0 represents the previous version. Default: `0`"
schema:
type: integer
tiller-host:
in: query
name: tiller_host
required: false
description: Hostname of the Tiller server
schema:
type: string
tiller-port:
in: query
name: tiller_port
required: false
schema:
type: integer
description: "Port number of the Tiller server. Default: the value of `CONF.tiller_port`"
tiller-namespace:
in: query
name: tiller_namespace
required: false
schema:
type: string
description: "Tiller namespace. Default: Value of `CONF.tiller_namespace`"
target-manifest:
in: query
name: target_manifest
required: false
schema:
type: string
description: Specifies the manifest to target if there are multiple manifests
disable-update-pre:
in: query
name: disable_update_pre
required: false
schema:
type: boolean
disable-update-post:
in: query
name: disable_update_post
required: false
schema:
type: boolean
enable-chart-cleanup:
in: query
name: enable_chart_cleanup
required: false
description: Flag to allow for chart cleanup
schema:
type: boolean
enable-all:
in: query
name: enable_all
required: false
description: Flag to test disabled tests
schema:
type: boolean
timeout:
in: query
name: timeout
required: false
description: "Specifies time in seconds Tiller should wait for charts to deploy until timing out. Default: 3600"
schema:
type: integer
wait:
in: query
name: wait
required: false
description: Specifies whether Tiller should wait until all charts are deployed
schema:
type: boolean
force:
in: query
name: force
required: false
description: Specifies whether to force resource update through
delete/recreate if needed.
schema:
type: boolean
default: false
recreate-pods:
in: query
name: recreate_pods
required: false
description: Specifies whether to restart pods for the resource if
applicable.
schema:
type: boolean
default: false
requestBodies:
apply-body:
required: true
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/manifest-json"
- $ref: "#/components/schemas/manifest-refs"
application/x-yaml:
schema:
$ref: "#/components/schemas/manifest-yaml"
manifest-body:
description: A manifest JSON or YAML object representation of a manifest
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/manifest-json"
application/x-yaml:
schema:
$ref: "#/components/schemas/manifest-yaml"
responses:
# HTTP error responses
err-bad-request:
description: 400 Bad request
err-no-auth:
description: 401 Not authorized
err-forbidden:
description: 403 Forbidden
err-not-found:
description: 404 Not found
err-not-allowed:
description: 405 Method not allowed
err-unsupported-media-type:
description: |
415 Unsupported Media Type
Mime type needs to be application/json or application/x-yaml.
err-server-error:
description: 500 Internal Server Error
response-options:
description: Empty response with `Allow` header indicating possible action(s)
headers:
Allow:
schema:
type: string
example:
Allow: GET,POST,DELETE
# API responses
response-post-apply:
description: Response of application of an Armada manifest
content:
application/json:
schema:
$ref: "#/components/schemas/result-apply"
response-post-rollback-release:
description: Response of a rollback of a specified release name
content:
application/json:
schema:
$ref: "#/components/schemas/result-rollback"
response-post-test-release:
description: Response of a test of a specified release name
content:
application/json:
schema:
$ref: "#/components/schemas/result-test"
response-post-validatedesign:
description: Response of a validation check
content:
application/json:
schema:
$ref: "#/components/schemas/base-response"
response-post-tests:
description: Response of all tests
content:
application/json:
schema:
$ref: "#/components/schemas/base-response"
response-get-releases:
description: Response of all namespaces and releases contained within
content:
application/json:
schema:
$ref: "#/components/schemas/releases"
response-get-versions:
description: Response of getting Armada versions
content:
application/json:
schema:
$ref: "#/components/schemas/versions"
response-get-status:
description: Response of Tiller statuses
content:
application/json:
schema:
$ref: "#/components/schemas/status"
schemas:
base-response:
type: object
properties:
kind:
type: string
apiVersion:
type: string
reason:
type: string
metadata:
$ref: "#/components/schemas/metadata"
details:
$ref: "#/components/schemas/detail"
status:
type: string
message:
type: string
code:
type: integer
example:
kind: Status
apiVersion: v1.0
reason: Validation
metadata: {}
details: []
status: Success
message: <Success message>
code: 200
detail:
type: object
properties:
errorCount:
type: integer
messageList:
type: array
items:
type: string
metadata:
type: object
additionalProperties:
type: string
releases:
type: object
additionalProperties:
type: array
items:
type: string
example:
namespace-one:
- release-A
- release-B
namespace-two:
- other-release-X
- other-release-Y
result-apply:
type: object
properties:
message:
type: object
properties:
install:
type: array
items:
type: string
upgrade:
type: array
items:
type: string
diff:
type: object
additionalProperties:
type: string
example:
install:
- release-A
- release-B
upgrade:
- release-C
- release-D
diff:
key1: val1
key2: val2
result-rollback:
type: object
properties:
message:
type: string
example:
message: "Rollback of release xyz complete"
result-test:
type: object
properties:
message:
type: string
result:
type: string
example:
message: "MESSAGE: No test found"
result: "FAILED: <reason>"
status:
type: object
properties:
tiller:
type: object
properties:
state:
type: boolean
version:
type: string
example:
tiller:
state: True
version: 0.1.0
version:
type: object
properties:
path:
type: string
status:
type: string
versions:
type: object
additionalProperties:
$ref: "#/components/schemas/version"
example:
v1.0:
path: /api/v1.0
status: stable
manifest-json:
type: object
example:
schema: armada/ChartGroup/v1
metadata:
schema: metadata/Document/v1
nname: someName
data:
description: Simple Service
sequenced: false
chart_group:
- group1
- group2
manifest-yaml:
type: object
manifest-refs:
type: object
properties:
hrefs:
oneOf:
- $ref: "#/components/schemas/manifest-json"
- $ref: "#/components/schemas/manifest-yaml"
overrides:
type: object
additionalProperties:
type: string