diff options
Diffstat (limited to 'kubernetes')
21 files changed, 89 insertions, 38 deletions
diff --git a/kubernetes/README_HELM b/kubernetes/README_HELM index c1d5fdf432..0f65120397 100644 --- a/kubernetes/README_HELM +++ b/kubernetes/README_HELM @@ -3,7 +3,7 @@ Prerequisites: - Helm In order to use Helm with Rancher, check the tiller version installed -by runing "helm version" on the ranchr CLI +by running "helm version" on the rancher CLI and install the appropriate Helm. Notice both tiller and helm are installed, but you will need to install on your VM. diff --git a/kubernetes/appc/templates/appc-deployment.yaml b/kubernetes/appc/templates/appc-deployment.yaml index 8caf286043..35e947093c 100644 --- a/kubernetes/appc/templates/appc-deployment.yaml +++ b/kubernetes/appc/templates/appc-deployment.yaml @@ -5,6 +5,7 @@ metadata: name: appc namespace: "{{ .Values.nsPrefix }}-appc" spec: + replicas: {{ .Values.appcReplicas }} selector: matchLabels: app: appc diff --git a/kubernetes/appc/templates/db-deployment.yaml b/kubernetes/appc/templates/db-deployment.yaml index 607a0df81f..0b29393cb5 100644 --- a/kubernetes/appc/templates/db-deployment.yaml +++ b/kubernetes/appc/templates/db-deployment.yaml @@ -5,6 +5,7 @@ metadata: name: appc-dbhost namespace: "{{ .Values.nsPrefix }}-appc" spec: + replicas: {{ .Values.dbReplicas }} selector: matchLabels: app: appc-dbhost @@ -45,4 +46,4 @@ spec: claimName: appc-db imagePullSecrets: - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }}
\ No newline at end of file +#{{ end }} diff --git a/kubernetes/appc/templates/dgbuilder-deployment.yaml b/kubernetes/appc/templates/dgbuilder-deployment.yaml index ed69c05f38..3bbc6715aa 100644 --- a/kubernetes/appc/templates/dgbuilder-deployment.yaml +++ b/kubernetes/appc/templates/dgbuilder-deployment.yaml @@ -5,6 +5,7 @@ metadata: name: appc-dgbuilder namespace: "{{ .Values.nsPrefix }}-appc" spec: + replicas: {{ .Values.dgbuilderReplicas }} selector: matchLabels: app: appc-dgbuilder diff --git a/kubernetes/appc/values.yaml b/kubernetes/appc/values.yaml index 882267c41d..0bf4da9c09 100644 --- a/kubernetes/appc/values.yaml +++ b/kubernetes/appc/values.yaml @@ -1,9 +1,12 @@ nsPrefix: onap pullPolicy: Always nodePortPrefix: 302 +appcReplicas: 1 +dbReplicas: 1 +dgbuilderReplicas: 1 image: readiness: oomk8s/readiness-check:1.0.0 appc: nexus3.onap.org:10001/openecomp/appc-image:v1.2.0 mysqlServer: mysql/mysql-server:5.6 dgbuilderSdnc: nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:v0.1.0 - filebeat: docker.elastic.co/beats/filebeat:5.5.0
\ No newline at end of file + filebeat: docker.elastic.co/beats/filebeat:5.5.0 diff --git a/kubernetes/message-router/templates/message-router-dmaap.yaml b/kubernetes/message-router/templates/message-router-dmaap.yaml index 1d9777e760..cecf69b86f 100644 --- a/kubernetes/message-router/templates/message-router-dmaap.yaml +++ b/kubernetes/message-router/templates/message-router-dmaap.yaml @@ -5,6 +5,7 @@ metadata: name: dmaap namespace: "{{ .Values.nsPrefix }}-message-router" spec: + replicas: {{ .Values.dmaapReplicas }} selector: matchLabels: app: dmaap diff --git a/kubernetes/message-router/templates/message-router-kafka.yaml b/kubernetes/message-router/templates/message-router-kafka.yaml index 509b15fc53..94e01b31c0 100644 --- a/kubernetes/message-router/templates/message-router-kafka.yaml +++ b/kubernetes/message-router/templates/message-router-kafka.yaml @@ -5,6 +5,7 @@ metadata: name: global-kafka namespace: "{{ .Values.nsPrefix }}-message-router" spec: + replicas: {{ .Values.kafkaReplicas }} selector: matchLabels: app: global-kafka diff --git a/kubernetes/message-router/templates/message-router-zookeeper.yaml b/kubernetes/message-router/templates/message-router-zookeeper.yaml index 47cdb51f2f..5a5bc9f355 100644 --- a/kubernetes/message-router/templates/message-router-zookeeper.yaml +++ b/kubernetes/message-router/templates/message-router-zookeeper.yaml @@ -5,6 +5,7 @@ metadata: name: zookeeper namespace: "{{ .Values.nsPrefix }}-message-router" spec: + replicas: {{ .Values.zookeeperReplicas }} selector: matchLabels: app: zookeeper @@ -41,4 +42,4 @@ spec: claimName: message-router-zookeeper imagePullSecrets: - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }}
\ No newline at end of file +#{{ end }} diff --git a/kubernetes/message-router/values.yaml b/kubernetes/message-router/values.yaml index 92067294f8..6782b71746 100644 --- a/kubernetes/message-router/values.yaml +++ b/kubernetes/message-router/values.yaml @@ -1,6 +1,9 @@ nsPrefix: onap pullPolicy: Always nodePortPrefix: 302 +dmaapReplicas: 1 +kafkaReplicas: 1 +zookeeperReplicas: 1 image: readiness: oomk8s/readiness-check:1.0.0 dmaap: attos/dmaap:latest diff --git a/kubernetes/mso/templates/db-deployment.yaml b/kubernetes/mso/templates/db-deployment.yaml index e6f09c565c..cc4c656a04 100644 --- a/kubernetes/mso/templates/db-deployment.yaml +++ b/kubernetes/mso/templates/db-deployment.yaml @@ -5,6 +5,7 @@ metadata: name: mariadb namespace: "{{ .Values.nsPrefix }}-mso" spec: + replicas: {{ .Values.dbReplicas }} selector: matchLabels: app: mariadb diff --git a/kubernetes/mso/templates/mso-deployment.yaml b/kubernetes/mso/templates/mso-deployment.yaml index 580facdaa6..b4146401c4 100644 --- a/kubernetes/mso/templates/mso-deployment.yaml +++ b/kubernetes/mso/templates/mso-deployment.yaml @@ -5,7 +5,7 @@ metadata: name: mso namespace: "{{ .Values.nsPrefix }}-mso" spec: - replicas: 1 + replicas: {{ .Values.msoReplicas }} selector: matchLabels: app: mso diff --git a/kubernetes/mso/values.yaml b/kubernetes/mso/values.yaml index 73b9f31446..77d3d60edf 100644 --- a/kubernetes/mso/values.yaml +++ b/kubernetes/mso/values.yaml @@ -7,6 +7,8 @@ openStackKeyStoneUrl: "http://1.2.3.4:5000" dmaapTopic: "AUTO" openStackServiceTenantName: "service" openStackEncryptedPasswordHere: "c124921a3a0efbe579782cde8227681e" +msoReplicas: 1 +dbReplicas: 1 image: readiness: oomk8s/readiness-check:1.0.0 mso: nexus3.onap.org:10001/openecomp/mso:v1.1.1 diff --git a/kubernetes/readiness/docker/init/ready.py b/kubernetes/readiness/docker/init/ready.py index c5b55eef18..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,25 +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 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 @@ -50,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/sdnc/templates/dgbuilder-deployment.yaml b/kubernetes/sdnc/templates/dgbuilder-deployment.yaml index e0f8b298e9..b9ec155c3f 100644 --- a/kubernetes/sdnc/templates/dgbuilder-deployment.yaml +++ b/kubernetes/sdnc/templates/dgbuilder-deployment.yaml @@ -5,6 +5,7 @@ metadata: name: sdnc-dgbuilder namespace: "{{ .Values.nsPrefix }}-sdnc" spec: + replicas: {{ .Values.dgbuilderReplicas }} selector: matchLabels: app: sdnc-dgbuilder diff --git a/kubernetes/sdnc/templates/dmaap-deployment.yaml b/kubernetes/sdnc/templates/dmaap-deployment.yaml index b9ba346156..eb6f354abd 100644 --- a/kubernetes/sdnc/templates/dmaap-deployment.yaml +++ b/kubernetes/sdnc/templates/dmaap-deployment.yaml @@ -5,6 +5,7 @@ metadata: name: dmaap-listener namespace: "{{ .Values.nsPrefix }}-sdnc" spec: + replicas: {{ .Values.dmaapReplicas }} selector: matchLabels: app: dmaap-listener diff --git a/kubernetes/sdnc/templates/nfs-provisoner-deployment.yaml b/kubernetes/sdnc/templates/nfs-provisoner-deployment.yaml index 9d3feeff9c..a283d0f626 100644 --- a/kubernetes/sdnc/templates/nfs-provisoner-deployment.yaml +++ b/kubernetes/sdnc/templates/nfs-provisoner-deployment.yaml @@ -5,7 +5,7 @@ metadata: name: nfs-provisioner namespace: "{{ .Values.nsPrefix }}-sdnc" spec: - replicas: 1 + replicas: {{ .Values.nfsReplicas }} strategy: type: Recreate template: diff --git a/kubernetes/sdnc/templates/ueb-deployment.yaml b/kubernetes/sdnc/templates/ueb-deployment.yaml index a7e5e748bd..c109acdaef 100644 --- a/kubernetes/sdnc/templates/ueb-deployment.yaml +++ b/kubernetes/sdnc/templates/ueb-deployment.yaml @@ -5,6 +5,7 @@ metadata: name: ueb-listener namespace: "{{ .Values.nsPrefix }}-sdnc" spec: + replicas: {{ .Values.uebReplicas }} selector: matchLabels: app: ueb-listener diff --git a/kubernetes/sdnc/templates/web-deployment.yaml b/kubernetes/sdnc/templates/web-deployment.yaml index 7e8b59c1eb..73d8e0a6cb 100644 --- a/kubernetes/sdnc/templates/web-deployment.yaml +++ b/kubernetes/sdnc/templates/web-deployment.yaml @@ -5,6 +5,7 @@ metadata: name: sdnc-portal namespace: "{{ .Values.nsPrefix }}-sdnc" spec: + replicas: {{ .Values.portalReplicas }} selector: matchLabels: app: sdnc-portal diff --git a/kubernetes/sdnc/values.yaml b/kubernetes/sdnc/values.yaml index 395970957a..e91dc2a4cf 100644 --- a/kubernetes/sdnc/values.yaml +++ b/kubernetes/sdnc/values.yaml @@ -14,5 +14,10 @@ image: enableODLCluster: false numberOfODLReplicas: 1 numberOfDbReplicas: 1 +dgbuilderReplicas: 1 +dmaapReplicas: 1 +nfsReplicas: 1 +uebReplicas: 1 +portalReplicas: 1 disableSdncSdncDgbuilder: false disableSdncSdncPortal: false diff --git a/kubernetes/vid/templates/vid-pv-pvc.yaml b/kubernetes/vid/templates/vid-pv-pvc.yaml index f513a87354..3315d093e3 100644 --- a/kubernetes/vid/templates/vid-pv-pvc.yaml +++ b/kubernetes/vid/templates/vid-pv-pvc.yaml @@ -13,7 +13,7 @@ spec: - ReadWriteMany persistentVolumeReclaimPolicy: Retain hostPath: - path: /dockerdata-nfs/{{ .Values.nsPrefix }}/vid/mariadb/data + path: {{ .Values.dataRootDir }}/{{ .Values.nsPrefix }}/vid/mariadb/data --- kind: PersistentVolumeClaim apiVersion: v1 @@ -29,4 +29,4 @@ spec: selector: matchLabels: name: "{{ .Values.nsPrefix }}-vid-db" -#{{ end }}
\ No newline at end of file +#{{ end }} diff --git a/kubernetes/vid/values.yaml b/kubernetes/vid/values.yaml index 9b1748f507..6e7b023df4 100644 --- a/kubernetes/vid/values.yaml +++ b/kubernetes/vid/values.yaml @@ -1,8 +1,9 @@ nsPrefix: onap pullPolicy: Always nodePortPrefix: 302 +dataRootDir: /dockerdata-nfs image: readiness: oomk8s/readiness-check:1.0.0 mariadb: nexus3.onap.org:10001/library/mariadb:10 vid: nexus3.onap.org:10001/openecomp/vid:v1.1.1 - filebeat: docker.elastic.co/beats/filebeat:5.5.0
\ No newline at end of file + filebeat: docker.elastic.co/beats/filebeat:5.5.0 |