From 6b072fae4535fa00956779aac636eddedc8d5455 Mon Sep 17 00:00:00 2001 From: Ritu Sood Date: Tue, 2 Jun 2020 18:41:57 +0000 Subject: Adding Kubernetes resources for v2 API Yaml file to start databases and v2 microservices Issue-ID: MULTICLOUD-1065 Signed-off-by: Ritu Sood Change-Id: I9ed4359fd972ef34e206e126e6f7a5131bd6929d --- deployments/kubernetes/Readme.md | 4 + deployments/kubernetes/onap4k8s.yaml | 359 +++++++++++++++++++++++++++++++++ deployments/kubernetes/onap4k8sdb.yaml | 87 ++++++++ 3 files changed, 450 insertions(+) create mode 100644 deployments/kubernetes/Readme.md create mode 100644 deployments/kubernetes/onap4k8s.yaml create mode 100644 deployments/kubernetes/onap4k8sdb.yaml diff --git a/deployments/kubernetes/Readme.md b/deployments/kubernetes/Readme.md new file mode 100644 index 00000000..d2d3d801 --- /dev/null +++ b/deployments/kubernetes/Readme.md @@ -0,0 +1,4 @@ +# Steps for running v2 API microservices +$kubectl create namespace onap4k8s +$kubectl apply -f onap4k8sdb.yaml -n onap4k8s +$kubectl apply -f onap4k8s.yaml -n onap4k8s diff --git a/deployments/kubernetes/onap4k8s.yaml b/deployments/kubernetes/onap4k8s.yaml new file mode 100644 index 00000000..302fd53e --- /dev/null +++ b/deployments/kubernetes/onap4k8s.yaml @@ -0,0 +1,359 @@ +# Resources to create ONAP4K8s v2 Microservices +--- +# Orchestrator Config Map +kind: ConfigMap +apiVersion: v1 +metadata: + name: orchestrator + labels: + app: orchestrator +data: + config.json: | + { + "database-type": "mongo", + "database-ip": "mongo", + "etcd-ip": "etcd", + "service-port": "9015" + } + +--- +# Orchestrator Service +apiVersion: v1 +kind: Service +metadata: + name: orchestrator + labels: + app: orchestrator +spec: + selector: + app: orchestrator + type: NodePort + ports: + - name: http + port: 9015 + protocol: TCP + targetPort: 9015 + +--- +# Orchestrator Deployment +apiVersion: apps/v1 +kind: Deployment +metadata: + name: orchestrator +spec: + replicas: 1 + selector: + matchLabels: + app: orchestrator + template: + metadata: + labels: + app: orchestrator + spec: + containers: + - name: orchestrator + image: rtsood/mco:0.0.1 + imagePullPolicy: IfNotPresent + command: ["/opt/mco/entrypoint", "mco"] + workingDir: /opt/mco + ports: + - containerPort: 9015 + volumeMounts: + - name: config + mountPath: /opt/mco/config.json + subPath: config.json + volumes: + - name: config + configMap: + name: orchestrator + items: + - key: config.json + path: config.json + +--- +# NCM Config Map +kind: ConfigMap +apiVersion: v1 +metadata: + name: ncm + labels: + app: ncm +data: + config.json: | + { + "database-type": "mongo", + "database-ip": "mongo", + "etcd-ip": "etcd", + "service-port": "9031" + } + +--- +# NCM Service +apiVersion: v1 +kind: Service +metadata: + name: ncm + labels: + app: ncm +spec: + selector: + app: ncm + type: NodePort + ports: + - name: http + port: 9031 + protocol: TCP + targetPort: 9031 + +--- +# NCM Deployment +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ncm +spec: + replicas: 1 + selector: + matchLabels: + app: ncm + template: + metadata: + labels: + app: ncm + spec: + containers: + - name: ncm + image: rtsood/mco:0.0.1 + imagePullPolicy: IfNotPresent + command: ["/opt/mco/entrypoint", "ncm"] + workingDir: /opt/mco + ports: + - containerPort: 9031 + volumeMounts: + - name: config + mountPath: /opt/mco/config.json + subPath: config.json + volumes: + - name: config + configMap: + name: ncm + items: + - key: config.json + path: config.json + +--- +# RSYNC ConfigMap +kind: ConfigMap +apiVersion: v1 +metadata: + name: rsync + labels: + app: rsync +data: + config.json: | + { + "database-type": "mongo", + "database-ip": "mongo", + "etcd-ip": "etcd" + } + +--- +# RSYNC Service +apiVersion: v1 +kind: Service +metadata: + name: rsync + labels: + app: rsync +spec: + selector: + app: rsync + type: NodePort + ports: + - name: internal + port: 9041 + protocol: TCP + targetPort: 9041 + +--- +# RSYNC Deployment +apiVersion: apps/v1 +kind: Deployment +metadata: + name: rsync +spec: + replicas: 1 + selector: + matchLabels: + app: rsync + template: + metadata: + labels: + app: rsync + spec: + containers: + - name: rsync + image: rtsood/mco:0.0.1 + imagePullPolicy: IfNotPresent + command: ["/opt/mco/entrypoint", "rsync"] + workingDir: /opt/mco + ports: + - containerPort: 9041 + volumeMounts: + - name: config + mountPath: /opt/mco/config.json + subPath: config.json + volumes: + - name: config + configMap: + name: rsync + items: + - key: config.json + path: config.json +--- +# Ovnaction Config Map +kind: ConfigMap +apiVersion: v1 +metadata: + name: ovnaction + labels: + app: ovnaction +data: + config.json: | + { + "database-type": "mongo", + "database-ip": "mongo", + "etcd-ip": "etcd", + "service-port": "9051" + } + +--- +# Ovnaction Service +apiVersion: v1 +kind: Service +metadata: + name: ovnaction + labels: + app: ovnaction +spec: + selector: + app: ovnaction + type: NodePort + ports: + - name: internal + port: 9053 + protocol: TCP + targetPort: 9053 + - name: http + port: 9051 + protocol: TCP + targetPort: 9051 + +--- +# Ovnaction Deployment +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ovnaction +spec: + replicas: 1 + selector: + matchLabels: + app: ovnaction + template: + metadata: + labels: + app: ovnaction + spec: + containers: + - name: ovnaction + image: rtsood/mco:0.0.1 + imagePullPolicy: IfNotPresent + command: ["/opt/mco/entrypoint", "ovnaction"] + workingDir: /opt/mco + ports: + - containerPort: 9053 + - containerPort: 9051 + volumeMounts: + - name: config + mountPath: /opt/mco/config.json + subPath: config.json + volumes: + - name: config + configMap: + name: ovnaction + items: + - key: config.json + path: config.json + +--- +# Clm Config Map +kind: ConfigMap +apiVersion: v1 +metadata: + name: clm + labels: + app: clm +data: + config.json: | + { + "database-type": "mongo", + "database-ip": "mongo", + "etcd-ip": "etcd", + "service-port": "9061" + } + +--- +# Clm Service +apiVersion: v1 +kind: Service +metadata: + name: clm + labels: + app: clm +spec: + selector: + app: clm + type: NodePort + ports: + - name: http + port: 9061 + protocol: TCP + targetPort: 9061 + +--- +# Clm Deployment +apiVersion: apps/v1 +kind: Deployment +metadata: + name: clm +spec: + replicas: 1 + selector: + matchLabels: + app: clm + template: + metadata: + labels: + app: clm + spec: + containers: + - name: clm + image: rtsood/mco:0.0.1 + imagePullPolicy: IfNotPresent + command: ["/opt/mco/entrypoint", "clm"] + workingDir: /opt/mco + ports: + - containerPort: 9061 + volumeMounts: + - name: config + mountPath: /opt/mco/config.json + subPath: config.json + volumes: + - name: config + configMap: + name: clm + items: + - key: config.json + path: config.json + diff --git a/deployments/kubernetes/onap4k8sdb.yaml b/deployments/kubernetes/onap4k8sdb.yaml new file mode 100644 index 00000000..c5982041 --- /dev/null +++ b/deployments/kubernetes/onap4k8sdb.yaml @@ -0,0 +1,87 @@ +# Resources to create Databases used by ONAP4K8s v2 Microservices +--- +#Etcd Service +apiVersion: v1 +kind: Service +metadata: + labels: + app: etcd + name: etcd +spec: + ports: + - name: "2379" + port: 2379 + targetPort: 2379 + - name: "2380" + port: 2380 + targetPort: 2380 + selector: + app: etcd + +--- +#Mongo Service +apiVersion: v1 +kind: Service +metadata: + labels: + app: mongo + name: mongo +spec: + ports: + - name: "27017" + port: 27017 + targetPort: 27017 + selector: + app: mongo + +--- +#Etcd Deployment +apiVersion: apps/v1 +kind: Deployment +metadata: + name: etcd +spec: + replicas: 1 + selector: + matchLabels: + app: etcd + template: + metadata: + labels: + app: etcd + spec: + containers: + - image: bitnami/etcd:3 + imagePullPolicy: IfNotPresent + name: etcd + env: + - name: "ALLOW_NONE_AUTHENTICATION" + value: "yes" + ports: + - containerPort: 2379 + - containerPort: 2380 + +--- +#Mongo Deployment +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: mongo + name: mongo +spec: + replicas: 1 + selector: + matchLabels: + app: mongo + template: + metadata: + labels: + app: mongo + spec: + containers: + - image: mongo + imagePullPolicy: IfNotPresent + name: mongo + ports: + - containerPort: 27017 -- cgit 1.2.3-korg