aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes')
-rw-r--r--kubernetes/aai/templates/aai-deployment.yaml1
-rw-r--r--kubernetes/aai/templates/aai-resources-deployment.yaml1
-rw-r--r--kubernetes/aai/templates/aai-traversal-deployment.yaml1
-rw-r--r--kubernetes/aai/templates/data-router-deployment.yaml1
-rw-r--r--kubernetes/aai/templates/elasticsearch-deployment.yaml1
-rw-r--r--kubernetes/aai/templates/hbase-deployment.yaml1
-rw-r--r--kubernetes/aai/templates/modelloader-deployment.yaml1
-rw-r--r--kubernetes/aai/templates/search-data-service-deployment.yaml1
-rw-r--r--kubernetes/aai/templates/sparky-be-deployment.yaml1
-rw-r--r--kubernetes/aai/values.yaml10
-rwxr-xr-xkubernetes/portal/templates/portal-apps-deployment.yaml1
-rwxr-xr-xkubernetes/portal/templates/portal-mariadb-deployment.yaml1
-rw-r--r--kubernetes/portal/templates/portal-vnc-dep.yaml1
-rw-r--r--kubernetes/portal/templates/portal-widgets-deployment.yaml1
-rw-r--r--kubernetes/portal/values.yaml4
-rw-r--r--kubernetes/readiness/docker/init/ready.py83
-rw-r--r--kubernetes/vid/templates/vid-mariadb-deployment.yaml1
-rw-r--r--kubernetes/vid/templates/vid-server-deployment.yaml1
-rw-r--r--kubernetes/vid/values.yaml2
19 files changed, 83 insertions, 31 deletions
diff --git a/kubernetes/aai/templates/aai-deployment.yaml b/kubernetes/aai/templates/aai-deployment.yaml
index e0e422b43a..4e8d82f42f 100644
--- a/kubernetes/aai/templates/aai-deployment.yaml
+++ b/kubernetes/aai/templates/aai-deployment.yaml
@@ -5,6 +5,7 @@ metadata:
name: aai-service
namespace: "{{ .Values.nsPrefix }}-aai"
spec:
+ replicas: {{ .Values.aaiServiceReplicas }}
selector:
matchLabels:
app: aai-service
diff --git a/kubernetes/aai/templates/aai-resources-deployment.yaml b/kubernetes/aai/templates/aai-resources-deployment.yaml
index 2e0b049d52..dd7d7cc9d9 100644
--- a/kubernetes/aai/templates/aai-resources-deployment.yaml
+++ b/kubernetes/aai/templates/aai-resources-deployment.yaml
@@ -5,6 +5,7 @@ metadata:
name: aai-resources
namespace: "{{ .Values.nsPrefix }}-aai"
spec:
+ replicas: {{ .Values.aaiResourceReplicas }}
selector:
matchLabels:
app: aai-resources
diff --git a/kubernetes/aai/templates/aai-traversal-deployment.yaml b/kubernetes/aai/templates/aai-traversal-deployment.yaml
index a61a83e042..38e7fb0847 100644
--- a/kubernetes/aai/templates/aai-traversal-deployment.yaml
+++ b/kubernetes/aai/templates/aai-traversal-deployment.yaml
@@ -5,6 +5,7 @@ metadata:
name: aai-traversal
namespace: "{{ .Values.nsPrefix }}-aai"
spec:
+ replicas: {{ .Values.aaiTraversalReplicas }}
selector:
matchLabels:
app: aai-traversal
diff --git a/kubernetes/aai/templates/data-router-deployment.yaml b/kubernetes/aai/templates/data-router-deployment.yaml
index 06dbc9118e..5a7f9e927f 100644
--- a/kubernetes/aai/templates/data-router-deployment.yaml
+++ b/kubernetes/aai/templates/data-router-deployment.yaml
@@ -5,6 +5,7 @@ metadata:
name: data-router
namespace: "{{ .Values.nsPrefix }}-aai"
spec:
+ replicas: {{ .Values.dataRouterReplicas }}
selector:
matchLabels:
app: data-router
diff --git a/kubernetes/aai/templates/elasticsearch-deployment.yaml b/kubernetes/aai/templates/elasticsearch-deployment.yaml
index baa1cb8523..d3535d07c6 100644
--- a/kubernetes/aai/templates/elasticsearch-deployment.yaml
+++ b/kubernetes/aai/templates/elasticsearch-deployment.yaml
@@ -5,6 +5,7 @@ metadata:
name: elasticsearch
namespace: "{{ .Values.nsPrefix }}-aai"
spec:
+ replicas: {{ .Values.elasticsearchReplicas }}
selector:
matchLabels:
app: elasticsearch
diff --git a/kubernetes/aai/templates/hbase-deployment.yaml b/kubernetes/aai/templates/hbase-deployment.yaml
index 3c1949c35a..5b2a98cc89 100644
--- a/kubernetes/aai/templates/hbase-deployment.yaml
+++ b/kubernetes/aai/templates/hbase-deployment.yaml
@@ -5,6 +5,7 @@ metadata:
name: hbase
namespace: "{{ .Values.nsPrefix }}-aai"
spec:
+ replicas: {{ .Values.hbaseReplicas }}
selector:
matchLabels:
app: hbase
diff --git a/kubernetes/aai/templates/modelloader-deployment.yaml b/kubernetes/aai/templates/modelloader-deployment.yaml
index 2508446334..c5a788c287 100644
--- a/kubernetes/aai/templates/modelloader-deployment.yaml
+++ b/kubernetes/aai/templates/modelloader-deployment.yaml
@@ -5,6 +5,7 @@ metadata:
name: model-loader-service
namespace: "{{ .Values.nsPrefix }}-aai"
spec:
+ replicas: {{ .Values.modelLoaderReplicas }}
selector:
matchLabels:
app: model-loader-service
diff --git a/kubernetes/aai/templates/search-data-service-deployment.yaml b/kubernetes/aai/templates/search-data-service-deployment.yaml
index 5f667106a7..7202e0d39c 100644
--- a/kubernetes/aai/templates/search-data-service-deployment.yaml
+++ b/kubernetes/aai/templates/search-data-service-deployment.yaml
@@ -5,6 +5,7 @@ metadata:
name: search-data-service
namespace: "{{ .Values.nsPrefix }}-aai"
spec:
+ replicas: {{ .Values.searchDataServiceReplicas }}
selector:
matchLabels:
app: search-data-service
diff --git a/kubernetes/aai/templates/sparky-be-deployment.yaml b/kubernetes/aai/templates/sparky-be-deployment.yaml
index 9fe324a817..e5339283ab 100644
--- a/kubernetes/aai/templates/sparky-be-deployment.yaml
+++ b/kubernetes/aai/templates/sparky-be-deployment.yaml
@@ -5,6 +5,7 @@ metadata:
name: sparky-be
namespace: "{{ .Values.nsPrefix }}-aai"
spec:
+ replicas: {{ .Values.sparkyReplicas }}
selector:
matchLabels:
app: sparky-be
diff --git a/kubernetes/aai/values.yaml b/kubernetes/aai/values.yaml
index 6912c7374a..b05859737e 100644
--- a/kubernetes/aai/values.yaml
+++ b/kubernetes/aai/values.yaml
@@ -5,7 +5,15 @@ nodePortPrefix: 302
# POLICY hotfix - Note this must be temporary
# See https://jira.onap.org/browse/POLICY-510
aaiServiceClusterIp: 10.43.255.254
-
+aaiServiceReplicas: 1
+aaiResourceReplicas: 1
+aaiTraversalReplicas: 1
+dataRouterReplicas: 1
+elasticsearchReplicas: 1
+hbaseReplicas: 1
+modelLoaderReplicas: 1
+searchDataServiceReplicas: 1
+sparkyReplicas: 1
image:
readiness: oomk8s/readiness-check:1.0.0
aaiProxy: aaionap/haproxy
diff --git a/kubernetes/portal/templates/portal-apps-deployment.yaml b/kubernetes/portal/templates/portal-apps-deployment.yaml
index b45cec4946..c6a38bd4cf 100755
--- a/kubernetes/portal/templates/portal-apps-deployment.yaml
+++ b/kubernetes/portal/templates/portal-apps-deployment.yaml
@@ -5,6 +5,7 @@ metadata:
name: portalapps
namespace: "{{ .Values.nsPrefix }}-portal"
spec:
+ replicas: {{ .Values.portalAppsReplicas }}
selector:
matchLabels:
app: portalapps
diff --git a/kubernetes/portal/templates/portal-mariadb-deployment.yaml b/kubernetes/portal/templates/portal-mariadb-deployment.yaml
index fafcad2772..9db512a120 100755
--- a/kubernetes/portal/templates/portal-mariadb-deployment.yaml
+++ b/kubernetes/portal/templates/portal-mariadb-deployment.yaml
@@ -5,6 +5,7 @@ metadata:
name: portaldb
namespace: "{{ .Values.nsPrefix }}-portal"
spec:
+ replicas: {{ .Values.portalDbReplicas }}
selector:
matchLabels:
app: portaldb
diff --git a/kubernetes/portal/templates/portal-vnc-dep.yaml b/kubernetes/portal/templates/portal-vnc-dep.yaml
index d5f433816e..3a80572238 100644
--- a/kubernetes/portal/templates/portal-vnc-dep.yaml
+++ b/kubernetes/portal/templates/portal-vnc-dep.yaml
@@ -22,6 +22,7 @@ metadata:
name: vnc-portal
namespace: "{{ .Values.nsPrefix }}-portal"
spec:
+ replicas: {{ .Values.vncPortalReplicas }}
selector:
matchLabels:
app: vnc-portal
diff --git a/kubernetes/portal/templates/portal-widgets-deployment.yaml b/kubernetes/portal/templates/portal-widgets-deployment.yaml
index 0dd92027df..6f27ef6e80 100644
--- a/kubernetes/portal/templates/portal-widgets-deployment.yaml
+++ b/kubernetes/portal/templates/portal-widgets-deployment.yaml
@@ -5,6 +5,7 @@ metadata:
name: portalwidgets
namespace: "{{ .Values.nsPrefix }}-portal"
spec:
+ replicas: {{ .Values.portalWidgetsReplicas }}
selector:
matchLabels:
app: portalwidgets
diff --git a/kubernetes/portal/values.yaml b/kubernetes/portal/values.yaml
index 34f5cc444b..f34e6a08fd 100644
--- a/kubernetes/portal/values.yaml
+++ b/kubernetes/portal/values.yaml
@@ -1,6 +1,10 @@
nsPrefix: onap
pullPolicy: Always
nodePortPrefix: 302
+portalAppsReplicas: 1
+portalDbReplicas: 1
+vncPortalReplicas: 1
+portalWidgetsReplicas: 1
image:
readiness: oomk8s/readiness-check:1.0.0
portalapps: nexus3.onap.org:10001/onap/portal-apps:v1.3.0
diff --git a/kubernetes/readiness/docker/init/ready.py b/kubernetes/readiness/docker/init/ready.py
index 7cfb6cdcde..6d2edef81c 100644
--- a/kubernetes/readiness/docker/init/ready.py
+++ b/kubernetes/readiness/docker/init/ready.py
@@ -1,8 +1,13 @@
#!/usr/bin/python
-from kubernetes import client, config
-import time, argparse, logging, sys, os
+import getopt
+import logging
+import os
+import sys
+import time
-#extract env variables.
+from kubernetes import client
+
+# extract env variables.
namespace = os.environ['NAMESPACE']
cert = os.environ['CERT']
host = os.environ['KUBERNETES_SERVICE_HOST']
@@ -11,12 +16,7 @@ token_path = os.environ['TOKEN']
with open(token_path, 'r') as token_file:
token = token_file.read().replace('\n', '')
-client.configuration.host = "https://" + host
-client.configuration.ssl_ca_cert = cert
-client.configuration.api_key['authorization'] = token
-client.configuration.api_key_prefix['authorization'] = 'Bearer'
-
-#setup logging
+# setup logging
log = logging.getLogger(__name__)
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - %(message)s'))
@@ -24,28 +24,29 @@ handler.setLevel(logging.INFO)
log.addHandler(handler)
log.setLevel(logging.INFO)
+configuration = client.Configuration()
+configuration.host = "https://" + host
+configuration.ssl_ca_cert = cert
+configuration.api_key['authorization'] = token
+configuration.api_key_prefix['authorization'] = 'Bearer'
+coreV1Api = client.CoreV1Api(client.ApiClient(configuration))
def is_ready(container_name):
- log.info( "Checking if " + container_name + " is ready")
- # config.load_kube_config() # for local testing
- # namespace='onap-sdc' # for local testing
- v1 = client.CoreV1Api()
-
ready = False
-
+ log.info("Checking if " + container_name + " is ready")
try:
- response = v1.list_namespaced_pod(namespace=namespace, watch=False)
+ response = coreV1Api.list_namespaced_pod(namespace=namespace, watch=False)
for i in response.items:
# container_statuses can be None, which is non-iterable.
if i.status.container_statuses is None:
- continue
+ continue
for s in i.status.container_statuses:
if s.name == container_name:
ready = s.ready
if not ready:
- log.info( container_name + " is not ready.")
+ log.info(container_name + " is not ready.")
else:
- log.info( container_name + " is ready!")
+ log.info(container_name + " is ready!")
else:
continue
return ready
@@ -53,27 +54,49 @@ def is_ready(container_name):
log.error("Exception when calling list_namespaced_pod: %s\n" % e)
-def main(args):
+DEF_TIMEOUT = 10
+DESCRIPTION = "Kubernetes container readiness check utility"
+USAGE = "Usage: ready.py [-t <timeout>] -c <container_name> [-c <container_name> ...]\n" \
+ "where\n" \
+ "<timeout> - wait for container readiness timeout in min, default is " + str(DEF_TIMEOUT) + "\n" \
+ "<container_name> - name of the container to wait for\n"
+
+def main(argv):
# args are a list of container names
- for container_name in args:
- # 5 min, TODO: make configurable
- timeout = time.time() + 60 * 10
+ container_names = []
+ timeout = DEF_TIMEOUT
+ try:
+ opts, args = getopt.getopt(argv, "hc:t:", ["container-name=", "timeout=", "help"])
+ for opt, arg in opts:
+ if opt in ("-h", "--help"):
+ print("%s\n\n%s" % (DESCRIPTION, USAGE))
+ sys.exit()
+ elif opt in ("-c", "--container-name"):
+ container_names.append(arg)
+ elif opt in ("-t", "--timeout"):
+ timeout = float(arg)
+ except (getopt.GetoptError, ValueError) as e:
+ print("Error parsing input parameters: %s\n" % e)
+ print(USAGE)
+ sys.exit(2)
+ if container_names.__len__() == 0:
+ print("Missing required input parameter(s)\n")
+ print(USAGE)
+ sys.exit(2)
+
+ for container_name in container_names:
+ timeout = time.time() + timeout * 60
while True:
ready = is_ready(container_name)
if ready is True:
break
elif time.time() > timeout:
- log.warning( "timed out waiting for '" + container_name + "' to be ready")
+ log.warning("timed out waiting for '" + container_name + "' to be ready")
exit(1)
else:
time.sleep(5)
if __name__ == "__main__":
- parser = argparse.ArgumentParser(description='Process some names.')
- parser.add_argument('--container-name', action='append', required=True, help='A container name')
- args = parser.parse_args()
- arg_dict = vars(args)
+ main(sys.argv[1:])
- for arg in arg_dict.itervalues():
- main(arg)
diff --git a/kubernetes/vid/templates/vid-mariadb-deployment.yaml b/kubernetes/vid/templates/vid-mariadb-deployment.yaml
index 758ee578f0..bf23c3f8b1 100644
--- a/kubernetes/vid/templates/vid-mariadb-deployment.yaml
+++ b/kubernetes/vid/templates/vid-mariadb-deployment.yaml
@@ -7,6 +7,7 @@ metadata:
name: vid-mariadb
namespace: "{{ .Values.nsPrefix }}-vid"
spec:
+ replicas: {{ .Values.vidMariaDbReplicas }}
selector:
matchLabels:
app: vid-mariadb
diff --git a/kubernetes/vid/templates/vid-server-deployment.yaml b/kubernetes/vid/templates/vid-server-deployment.yaml
index c979845fe1..7f9cb653b2 100644
--- a/kubernetes/vid/templates/vid-server-deployment.yaml
+++ b/kubernetes/vid/templates/vid-server-deployment.yaml
@@ -7,6 +7,7 @@ metadata:
name: vid-server
namespace: "{{ .Values.nsPrefix }}-vid"
spec:
+ replicas: {{ .Values.vidServerReplicas }}
selector:
matchLabels:
app: vid-server
diff --git a/kubernetes/vid/values.yaml b/kubernetes/vid/values.yaml
index 6e7b023df4..64635889cf 100644
--- a/kubernetes/vid/values.yaml
+++ b/kubernetes/vid/values.yaml
@@ -2,6 +2,8 @@ nsPrefix: onap
pullPolicy: Always
nodePortPrefix: 302
dataRootDir: /dockerdata-nfs
+vidMariaDbReplicas: 1
+vidServerReplicas: 1
image:
readiness: oomk8s/readiness-check:1.0.0
mariadb: nexus3.onap.org:10001/library/mariadb:10