def do_helm_override_delete(cc, args): """Delete overrides for a chart.""" app = app_utils._find_app(cc, args.app) _find_overrides(cc, app, args.chart, args.namespace) cc.helm.delete_overrides(args.app, args.chart, args.namespace) print('Deleted chart overrides %s:%s for application %s' % (args.chart, args.namespace, args.app))
def do_helm_override_list(cc, args): """List system helm charts.""" app = app_utils._find_app(cc, args.app) charts = cc.helm.list_charts(app.name) utils.print_list(charts, ['name', 'namespaces'], ['chart name', 'overrides namespaces'], sortby=0)
def do_helm_override_list(cc, args): """List system helm charts.""" app = app_utils._find_app(cc, args.app) charts = cc.helm.list_charts(app.name) keys = ['name', 'namespaces'] labels = ['chart name', 'overrides namespaces'] if args.long: keys.append('enabled') labels.append('chart enabled') utils.print_list(charts, keys, labels, sortby=0)
def do_helm_chart_attribute_modify(cc, args): """Modify helm chart attributes. This function is provided to modify system behaviorial attributes related to a chart. This does not modify a chart nor does it modify chart overrides which are managed through the helm-override-update command. """ # Make sure the chart is present app = app_utils._find_app(cc, args.app) chart = _find_overrides(cc, app, args.chart, args.namespace) attributes = {} if args.enabled is not None: attributes.update({'enabled': args.enabled}) chart = cc.helm.update_chart(args.app, args.chart, args.namespace, attributes) _print_helm_chart(chart)
def do_helm_override_update(cc, args): """Update helm chart user overrides.""" app = app_utils._find_app(cc, args.app) _find_overrides(cc, app, args.chart, args.namespace) # This logic results in similar behaviour to "helm upgrade". flag = 'reset' if args.reuse_values and not args.reset_values: flag = 'reuse' # Overrides can be specified three different ways. To preserve helm's # behaviour we will process all "--values" files first, then all "--set" # values, then finally all "--set-string" values. override_files = [] # need to handle missing files if args.files: try: for filename in args.files: with open(filename, 'r') as input_file: overrides = yaml.load(input_file) override_files.append(yaml.dump(overrides)) except IOError as ex: raise exc.CommandError('error opening values file: %s' % ex) override_set = [] for override in args.set: override_set.append(override) overrides = { 'files': override_files, 'set': override_set, } chart = cc.helm.update_overrides(args.app, args.chart, args.namespace, flag, overrides) _print_helm_chart(chart)
def do_helm_override_show(cc, args): """Show overrides for chart.""" app = app_utils._find_app(cc, args.app) _find_overrides(cc, app, args.chart, args.namespace) chart = cc.helm.get_overrides(args.app, args.chart, args.namespace) _print_helm_chart(chart)