-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for alertmanager silence operator (#839)
* Add support for alertmanager silence operator Seems to be one of the few ways to feasibly manage alertmanager silences around. Can also integrate into the console. * Move silence operator to separate chart * Fix gitlab wildcard cert we needed to explicitly name the cert for the kas ingress
- Loading branch information
1 parent
ce7ab17
commit a230873
Showing
13 changed files
with
255 additions
and
4 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
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
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
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,23 @@ | ||
# 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 | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,6 @@ | ||
dependencies: | ||
- name: silence-operator | ||
repository: https://wiremind.github.io/wiremind-helm-charts | ||
version: 0.0.6 | ||
digest: sha256:95128fe4e6765a00cb3d655dfe5d9720711740bccc9c933381743add2e71c739 | ||
generated: "2023-09-06T13:55:17.876963-04:00" |
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,10 @@ | ||
apiVersion: v2 | ||
name: silence-operator | ||
description: A Helm chart for Kubernetes | ||
type: application | ||
version: 0.0.6 | ||
appVersion: "1.16.0" | ||
dependencies: | ||
- name: silence-operator | ||
version: 0.0.6 | ||
repository: https://wiremind.github.io/wiremind-helm-charts |
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,13 @@ | ||
# silence-operator | ||
|
||
Deploys the alertmanager silence operator to allow for CRD managed alert silences. You can specify any silences you might want to add using in your installations `values.yaml` file: | ||
|
||
```yaml | ||
silence-operator: | ||
silences: | ||
<name>: | ||
matchers: | ||
- name: alertname | ||
value: <Alertname> | ||
regex: false | ||
``` |
Binary file not shown.
96 changes: 96 additions & 0 deletions
96
monitoring/helm/silence-operator/crds/monitoring.giantswarm.io_silences.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,96 @@ | ||
|
||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.7.0 | ||
creationTimestamp: null | ||
name: silences.monitoring.giantswarm.io | ||
spec: | ||
group: monitoring.giantswarm.io | ||
names: | ||
categories: | ||
- common | ||
- giantswarm | ||
kind: Silence | ||
listKind: SilenceList | ||
plural: silences | ||
singular: silence | ||
scope: Cluster | ||
versions: | ||
- name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: Silence represents schema for managed silences in Alertmanager. | ||
Reconciled by silence-operator. | ||
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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
properties: | ||
issue_url: | ||
description: IssueURL is a link to a GitHub issue describing the problem. | ||
type: string | ||
matchers: | ||
items: | ||
properties: | ||
isEqual: | ||
type: boolean | ||
isRegex: | ||
type: boolean | ||
name: | ||
type: string | ||
value: | ||
type: string | ||
required: | ||
- isRegex | ||
- name | ||
- value | ||
type: object | ||
type: array | ||
owner: | ||
description: Owner is GitHub username of a person who created and/or | ||
owns the silence. | ||
type: string | ||
postmortem_url: | ||
description: 'PostmortemURL is a link to a document describing the | ||
problem. Deprecated: Use IssueURL instead.' | ||
type: string | ||
targetTags: | ||
items: | ||
properties: | ||
name: | ||
type: string | ||
value: | ||
type: string | ||
required: | ||
- name | ||
- value | ||
type: object | ||
type: array | ||
required: | ||
- matchers | ||
type: object | ||
required: | ||
- metadata | ||
- spec | ||
type: object | ||
served: true | ||
storage: true | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
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,10 @@ | ||
apiVersion: plural.sh/v1alpha1 | ||
kind: Dependencies | ||
metadata: | ||
description: Deploys silence operator | ||
spec: | ||
dependencies: | ||
- type: helm | ||
name: bootstrap | ||
repo: bootstrap | ||
version: '>= 0.5.1' |
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,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "silence-operator-plural.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 "silence-operator-plural.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 "silence-operator.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "silence-operator-plural.labels" -}} | ||
helm.sh/chart: {{ include "silence-operator.chart" . }} | ||
{{ include "silence-operator.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "silence-operator-plural.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "silence-operator.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "silence-operator-plural.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "silence-operator.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- 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,8 @@ | ||
{{- range $name, $spec := .Values.silences -}} | ||
apiVersion: monitoring.giantswarm.io/v1alpha1 | ||
kind: Silence | ||
metadata: | ||
name: {{ $name }} | ||
spec: | ||
{{ $spec | toYaml | nindent 2 }} | ||
{{- 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,18 @@ | ||
silences: {} | ||
|
||
silence-operator: | ||
sync: | ||
enabled: true | ||
init: | ||
method: | ||
kubernetes: | ||
enabled: true | ||
image: | ||
name: ghcr.io/pluralsh/containers/kubectl | ||
tag: 1.27-plural1.0.0 | ||
rbac: | ||
create: true | ||
operator: | ||
alertmanager: | ||
service: | ||
address: "http://monitoring-alertmanager.monitoring:9093" |