diff options
Diffstat (limited to 'deployments/kubernetes')
-rw-r--r-- | deployments/kubernetes/Readme.md | 45 | ||||
-rwxr-xr-x | deployments/kubernetes/cleanup-emco.sh | 19 | ||||
-rw-r--r-- | deployments/kubernetes/monitor-deploy.yaml | 325 | ||||
-rw-r--r-- | deployments/kubernetes/onap4k8s.yaml | 96 |
4 files changed, 471 insertions, 14 deletions
diff --git a/deployments/kubernetes/Readme.md b/deployments/kubernetes/Readme.md index d2d3d801..ba319837 100644 --- a/deployments/kubernetes/Readme.md +++ b/deployments/kubernetes/Readme.md @@ -1,4 +1,41 @@ -# Steps for running v2 API microservices -$kubectl create namespace onap4k8s -$kubectl apply -f onap4k8sdb.yaml -n onap4k8s -$kubectl apply -f onap4k8s.yaml -n onap4k8s +# Steps for running EMCO API microservices + +### Steps to install packages +**1. Create namespace for EMCO Microservices** + +`$ kubectl create namespace onap4k8s` + +**2. Create Databases used by EMCO Microservices for Etcd and Mongo** + +`$ kubectl apply -f onap4k8sdb.yaml -n onap4k8s` + +**3. create EMCO Microservices** + +`$ kubectl apply -f onap4k8s.yaml -n onap4k8s` + +### Steps to cleanup packages +**1. Cleanup EMCO Microservies** + +`$ kubectl delete -f onap4k8s.yaml -n onap4k8s` + +**2. Cleanup EMCO Microservices for Etcd and Mongo** + +`$ kubectl delete -f onap4k8sdb.yaml -n onap4k8s` + +# Steps for running the monitor microservice in clusters + +The EMCO microservices utilize the monitor microservice to collect +status information from clusters to which EMCO deploys applications. +It must be installed in each cluster to which EMCO deploys applications. + +### Steps to install monitor in a cluster + +**1. Instantiate the monitor resources + + $ kubectl apply -f monitor-deploy.yaml + +### Steps to cleanup monitor in a cluster + +**1. Cleanup the monitor resources + + $ kubectl delete -f monitor-deploy.yaml diff --git a/deployments/kubernetes/cleanup-emco.sh b/deployments/kubernetes/cleanup-emco.sh new file mode 100755 index 00000000..4572350d --- /dev/null +++ b/deployments/kubernetes/cleanup-emco.sh @@ -0,0 +1,19 @@ +# To clean up composite vfw demo resources in a cluster +kubectl -n onap4k8s delete deployment clm +kubectl -n onap4k8s delete deployment orchestrator +kubectl -n onap4k8s delete deployment ncm +kubectl -n onap4k8s delete deployment ovnaction +kubectl -n onap4k8s delete deployment dcm +kubectl -n onap4k8s delete deployment rsync +kubectl -n onap4k8s delete service clm +kubectl -n onap4k8s delete service orchestrator +kubectl -n onap4k8s delete service ncm +kubectl -n onap4k8s delete service ovnaction +kubectl -n onap4k8s delete service dcm +kubectl -n onap4k8s delete service rsync +kubectl -n onap4k8s delete configmap clm +kubectl -n onap4k8s delete configmap orchestrator +kubectl -n onap4k8s delete configmap ncm +kubectl -n onap4k8s delete configmap ovnaction +kubectl -n onap4k8s delete configmap dcm +kubectl -n onap4k8s delete configmap rsync diff --git a/deployments/kubernetes/monitor-deploy.yaml b/deployments/kubernetes/monitor-deploy.yaml new file mode 100644 index 00000000..ef8e5ec3 --- /dev/null +++ b/deployments/kubernetes/monitor-deploy.yaml @@ -0,0 +1,325 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: resourcebundlestates.k8splugin.io +spec: + group: k8splugin.io + names: + kind: ResourceBundleState + listKind: ResourceBundleStateList + plural: resourcebundlestates + singular: resourcebundlestate + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + selector: + type: object + required: + - selector + type: object + status: + properties: + podStatuses: + items: + type: object + type: array + ready: + type: boolean + resourceCount: + format: int32 + type: integer + serviceStatuses: + items: + type: object + type: array + configMapStatuses: + items: + type: object + type: array + deploymentStatuses: + items: + type: object + type: array + secretStatuses: + items: + type: object + type: array + daemonSetStatuses: + items: + type: object + type: array + ingressStatuses: + items: + type: object + type: array + jobStatuses: + items: + type: object + type: array + statefulSetStatuses: + items: + type: object + type: array + csrStatuses: + items: + type: object + type: array + required: + - ready + - resourceCount + - podStatuses + - serviceStatuses + - configMapStatuses + - deploymentStatuses + - secretStatuses + - daemonSetStatuses + - ingressStatuses + - jobStatuses + - statefulSetStatuses + - csrStatuses + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + creationTimestamp: null + name: monitor +rules: +- apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - '*' +- apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' +- apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - create +- apiGroups: + - apps + resourceNames: + - monitor + resources: + - deployments/finalizers + verbs: + - update +- apiGroups: + - "" + resources: + - pods + verbs: + - get +- apiGroups: + - apps + resources: + - replicasets + verbs: + - get +- apiGroups: + - k8splugin.io + resources: + - '*' + verbs: + - '*' +- apiGroups: + - batch + resources: + - '*' + verbs: + - '*' +- apiGroups: + - extensions + resources: + - '*' + verbs: + - '*' +- apiGroups: + - certificates.k8s.io + resources: + - '*' + verbs: + - '*' + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + creationTimestamp: null + name: monitor +rules: +- apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - '*' +- apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' +- apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - create +- apiGroups: + - apps + resourceNames: + - monitor + resources: + - deployments/finalizers + verbs: + - update +- apiGroups: + - "" + resources: + - pods + verbs: + - get +- apiGroups: + - apps + resources: + - replicasets + verbs: + - get +- apiGroups: + - k8splugin.io + resources: + - '*' + verbs: + - '*' +- apiGroups: + - batch + resources: + - '*' + verbs: + - '*' +- apiGroups: + - extensions + resources: + - '*' + verbs: + - '*' + +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: monitor +subjects: +- kind: ServiceAccount + name: monitor +roleRef: + kind: Role + name: monitor + apiGroup: rbac.authorization.k8s.io + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: monitor +subjects: +- kind: ServiceAccount + name: monitor + namespace: default +roleRef: + kind: ClusterRole + name: monitor + apiGroup: rbac.authorization.k8s.io + +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: monitor + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: monitor + labels: + "emco/deployment-id": "monitor" +spec: + replicas: 1 + selector: + matchLabels: + "emco/deployment-id": "monitor" + template: + metadata: + labels: + "emco/deployment-id": "monitor" + spec: + serviceAccountName: monitor + containers: + - name: monitor + # Replace this with the built image name + image: emcov2/monitor:latest + command: + - /opt/monitor/monitor + imagePullPolicy: IfNotPresent + env: + - name: WATCH_NAMESPACE + value: "" + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: "monitor" + diff --git a/deployments/kubernetes/onap4k8s.yaml b/deployments/kubernetes/onap4k8s.yaml index 1bd4ce94..1d0c55f7 100644 --- a/deployments/kubernetes/onap4k8s.yaml +++ b/deployments/kubernetes/onap4k8s.yaml @@ -31,6 +31,7 @@ spec: ports: - name: http port: 9015 + nodePort: 31298 protocol: TCP targetPort: 9015 @@ -52,8 +53,8 @@ spec: spec: containers: - name: orchestrator - image: rtsood/emco:0.0.1 - imagePullPolicy: IfNotPresent + image: emcov2/emco:stable + imagePullPolicy: Always command: ["/opt/emco/entrypoint", "orchestrator"] workingDir: /opt/emco ports: @@ -102,6 +103,7 @@ spec: ports: - name: http port: 9031 + nodePort: 32737 protocol: TCP targetPort: 9031 @@ -123,8 +125,8 @@ spec: spec: containers: - name: ncm - image: rtsood/emco:0.0.1 - imagePullPolicy: IfNotPresent + image: emcov2/emco:stable + imagePullPolicy: Always command: ["/opt/emco/entrypoint", "ncm"] workingDir: /opt/emco ports: @@ -193,8 +195,8 @@ spec: spec: containers: - name: rsync - image: rtsood/emco:0.0.1 - imagePullPolicy: IfNotPresent + image: emcov2/emco:stable + imagePullPolicy: Always command: ["/opt/emco/entrypoint", "rsync"] workingDir: /opt/emco ports: @@ -246,6 +248,7 @@ spec: targetPort: 9053 - name: http port: 9051 + nodePort: 31181 protocol: TCP targetPort: 9051 @@ -267,8 +270,8 @@ spec: spec: containers: - name: ovnaction - image: rtsood/emco:0.0.1 - imagePullPolicy: IfNotPresent + image: emcov2/emco:stable + imagePullPolicy: Always command: ["/opt/emco/entrypoint", "ovnaction"] workingDir: /opt/emco ports: @@ -318,6 +321,7 @@ spec: ports: - name: http port: 9061 + nodePort: 31856 protocol: TCP targetPort: 9061 @@ -339,8 +343,8 @@ spec: spec: containers: - name: clm - image: rtsood/emco:0.0.1 - imagePullPolicy: IfNotPresent + image: emcov2/emco:stable + imagePullPolicy: Always command: ["/opt/emco/entrypoint", "clm"] workingDir: /opt/emco ports: @@ -357,3 +361,75 @@ spec: - key: config.json path: config.json +--- +# DCM Config Map +kind: ConfigMap +apiVersion: v1 +metadata: + name: dcm + labels: + app: dcm +data: + config.json: | + { + "database-type": "mongo", + "database-ip": "mongo", + "etcd-ip": "etcd", + "service-port": "9077" + } + +--- +# DCM Service +apiVersion: v1 +kind: Service +metadata: + name: dcm + labels: + app: dcm +spec: + selector: + app: dcm + type: NodePort + ports: + - name: http + port: 9077 + nodePort: 31877 + protocol: TCP + targetPort: 9077 + +--- +# DCM Deployment +apiVersion: apps/v1 +kind: Deployment +metadata: + name: dcm +spec: + replicas: 1 + selector: + matchLabels: + app: dcm + template: + metadata: + labels: + app: dcm + spec: + containers: + - name: dcm + image: emcov2/emco:stable + imagePullPolicy: Always + command: ["/opt/emco/entrypoint", "dcm"] + workingDir: /opt/emco + ports: + - containerPort: 9077 + volumeMounts: + - name: config + mountPath: /opt/emco/config.json + subPath: config.json + volumes: + - name: config + configMap: + name: dcm + items: + - key: config.json + path: config.json + |