Skip to content

Commit

Permalink
Kfserving component service account option (#3852)
Browse files Browse the repository at this point in the history
* AUpdate component yaml with sa input

* Add service account arg to kfservingdeployer..py

* Add sservice_account to deploy model request

* Update kfserving SDK to 0.2.2

* Black formatting kfservingdeployer.py

* Black formatting app.py

* Update Kfserving sdk to 0.3.0

* Add service_account to Endpointspec

* Add service_account to Endpointspecs
  • Loading branch information
Leonard Aukea committed May 29, 2020
1 parent f7acb71 commit 8d738ea
Show file tree
Hide file tree
Showing 4 changed files with 249 additions and 97 deletions.
2 changes: 1 addition & 1 deletion components/kubeflow/kfserving/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.6-slim

RUN pip3 install kubernetes==10.0.1 kfserving==0.2.1 requests==2.22.0 Flask==1.1.1 flask-cors==3.0.8
RUN pip3 install kubernetes==10.0.1 kfserving==0.3.0 requests==2.22.0 Flask==1.1.1 flask-cors==3.0.8

ENV APP_HOME /app
COPY src $APP_HOME
Expand Down
4 changes: 3 additions & 1 deletion components/kubeflow/kfserving/component.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ inputs:
- {name: Canary Custom Model Spec, type: String, default: '{}', description: 'Custom runtime canary custom model container spec.'}
- {name: Autoscaling Target, type: String, default: '0', description: 'Autoscaling Target Number'}
- {name: KFServing Endpoint, type: String, default: '', description: 'KFServing remote deployer API endpoint'}
- {name: Service Account, type: String, default: '', description: 'Model Service Account'}
outputs:
- {name: Service Endpoint URI, type: String, description: 'URI of the deployed prediction service..'}
implementation:
Expand All @@ -31,5 +32,6 @@ implementation:
--canary-custom-model-spec, {inputValue: Canary Custom Model Spec},
--kfserving-endpoint, {inputValue: KFServing Endpoint},
--autoscaling-target, {inputValue: Autoscaling Target},
--output_path, {outputPath: Service Endpoint URI}
--service-account, {inputValue: Service Account},
--output-path, {outputPath: Service Endpoint URI}
]
39 changes: 21 additions & 18 deletions components/kubeflow/kfserving/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,36 @@
CORS(app)


@app.route('/deploy-model', methods=['POST'])
@app.route("/deploy-model", methods=["POST"])
def deploy_model_post():
if not request.json:
abort(400)
return json.dumps(deploy_model(
action=request.json['action'],
model_name=request.json['model_name'],
default_model_uri=request.json['default_model_uri'],
canary_model_uri=request.json['canary_model_uri'],
canary_model_traffic=request.json['canary_model_traffic'],
namespace=request.json['namespace'],
framework=request.json['framework'],
default_custom_model_spec=request.json['default_custom_model_spec'],
canary_custom_model_spec=request.json['canary_custom_model_spec'],
autoscaling_target=request.json['autoscaling_target']
))


@app.route('/', methods=['GET'])
return json.dumps(
deploy_model(
action=request.json["action"],
model_name=request.json["model_name"],
default_model_uri=request.json["default_model_uri"],
canary_model_uri=request.json["canary_model_uri"],
canary_model_traffic=request.json["canary_model_traffic"],
namespace=request.json["namespace"],
framework=request.json["framework"],
default_custom_model_spec=request.json["default_custom_model_spec"],
canary_custom_model_spec=request.json["canary_custom_model_spec"],
autoscaling_target=request.json["autoscaling_target"],
service_account=request.json["service_account"],
)
)


@app.route("/", methods=["GET"])
def root_get():
return 200


@app.route('/', methods=['OPTIONS'])
@app.route("/", methods=["OPTIONS"])
def root_options():
return "200"


if __name__ == "__main__":
app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
app.run(debug=True, host="0.0.0.0", port=int(os.environ.get("PORT", 8080)))
Loading

0 comments on commit 8d738ea

Please sign in to comment.