Skip to content

Commit 7698eb9

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 94d6c66 + 212412d commit 7698eb9

File tree

5 files changed

+39
-15
lines changed

5 files changed

+39
-15
lines changed

rootfs/api/management/commands/load_db_state_to_k8s.py

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def save_apps(self):
4848
try:
4949
app.save()
5050
app.config_set.latest().save()
51+
app.tls_set.latest().sync()
5152
except DeisException as error:
5253
print('ERROR: Problem saving to model {} for {}'
5354
'due to {}'.format(str(App.__name__), str(app), str(error)))

rootfs/api/models/app.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ def create(self, *args, **kwargs): # noqa
198198
try:
199199
self._scheduler.ns.get(namespace)
200200
except KubeException:
201-
self._scheduler.ns.create(namespace)
201+
try:
202+
self._scheduler.ns.create(namespace)
203+
except KubeException as e:
204+
raise ServiceUnavailable('Could not create the Namespace in Kubernetes') from e
205+
202206
if settings.KUBERNETES_NAMESPACE_DEFAULT_QUOTA_SPEC != '':
203207
quota_spec = json.loads(settings.KUBERNETES_NAMESPACE_DEFAULT_QUOTA_SPEC)
204208
self.log('creating Quota {} for namespace {}'.format(quota_name, namespace),

rootfs/api/models/tls.py

+25-6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ class Meta:
1818
def __str__(self):
1919
return "{}-{}".format(self.app.id, str(self.uuid)[:7])
2020

21+
def _load_service_config(self, app, component):
22+
config = super()._load_service_config(app, component)
23+
24+
# See if the ssl.enforce annotation is available
25+
if 'ssl' not in config:
26+
config['ssl'] = {}
27+
if 'enforce' not in config['ssl']:
28+
config['ssl']['enforce'] = 'false'
29+
30+
return config
31+
2132
def _check_previous_tls_settings(self):
2233
try:
2334
previous_tls_settings = self.app.tls_set.latest()
@@ -40,16 +51,24 @@ def save(self, *args, **kwargs):
4051
# get config for the service
4152
config = self._load_service_config(app, 'router')
4253

43-
# See if the ssl.enforce annotation is available
44-
if 'ssl' not in config:
45-
config['ssl'] = {}
46-
if 'enforce' not in config['ssl']:
47-
config['ssl']['enforce'] = 'false'
48-
4954
# convert from bool to string
5055
config['ssl']['enforce'] = str(https_enforced)
5156

5257
self._save_service_config(app, 'router', config)
5358

5459
# Save to DB
5560
return super(TLS, self).save(*args, **kwargs)
61+
62+
def sync(self):
63+
try:
64+
app = str(self.app)
65+
66+
config = self._load_service_config(app, 'router')
67+
if (
68+
config['ssl']['enforce'] != str(self.https_enforced) and
69+
self.https_enforced is not None
70+
):
71+
config['ssl']['enforce'] = str(self.https_enforced)
72+
self._save_service_config(app, 'router', config)
73+
except TLS.DoesNotExist:
74+
pass

rootfs/dev_requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Run "make test-unit" for the % of code exercised during tests
2-
coverage==4.3.4
2+
coverage==4.4.1
33

44
# Run "make test-style" to check python syntax and style
55
flake8==3.3.0

rootfs/requirements.txt

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# Deis controller requirements
22
backoff==1.4.3
3-
Django==1.11.2
4-
django-auth-ldap==1.2.12
3+
Django==1.11.4
4+
django-auth-ldap==1.2.14
55
django-cors-middleware==1.3.1
6-
django-guardian==1.4.8
6+
django-guardian==1.4.9
77
djangorestframework==3.6.3
88
docker-py==1.10.6
99
gunicorn==19.7.1
1010
idna==2.5
1111
jmespath==0.9.3
12-
jsonfield==2.0.1
12+
jsonfield==2.0.2
1313
jsonschema==2.6.0
1414
morph==0.1.2
1515
ndg-httpsclient==0.4.2
1616
packaging==16.8
1717
pyasn1==0.2.3
1818
psycopg2==2.7.1
19-
pyldap==2.4.35.1
20-
pyOpenSSL==17.0.0
19+
pyldap==2.4.37
20+
pyOpenSSL==17.2.0
2121
pytz==2017.2
22-
requests==2.14.2
22+
requests==2.18.2
2323
requests-toolbelt==0.8.0

0 commit comments

Comments
 (0)