Add ingressmonitorcontroller (#8975)

* Add official ingressmonitorcontroller chart

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>

* Remove trailing space from values.yaml in ingressmonitorcontroller chart

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>

* Update chart.yaml in ingressmonitorcontroller chart

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>

* Implement chart review comments

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>

* Fix cluster role api version

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>

* Add labels in rbac

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>

* Update api version of deployment

Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
This commit is contained in:
Faizan Ahmad
2018-11-17 12:43:01 -08:00
committed by k8s-ci-robot
parent 8ce327d1a7
commit 2da0fb483b
12 changed files with 482 additions and 0 deletions
@@ -0,0 +1,23 @@
apiVersion: v1
name: ingressmonitorcontroller
version: 1.0.47
appVersion: 1.0.47
description: IngressMonitorController chart that runs on kubernetes
keywords:
- IngressMonitorController
- kubernetes
home: https://github.com/stakater/IngressMonitorController
icon: https://raw.githubusercontent.com/stakater/IngressMonitorController/master/assets/web/IMC-round-100px.png
sources:
- https://github.com/stakater/IngressMonitorController
maintainers:
- name: rasheedamir
email: rasheed@aurorasolutions.io
- name: waseem-h
email: waseemhassan@stakater.com
- name: faizanahmad055
email: faizan.ahmad55@outlook.com
- name: kahootali
email: ali.kahoot@aurorasolutions.io
- name: ahmadiq
email: ahmad@aurorasolutions.io
+100
View File
@@ -0,0 +1,100 @@
# ![](https://raw.githubusercontent.com/stakater/IngressMonitorController/master/assets/web/IMC-round-100px.png) Ingress Monitor Controller
A Kubernetes/Openshift controller to watch ingresses/routes and create liveness alerts for your apps/microservices in Uptime checkers.
[![Get started with Stakater](https://stakater.github.io/README/stakater-github-banner.png)](http://stakater.com/?utm_source=IngressMonitorController&utm_medium=github)
## Problem Statement
We want to monitor ingresses in a kubernetes cluster and routes in openshift cluster via any uptime checker but the problem is having to manually check for new ingresses or routes / removed ingresses or routes and add them to the checker or remove them.
## Solution
[IngressMonitorController](https://github.com/stakater/IngressMonitorController) will continuously watch ingresses/routes in specific or all namespaces, and automatically add / remove monitors in any of the uptime checkers. With the help of this solution, you can keep a check on your services and see whether they're up and running and live, without worrying about manually registering them on the Uptime checker.
## Supported Uptime Checkers
Currently we support the following monitors:
- [UptimeRobot](https://uptimerobot.com)
- [Pingdom](https://pingdom.com) ([Additional Config](https://github.com/stakater/IngressMonitorController/blob/master/docs/pingdom-configuration.md))
- [StatusCake](https://www.statuscake.com) ([Additional Config](https://github.com/stakater/IngressMonitorController/blob/master/docs/statuscake-configuration.md))
## Usage
The following quickstart let's you set up Ingress Monitor Controller to register uptime monitors for ingresses/routes in all namespaces:
1. Update the `values.yaml` and set the following properties
| Key | Description | Example | Default Value |
|---------------|---------------------------------------------------------------------------|------------------------------------|------------------------------------|
| useFullName | Option to use full name containing release name for resources | `false` | `false` |
| matchLabels | Match labels for deployment selector | `{}` | `{}`
| deployment.labels | Labels for deployment | `{}` | `{}`
| deployment.annotations | Annotations for deployment | `{}` | `{}`
| config.labels | Labels for configmap | `{}` | `{}`
| config.annotations | Annotations for configmap | `fabric8.io/target-platform: kubernetes` | `fabric8.io/target-platform: kubernetes`
| rbac.create | Option to create rbac resources | `true` | `true`
| rbac.labels | Labels for rbac | `{}` | `{}`
| serviceAccount.create | Option to create service account | `true` | `true`
| serviceAccount.labels | Labels for serviceAccount | `{}` | `{}`
| serviceAccount.name | Name of serviceAccount | `ingressmonitorcontroller` | `ingressmonitorcontroller`
| image.name | Image of ingressMonitorController | `stakater/ingressmonitorcontroller` | `stakater/ingressmonitorcontroller`
| image.tag | Version of ingressMonitorController Image | `1.0.47` | `1.0.47`
| image.pullPolicy | Pull policy for image | `IfNotPresent` | `IfNotPresent`
| providers.name | Name of the provider | `UptimeRobot` | `UptimeRobot` |
| providers.apiKey | ApiKey of the provider | `u956-afus321g565fghr519` | `your-api-key` |
| providers.apiURL | Base url of the ApiProvider | `https://api.uptimerobot.com/v2/` | `https://api.uptimerobot.com/v2/` |
| providers.alertContacts | A `-` separated list of contact id's that you want to add to the monitors | `12345_0_0-23564_0_0` | `some-alert-contacts` |
| watchNamespace | Name of the namespace if you want to monitor ingresses/route only in that namespace. | `dev` | `""` |
| enableMonitorDeletion | A safeguard flag that is used to enable or disable monitor deletion on ingress deletion (Useful for prod environments where you don't want to remove monitor on ingress deletion) | `false` | `false` |
*Note:* Follow [this](https://github.com/stakater/IngressMonitorController/blob/master/docs/uptimerobot-configuration.md) guide to see how to fetch `alertContacts` from UptimeRobot.
2. Enable for your Ingress/Route
You will need to add the following annotation on your ingresses/routes so that the controller is able to recognize and monitor it.
```yaml
"monitor.stakater.com/enabled": "true"
```
3. Deploy the controller by running the following command:
```bash
helm install --name imc-stakater . --namespace default
```
## Help
### Documentation
You can find more detailed documentation for configuration, extension, and support for other Uptime checkers etc. [here](https://github.com/stakater/IngressMonitorController/blob/master/docs/Deploying-to-Kubernetes.md)
### Have a question?
File a GitHub [issue](https://github.com/stakater/IngressMonitorController/issues), or send us an [email](mailto:hello@stakater.com).
### Talk to us on Slack
Join and talk to us on the #tools-ingressmonitor channel for discussing the Ingress Monitor Controller
[![Join Slack](https://stakater.github.io/README/stakater-join-slack-btn.png)](https://stakater-slack.herokuapp.com/)
[![Chat](https://stakater.github.io/README/stakater-chat-btn.png)](https://stakater.slack.com/messages/CA66MMYSE/)
## License
Apache2 © [Stakater](http://stakater.com)
## About
The `IngressMonitorController` is maintained by [Stakater][website]. Like it? Please let us know at <hello@stakater.com>
See [our other projects][community]
or contact us in case of professional services and queries on <hello@stakater.com>
[website]: http://stakater.com/
[community]: https://www.stakater.com/projects-overview.html
## Contributers
Stakater Team and the Open Source community! :trophy:
@@ -0,0 +1,13 @@
- Follow below mentioned URL to view uptimerobot configuration
https://github.com/stakater/IngressMonitorController/blob/master/docs/uptimerobot-configuration.md
- Follow below mentioned URL to view statuscake configuration
https://github.com/stakater/IngressMonitorController/blob/master/docs/statuscake-configuration.md
- Follow below mentioned URL to view pingdom configuration
https://github.com/stakater/IngressMonitorController/blob/master/docs/pingdom-configuration.md
- For further details, go through docs section of IngressMonitorController
https://github.com/stakater/IngressMonitorController/tree/master/docs
- After successful setup of your provider, you will be able to receive notifications based on your provide configurations.
@@ -0,0 +1,27 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" | lower -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "serviceAccountName" -}}
{{- if .Values.ingressMonitorController.serviceAccount.create -}}
{{ default (include "fullname" .) .Values.ingressMonitorController.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.ingressMonitorController.serviceAccount.name }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,45 @@
{{- if and ( .Values.ingressMonitorController.rbac.create ) (eq .Values.ingressMonitorController.watchNamespace "") }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
{{- if .Values.ingressMonitorController.useFullName }}
name: {{ template "fullname" . }}-role
{{- else }}
name: {{ template "name" . }}-role
{{- end }}
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- if .Values.ingressMonitorController.rbac.labels }}
{{ toYaml .Values.ingressMonitorController.rbac.labels | indent 4 }}
{{- end }}
{{- if .Values.ingressMonitorController.matchLabels }}
{{ toYaml .Values.ingressMonitorController.matchLabels | indent 4 }}
{{- end }}
rules:
- apiGroups:
- ""
- "extensions"
- "route.openshift.io"
resources:
- ingresses
- routes
verbs:
- list
- get
- update
- patch
- watch
- delete
- apiGroups:
- ""
resources:
- services
- pods
verbs:
- list
- get
- watch
{{- end }}
@@ -0,0 +1,33 @@
{{- if and ( .Values.ingressMonitorController.rbac.create ) (eq .Values.ingressMonitorController.watchNamespace "") }}
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
{{- if .Values.ingressMonitorController.useFullName }}
name: {{ template "fullname" . }}-role-binding
{{- else }}
name: {{ template "name" . }}-role-binding
{{- end }}
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- if .Values.ingressMonitorController.rbac.labels }}
{{ toYaml .Values.ingressMonitorController.rbac.labels | indent 4 }}
{{- end }}
{{- if .Values.ingressMonitorController.matchLabels }}
{{ toYaml .Values.ingressMonitorController.matchLabels | indent 4 }}
{{- end }}
roleRef:
kind: ClusterRole
{{- if .Values.ingressMonitorController.useFullName }}
name: {{ template "fullname" . }}-role
{{- else }}
name: {{ template "name" . }}-role
{{- end }}
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: {{ template "serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
@@ -0,0 +1,36 @@
apiVersion: v1
kind: ConfigMap
metadata:
{{- if .Values.ingressMonitorController.useFullName }}
name: {{ template "fullname" . }}
{{- else }}
name: {{ template "name" . }}
{{- end }}
annotations:
{{- if .Values.ingressMonitorController.config.annotations }}
{{ toYaml .Values.ingressMonitorController.config.annotations | indent 4 }}
{{- end }}
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- if .Values.ingressMonitorController.config.labels }}
{{ toYaml .Values.ingressMonitorController.config.labels | indent 4 }}
{{- end }}
{{- if .Values.ingressMonitorController.matchLabels }}
{{ toYaml .Values.ingressMonitorController.matchLabels | indent 4 }}
{{- end }}
data:
config.yaml: |-
providers:
{{- range .Values.ingressMonitorController.providers }}
- name: {{ .name }}
apiKey: {{ .apiKey }}
apiURL: {{ .apiURL }}
username: {{ .username | default "null" }}
password: {{ .password | default "null" }}
alertContacts: {{ .alertContacts }}
{{- end }}
enableMonitorDeletion: {{ .Values.ingressMonitorController.enableMonitorDeletion }}
monitorNameTemplate: "{{ .Values.ingressMonitorController.monitorNameTemplate }}"
@@ -0,0 +1,74 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
{{- if .Values.ingressMonitorController.deployment.annotations }}
{{ toYaml .Values.ingressMonitorController.deployment.annotations | indent 4 }}
{{- end }}
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- if .Values.ingressMonitorController.deployment.labels }}
{{ toYaml .Values.ingressMonitorController.deployment.labels | indent 4 }}
{{- end }}
{{- if .Values.ingressMonitorController.matchLabels }}
{{ toYaml .Values.ingressMonitorController.matchLabels | indent 4 }}
{{- end }}
{{- if .Values.ingressMonitorController.useFullName }}
name: {{ template "fullname" . }}
{{- else }}
name: {{ template "name" . }}
{{- end }}
spec:
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: {{ template "name" . }}
release: {{ .Release.Name | quote }}
{{- if .Values.ingressMonitorController.matchLabels }}
{{ toYaml .Values.ingressMonitorController.matchLabels | indent 6 }}
{{- end }}
template:
metadata:
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- if .Values.ingressMonitorController.deployment.labels }}
{{ toYaml .Values.ingressMonitorController.deployment.labels | indent 8 }}
{{- end }}
{{- if .Values.ingressMonitorController.matchLabels }}
{{ toYaml .Values.ingressMonitorController.matchLabels | indent 8 }}
{{- end }}
spec:
containers:
- env:
{{- if .Values.ingressMonitorController.watchNamespace }}
- name: KUBERNETES_NAMESPACE
value: {{ .Values.ingressMonitorController.watchNamespace | quote }}
{{- end }}
- name: CONFIG_FILE_PATH
value: {{ .Values.ingressMonitorController.configFilePath }}
image: "{{ .Values.ingressMonitorController.image.name }}:{{ .Values.ingressMonitorController.image.tag }}"
imagePullPolicy: {{ .Values.ingressMonitorController.image.pullPolicy }}
{{- if .Values.ingressMonitorController.useFullName }}
name: {{ template "fullname" . }}
{{- else }}
name: {{ template "name" . }}
{{- end }}
volumeMounts:
- mountPath: /etc/IngressMonitorController
name: config-volume
serviceAccountName: {{ template "serviceAccountName" . }}
volumes:
- configMap:
{{- if .Values.ingressMonitorController.useFullName }}
name: {{ template "fullname" . }}
{{- else }}
name: {{ template "name" . }}
{{- end }}
name: config-volume
@@ -0,0 +1,46 @@
{{- if and ( .Values.ingressMonitorController.rbac.create ) (.Values.ingressMonitorController.watchNamespace) }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
{{- if .Values.ingressMonitorController.useFullName }}
name: {{ template "fullname" . }}-role
{{- else }}
name: {{ template "name" . }}-role
{{- end }}
namespace: {{ .Values.ingressMonitorController.watchNamespace | quote }}
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- if .Values.ingressMonitorController.rbac.labels }}
{{ toYaml .Values.ingressMonitorController.rbac.labels | indent 4 }}
{{- end }}
{{- if .Values.ingressMonitorController.matchLabels }}
{{ toYaml .Values.ingressMonitorController.matchLabels | indent 4 }}
{{- end }}
rules:
- apiGroups:
- ""
- "extensions"
- "route.openshift.io"
resources:
- ingresses
- routes
verbs:
- list
- get
- update
- patch
- watch
- delete
- apiGroups:
- ""
resources:
- services
- pods
verbs:
- list
- get
- watch
{{- end }}
@@ -0,0 +1,34 @@
{{- if and ( .Values.ingressMonitorController.rbac.create ) (.Values.ingressMonitorController.watchNamespace) }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
{{- if .Values.ingressMonitorController.useFullName }}
name: {{ template "fullname" . }}-role-binding
{{- else }}
name: {{ template "name" . }}-role-binding
{{- end }}
namespace: {{ .Values.ingressMonitorController.watchNamespace | quote }}
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- if .Values.ingressMonitorController.rbac.labels }}
{{ toYaml .Values.ingressMonitorController.rbac.labels | indent 4 }}
{{- end }}
{{- if .Values.ingressMonitorController.matchLabels }}
{{ toYaml .Values.ingressMonitorController.matchLabels | indent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
{{- if .Values.ingressMonitorController.useFullName }}
name: {{ template "fullname" . }}-role
{{- else }}
name: {{ template "name" . }}-role
{{- end }}
subjects:
- kind: ServiceAccount
name: {{ template "serviceAccountName" . }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
@@ -0,0 +1,17 @@
{{- if .Values.ingressMonitorController.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- if .Values.ingressMonitorController.serviceAccount.labels }}
{{ toYaml .Values.ingressMonitorController.serviceAccount.labels | indent 4 }}
{{- end }}
{{- if .Values.ingressMonitorController.matchLabels }}
{{ toYaml .Values.ingressMonitorController.matchLabels | indent 4 }}
{{- end }}
name: {{ template "serviceAccountName" . }}
{{- end }}
@@ -0,0 +1,34 @@
ingressMonitorController:
watchNamespace: ""
useFullName: false
matchLabels: {}
deployment:
labels: {}
annotations: {}
config:
labels: {}
annotations:
fabric8.io/target-platform: kubernetes
rbac:
create: true
labels: {}
# Service account config for the agent pods
serviceAccount:
# Specifies whether a ServiceAccount should be created
create: true
labels: {}
# The name of the ServiceAccount to use.
# If not set and create is true, a name is generated using the fullname template
name: ingressmonitorcontroller
image:
name: stakater/ingressmonitorcontroller
tag: "1.0.47"
pullPolicy: IfNotPresent
providers:
- name: UptimeRobot
apiKey: your-api-key
apiURL: https://api.uptimerobot.com/v2
alertContacts: some-alert-contacts
enableMonitorDeletion: true
configFilePath: /etc/IngressMonitorController/config.yaml
monitorNameTemplate: "{{.Namespace}}-{{.IngressName}}"