Added helm rollback code
This commit is contained in:
parent
032504b14a
commit
f2187c6fc5
12
main.py
12
main.py
@ -77,9 +77,21 @@ def get_chartdata(tiller_ns, namespace, chart):
|
|||||||
info(f"Output from command:\n{output}")
|
info(f"Output from command:\n{output}")
|
||||||
data = json.loads(output)
|
data = json.loads(output)
|
||||||
for revision in data:
|
for revision in data:
|
||||||
|
revision['chartName'] = chart
|
||||||
revision["namespace"] = namespace
|
revision["namespace"] = namespace
|
||||||
revision["tiller_ns"] = tiller_ns
|
revision["tiller_ns"] = tiller_ns
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def chartRollback(revision, chart, tiller_ns)
|
||||||
|
command = "/usr/local/bin/helm --tiller-namespace " + tiller_ns + " rollback " + chart + revision # helm2
|
||||||
|
info(f"Running command: {command}")
|
||||||
|
try:
|
||||||
|
output = check_output(command.split(" "), stderr=STDOUT).decode("utf-8")
|
||||||
|
except CalledProcessError as err:
|
||||||
|
error(err.output.decode("utf-8"))
|
||||||
|
raise err
|
||||||
|
info(f"Output from command:\n{output}")
|
||||||
|
return output
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(host='0.0.0.0', port=3000, debug=True)
|
app.run(host='0.0.0.0', port=3000, debug=True)
|
||||||
|
|||||||
BIN
routes/.kube_helm_routes.py.swp
Normal file
BIN
routes/.kube_helm_routes.py.swp
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
from flask import render_template, request, jsonify
|
from flask import render_template, request, jsonify
|
||||||
from forms import deploySelectForm
|
from forms import deploySelectForm
|
||||||
from main import get_namespaces, get_charts, get_chartdata, get_tiller_namespaces
|
from main import get_namespaces, get_charts, get_chartdata, get_tiller_namespaces, chartRollback
|
||||||
from . import routes
|
from . import routes
|
||||||
from tables import chartVersionTable
|
from tables import chartVersionTable
|
||||||
import json
|
import json
|
||||||
@ -33,5 +33,5 @@ def namespaceLookup(tiller_ns, namespace):
|
|||||||
|
|
||||||
@routes.route('/deployChartRevision/<revision>/<chart>/<namespace>/<tiller_ns>', methods=['POST'])
|
@routes.route('/deployChartRevision/<revision>/<chart>/<namespace>/<tiller_ns>', methods=['POST'])
|
||||||
def deployChartRevision(revision, chart, namespace, tiller_ns):
|
def deployChartRevision(revision, chart, namespace, tiller_ns):
|
||||||
charts = get_charts(tiller_ns, namespace)
|
rollback = chartRollback(revision, chart, tiller_ns)
|
||||||
return jsonify(charts)
|
return rollback
|
||||||
|
|||||||
@ -8,4 +8,4 @@ class chartVersionTable(Table):
|
|||||||
tiller_ns = Col('Tiiler Namespace')
|
tiller_ns = Col('Tiiler Namespace')
|
||||||
chart = Col('Chart Version')
|
chart = Col('Chart Version')
|
||||||
description = Col('Description')
|
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"})
|
deploy = ButtonCol('Deploy', 'routes.deployChartRevision', url_kwargs=dict(revision='revision', chart='chartName', namespace='namespace', tiller_ns='tiller_ns'), button_attrs={"type" : "submit", "class" : "btn btn-danger"})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user