Fix DNS name list for kube services in certs

* Also adds liveness and readiness probes for Prom deployment

Change-Id: Id65d1e555e14478f2439c14dd6d6d7952411256d
This commit is contained in:
Mark Burnett 2018-02-14 12:46:33 -06:00
parent 5240aca78c
commit b4449434a5
4 changed files with 58 additions and 17 deletions

View File

@ -56,6 +56,23 @@ spec:
ports:
- name: api-public
containerPort: {{ .Values.network.api.port }}
livenessProbe:
failureThreshold: 5
httpGet:
path: /api/v1.0/health
port: {{ .Values.network.api.target_port }}
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /api/v1.0/health
port: {{ .Values.network.api.target_port }}
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 5
volumeMounts:
- name: promenade-etc
mountPath: /etc/promenade/api-paste.ini

View File

@ -24,7 +24,7 @@ class Generator:
for cert_def in ca_def.get('certificates', []):
hosts = cert_def.get('hosts', [])
hosts.extend(
self.get_host_list(
get_host_list(
cert_def.get('kubernetes_service_names', [])))
self.gen(
'certificate',
@ -37,26 +37,19 @@ class Generator:
self.gen('keypair', keypair_def['name'])
_write(output_dir, self.documents)
def get_host_list(self, service_names):
service_list = []
for service in service_names:
parts = service.split('.')
for i in range(len(parts)):
service_list.append('.'.join(parts[:i]))
return service_list
def gen(self, kind, *args, **kwargs):
method = getattr(self.keys, 'generate_' + kind)
self.documents.extend(method(*args, **kwargs))
def _service_dns(self, name, namespace):
return [
name,
'.'.join([name, namespace]),
'.'.join([name, namespace, 'svc']),
'.'.join([name, namespace, 'svc', self.cluster_domain]),
]
def get_host_list(service_names):
service_list = []
for service in service_names:
parts = service.split('.')
for i in range(len(parts)):
service_list.append('.'.join(parts[:i + 1]))
return service_list
def _write(output_dir, docs):

View File

@ -0,0 +1,31 @@
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from promenade import generator
def test_get_host_list():
service_fqdns = [
'kubernetes.default.svc.cluster.local',
]
expected_parts = [
'kubernetes',
'kubernetes.default',
'kubernetes.default.svc',
'kubernetes.default.svc.cluster',
'kubernetes.default.svc.cluster.local',
]
actual_parts = generator.get_host_list(service_fqdns)
assert actual_parts == expected_parts

View File

@ -2,7 +2,7 @@
envlist = lint,unit,bandit,docs
[testenv]
basepython=python3.5
basepython=python3
[testenv:unit]
setenv =