-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
375 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0" | ||
description: A k8s prometheus alert-operator chart | ||
name: alert-operator | ||
version: 0.0.1 | ||
home: https://github.com/georgedriver/helm-charts | ||
sources: | ||
- https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources | ||
- https://github.com/operator-framework/operator-sdk | ||
- https://github.com/georgedriver/helm-charts | ||
keywords: | ||
- alert | ||
- prometheus | ||
- operator | ||
maintainers: | ||
- name: George |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Alert Operator Chart | ||
|
||
This repository provide a k8s prometheus alert-operator chart. | ||
|
||
## TL;DR | ||
To install: | ||
```bash | ||
helm upgrade --install -n alert-operator . | ||
``` | ||
|
||
## Chart Content | ||
The chart will provide the following resources: | ||
1. Alert Operator CRD's resource (installed first using helm CRD hook) | ||
2. Alert operator supporting service-account, cluster-role and cluster-role-binding resources. | ||
3. Alert-operator deployment | ||
4. Alert-operator service, ServiceMonitor & monitoring resources. *** currently disabled by default as prometheus metrics are not yet supported *** | ||
|
||
## alert-operator Configuration | ||
The following values are set in this chart values.yaml, some overwrite the sub-chart values | ||
|
||
|
||
### k8s-kube2iam Chart Configuration | ||
|
||
| Parameter | Description | Default | | ||
| ------------- | ------------- | --------| | ||
| replicaCount | The deployment replace count | 1 | | ||
| image.repository | The container image repository | georgedriver/alertroute-operator | | ||
| nameOverride | A name to overide chart name. | '' | | ||
| fullnameOverride | A full name to be used with chart resources | '' | | ||
| service.port | The port to expose for metrics | 60000 | | ||
| monitoring.enabled | Enable monitoring resources | false | | ||
| monitoring.alerting.enables | Enable alerting resources | false | | ||
| resources | Resource limit/request for deployment | {} | | ||
| nodeSelector | Node selector label lists | {} | | ||
|tolerations | tolerations label list | [] | | ||
| affinity | affinity label list | {} | | ||
| imagePullSecrets | list of existing pull secret to use with the container | [] | | ||
| crd.install | If set, the helm will add the CRD's (Set to true only on new clusters) | 'false' | | ||
|
||
## Monitoring | ||
|
||
### Service Monitor Resource | ||
When monitoring enabled, a ServiceMonitor will be created to auto-add the alert-operator metrics to Prometheus. Check the Prometheus Operator Service Monitor for details. | ||
|
||
## Grafana Dashaboard | ||
When monitoring enabled, Helm will create a config map resources with the label of "grafana-dashboard" to store alert-operator dashboards. | ||
If you want to add a new dashboard, create the dashboard, export it to a JSON file and put it in the "dashboards" folder under the charts. | ||
Grafana will auto-detect any dashboard based on the label, and load it. | ||
|
||
## Prometheus Rules | ||
PrometheusRules resource is used to create Prometheus alerts. If alerting enabled, helm will create the resource for Prometheus to auto-detect it. | ||
To create/modify alerts - edit the PrometheusRules resource file in the templates folder and change the spec. See Prometheus documantation for more details on alerts. | ||
|
||
## Alert Manager | ||
AlertManager resource will handle spinning a new instance of alertmanager for your application. | ||
Use alert manager resource, and it's Configuration to set how your alerts are being handled - if you want to push them to Pagerduty/email/slack etc. | ||
See Prometheus Alert Manager documantation for more details |
Empty file.
15 changes: 15 additions & 0 deletions
15
charts/alert-operator/crds/monitoring_v1alpha1_alertmanagerreceiver_crd.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: alertmanagerreceivers.monitoring.alerts.com | ||
annotations: | ||
helm.sh/hook: crd-install | ||
spec: | ||
group: monitoring.alerts.com | ||
names: | ||
kind: AlertManagerReceiver | ||
listKind: AlertManagerReceiverList | ||
plural: alertmanagerreceivers | ||
singular: alertmanagerreceiver | ||
scope: Namespaced | ||
version: v1alpha1 |
15 changes: 15 additions & 0 deletions
15
charts/alert-operator/crds/monitoring_v1alpha1_alertmanagerroute_crd.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: alertmanagerroutes.monitoring.alerts.com | ||
annotations: | ||
helm.sh/hook: crd-install | ||
spec: | ||
group: monitoring.alerts.com | ||
names: | ||
kind: AlertManagerRoute | ||
listKind: AlertManagerRouteList | ||
plural: alertmanagerroutes | ||
singular: alertmanagerroute | ||
scope: Namespaced | ||
version: v1alpha1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "alert-operator.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- 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). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "alert-operator.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "alert-operator.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "alert-operator.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "alert-operator.name" . }} | ||
helm.sh/chart: {{ include "alert-operator.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "alert-operator.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: {{ include "alert-operator.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
spec: | ||
containers: | ||
- name: {{ include "alert-operator.fullname" . }} | ||
# Replace this with the built image name | ||
image: {{ .Values.image.repository }}:{{ .Values.image.tag }} | ||
ports: | ||
- containerPort: {{ .Values.service.port }} | ||
name: metrics | ||
command: | ||
- alert-operator | ||
imagePullPolicy: Always | ||
env: | ||
- name: WATCH_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: OPERATOR_NAME | ||
value: "alert-operator" | ||
resources: | ||
{{ toYaml .Values.resources | indent 12 }} | ||
serviceAccountName: {{ include "alert-operator.fullname" . }} | ||
{{- if .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- range $secret := .Values.imagePullSecrets }} | ||
{{ list $secret | toYaml | indent 9 -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
creationTimestamp: null | ||
name: {{ include "alert-operator.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "alert-operator.name" . }} | ||
helm.sh/chart: {{ include "alert-operator.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
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: | ||
- monitoring.alerts.com | ||
resources: | ||
- '*' | ||
- alertmanagerreceivers | ||
verbs: | ||
- '*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: {{ include "alert-operator.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "alert-operator.name" . }} | ||
helm.sh/chart: {{ include "alert-operator.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "alert-operator.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
roleRef: | ||
kind: ClusterRole | ||
name: {{ include "alert-operator.fullname" . }} | ||
apiGroup: rbac.authorization.k8s.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{{- if .Values.monitoring.enabled }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
name: {{ include "alert-operator.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "alert-operator.name" . }} | ||
helm.sh/chart: {{ include "alert-operator.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
k8s-monitoring: "true" | ||
spec: | ||
jobLabel: {{ template "alert-operator.fullname" . }} | ||
selector: | ||
namespaceSelector: | ||
matchNames: | ||
- {{ .Release.Namespace }} | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "alert-operator.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
endpoints: | ||
- port: tcp-metrics | ||
interval: 15s | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "alert-operator.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "alert-operator.name" . }} | ||
helm.sh/chart: {{ include "alert-operator.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
name: tcp-metrics | ||
selector: | ||
app.kubernetes.io/name: {{ include "alert-operator.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "alert-operator.fullname" . }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "alert-operator.name" . }} | ||
helm.sh/chart: {{ include "alert-operator.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Default values for alert-operator. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
replicaCount: 1 | ||
|
||
image: | ||
repository: georgedriver/alert-operator | ||
tag: master | ||
pullPolicy: Always | ||
|
||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
service: | ||
port: 60000 | ||
|
||
monitoring: | ||
enabled: false | ||
alerting: | ||
enable: false | ||
|
||
resources: {} | ||
# We usually recommend not to specify default resources and to leave this as a conscious | ||
# choice for the user. This also increases chances charts run on environments with little | ||
# resources, such as Minikube. If you do want to specify resources, uncomment the following | ||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'. | ||
# limits: | ||
# cpu: 100m | ||
# memory: 128Mi | ||
# requests: | ||
# cpu: 100m | ||
# memory: 128Mi | ||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} | ||
# | ||
# imagePullSecrets: [] |