Skip to content

Commit e632760

Browse files
author
lijianguo
committed
chore(helmbroker): fixup configMap
1 parent f085f8f commit e632760

6 files changed

Lines changed: 20 additions & 4 deletions

File tree

charts/helmbroker/templates/_helpers.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
env:
44
- name: "TZ"
55
value: {{ .Values.time_zone | default "UTC" | quote }}
6+
- name: USERNAME:
7+
{{ if .Values.username | default "" | ne "" }}{{ .Values.username | b64enc }}{{ else }}{{ randAlphaNum 32 | b64enc }}{{ end }}
8+
- name: PASSWORD:
9+
{{ if .Values.password | default "" | ne "" }}{{ .Values.password | b64enc }}{{ else }}{{ randAlphaNum 32 | b64enc }}{{ end }}
610
{{- range $key, $value := .Values.environment }}
711
- name: {{ $key }}
812
value: {{ $value | quote }}

charts/helmbroker/values.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ repositories: {}
1111
#- name: drycc-helm-broker
1212
# url: http://helm-broker.drycc.cc/index-drycc.yaml
1313

14+
# broker_credentials:
15+
# Optional Usernames and passwords that will be required to communicate with service broker
16+
username: admin
17+
password: admin
18+
1419
persistence:
15-
enabled: false
20+
enabled: true
1621
accessMode: ReadWriteMany
1722
size: 5Gi
1823
storageClass: ""

rootfs/helmbroker/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
CONFIG_PATH = os.path.join(HELMBROKER_ROOT, 'config')
77
INSTANCES_PATH = os.path.join(HELMBROKER_ROOT, 'instances')
88

9+
USERNAME = os.environ.get('USERNAME')
10+
PASSWORD = os.environ.get('PASSWORD')
11+
912

1013
class Config:
1114
DEBUG = os.environ.get("DEBUG", False)

rootfs/helmbroker/loader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def addons_meta_file():
6666
for addon_meta in addons_meta:
6767
with open(f'{ADDONS_PATH}/{"/".join(addon_meta)}', 'r') as f:
6868
meta = yaml.load(f.read(), Loader=yaml.Loader)
69+
meta['tags'] = meta.get('tags').split(', ') if meta.get('tags') else [] # noqa
6970
meta['plans'] = []
7071
addons_dict[meta['name']] = meta
7172

rootfs/helmbroker/meta.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,4 @@ def dump_addons_meta(data):
136136
file = os.path.join(ADDONS_PATH, "addons.json")
137137
validate(instance=data, schema=INSTANCE_META_SCHEMA)
138138
with open(file, "w") as f:
139-
print("save addons.json")
140139
f.write(json.dumps(data, sort_keys=True, indent=2))

rootfs/helmbroker/wsgi.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from flask import Flask, make_response
33
from openbrokerapi import api, log_util
44
from helmbroker.broker import HelmServiceBroker
5-
from helmbroker.config import Config
5+
from helmbroker.config import Config, USERNAME, PASSWORD
66

77
application = Flask("helmbroker")
88

@@ -24,4 +24,8 @@ def readiness():
2424

2525

2626
application.config.from_object(Config)
27-
application.register_blueprint(api.get_blueprint(HelmServiceBroker(), api.BrokerCredentials("", ""), log_util.basic_config())) # noqa
27+
catalog_api = api.get_blueprint(
28+
HelmServiceBroker(),
29+
api.BrokerCredentials(USERNAME, PASSWORD),
30+
log_util.basic_config())
31+
application.register_blueprint(catalog_api)

0 commit comments

Comments
 (0)