From 64cab4788f18822553c582f63e2a7c0a216d5f7b Mon Sep 17 00:00:00 2001 From: Sean Eagan Date: Wed, 24 Apr 2019 10:47:15 -0500 Subject: [PATCH] [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 --- armada/handlers/chart_deploy.py | 11 +++- armada/schemas/armada-chart-schema-v2.yaml | 4 +- .../operations/documents/migration-v1-v2.rst | 5 +- .../documents/v2/document-authoring.rst | 51 ++++++++++++------- 4 files changed, 50 insertions(+), 21 deletions(-) diff --git a/armada/handlers/chart_deploy.py b/armada/handlers/chart_deploy.py index 64f9045d..76d4a7f1 100644 --- a/armada/handlers/chart_deploy.py +++ b/armada/handlers/chart_deploy.py @@ -21,6 +21,7 @@ from armada.exceptions import armada_exceptions from armada.handlers.chartbuilder import ChartBuilder from armada.handlers.release_diff import ReleaseDiff from armada.handlers.chart_delete import ChartDelete +from armada.handlers.schema import get_schema_info from armada.handlers.test import Test from armada.handlers.wait import ChartWait from armada.exceptions import tiller_exceptions @@ -92,8 +93,16 @@ class ChartDeploy(object): old_values_string = old_release.config.raw upgrade = chart.get('upgrade', {}) - disable_hooks = upgrade.get('no_hooks', False) options = upgrade.get('options', {}) + + # TODO: Remove when v1 doc support is removed. + schema_info = get_schema_info(ch['schema']) + if schema_info.version < 2: + no_hooks_location = upgrade + else: + no_hooks_location = options + + disable_hooks = no_hooks_location.get('no_hooks', False) force = options.get('force', False) recreate_pods = options.get('recreate_pods', False) diff --git a/armada/schemas/armada-chart-schema-v2.yaml b/armada/schemas/armada-chart-schema-v2.yaml index 49e020cd..cff97054 100644 --- a/armada/schemas/armada-chart-schema-v2.yaml +++ b/armada/schemas/armada-chart-schema-v2.yaml @@ -126,8 +126,6 @@ data: upgrade: type: object properties: - no_hooks: - type: boolean pre: type: object additionalProperties: false @@ -141,6 +139,8 @@ data: type: boolean recreate_pods: type: boolean + no_hooks: + type: boolean additionalProperties: false additionalProperties: false required: diff --git a/doc/source/operations/documents/migration-v1-v2.rst b/doc/source/operations/documents/migration-v1-v2.rst index 51fee18d..851cc5a7 100644 --- a/doc/source/operations/documents/migration-v1-v2.rst +++ b/doc/source/operations/documents/migration-v1-v2.rst @@ -48,8 +48,11 @@ Chart | with ``type: job`` no longer | ``type: job`` and you also want to delete cronjobs, add | | deletes cronjobs | another item with ``type: cronjob`` and same labels. | +--------------------------------+------------------------------------------------------------+ +| ``upgrade.no_hooks`` moved to | Remove as desired, otherwise move to the new location. | +| ``upgrade.options.no_hooks``, | | +| and now optional | | ++--------------------------------+------------------------------------------------------------+ | ``dependencies``, | Remove as desired. | -| ``upgrade.no_hooks``, | | | ``source.subpath`` | | | now optional | | +--------------------------------+------------------------------------------------------------+ diff --git a/doc/source/operations/documents/v2/document-authoring.rst b/doc/source/operations/documents/v2/document-authoring.rst index 5880a436..4467e9e9 100644 --- a/doc/source/operations/documents/v2/document-authoring.rst +++ b/doc/source/operations/documents/v2/document-authoring.rst @@ -113,7 +113,7 @@ Chart +-----------------+----------+---------------------------------------------------------------------------------------+ | test | object | See Test_. | +-----------------+----------+---------------------------------------------------------------------------------------+ -| upgrade | object | upgrade the chart managed by the armada yaml | +| upgrade | object | See Upgrade_. | +-----------------+----------+---------------------------------------------------------------------------------------+ | delete | object | See Delete_. | +-----------------+----------+---------------------------------------------------------------------------------------+ @@ -190,14 +190,14 @@ Run helm tests on the chart after install/upgrade. setting the ``enabled`` key to ``False``. Test Options -^^^^^^^^^^^^ +~~~~~~~~~~~~ Test options to pass through directly to helm. +-------------+----------+---------------------------------------------------------------+ | keyword | type | action | +=============+==========+===============================================================+ -| cleanup | bool | cleanup test pods after test completion, defaults to false | +| cleanup | bool | Same as Helm CLI. | +-------------+----------+---------------------------------------------------------------+ .. note:: @@ -212,26 +212,43 @@ Test options to pass through directly to helm. running tests. Similar suggestions have been made for how ``helm test --cleanup`` itself ought to work (https://github.com/helm/helm/issues/3279). +Upgrade +^^^^^^^ + ++-------------+----------+---------------------------------------------------------------+ +| keyword | type | action | ++=============+==========+===============================================================+ +| options | object | See `Upgrade - Options`_. | ++-------------+----------+---------------------------------------------------------------+ +| pre | object | See `Upgrade - Pre`_. | ++-------------+----------+---------------------------------------------------------------+ + +Upgrade - Options +~~~~~~~~~~~~~~~~~ + +Upgrade options to pass through directly to helm. + ++---------------+----------+---------------------------------------------------------------+ +| keyword | type | action | ++===============+==========+===============================================================+ +| no_hooks | boolean | Same as Helm CLI. | ++---------------+----------+---------------------------------------------------------------+ +| force | boolean | Same as Helm CLI. | ++---------------+----------+---------------------------------------------------------------+ +| recreate_pods | boolean | Same as Helm CLI. | ++---------------+----------+---------------------------------------------------------------+ + Upgrade - Pre -^^^^^^^^^^^^^ +~~~~~~~~~~~~~ +-------------+----------+---------------------------------------------------------------+ | keyword | type | action | +=============+==========+===============================================================+ -| pre | object | actions performed prior to updating a release | +| delete | array | List of `Upgrade - Pre - Delete`_. | +-------------+----------+---------------------------------------------------------------+ -Upgrade - Actions -^^^^^^^^^^^^^^^^^ - -+-------------+----------+---------------------------------------------------------------+ -| keyword | type | action | -+=============+==========+===============================================================+ -| delete | array | List of `Upgrade - Actions - Delete`_. | -+-------------+----------+---------------------------------------------------------------+ - -Upgrade - Actions - Delete -^^^^^^^^^^^^^^^^^^^^^^^^^^ +Upgrade - Pre - Delete +********************** +-------------+----------+---------------------------------------------------------------+ | keyword | type | action | @@ -243,7 +260,7 @@ Upgrade - Actions - Delete +-------------+----------+---------------------------------------------------------------+ Chart Example -^^^^^^^^^^^^^ +~~~~~~~~~~~~~ ::