Added helm2 specifics

This commit is contained in:
jenkins-x-bot 2020-09-14 13:55:18 +08:00
parent 17443ee1ea
commit 4b2dca4355
4 changed files with 15 additions and 20 deletions

View File

@ -7,7 +7,6 @@ from wtforms import validators, ValidationError
from wtforms.validators import InputRequired, Email, Length
from flask_bootstrap import Bootstrap
class deploySelectForm(FlaskForm):
tiller_ns = SelectField('tiller_ns', choices=[], coerce=str)
namespace = SelectField('namespace', choices=[], coerce=str)

View File

@ -69,7 +69,6 @@ def get_chartdata(tiller_ns, namespace, chart):
command = "/usr/local/bin/helm --tiller-namespace " + tiller_ns + " history " + chart + " --output json" #helm2
#command = "/usr/local/bin/helm -n " + namespace + " history " + chart + " -ojson" #helm3
info(f"Running command: {command}")
print(f"Running command: {command}")
try:
output = check_output(command.split(" "), stderr=STDOUT).decode("utf-8")
except CalledProcessError as err:
@ -79,7 +78,7 @@ def get_chartdata(tiller_ns, namespace, chart):
data = json.loads(output)
for revision in data:
revision["namespace"] = namespace
print(data[0])
revision["tiller_ns"] = tiller_ns
return data
if __name__ == "__main__":

View File

@ -26,15 +26,12 @@ def chartVersions():
return render_template('chartRevisionList.html', table=table, namespace=namespace)
@routes.route('/nsLookup/<tiller>/<namespace>')
def namespaceLookup(tiller, namespace):
charts = get_charts(tiller, namespace)
@routes.route('/nsLookup/<tiller>/<namespace>/<tiller_ns>')
def namespaceLookup(tiller, namespace, tiller_ns):
charts = get_charts(tiller, namespace, tiller_ns)
return jsonify(charts)
@routes.route('/deployChartRevision/<revision>/<chart>/<namespace>', methods=['POST'])
def deployChartRevision(revision, chart, namespace):
print(revision)
print(chart)
print(namespace)
charts = get_charts(namespace)
@routes.route('/deployChartRevision/<revision>/<chart>/<namespace>/<tiller_ns>', methods=['POST'])
def deployChartRevision(revision, chart, namespace, tiller_ns):
charts = get_charts(tiller_ns, namespace)
return jsonify(charts)

View File

@ -1,11 +1,11 @@
from flask_table import Table, Col, LinkCol, ButtonCol
class chartVersionTable(Table):
Revision = Col('Chart Revision')
Updated = Col('Updated')
Status = Col('Status')
Namespace = Col('Namespace')
Chart = Col('Chart Version')
AppVersion = Col('Application Version')
Description = Col('Description')
deploy = ButtonCol('Deploy', 'routes.deployChartRevision', url_kwargs=dict(revision='Revision', chart='Chart', namespace='Namespace'), button_attrs={"type" : "submit", "class" : "btn btn-danger"})
revision = Col('Chart Revision')
updated = Col('Updated')
status = Col('Status')
namespace = Col('Namespace')
tiller_ns = Col('Tiiler Namespace')
chart = Col('Chart Version')
description = Col('Description')
deploy = ButtonCol('Deploy', 'routes.deployChartRevision', url_kwargs=dict(revision='revision', chart='chart', namespace='namespace', tiller_ns='tiller_ns'), button_attrs={"type" : "submit", "class" : "btn btn-danger"})