Skip to content

Commit

Permalink
Helm views
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Tengler authored and Adam Tengler committed Jan 24, 2018
1 parent bd193fb commit a4ed98a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
38 changes: 38 additions & 0 deletions kqueen/blueprints/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from flask_jwt import jwt_required
from importlib import import_module
from kqueen.auth import encrypt_password
from kqueen.helm import HelmWrapper
from kqueen.models import Cluster
from kqueen.models import Organization
from kqueen.models import Provisioner
Expand Down Expand Up @@ -398,3 +399,40 @@ def swagger_json():
abort(500)

return jsonify(data)


# Helm

@api.route('/clusters/<uuid:pk>/helm/install', methods=['POST'])
@jwt_required()
def helm_install(pk):
obj = get_object(Cluster, pk, current_identity)

data = request.json
if not isinstance(data, dict) or (isinstance(data, dict) and 'name' not in data):
abort(400)

helm = HelmWrapper(obj.kubeconfig)
return jsonify(helm.install(data['name']))


@api.route('/clusters/<uuid:pk>/helm/delete', methods=['POST'])
@jwt_required()
def helm_delete(pk):
obj = get_object(Cluster, pk, current_identity)

data = request.json
if not isinstance(data, dict) or (isinstance(data, dict) and 'name' not in data):
abort(400)

helm = HelmWrapper(obj.kubeconfig)
return jsonify(helm.delete(data['name']))


@api.route('/clusters/<uuid:pk>/helm/list', methods=['GET'])
@jwt_required()
def helm_list(pk):
obj = get_object(Cluster, pk, current_identity)

helm = HelmWrapper(obj.kubeconfig)
return jsonify(helm.list())
4 changes: 4 additions & 0 deletions kqueen/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,7 @@ def repo_update(self):
def reset(self):
raw = self._call('helm reset')
return self._no_parse(raw)

def version(self):
raw = self._call('helm version')
return self._no_parse(raw)

0 comments on commit a4ed98a

Please sign in to comment.