Create monitor deployment yaml file 66/112066/4
authorEric Multanen <eric.w.multanen@intel.com>
Wed, 2 Sep 2020 21:27:28 +0000 (14:27 -0700)
committerEric Multanen <eric.w.multanen@intel.com>
Thu, 10 Sep 2020 04:42:58 +0000 (21:42 -0700)
Combine all resources into a yaml file for deployment
of the monitor program in a cluster.

Issue-ID: MULTICLOUD-1065
Signed-off-by: Eric Multanen <eric.w.multanen@intel.com>
Change-Id: I4b7029bb62d01dc166ad4e25a89f99d139057e0c

deployments/kubernetes/Readme.md
deployments/kubernetes/monitor-deploy.yaml [new file with mode: 0644]

index b5a99a6..ba31983 100644 (file)
@@ -1,23 +1,41 @@
-# Steps for running v2 API microservices
+# Steps for running EMCO API microservices
 
 ### Steps to install packages
-**1. Create namespace for ONAP4K8s v2 Microservices**
+**1. Create namespace for EMCO Microservices**
 
 `$ kubectl create namespace onap4k8s`
 
-**2. Create Databases used by ONAP4K8s v2 Microservices for Etcd and Mongo**
+**2. Create Databases used by EMCO Microservices for Etcd and Mongo**
 
 `$ kubectl apply -f onap4k8sdb.yaml -n onap4k8s`
 
-**3. create ONAP4K8s v2 Microservices**
+**3. create EMCO Microservices**
 
 `$ kubectl apply -f onap4k8s.yaml -n onap4k8s`
 
 ### Steps to cleanup  packages
-**1. Cleanup ONAP4K8s v2 Microservies**
+**1. Cleanup EMCO Microservies**
 
 `$ kubectl delete -f onap4k8s.yaml -n onap4k8s`
 
-**2. Cleanup v2 Microservices for Etcd and Mongo**
+**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/monitor-deploy.yaml b/deployments/kubernetes/monitor-deploy.yaml
new file mode 100644 (file)
index 0000000..29bb1eb
--- /dev/null
@@ -0,0 +1,314 @@
+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
+          required:
+          - ready
+          - resourceCount
+          - podStatuses
+          - serviceStatuses
+          - configMapStatuses
+          - deploymentStatuses
+          - secretStatuses
+          - daemonSetStatuses
+          - ingressStatuses
+          - jobStatuses
+          - statefulSetStatuses
+          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:
+  - '*'
+
+---
+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"
+