aboutsummaryrefslogtreecommitdiffstats
path: root/src/monitor/deploy
diff options
context:
space:
mode:
authorKiran Kamineni <kiran.k.kamineni@intel.com>2019-07-31 15:32:28 -0700
committerKiran Kamineni <kiran.k.kamineni@intel.com>2019-08-28 12:45:14 -0700
commitab8c95eff5c1228237f758d3ccfc99c751f713f7 (patch)
treea950ac5356f547434f24c8cc3bf53f3620e84a74 /src/monitor/deploy
parentdcace0784979890bb986fb078348b4b3ceef146c (diff)
Adding monitor operator to monitor edge resources
Add an operator to monitor resources at the edge location. The operator listens to pods and services right now and stores their information in a CustomResource Issue-ID: MULTICLOUD-675 Change-Id: I801478a77fcd019010ea1b4388d6077f63b89d05 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'src/monitor/deploy')
-rw-r--r--src/monitor/deploy/crds/k8splugin_v1alpha1_resourcebundlestate_cr.yaml13
-rw-r--r--src/monitor/deploy/crds/k8splugin_v1alpha1_resourcebundlestate_crd.yaml71
-rw-r--r--src/monitor/deploy/operator.yaml33
-rw-r--r--src/monitor/deploy/role.yaml60
-rw-r--r--src/monitor/deploy/role_binding.yaml11
-rw-r--r--src/monitor/deploy/service_account.yaml4
6 files changed, 192 insertions, 0 deletions
diff --git a/src/monitor/deploy/crds/k8splugin_v1alpha1_resourcebundlestate_cr.yaml b/src/monitor/deploy/crds/k8splugin_v1alpha1_resourcebundlestate_cr.yaml
new file mode 100644
index 00000000..9e6e42d3
--- /dev/null
+++ b/src/monitor/deploy/crds/k8splugin_v1alpha1_resourcebundlestate_cr.yaml
@@ -0,0 +1,13 @@
+apiVersion: k8splugin.io/v1alpha1
+kind: ResourceBundleState
+metadata:
+ name: example-resourcebundlestate
+ namespace: test
+ labels:
+ "k8splugin.io/rb-inst-id": "bionic-beaver"
+spec:
+ selector:
+ matchLabels:
+ "k8splugin.io/rb-inst-id": "bionic-beaver"
+status:
+ ready: false
diff --git a/src/monitor/deploy/crds/k8splugin_v1alpha1_resourcebundlestate_crd.yaml b/src/monitor/deploy/crds/k8splugin_v1alpha1_resourcebundlestate_crd.yaml
new file mode 100644
index 00000000..68585a32
--- /dev/null
+++ b/src/monitor/deploy/crds/k8splugin_v1alpha1_resourcebundlestate_crd.yaml
@@ -0,0 +1,71 @@
+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:
+ properties:
+ metadata:
+ type: object
+ ready:
+ type: boolean
+ status:
+ type: object
+ required:
+ - ready
+ type: object
+ type: array
+ ready:
+ type: boolean
+ resourceCount:
+ format: int32
+ type: integer
+ serviceStatuses:
+ items:
+ type: object
+ type: array
+ required:
+ - ready
+ - resourceCount
+ - podStatuses
+ - serviceStatuses
+ type: object
+ version: v1alpha1
+ versions:
+ - name: v1alpha1
+ served: true
+ storage: true
diff --git a/src/monitor/deploy/operator.yaml b/src/monitor/deploy/operator.yaml
new file mode 100644
index 00000000..9affeaaa
--- /dev/null
+++ b/src/monitor/deploy/operator.yaml
@@ -0,0 +1,33 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: monitor
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ name: monitor
+ template:
+ metadata:
+ labels:
+ name: monitor
+ spec:
+ serviceAccountName: monitor
+ containers:
+ - name: monitor
+ # Replace this with the built image name
+ image: k8splugin.io/monitor:latest
+ command:
+ - monitor
+ imagePullPolicy: IfNotPresent
+ env:
+ - name: WATCH_NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: POD_NAME
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.name
+ - name: OPERATOR_NAME
+ value: "monitor"
diff --git a/src/monitor/deploy/role.yaml b/src/monitor/deploy/role.yaml
new file mode 100644
index 00000000..4d0fd1b6
--- /dev/null
+++ b/src/monitor/deploy/role.yaml
@@ -0,0 +1,60 @@
+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:
+ - '*'
diff --git a/src/monitor/deploy/role_binding.yaml b/src/monitor/deploy/role_binding.yaml
new file mode 100644
index 00000000..69cd2935
--- /dev/null
+++ b/src/monitor/deploy/role_binding.yaml
@@ -0,0 +1,11 @@
+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
diff --git a/src/monitor/deploy/service_account.yaml b/src/monitor/deploy/service_account.yaml
new file mode 100644
index 00000000..ba9b61cc
--- /dev/null
+++ b/src/monitor/deploy/service_account.yaml
@@ -0,0 +1,4 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: monitor