Fix chart cleanup bug

-chart cleanup was never refactored for new yaml format
-fix chart cleanup syntax
-add simple.yaml for quick tests
-fix chart cleanup cli flag
This commit is contained in:
Tim Heyer 2017-07-12 16:29:28 +00:00 committed by Alexis Rivera DeLa Torre
parent 701ac2fa8f
commit 5e580ee3cb
3 changed files with 37 additions and 2 deletions

View File

@ -41,7 +41,7 @@ class ApplyChartsCommand(cmd.Command):
default=False, help='Disable pre upgrade actions')
parser.add_argument('--disable-update-post', action='store_true',
default=False, help='Disable post upgrade actions')
parser.add_argument('--enable-chart-cleanup', action='store',
parser.add_argument('--enable-chart-cleanup', action='store_true',
default=False, help='Enable Chart Clean Up')
parser.add_argument('--wait', action='store_true',
default=False, help='Wait until all charts'

View File

@ -267,7 +267,13 @@ class Tiller(object):
:result - will remove any chart that is not present in yaml
'''
valid_charts = [release_prefix(prefix, chart) for chart in charts]
valid_charts = []
for gchart in charts:
for chart in gchart.get('chart_group'):
valid_charts.append(release_prefix(prefix,
chart.get('chart')
.get('name')))
actual_charts = [x.name for x in self.list_releases()]
chart_diff = list(set(actual_charts) - set(valid_charts))

29
examples/simple.yaml Normal file
View File

@ -0,0 +1,29 @@
# For simple deployments
armada:
release_prefix: armada
charts:
- description: Deploys Helm Toolkit and Mariadb
chart_group:
- chart: &blog-1
name: blog-1
release_name: blog-1
namespace: default
values: {}
source:
type: git
location: https://github.com/gardlt/hello-world-chart
subpath: .
reference: master
dependencies: []
- chart: &blog-2
name: blog-2
release_name: blog-2
namespace: default
values: {}
source:
type: git
location: https://github.com/gardlt/hello-world-chart
subpath: .
reference: master
dependencies: []