Skip to content

Commit

Permalink
Add support for OpsGenie as a notification channel
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Petkovski committed May 29, 2020
1 parent 6e8dab0 commit 1890837
Show file tree
Hide file tree
Showing 23 changed files with 1,282 additions and 645 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.1.0] - 2020-05-29
- Add support for Opsgenie as a notification channel

## [1.0.1] - 2020-05-21
- Eliminates a memory leak caused by the defaults of `http.Client` by setting an explicit connection timeout.

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ In order to deploy the operator, execute the following steps:
* Add your secrets to `deploy/1-secret.yaml`
* Add the base64 encoded New Relic admin password
* Optionally, add the default Slack webhook URL for `SlackNotificationChannel`s.
* Optionally, add the Opsgenie API key for `OpsgenieNotificationChannel`s.
* Deploy the custom resource definitions by running
```kubectl apply -f deploy/crds/```
* Deploy the operator manifests by running
Expand Down
1 change: 1 addition & 0 deletions deploy/1-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ metadata:
data:
adminKey: ""
defaultSlackWebhookUrl: "" # optional
defaultOpsgenieApiKey: "" # optional
2 changes: 2 additions & 0 deletions deploy/2-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ rules:
- slacknotificationchannels/status
- emailnotificationchannels
- emailnotificationchannels/status
- opsgenienotificationchannels
- opsgenienotificationchannels/status
verbs:
- "*"
- apiGroups:
Expand Down
7 changes: 6 additions & 1 deletion deploy/3-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
serviceAccountName: newrelic-alert-manager
containers:
- name: newrelic-alert-manager
image: personio/newrelic-alert-manager:1.0.1
image: personio/newrelic-alert-manager:1.1.0
command:
- newrelic-alert-manager
imagePullPolicy: Always
Expand All @@ -37,6 +37,11 @@ spec:
secretKeyRef:
name: newrelic-alert-manager
key: defaultSlackWebhookUrl
- name: DEFAULT_OPS_GENIE_API_KEY
valueFrom:
secretKeyRef:
name: newrelic-alert-manager
key: defaultOpsgenieApiKey
resources:
requests:
cpu: "0.5"
Expand Down
109 changes: 109 additions & 0 deletions deploy/crds/alerts.newrelic.io_opsgenienotificationchannels_crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: opsgenienotificationchannels.alerts.newrelic.io
spec:
additionalPrinterColumns:
- JSONPath: .spec.name
description: The New Relic name this channel
name: NR Name
type: string
- JSONPath: .status.status
description: The status of this channel
name: Status
type: string
- JSONPath: .status.newrelicId
description: The New Relic ID of this channel
name: Newrelic ID
type: string
- JSONPath: .metadata.creationTimestamp
description: The age of this channel
name: Age
type: date
group: alerts.newrelic.io
names:
kind: OpsgenieNotificationChannel
listKind: OpsgenieNotificationChannelList
plural: opsgenienotificationchannels
singular: opsgenienotificationchannel
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: NotificationChannel is the Schema for the OpsgenieNotificationChannels
API
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:
description: OpsgenieNotificationChannelSpec defines the desired state of
NotificationChannel
properties:
api_key:
description: The Opsgenie API Key. If left empty, the default API key
specified when deploying the operator will be used
type: string
name:
description: The name of the notification channel created in New Relic
type: string
policySelector:
additionalProperties:
type: string
description: A label selector defining the alert policies covered by
the notification channel
type: object
recipients:
description: A comma-separated value of emails
items:
type: string
type: array
tags:
description: A list of tags
items:
type: string
type: array
teams:
description: A list of teams
items:
type: string
type: array
required:
- name
type: object
status:
description: NotificationChannelStatus defines the observed state of NotificationChannel
properties:
newrelicConfigVersion:
type: string
newrelicId:
description: The resource id in New Relic
format: int64
type: integer
reason:
description: When a policy fails to be created, the value will be set
to the error message received from New Relic
type: string
status:
description: The value will be set to `Ready` once the policy has been
created in New Relic
type: string
required:
- status
type: object
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
Loading

0 comments on commit 1890837

Please sign in to comment.