-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwsgi.py
More file actions
31 lines (24 loc) · 865 Bytes
/
wsgi.py
File metadata and controls
31 lines (24 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
from flask import Flask, make_response
from openbrokerapi import api, log_util
from helmbroker.broker import HelmServiceBroker
from helmbroker.config import Config, USERNAME, PASSWORD
application = Flask("helmbroker")
@application.route("/healthz")
def healthz():
return "OK"
@application.route("/readiness")
def readiness():
if "KUBECONFIG" in os.environ:
return "OK"
elif "KUBERNETES_SERVICE_PORT" in os.environ and \
("KUBERNETES_SERVICE_HOST" in os.environ or
"KUBERNETES_CLUSTER_DOMAIN" in os.environ):
return "OK"
return make_response("kubernetes not available", 500)
application.config.from_object(Config)
catalog_api = api.get_blueprint(
HelmServiceBroker(),
api.BrokerCredentials(USERNAME, PASSWORD),
log_util.basic_config())
application.register_blueprint(catalog_api)