1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-21 11:48:53 +00:00

*: Add AlertmanagerConfig CRD

This commit is contained in:
Frederic Branczyk 2020-05-20 13:05:04 +02:00 committed by Gerard Ryan
parent 4484e4961d
commit 53eb1eb7bc
No known key found for this signature in database
GPG key ID: 4E00938BDBFCA05B
27 changed files with 2230 additions and 33 deletions

View file

@ -65,6 +65,16 @@ This Document documents the types introduced by the Prometheus Operator to be co
* [ThanosRulerList](#thanosrulerlist)
* [ThanosRulerSpec](#thanosrulerspec)
* [ThanosRulerStatus](#thanosrulerstatus)
* [AlertmanagerConfig](#alertmanagerconfig)
* [AlertmanagerConfigList](#alertmanagerconfiglist)
* [AlertmanagerConfigSpec](#alertmanagerconfigspec)
* [HTTPConfig](#httpconfig)
* [InhibitRule](#inhibitrule)
* [Matcher](#matcher)
* [PagerDutyConfig](#pagerdutyconfig)
* [PagerDutyConfigDetail](#pagerdutyconfigdetail)
* [Receiver](#receiver)
* [Route](#route)
## APIServerConfig
@ -171,6 +181,8 @@ AlertmanagerSpec is a specification of the desired behavior of the Alertmanager
| clusterAdvertiseAddress | ClusterAdvertiseAddress is the explicit address to advertise in cluster. Needs to be provided for non RFC1918 [1] (public) addresses. [1] RFC1918: https://tools.ietf.org/html/rfc1918 | string | false |
| portName | Port name used for the pods and governing service. This defaults to web | string | false |
| forceEnableClusterMode | ForceEnableClusterMode ensures Alertmanager does not deactivate the cluster mode when running with a single replica. Use case is e.g. spanning an Alertmanager cluster across Kubernetes clusters with a single replica in each. | bool | false |
| alertmanagerConfigSelector | AlertmanagerConfigs to be selected for to merge and configure Alertmanager with. | *[metav1.LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#labelselector-v1-meta) | false |
| alertmanagerConfigNamespaceSelector | Namespaces to be selected for AlertmanagerConfig discovery. If nil, only check own namespace. | *[metav1.LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#labelselector-v1-meta) | false |
[Back to TOC](#table-of-contents)
@ -928,3 +940,132 @@ ThanosRulerStatus is the most recent observed status of the ThanosRuler. Read-on
| unavailableReplicas | Total number of unavailable pods targeted by this ThanosRuler deployment. | int32 | true |
[Back to TOC](#table-of-contents)
## AlertmanagerConfig
AlertmanagerConfig defines a namespaced AlertmanagerConfig to be aggregated across multiple namespaces configuring one Alertmanager.
| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| metadata | | [metav1.ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#objectmeta-v1-meta) | false |
| spec | | [AlertmanagerConfigSpec](#alertmanagerconfigspec) | true |
[Back to TOC](#table-of-contents)
## AlertmanagerConfigList
AlertmanagerConfigList is a list of AlertmanagerConfig.
| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| metadata | Standard list metadata More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata | [metav1.ListMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#listmeta-v1-meta) | false |
| items | List of AlertmanagerConfig | []*[AlertmanagerConfig](#alertmanagerconfig) | true |
[Back to TOC](#table-of-contents)
## AlertmanagerConfigSpec
| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| route | | *[Route](#route) | false |
| receivers | | [][Receiver](#receiver) | false |
| inhibitRules | | [][InhibitRule](#inhibitrule) | false |
[Back to TOC](#table-of-contents)
## HTTPConfig
| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| basicAuth | | *[BasicAuth](#basicauth) | false |
| bearerTokenSecret | | *[v1.SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#secretkeyselector-v1-core) | false |
| tlsConfig | | *[TLSConfig](#tlsconfig) | false |
| proxyURL | | *string | false |
[Back to TOC](#table-of-contents)
## InhibitRule
| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| matcher | | [][Matcher](#matcher) | false |
| matcher | | [][Matcher](#matcher) | false |
| equal | | []string | false |
[Back to TOC](#table-of-contents)
## Matcher
| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| name | | string | true |
| value | | string | true |
| regex | | *bool | false |
[Back to TOC](#table-of-contents)
## PagerDutyConfig
| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| sendResolved | | *bool | false |
| routingKey | | *string | false |
| serviceKey | | *string | false |
| url | | *string | false |
| client | | *string | false |
| clientURL | | *string | false |
| description | | *string | false |
| severity | | *string | false |
| details | | [][PagerDutyConfigDetail](#pagerdutyconfigdetail) | false |
| httpConfig | | *[HTTPConfig](#httpconfig) | false |
[Back to TOC](#table-of-contents)
## PagerDutyConfigDetail
| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| key | | string | true |
| value | | string | true |
[Back to TOC](#table-of-contents)
## Receiver
| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| name | | string | true |
| pagerDutyConfigs | | [][PagerDutyConfig](#pagerdutyconfig) | false |
[Back to TOC](#table-of-contents)
## Route
| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |
| receiver | | string | false |
| groupBy | | []string | false |
| groupWait | | string | false |
| groupInterval | | string | false |
| repeatInterval | | string | false |
| matchers | | [][Matcher](#matcher) | false |
| continue | | *bool | false |
| routes | | [][Route](#route) | false |
[Back to TOC](#table-of-contents)

View file

@ -29,6 +29,7 @@ rules:
resources:
- alertmanagers
- alertmanagers/finalizers
- alertmanagerconfigs
- prometheuses
- prometheuses/finalizers
- thanosrulers

View file

@ -17,6 +17,7 @@ VERSION?=$(shell cat VERSION | tr -d " \t\n\r")
TYPES_V1_TARGET := pkg/apis/monitoring/v1/types.go
TYPES_V1_TARGET += pkg/apis/monitoring/v1/thanos_types.go
TYPES_V1_TARGET += pkg/apis/monitoring/v1/alertmanager_config_types.go
TOOLS_BIN_DIR ?= $(shell pwd)/tmp/bin
export PATH := $(TOOLS_BIN_DIR):$(PATH)

View file

@ -1,4 +1,366 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
creationTimestamp: null
name: alertmanagerconfigs.monitoring.coreos.com
spec:
group: monitoring.coreos.com
names:
kind: AlertmanagerConfig
listKind: AlertmanagerConfigList
plural: alertmanagerconfigs
singular: alertmanagerconfig
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: AlertmanagerConfig defines a namespaced AlertmanagerConfig to
be aggregated across multiple namespaces configuring one Alertmanager.
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:
inhibitRules:
items:
properties:
equal:
items:
type: string
type: array
matcher:
items:
properties:
name:
type: string
regex:
type: boolean
value:
type: string
required:
- name
- value
type: object
type: array
type: object
type: array
receivers:
items:
properties:
name:
type: string
pagerDutyConfigs:
items:
properties:
client:
type: string
clientURL:
type: string
description:
type: string
details:
items:
properties:
key:
type: string
value:
type: string
required:
- key
- value
type: object
type: array
httpConfig:
properties:
basicAuth:
description: 'BasicAuth allow an endpoint to authenticate
over basic authentication More info: https://prometheus.io/docs/operating/configuration/#endpoints'
properties:
password:
description: The secret in the service monitor
namespace that contains the password for authentication.
properties:
key:
description: The key of the secret to select
from. Must be a valid secret key.
type: string
name:
description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the Secret or
its key must be defined
type: boolean
required:
- key
type: object
username:
description: The secret in the service monitor
namespace that contains the username for authentication.
properties:
key:
description: The key of the secret to select
from. Must be a valid secret key.
type: string
name:
description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the Secret or
its key must be defined
type: boolean
required:
- key
type: object
type: object
bearerTokenSecret:
description: SecretKeySelector selects a key of a
Secret.
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its
key must be defined
type: boolean
required:
- key
type: object
proxyURL:
type: string
tlsConfig:
description: TLSConfig extends the safe TLS configuration
with file parameters.
properties:
ca:
description: Struct containing the CA cert to
use for the targets.
properties:
configMap:
description: ConfigMap containing data to
use for the targets.
properties:
key:
description: The key to select.
type: string
name:
description: 'Name of the referent. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the ConfigMap
or its key must be defined
type: boolean
required:
- key
type: object
secret:
description: Secret containing data to use
for the targets.
properties:
key:
description: The key of the secret to
select from. Must be a valid secret
key.
type: string
name:
description: 'Name of the referent. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the Secret
or its key must be defined
type: boolean
required:
- key
type: object
type: object
caFile:
description: Path to the CA cert in the Prometheus
container to use for the targets.
type: string
cert:
description: Struct containing the client cert
file for the targets.
properties:
configMap:
description: ConfigMap containing data to
use for the targets.
properties:
key:
description: The key to select.
type: string
name:
description: 'Name of the referent. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the ConfigMap
or its key must be defined
type: boolean
required:
- key
type: object
secret:
description: Secret containing data to use
for the targets.
properties:
key:
description: The key of the secret to
select from. Must be a valid secret
key.
type: string
name:
description: 'Name of the referent. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the Secret
or its key must be defined
type: boolean
required:
- key
type: object
type: object
certFile:
description: Path to the client cert file in the
Prometheus container for the targets.
type: string
insecureSkipVerify:
description: Disable target certificate validation.
type: boolean
keyFile:
description: Path to the client key file in the
Prometheus container for the targets.
type: string
keySecret:
description: Secret containing the client key
file for the targets.
properties:
key:
description: The key of the secret to select
from. Must be a valid secret key.
type: string
name:
description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the Secret or
its key must be defined
type: boolean
required:
- key
type: object
serverName:
description: Used to verify the hostname for the
targets.
type: string
type: object
type: object
routingKey:
type: string
sendResolved:
type: boolean
serviceKey:
type: string
severity:
type: string
url:
type: string
type: object
type: array
required:
- name
type: object
type: array
route:
properties:
continue:
type: boolean
groupBy:
items:
type: string
type: array
groupInterval:
type: string
groupWait:
type: string
matchers:
items:
properties:
name:
type: string
regex:
type: boolean
value:
type: string
required:
- name
- value
type: object
type: array
receiver:
type: string
repeatInterval:
type: string
routes:
items: {}
type: array
type: object
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
---
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
@ -646,6 +1008,96 @@ spec:
type: array
type: object
type: object
alertmanagerConfigNamespaceSelector:
description: Namespaces to be selected for AlertmanagerConfig discovery.
If nil, only check own namespace.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
The requirements are ANDed.
items:
description: A label selector requirement is a selector that
contains values, a key, and an operator that relates the key
and values.
properties:
key:
description: key is the label key that the selector applies
to.
type: string
operator:
description: operator represents a key's relationship to
a set of values. Valid operators are In, NotIn, Exists
and DoesNotExist.
type: string
values:
description: values is an array of string values. If the
operator is In or NotIn, the values array must be non-empty.
If the operator is Exists or DoesNotExist, the values
array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs. A single
{key,value} in the matchLabels map is equivalent to an element
of matchExpressions, whose key field is "key", the operator
is "In", and the values array contains only "value". The requirements
are ANDed.
type: object
type: object
alertmanagerConfigSelector:
description: AlertmanagerConfigs to be selected for to merge and configure
Alertmanager with.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
The requirements are ANDed.
items:
description: A label selector requirement is a selector that
contains values, a key, and an operator that relates the key
and values.
properties:
key:
description: key is the label key that the selector applies
to.
type: string
operator:
description: operator represents a key's relationship to
a set of values. Valid operators are In, NotIn, Exists
and DoesNotExist.
type: string
values:
description: values is an array of string values. If the
operator is In or NotIn, the values array must be non-empty.
If the operator is Exists or DoesNotExist, the values
array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs. A single
{key,value} in the matchLabels map is equivalent to an element
of matchExpressions, whose key field is "key", the operator
is "In", and the values array contains only "value". The requirements
are ANDed.
type: object
type: object
baseImage:
description: 'Base image that is used to deploy pods, without tag.
Deprecated: use ''image'' instead'
@ -17102,6 +17554,7 @@ rules:
resources:
- alertmanagers
- alertmanagers/finalizers
- alertmanagerconfigs
- prometheuses
- prometheuses/finalizers
- thanosrulers

View file

@ -0,0 +1,361 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
creationTimestamp: null
name: alertmanagerconfigs.monitoring.coreos.com
spec:
group: monitoring.coreos.com
names:
kind: AlertmanagerConfig
listKind: AlertmanagerConfigList
plural: alertmanagerconfigs
singular: alertmanagerconfig
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: AlertmanagerConfig defines a namespaced AlertmanagerConfig to
be aggregated across multiple namespaces configuring one Alertmanager.
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:
inhibitRules:
items:
properties:
equal:
items:
type: string
type: array
matcher:
items:
properties:
name:
type: string
regex:
type: boolean
value:
type: string
required:
- name
- value
type: object
type: array
type: object
type: array
receivers:
items:
properties:
name:
type: string
pagerDutyConfigs:
items:
properties:
client:
type: string
clientURL:
type: string
description:
type: string
details:
items:
properties:
key:
type: string
value:
type: string
required:
- key
- value
type: object
type: array
httpConfig:
properties:
basicAuth:
description: 'BasicAuth allow an endpoint to authenticate
over basic authentication More info: https://prometheus.io/docs/operating/configuration/#endpoints'
properties:
password:
description: The secret in the service monitor
namespace that contains the password for authentication.
properties:
key:
description: The key of the secret to select
from. Must be a valid secret key.
type: string
name:
description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the Secret or
its key must be defined
type: boolean
required:
- key
type: object
username:
description: The secret in the service monitor
namespace that contains the username for authentication.
properties:
key:
description: The key of the secret to select
from. Must be a valid secret key.
type: string
name:
description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the Secret or
its key must be defined
type: boolean
required:
- key
type: object
type: object
bearerTokenSecret:
description: SecretKeySelector selects a key of a
Secret.
properties:
key:
description: The key of the secret to select from. Must
be a valid secret key.
type: string
name:
description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind,
uid?'
type: string
optional:
description: Specify whether the Secret or its
key must be defined
type: boolean
required:
- key
type: object
proxyURL:
type: string
tlsConfig:
description: TLSConfig extends the safe TLS configuration
with file parameters.
properties:
ca:
description: Struct containing the CA cert to
use for the targets.
properties:
configMap:
description: ConfigMap containing data to
use for the targets.
properties:
key:
description: The key to select.
type: string
name:
description: 'Name of the referent. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the ConfigMap
or its key must be defined
type: boolean
required:
- key
type: object
secret:
description: Secret containing data to use
for the targets.
properties:
key:
description: The key of the secret to
select from. Must be a valid secret
key.
type: string
name:
description: 'Name of the referent. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the Secret
or its key must be defined
type: boolean
required:
- key
type: object
type: object
caFile:
description: Path to the CA cert in the Prometheus
container to use for the targets.
type: string
cert:
description: Struct containing the client cert
file for the targets.
properties:
configMap:
description: ConfigMap containing data to
use for the targets.
properties:
key:
description: The key to select.
type: string
name:
description: 'Name of the referent. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the ConfigMap
or its key must be defined
type: boolean
required:
- key
type: object
secret:
description: Secret containing data to use
for the targets.
properties:
key:
description: The key of the secret to
select from. Must be a valid secret
key.
type: string
name:
description: 'Name of the referent. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the Secret
or its key must be defined
type: boolean
required:
- key
type: object
type: object
certFile:
description: Path to the client cert file in the
Prometheus container for the targets.
type: string
insecureSkipVerify:
description: Disable target certificate validation.
type: boolean
keyFile:
description: Path to the client key file in the
Prometheus container for the targets.
type: string
keySecret:
description: Secret containing the client key
file for the targets.
properties:
key:
description: The key of the secret to select
from. Must be a valid secret key.
type: string
name:
description: 'Name of the referent. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion,
kind, uid?'
type: string
optional:
description: Specify whether the Secret or
its key must be defined
type: boolean
required:
- key
type: object
serverName:
description: Used to verify the hostname for the
targets.
type: string
type: object
type: object
routingKey:
type: string
sendResolved:
type: boolean
serviceKey:
type: string
severity:
type: string
url:
type: string
type: object
type: array
required:
- name
type: object
type: array
route:
properties:
continue:
type: boolean
groupBy:
items:
type: string
type: array
groupInterval:
type: string
groupWait:
type: string
matchers:
items:
properties:
name:
type: string
regex:
type: boolean
value:
type: string
required:
- name
- value
type: object
type: array
receiver:
type: string
repeatInterval:
type: string
routes:
items: {}
type: array
type: object
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View file

@ -646,6 +646,96 @@ spec:
type: array
type: object
type: object
alertmanagerConfigNamespaceSelector:
description: Namespaces to be selected for AlertmanagerConfig discovery.
If nil, only check own namespace.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
The requirements are ANDed.
items:
description: A label selector requirement is a selector that
contains values, a key, and an operator that relates the key
and values.
properties:
key:
description: key is the label key that the selector applies
to.
type: string
operator:
description: operator represents a key's relationship to
a set of values. Valid operators are In, NotIn, Exists
and DoesNotExist.
type: string
values:
description: values is an array of string values. If the
operator is In or NotIn, the values array must be non-empty.
If the operator is Exists or DoesNotExist, the values
array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs. A single
{key,value} in the matchLabels map is equivalent to an element
of matchExpressions, whose key field is "key", the operator
is "In", and the values array contains only "value". The requirements
are ANDed.
type: object
type: object
alertmanagerConfigSelector:
description: AlertmanagerConfigs to be selected for to merge and configure
Alertmanager with.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
The requirements are ANDed.
items:
description: A label selector requirement is a selector that
contains values, a key, and an operator that relates the key
and values.
properties:
key:
description: key is the label key that the selector applies
to.
type: string
operator:
description: operator represents a key's relationship to
a set of values. Valid operators are In, NotIn, Exists
and DoesNotExist.
type: string
values:
description: values is an array of string values. If the
operator is In or NotIn, the values array must be non-empty.
If the operator is Exists or DoesNotExist, the values
array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs. A single
{key,value} in the matchLabels map is equivalent to an element
of matchExpressions, whose key field is "key", the operator
is "In", and the values array contains only "value". The requirements
are ANDed.
type: object
type: object
baseImage:
description: 'Base image that is used to deploy pods, without tag.
Deprecated: use ''image'' instead'

View file

@ -12,6 +12,7 @@ rules:
resources:
- alertmanagers
- alertmanagers/finalizers
- alertmanagerconfigs
- prometheuses
- prometheuses/finalizers
- thanosrulers

28
go.sum
View file

@ -626,6 +626,7 @@ github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0=
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/jsimonetti/rtnetlink v0.0.0-20190606172950-9527aa82566a/go.mod h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw=
github.com/jsimonetti/rtnetlink v0.0.0-20190830100107-3784a6c7c552/go.mod h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw=
@ -635,7 +636,6 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@ -772,6 +772,7 @@ github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86wM1zFnC6/uDBfZGNwB65O+pR2OFi5q/YQaEUid1qA=
@ -820,7 +821,6 @@ github.com/opentracing-contrib/go-stdlib v1.0.0/go.mod h1:qtI1ogk+2JhVPIXVc6q+NH
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.1.1-0.20200124165624-2876d2018785/go.mod h1:C+iumr2ni468+1jvcHXLCdqP9uQnoQbdX93F3aWahWU=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
@ -858,7 +858,6 @@ github.com/prometheus-community/prom-label-proxy v0.1.1-0.20200616110844-0fbfa11
github.com/prometheus-community/prom-label-proxy v0.1.1-0.20200616110844-0fbfa11fa8f3/go.mod h1:XdjyZg7LCbCC5FADHtpgNp6kQ0W9beXVGfmcvndMj5Y=
github.com/prometheus/alertmanager v0.18.0/go.mod h1:WcxHBl40VSPuOaqWae6l6HpnEOVRIycEJ7i9iYkadEE=
github.com/prometheus/alertmanager v0.19.0/go.mod h1:Eyp94Yi/T+kdeb2qvq66E3RGuph5T/jm/RBVh4yz1xo=
github.com/prometheus/alertmanager v0.20.0 h1:PBMNY7oyIvYMBBIag35/C0hO7xn8+35p4V5rNAph5N8=
github.com/prometheus/alertmanager v0.20.0/go.mod h1:9g2i48FAyZW6BtbsnvHtMHQXl2aVtrORKwKVCQ+nbrg=
github.com/prometheus/alertmanager v0.21.0 h1:qK51JcUR9l/unhawGA9F9B64OCYfcGewhPNprem/Acc=
github.com/prometheus/alertmanager v0.21.0/go.mod h1:h7tJ81NA0VLWvWEayi1QltevFkLF3KxmC/malTcT8Go=
@ -873,9 +872,7 @@ github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNk
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.5.1 h1:bdHYieyGlH+6OLEk2YQha8THib30KP0/yD0YH9m6xcA=
github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.6.0 h1:YVPodQOcK15POxhgARIvnDRVpLcuK8mglnMrWfyrw6A=
github.com/prometheus/client_golang v1.6.0/go.mod h1:ZLOG9ck3JLRdB5MgO8f+lLTe83AXG6ro35rLTxvnIl4=
github.com/prometheus/client_golang v1.7.1 h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
@ -894,9 +891,7 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
github.com/prometheus/common v0.8.0/go.mod h1:PC/OgXc+UN7B4ALwvn1yzVZmVwvhXp5JsbBv6wSv6i0=
github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U=
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.11.1/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
github.com/prometheus/common v0.13.0 h1:vJlpe9wPgDRM1Z+7Wj3zUUjY1nr6/1jNKyl7llliccg=
@ -912,7 +907,6 @@ github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDa
github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
github.com/prometheus/procfs v0.0.6/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/procfs v0.0.11 h1:DhHlBtkHWPYi8O2y31JkK0TF+DGM+51OopZjH/Ia5qI=
github.com/prometheus/procfs v0.0.11/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
@ -1020,7 +1014,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/uber/jaeger-client-go v2.15.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-client-go v2.20.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-client-go v2.23.0+incompatible h1:o2g11IUBdEsSZVzF3k7+bahLmxRP/dbOoW4zQ30UlKE=
github.com/uber/jaeger-client-go v2.23.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-client-go v2.23.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-client-go v2.24.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
@ -1117,9 +1110,7 @@ golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200422194213-44a606286825 h1:dSChiwOTvzwbHFTMq2l6uRardHH7/E6SqEkqccinS/o=
golang.org/x/crypto v0.0.0-20200422194213-44a606286825/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de h1:ikNHVSjEfnvz6sxdSPCaPt572qowuyMDMJLLm3Db3ig=
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@ -1157,7 +1148,6 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@ -1200,7 +1190,6 @@ golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd h1:QPwSajcTUrFriMF1nJ3XzgoqakqQEsnZf9LdXdi2nkI=
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
@ -1223,7 +1212,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o=
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -1288,7 +1276,6 @@ golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f h1:gWF768j/LaZugp8dyS4UwsslYCYz9XgFxvlgsn0n9H8=
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -1301,7 +1288,6 @@ golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fq
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180805044716-cb6730876b98/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@ -1309,7 +1295,6 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI=
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s=
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@ -1372,7 +1357,6 @@ golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapK
golang.org/x/tools v0.0.0-20200216192241-b320d3a0f5a2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200422205258-72e4a01eba43 h1:Lcsc5ErIWemp8qAbYffG5vPrqjJ0zk82RTFGifeS1Pc=
golang.org/x/tools v0.0.0-20200422205258-72e4a01eba43/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200513201620-d5fe73897c97/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200603131246-cc40288be839/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
@ -1470,7 +1454,6 @@ google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLY
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
@ -1510,12 +1493,10 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200603094226-e3079894b1e8/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ=
@ -1533,9 +1514,7 @@ k8s.io/api v0.0.0-20190813020757-36bff7324fb7/go.mod h1:3Iy+myeAORNCLgjd/Xu9ebwN
k8s.io/api v0.0.0-20191115095533-47f6de673b26/go.mod h1:iA/8arsvelvo4IDqIhX4IbjTEKBGgvsf2OraTuRtLFU=
k8s.io/api v0.0.0-20191122220107-b5267f2975e0/go.mod h1:vYpRfxYkMrmPPSesoHEkGNHxNKTk96REAwqm/inQbs0=
k8s.io/api v0.17.5/go.mod h1:0zV5/ungglgy2Rlm3QK8fbxkXVs+BSJWpJP/+8gUVLY=
k8s.io/api v0.18.2 h1:wG5g5ZmSVgm5B+eHMIbI9EGATS2L8Z72rda19RIEgY8=
k8s.io/api v0.18.2/go.mod h1:SJCWI7OLzhZSvbY7U8zwNl9UA4o1fizoug34OV/2r78=
k8s.io/api v0.18.3 h1:2AJaUQdgUZLoDZHrun21PW2Nx9+ll6cUzvn3IKhSIn0=
k8s.io/api v0.18.3/go.mod h1:UOaMwERbqJMfeeeHc8XJKawj4P9TgDRnViIqqBeH2QA=
k8s.io/api v0.18.5/go.mod h1:tN+e/2nbdGKOAH55NMV8oGrMG+3uRlA9GaRfvnCCSNk=
k8s.io/api v0.18.6/go.mod h1:eeyxr+cwCjMdLAmr2W3RyDI0VvTawSg/3RFFBEnmZGI=
@ -1547,9 +1526,7 @@ k8s.io/apimachinery v0.0.0-20190809020650-423f5d784010/go.mod h1:Waf/xTS2FGRrgXC
k8s.io/apimachinery v0.0.0-20191115015347-3c7067801da2/go.mod h1:dXFS2zaQR8fyzuvRdJDHw2Aerij/yVGJSre0bZQSVJA=
k8s.io/apimachinery v0.0.0-20191121175448-79c2a76c473a/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg=
k8s.io/apimachinery v0.17.5/go.mod h1:ioIo1G/a+uONV7Tv+ZmCbMG1/a3kVw5YcDdncd8ugQ0=
k8s.io/apimachinery v0.18.2 h1:44CmtbmkzVDAhCpRVSiP2R5PPrC2RtlIv/MoB8xpdRA=
k8s.io/apimachinery v0.18.2/go.mod h1:9SnR/e11v5IbyPCGbvJViimtJ0SwHG4nfZFjU77ftcA=
k8s.io/apimachinery v0.18.3 h1:pOGcbVAhxADgUYnjS08EFXs9QMl8qaH5U4fr5LGUrSk=
k8s.io/apimachinery v0.18.3/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
k8s.io/apimachinery v0.18.5/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
k8s.io/apimachinery v0.18.6/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
@ -1577,7 +1554,6 @@ k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058/go.mod h1:nfDlWeOsu3pUf4y
k8s.io/kube-openapi v0.0.0-20190722073852-5e22f3d471e6/go.mod h1:RZvgC8MSN6DjiMV6oIfEE9pDL9CYXokkfaCKZeHm3nc=
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
k8s.io/kube-openapi v0.0.0-20200316234421-82d701f24f9d h1:jocF7XFucw2pEiv2wS7wk2FRFCjDFGV1oa4TMs0SAT0=
k8s.io/kube-openapi v0.0.0-20200316234421-82d701f24f9d/go.mod h1:F+5wygcW0wmRTnM3cOgIqGivxkwSWIWT5YdsDbeAOaU=
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6 h1:Oh3Mzx5pJ+yIumsAD0MOECPVeXsVot0UkiaCGVyfGQY=
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -39,6 +39,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
// Prefixing with 0 to ensure these manifests are listed and therefore created first.
'0alertmanagerCustomResourceDefinition': import 'alertmanager-crd.libsonnet',
'0alertmanagerConfigCustomResourceDefinition': import 'alertmanagerconfig-crd.libsonnet',
'0prometheusCustomResourceDefinition': import 'prometheus-crd.libsonnet',
'0servicemonitorCustomResourceDefinition': import 'servicemonitor-crd.libsonnet',
'0podmonitorCustomResourceDefinition': import 'podmonitor-crd.libsonnet',
@ -66,6 +67,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
policyRule.withResources([
'alertmanagers',
'alertmanagers/finalizers',
'alertmanagerconfigs',
'prometheuses',
'prometheuses/finalizers',
'thanosrulers',

View file

@ -25,11 +25,14 @@ import (
monitoringclient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
"github.com/prometheus-operator/prometheus-operator/pkg/informers"
"github.com/prometheus-operator/prometheus-operator/pkg/k8sutil"
"github.com/prometheus-operator/prometheus-operator/pkg/listwatch"
"github.com/prometheus-operator/prometheus-operator/pkg/operator"
"gopkg.in/yaml.v2"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/pkg/errors"
"github.com/prometheus/alertmanager/config"
"github.com/prometheus/client_golang/prometheus"
appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
@ -37,6 +40,7 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/cache"
@ -54,8 +58,12 @@ type Operator struct {
mclient monitoringclient.Interface
logger log.Logger
alrtInfs *informers.ForResource
ssetInfs *informers.ForResource
nsAlrtInf cache.SharedIndexInformer
nsAlrtCfgInf cache.SharedIndexInformer
alrtInfs *informers.ForResource
alrtCfgInfs *informers.ForResource
ssetInfs *informers.ForResource
queue workqueue.RateLimitingInterface
@ -126,6 +134,22 @@ func New(ctx context.Context, c operator.Config, logger log.Logger, r prometheus
return nil, errors.Wrap(err, "error creating alertmanager informers")
}
o.alrtCfgInfs, err = informers.NewInformersForResource(
informers.NewMonitoringInformerFactories(
o.config.Namespaces.AllowList,
o.config.Namespaces.DenyList,
mclient,
resyncPeriod,
func(options *metav1.ListOptions) {
options.LabelSelector = o.config.AlertManagerSelector
},
),
monitoringv1.SchemeGroupVersion.WithResource(monitoringv1.AlertmanagerConfigName),
)
if err != nil {
return nil, errors.Wrap(err, "error creating alertmanagerconfig informers")
}
o.ssetInfs, err = informers.NewInformersForResource(
informers.NewKubeInformerFactories(
o.config.Namespaces.AlertmanagerAllowList,
@ -140,6 +164,34 @@ func New(ctx context.Context, c operator.Config, logger log.Logger, r prometheus
return nil, errors.Wrap(err, "error creating statefulset informers")
}
newNamespaceInformer := func(o *Operator, allowList map[string]struct{}) cache.SharedIndexInformer {
// nsResyncPeriod is used to control how often the namespace informer
// should resync. If the unprivileged ListerWatcher is used, then the
// informer must resync more often because it cannot watch for
// namespace changes.
nsResyncPeriod := 15 * time.Second
// If the only namespace is v1.NamespaceAll, then the client must be
// privileged and a regular cache.ListWatch will be used. In this case
// watching works and we do not need to resync so frequently.
if listwatch.IsAllNamespaces(allowList) {
nsResyncPeriod = resyncPeriod
}
nsInf := cache.NewSharedIndexInformer(
o.metrics.NewInstrumentedListerWatcher(
listwatch.NewUnprivilegedNamespaceListWatchFromClient(o.logger, o.kclient.CoreV1().RESTClient(), allowList, o.config.Namespaces.DenyList, fields.Everything()),
),
&v1.Namespace{}, nsResyncPeriod, cache.Indexers{},
)
return nsInf
}
o.nsAlrtCfgInf = newNamespaceInformer(o, o.config.Namespaces.AllowList)
if listwatch.IdenticalNamespaces(o.config.Namespaces.AllowList, o.config.Namespaces.AlertmanagerAllowList) {
o.nsAlrtInf = o.nsAlrtCfgInf
} else {
o.nsAlrtInf = newNamespaceInformer(o, o.config.Namespaces.AlertmanagerAllowList)
}
return o, nil
}
@ -152,6 +204,7 @@ func (c *Operator) waitForCacheSync(ctx context.Context) error {
informersForResource *informers.ForResource
}{
{"Alertmanager", c.alrtInfs},
{"AlertmanagerConfig", c.alrtCfgInfs},
{"StatefulSet", c.ssetInfs},
} {
for _, inf := range infs.informersForResource.GetInformers() {
@ -176,6 +229,11 @@ func (c *Operator) addHandlers() {
DeleteFunc: c.handleAlertmanagerDelete,
UpdateFunc: c.handleAlertmanagerUpdate,
})
c.alrtCfgInfs.AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: c.handleAlertmanagerConfigAdd,
DeleteFunc: c.handleAlertmanagerConfigDelete,
UpdateFunc: c.handleAlertmanagerConfigUpdate,
})
c.ssetInfs.AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: c.handleStatefulSetAdd,
DeleteFunc: c.handleStatefulSetDelete,
@ -183,6 +241,98 @@ func (c *Operator) addHandlers() {
})
}
func (c *Operator) handleAlertmanagerConfigAdd(obj interface{}) {
o, ok := c.getObject(obj)
if ok {
level.Debug(c.logger).Log("msg", "AlertmanagerConfig added")
c.metrics.TriggerByCounter(monitoringv1.AlertmanagerConfigKind, "add").Inc()
c.enqueueForMonitorNamespace(o.GetNamespace())
}
}
func (c *Operator) handleAlertmanagerConfigUpdate(old, cur interface{}) {
if old.(*monitoringv1.AlertmanagerConfig).ResourceVersion == cur.(*monitoringv1.AlertmanagerConfig).ResourceVersion {
return
}
o, ok := c.getObject(cur)
if ok {
level.Debug(c.logger).Log("msg", "AlertmanagerConfig updated")
c.metrics.TriggerByCounter(monitoringv1.AlertmanagerConfigKind, "update").Inc()
c.enqueueForMonitorNamespace(o.GetNamespace())
}
}
func (c *Operator) handleAlertmanagerConfigDelete(obj interface{}) {
o, ok := c.getObject(obj)
if ok {
level.Debug(c.logger).Log("msg", "AlertmanagerConfig delete")
c.metrics.TriggerByCounter(monitoringv1.AlertmanagerConfigKind, "delete").Inc()
c.enqueueForMonitorNamespace(o.GetNamespace())
}
}
func (c *Operator) enqueueForMonitorNamespace(nsName string) {
c.enqueueForNamespace(c.nsAlrtCfgInf.GetStore(), nsName)
}
// enqueueForNamespace enqueues all Alertmanager object keys that belong to the
// given namespace or select objects in the given namespace.
func (c *Operator) enqueueForNamespace(store cache.Store, nsName string) {
nsObject, exists, err := store.GetByKey(nsName)
if err != nil {
level.Error(c.logger).Log(
"msg", "get namespace to enqueue Alertmanager instances failed",
"err", err,
)
return
}
if !exists {
level.Error(c.logger).Log(
"msg", fmt.Sprintf("get namespace to enqueue Alertmanager instances failed: namespace %q does not exist", nsName),
)
return
}
ns := nsObject.(*v1.Namespace)
objs, err := c.alrtInfs.List(labels.Everything())
if err != nil {
level.Error(c.logger).Log(
"msg", "listing all Alertmanager instances from cache failed",
"err", err,
)
return
}
for _, obj := range objs {
// Check for Alertmanager instances in the namespace.
am := obj.(*monitoringv1.Alertmanager)
if am.Namespace == nsName {
c.enqueue(am)
return
}
// Check for Alertmanager instances selecting AlertmanagerConfigs in
// the namespace.
acNSSelector, err := metav1.LabelSelectorAsSelector(am.Spec.AlertmanagerConfigNamespaceSelector)
if err != nil {
level.Error(c.logger).Log(
"msg", fmt.Sprintf("failed to convert AlertmanagerConfigNamespaceSelector of %q to selector", am.Name),
"err", err,
)
return
}
if acNSSelector.Matches(labels.Set(ns.Labels)) {
c.enqueue(am)
return
}
}
}
// Run the controller.
func (c *Operator) Run(ctx context.Context) error {
defer c.queue.ShutDown()
@ -211,7 +361,12 @@ func (c *Operator) Run(ctx context.Context) error {
go c.worker(ctx)
go c.alrtInfs.Start(ctx.Done())
go c.alrtCfgInfs.Start(ctx.Done())
go c.ssetInfs.Start(ctx.Done())
go c.nsAlrtCfgInf.Run(ctx.Done())
if c.nsAlrtInf != c.nsAlrtCfgInf {
go c.nsAlrtInf.Run(ctx.Done())
}
if err := c.waitForCacheSync(ctx); err != nil {
return err
}
@ -419,6 +574,10 @@ func (c *Operator) sync(ctx context.Context, key string) error {
level.Info(c.logger).Log("msg", "sync alertmanager", "key", key)
if err := c.provisionAlertmanagerConfiguration(context.TODO(), am); err != nil {
return errors.Wrap(err, "provision alertmanager configuration")
}
// Create governing service if it doesn't exist.
svcClient := c.kclient.CoreV1().Services(am.Namespace)
if err = k8sutil.CreateOrUpdateService(ctx, svcClient, makeStatefulSetService(am, c.config)); err != nil {
@ -471,6 +630,64 @@ func (c *Operator) sync(ctx context.Context, key string) error {
return nil
}
func (c *Operator) provisionAlertmanagerConfiguration(ctx context.Context, am *monitoringv1.Alertmanager) error {
secretName := defaultConfigSecretName(am.Name)
if am.Spec.ConfigSecret != "" {
secretName = am.Spec.ConfigSecret
}
secret, err := c.kclient.CoreV1().Secrets(am.Namespace).Get(ctx, secretName, metav1.GetOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return errors.Wrap(err, "get base configuration secret")
}
var baseConfigYaml yaml.MapSlice
baseConfig, _ := secret.Data["alertmanager.yaml"]
_, err = config.Load(string(baseConfig))
if err != nil {
level.Warn(c.logger).Log("msg", "base configuration loaded from Secret could not be parsed", "secret", secretName)
baseConfig = []byte{}
}
err = yaml.Unmarshal(baseConfig, &baseConfigYaml)
if err != nil {
return errors.Wrap(err, "unmarshalling base config")
}
foundRoute := false
foundReceivers := false
foundInhibitRules := false
for _, i := range baseConfigYaml {
if k, ok := i.Key.(string); ok {
if k == "route" {
foundRoute = true
}
if k == "receivers" {
foundReceivers = true
}
if k == "route" {
foundInhibitRules = true
}
}
}
if !foundRoute {
return errors.New("default route must be configured")
}
// build routes, receivers and inhibit rules from AlertmanagerConfigs here
if foundReceivers {
// just append receivrs from AlertmanagerConfig CRs, otherwise must first create receivers field
}
if foundInhibitRules {
// just append inhibition rules from AlertmanagerConfig CRs, otherwise must first create inhibit rules field
}
return nil
}
//checkAlertmanagerSpecDeprecation checks for deprecated fields in the prometheus spec and logs a warning if applicable
func checkAlertmanagerSpecDeprecation(key string, a *monitoringv1.Alertmanager, logger log.Logger) {
deprecationWarningf := "alertmanager key=%v, field %v is deprecated, '%v' field should be used instead"

View file

@ -73,9 +73,6 @@ func makeStatefulSet(am *monitoringv1.Alertmanager, old *appsv1.StatefulSet, con
if _, ok := am.Spec.Resources.Requests[v1.ResourceMemory]; !ok {
am.Spec.Resources.Requests[v1.ResourceMemory] = resource.MustParse("200Mi")
}
if am.Spec.ConfigSecret == "" {
am.Spec.ConfigSecret = configSecretName(am.Name)
}
spec, err := makeStatefulSetSpec(am, config)
if err != nil {
@ -570,7 +567,7 @@ func makeStatefulSetSpec(a *monitoringv1.Alertmanager, config Config) (*appsv1.S
}, nil
}
func configSecretName(name string) string {
func defaultConfigSecretName(name string) string {
return prefixedName(name)
}

View file

@ -0,0 +1,117 @@
// Copyright 2018 The prometheus-operator Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package v1
import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)
const (
AlertmanagerConfigKind = "AlertmanagerConfig"
AlertmanagerConfigName = "alertmanagerconfigs"
AlertmanagerConfigKindKey = "alertmanagerconfig"
)
// AlertmanagerConfig defines a namespaced AlertmanagerConfig to be aggregated across multiple namespaces configuring one Alertmanager.
// +genclient
// +k8s:openapi-gen=true
type AlertmanagerConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec AlertmanagerConfigSpec `json:"spec"`
}
// AlertmanagerConfigList is a list of AlertmanagerConfig.
// +k8s:openapi-gen=true
type AlertmanagerConfigList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata
// More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata
metav1.ListMeta `json:"metadata,omitempty"`
// List of AlertmanagerConfig
Items []*AlertmanagerConfig `json:"items"`
}
type AlertmanagerConfigSpec struct {
Route *Route `json:"route,omitempty"`
Receivers []Receiver `json:"receivers,omitempty"`
InhibitRules []InhibitRule `json:"inhibitRules,omitempty"`
}
type Route struct {
Receiver string `json:"receiver,omitempty"`
GroupBy []string `json:"groupBy,omitempty"`
GroupWait string `json:"groupWait,omitempty"`
GroupInterval string `json:"groupInterval,omitempty"`
RepeatInterval string `json:"repeatInterval,omitempty"`
Matchers []Matcher `json:"matchers,omitempty"`
Continue *bool `json:"continue,omitempty"`
Routes []Route `json:"routes,omitempty"`
}
type Receiver struct {
Name string `json:"name"`
PagerDutyConfigs []PagerDutyConfig `json:"pagerDutyConfigs,omitempty"`
}
type PagerDutyConfig struct {
SendResolved *bool `json:"sendResolved,omitempty"`
RoutingKey *string `json:"routingKey,omitempty"`
ServiceKey *string `json:"serviceKey,omitempty"`
URL *string `json:"url,omitempty"`
Client *string `json:"client,omitempty"`
ClientURL *string `json:"clientURL,omitempty"`
Description *string `json:"description,omitempty"`
Severity *string `json:"severity,omitempty"`
Details []PagerDutyConfigDetail `json:"details,omitempty"`
HTTPConfig *HTTPConfig `json:"httpConfig,omitempty"`
}
type HTTPConfig struct {
BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
BearerTokenSecret *v1.SecretKeySelector `json:"bearerTokenSecret,omitempty"`
TLSConfig *TLSConfig `json:"tlsConfig,omitempty"`
ProxyURL *string `json:"proxyURL,omitempty"`
}
type PagerDutyConfigDetail struct {
Key string `json:"key"`
Value string `json:"value"`
}
type InhibitRule struct {
TargetMatch []Matcher `json:"matcher,omitempty"`
SourceMatch []Matcher `json:"matcher,omitempty"`
Equal []string `json:"equal,omitempty"`
}
type Matcher struct {
Name string `json:"name"`
Value string `json:"value"`
Regex *bool `json:"regex,omitempty"`
}
// DeepCopyObject implements the runtime.Object interface.
func (l *AlertmanagerConfig) DeepCopyObject() runtime.Object {
return l.DeepCopy()
}
// DeepCopyObject implements the runtime.Object interface.
func (l *AlertmanagerConfigList) DeepCopyObject() runtime.Object {
return l.DeepCopy()
}

View file

@ -57,6 +57,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&ProbeList{},
&Alertmanager{},
&AlertmanagerList{},
&AlertmanagerConfig{},
&AlertmanagerConfigList{},
&PrometheusRule{},
&PrometheusRuleList{},
&ThanosRuler{},

View file

@ -1245,6 +1245,11 @@ type AlertmanagerSpec struct {
// ForceEnableClusterMode ensures Alertmanager does not deactivate the cluster mode when running with a single replica.
// Use case is e.g. spanning an Alertmanager cluster across Kubernetes clusters with a single replica in each.
ForceEnableClusterMode bool `json:"forceEnableClusterMode,omitempty"`
// AlertmanagerConfigs to be selected for to merge and configure Alertmanager with.
AlertmanagerConfigSelector *metav1.LabelSelector `json:"alertmanagerConfigSelector,omitempty"`
// Namespaces to be selected for AlertmanagerConfig discovery. If nil, only
// check own namespace.
AlertmanagerConfigNamespaceSelector *metav1.LabelSelector `json:"alertmanagerConfigNamespaceSelector,omitempty"`
}
// AlertmanagerList is a list of Alertmanagers.

View file

@ -94,6 +94,86 @@ func (in *Alertmanager) DeepCopy() *Alertmanager {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AlertmanagerConfig) DeepCopyInto(out *AlertmanagerConfig) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerConfig.
func (in *AlertmanagerConfig) DeepCopy() *AlertmanagerConfig {
if in == nil {
return nil
}
out := new(AlertmanagerConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AlertmanagerConfigList) DeepCopyInto(out *AlertmanagerConfigList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]*AlertmanagerConfig, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(AlertmanagerConfig)
(*in).DeepCopyInto(*out)
}
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerConfigList.
func (in *AlertmanagerConfigList) DeepCopy() *AlertmanagerConfigList {
if in == nil {
return nil
}
out := new(AlertmanagerConfigList)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AlertmanagerConfigSpec) DeepCopyInto(out *AlertmanagerConfigSpec) {
*out = *in
if in.Route != nil {
in, out := &in.Route, &out.Route
*out = new(Route)
(*in).DeepCopyInto(*out)
}
if in.Receivers != nil {
in, out := &in.Receivers, &out.Receivers
*out = make([]Receiver, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.InhibitRules != nil {
in, out := &in.InhibitRules, &out.InhibitRules
*out = make([]InhibitRule, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerConfigSpec.
func (in *AlertmanagerConfigSpec) DeepCopy() *AlertmanagerConfigSpec {
if in == nil {
return nil
}
out := new(AlertmanagerConfigSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AlertmanagerEndpoints) DeepCopyInto(out *AlertmanagerEndpoints) {
*out = *in
@ -240,6 +320,16 @@ func (in *AlertmanagerSpec) DeepCopyInto(out *AlertmanagerSpec) {
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.AlertmanagerConfigSelector != nil {
in, out := &in.AlertmanagerConfigSelector, &out.AlertmanagerConfigSelector
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
if in.AlertmanagerConfigNamespaceSelector != nil {
in, out := &in.AlertmanagerConfigNamespaceSelector, &out.AlertmanagerConfigNamespaceSelector
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlertmanagerSpec.
@ -425,6 +515,95 @@ func (in *Endpoint) DeepCopy() *Endpoint {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HTTPConfig) DeepCopyInto(out *HTTPConfig) {
*out = *in
if in.BasicAuth != nil {
in, out := &in.BasicAuth, &out.BasicAuth
*out = new(BasicAuth)
(*in).DeepCopyInto(*out)
}
if in.BearerTokenSecret != nil {
in, out := &in.BearerTokenSecret, &out.BearerTokenSecret
*out = new(corev1.SecretKeySelector)
(*in).DeepCopyInto(*out)
}
if in.TLSConfig != nil {
in, out := &in.TLSConfig, &out.TLSConfig
*out = new(TLSConfig)
(*in).DeepCopyInto(*out)
}
if in.ProxyURL != nil {
in, out := &in.ProxyURL, &out.ProxyURL
*out = new(string)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPConfig.
func (in *HTTPConfig) DeepCopy() *HTTPConfig {
if in == nil {
return nil
}
out := new(HTTPConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *InhibitRule) DeepCopyInto(out *InhibitRule) {
*out = *in
if in.TargetMatch != nil {
in, out := &in.TargetMatch, &out.TargetMatch
*out = make([]Matcher, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.SourceMatch != nil {
in, out := &in.SourceMatch, &out.SourceMatch
*out = make([]Matcher, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Equal != nil {
in, out := &in.Equal, &out.Equal
*out = make([]string, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InhibitRule.
func (in *InhibitRule) DeepCopy() *InhibitRule {
if in == nil {
return nil
}
out := new(InhibitRule)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Matcher) DeepCopyInto(out *Matcher) {
*out = *in
if in.Regex != nil {
in, out := &in.Regex, &out.Regex
*out = new(bool)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Matcher.
func (in *Matcher) DeepCopy() *Matcher {
if in == nil {
return nil
}
out := new(Matcher)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NamespaceSelector) DeepCopyInto(out *NamespaceSelector) {
*out = *in
@ -445,6 +624,86 @@ func (in *NamespaceSelector) DeepCopy() *NamespaceSelector {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PagerDutyConfig) DeepCopyInto(out *PagerDutyConfig) {
*out = *in
if in.SendResolved != nil {
in, out := &in.SendResolved, &out.SendResolved
*out = new(bool)
**out = **in
}
if in.RoutingKey != nil {
in, out := &in.RoutingKey, &out.RoutingKey
*out = new(string)
**out = **in
}
if in.ServiceKey != nil {
in, out := &in.ServiceKey, &out.ServiceKey
*out = new(string)
**out = **in
}
if in.URL != nil {
in, out := &in.URL, &out.URL
*out = new(string)
**out = **in
}
if in.Client != nil {
in, out := &in.Client, &out.Client
*out = new(string)
**out = **in
}
if in.ClientURL != nil {
in, out := &in.ClientURL, &out.ClientURL
*out = new(string)
**out = **in
}
if in.Description != nil {
in, out := &in.Description, &out.Description
*out = new(string)
**out = **in
}
if in.Severity != nil {
in, out := &in.Severity, &out.Severity
*out = new(string)
**out = **in
}
if in.Details != nil {
in, out := &in.Details, &out.Details
*out = make([]PagerDutyConfigDetail, len(*in))
copy(*out, *in)
}
if in.HTTPConfig != nil {
in, out := &in.HTTPConfig, &out.HTTPConfig
*out = new(HTTPConfig)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PagerDutyConfig.
func (in *PagerDutyConfig) DeepCopy() *PagerDutyConfig {
if in == nil {
return nil
}
out := new(PagerDutyConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PagerDutyConfigDetail) DeepCopyInto(out *PagerDutyConfigDetail) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PagerDutyConfigDetail.
func (in *PagerDutyConfigDetail) DeepCopy() *PagerDutyConfigDetail {
if in == nil {
return nil
}
out := new(PagerDutyConfigDetail)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodMetricsEndpoint) DeepCopyInto(out *PodMetricsEndpoint) {
*out = *in
@ -1207,6 +1466,28 @@ func (in *QueueConfig) DeepCopy() *QueueConfig {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Receiver) DeepCopyInto(out *Receiver) {
*out = *in
if in.PagerDutyConfigs != nil {
in, out := &in.PagerDutyConfigs, &out.PagerDutyConfigs
*out = make([]PagerDutyConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Receiver.
func (in *Receiver) DeepCopy() *Receiver {
if in == nil {
return nil
}
out := new(Receiver)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RelabelConfig) DeepCopyInto(out *RelabelConfig) {
*out = *in
@ -1296,6 +1577,45 @@ func (in *RemoteWriteSpec) DeepCopy() *RemoteWriteSpec {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Route) DeepCopyInto(out *Route) {
*out = *in
if in.GroupBy != nil {
in, out := &in.GroupBy, &out.GroupBy
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Matchers != nil {
in, out := &in.Matchers, &out.Matchers
*out = make([]Matcher, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Continue != nil {
in, out := &in.Continue, &out.Continue
*out = new(bool)
**out = **in
}
if in.Routes != nil {
in, out := &in.Routes, &out.Routes
*out = make([]Route, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route.
func (in *Route) DeepCopy() *Route {
if in == nil {
return nil
}
out := new(Route)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Rule) DeepCopyInto(out *Rule) {
*out = *in

View file

@ -53,6 +53,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
// Group=monitoring.coreos.com, Version=v1
case v1.SchemeGroupVersion.WithResource("alertmanagers"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Monitoring().V1().Alertmanagers().Informer()}, nil
case v1.SchemeGroupVersion.WithResource("alertmanagerconfigs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Monitoring().V1().AlertmanagerConfigs().Informer()}, nil
case v1.SchemeGroupVersion.WithResource("podmonitors"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Monitoring().V1().PodMonitors().Informer()}, nil
case v1.SchemeGroupVersion.WithResource("probes"):

View file

@ -0,0 +1,88 @@
// Copyright 2018 The prometheus-operator Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by informer-gen. DO NOT EDIT.
package v1
import (
"context"
time "time"
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
internalinterfaces "github.com/prometheus-operator/prometheus-operator/pkg/client/informers/externalversions/internalinterfaces"
v1 "github.com/prometheus-operator/prometheus-operator/pkg/client/listers/monitoring/v1"
versioned "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
)
// AlertmanagerConfigInformer provides access to a shared informer and lister for
// AlertmanagerConfigs.
type AlertmanagerConfigInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1.AlertmanagerConfigLister
}
type alertmanagerConfigInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewAlertmanagerConfigInformer constructs a new informer for AlertmanagerConfig type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewAlertmanagerConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredAlertmanagerConfigInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredAlertmanagerConfigInformer constructs a new informer for AlertmanagerConfig type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredAlertmanagerConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.MonitoringV1().AlertmanagerConfigs(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.MonitoringV1().AlertmanagerConfigs(namespace).Watch(context.TODO(), options)
},
},
&monitoringv1.AlertmanagerConfig{},
resyncPeriod,
indexers,
)
}
func (f *alertmanagerConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredAlertmanagerConfigInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *alertmanagerConfigInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&monitoringv1.AlertmanagerConfig{}, f.defaultInformer)
}
func (f *alertmanagerConfigInformer) Lister() v1.AlertmanagerConfigLister {
return v1.NewAlertmanagerConfigLister(f.Informer().GetIndexer())
}

View file

@ -24,6 +24,8 @@ import (
type Interface interface {
// Alertmanagers returns a AlertmanagerInformer.
Alertmanagers() AlertmanagerInformer
// AlertmanagerConfigs returns a AlertmanagerConfigInformer.
AlertmanagerConfigs() AlertmanagerConfigInformer
// PodMonitors returns a PodMonitorInformer.
PodMonitors() PodMonitorInformer
// Probes returns a ProbeInformer.
@ -54,6 +56,11 @@ func (v *version) Alertmanagers() AlertmanagerInformer {
return &alertmanagerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// AlertmanagerConfigs returns a AlertmanagerConfigInformer.
func (v *version) AlertmanagerConfigs() AlertmanagerConfigInformer {
return &alertmanagerConfigInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// PodMonitors returns a PodMonitorInformer.
func (v *version) PodMonitors() PodMonitorInformer {
return &podMonitorInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}

View file

@ -0,0 +1,92 @@
// Copyright 2018 The prometheus-operator Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by lister-gen. DO NOT EDIT.
package v1
import (
v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// AlertmanagerConfigLister helps list AlertmanagerConfigs.
type AlertmanagerConfigLister interface {
// List lists all AlertmanagerConfigs in the indexer.
List(selector labels.Selector) (ret []*v1.AlertmanagerConfig, err error)
// AlertmanagerConfigs returns an object that can list and get AlertmanagerConfigs.
AlertmanagerConfigs(namespace string) AlertmanagerConfigNamespaceLister
AlertmanagerConfigListerExpansion
}
// alertmanagerConfigLister implements the AlertmanagerConfigLister interface.
type alertmanagerConfigLister struct {
indexer cache.Indexer
}
// NewAlertmanagerConfigLister returns a new AlertmanagerConfigLister.
func NewAlertmanagerConfigLister(indexer cache.Indexer) AlertmanagerConfigLister {
return &alertmanagerConfigLister{indexer: indexer}
}
// List lists all AlertmanagerConfigs in the indexer.
func (s *alertmanagerConfigLister) List(selector labels.Selector) (ret []*v1.AlertmanagerConfig, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1.AlertmanagerConfig))
})
return ret, err
}
// AlertmanagerConfigs returns an object that can list and get AlertmanagerConfigs.
func (s *alertmanagerConfigLister) AlertmanagerConfigs(namespace string) AlertmanagerConfigNamespaceLister {
return alertmanagerConfigNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// AlertmanagerConfigNamespaceLister helps list and get AlertmanagerConfigs.
type AlertmanagerConfigNamespaceLister interface {
// List lists all AlertmanagerConfigs in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v1.AlertmanagerConfig, err error)
// Get retrieves the AlertmanagerConfig from the indexer for a given namespace and name.
Get(name string) (*v1.AlertmanagerConfig, error)
AlertmanagerConfigNamespaceListerExpansion
}
// alertmanagerConfigNamespaceLister implements the AlertmanagerConfigNamespaceLister
// interface.
type alertmanagerConfigNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all AlertmanagerConfigs in the indexer for a given namespace.
func (s alertmanagerConfigNamespaceLister) List(selector labels.Selector) (ret []*v1.AlertmanagerConfig, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1.AlertmanagerConfig))
})
return ret, err
}
// Get retrieves the AlertmanagerConfig from the indexer for a given namespace and name.
func (s alertmanagerConfigNamespaceLister) Get(name string) (*v1.AlertmanagerConfig, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1.Resource("alertmanagerconfig"), name)
}
return obj.(*v1.AlertmanagerConfig), nil
}

View file

@ -24,6 +24,14 @@ type AlertmanagerListerExpansion interface{}
// AlertmanagerNamespaceLister.
type AlertmanagerNamespaceListerExpansion interface{}
// AlertmanagerConfigListerExpansion allows custom methods to be added to
// AlertmanagerConfigLister.
type AlertmanagerConfigListerExpansion interface{}
// AlertmanagerConfigNamespaceListerExpansion allows custom methods to be added to
// AlertmanagerConfigNamespaceLister.
type AlertmanagerConfigNamespaceListerExpansion interface{}
// PodMonitorListerExpansion allows custom methods to be added to
// PodMonitorLister.
type PodMonitorListerExpansion interface{}

View file

@ -0,0 +1,176 @@
// Copyright 2018 The prometheus-operator Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
package v1
import (
"context"
"time"
v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
scheme "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/scheme"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// AlertmanagerConfigsGetter has a method to return a AlertmanagerConfigInterface.
// A group's client should implement this interface.
type AlertmanagerConfigsGetter interface {
AlertmanagerConfigs(namespace string) AlertmanagerConfigInterface
}
// AlertmanagerConfigInterface has methods to work with AlertmanagerConfig resources.
type AlertmanagerConfigInterface interface {
Create(ctx context.Context, alertmanagerConfig *v1.AlertmanagerConfig, opts metav1.CreateOptions) (*v1.AlertmanagerConfig, error)
Update(ctx context.Context, alertmanagerConfig *v1.AlertmanagerConfig, opts metav1.UpdateOptions) (*v1.AlertmanagerConfig, error)
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.AlertmanagerConfig, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.AlertmanagerConfigList, error)
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.AlertmanagerConfig, err error)
AlertmanagerConfigExpansion
}
// alertmanagerConfigs implements AlertmanagerConfigInterface
type alertmanagerConfigs struct {
client rest.Interface
ns string
}
// newAlertmanagerConfigs returns a AlertmanagerConfigs
func newAlertmanagerConfigs(c *MonitoringV1Client, namespace string) *alertmanagerConfigs {
return &alertmanagerConfigs{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the alertmanagerConfig, and returns the corresponding alertmanagerConfig object, and an error if there is any.
func (c *alertmanagerConfigs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.AlertmanagerConfig, err error) {
result = &v1.AlertmanagerConfig{}
err = c.client.Get().
Namespace(c.ns).
Resource("alertmanagerconfigs").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of AlertmanagerConfigs that match those selectors.
func (c *alertmanagerConfigs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.AlertmanagerConfigList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1.AlertmanagerConfigList{}
err = c.client.Get().
Namespace(c.ns).
Resource("alertmanagerconfigs").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested alertmanagerConfigs.
func (c *alertmanagerConfigs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("alertmanagerconfigs").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a alertmanagerConfig and creates it. Returns the server's representation of the alertmanagerConfig, and an error, if there is any.
func (c *alertmanagerConfigs) Create(ctx context.Context, alertmanagerConfig *v1.AlertmanagerConfig, opts metav1.CreateOptions) (result *v1.AlertmanagerConfig, err error) {
result = &v1.AlertmanagerConfig{}
err = c.client.Post().
Namespace(c.ns).
Resource("alertmanagerconfigs").
VersionedParams(&opts, scheme.ParameterCodec).
Body(alertmanagerConfig).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a alertmanagerConfig and updates it. Returns the server's representation of the alertmanagerConfig, and an error, if there is any.
func (c *alertmanagerConfigs) Update(ctx context.Context, alertmanagerConfig *v1.AlertmanagerConfig, opts metav1.UpdateOptions) (result *v1.AlertmanagerConfig, err error) {
result = &v1.AlertmanagerConfig{}
err = c.client.Put().
Namespace(c.ns).
Resource("alertmanagerconfigs").
Name(alertmanagerConfig.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(alertmanagerConfig).
Do(ctx).
Into(result)
return
}
// Delete takes name of the alertmanagerConfig and deletes it. Returns an error if one occurs.
func (c *alertmanagerConfigs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("alertmanagerconfigs").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *alertmanagerConfigs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("alertmanagerconfigs").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched alertmanagerConfig.
func (c *alertmanagerConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.AlertmanagerConfig, err error) {
result = &v1.AlertmanagerConfig{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("alertmanagerconfigs").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View file

@ -0,0 +1,128 @@
// Copyright 2018 The prometheus-operator Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeAlertmanagerConfigs implements AlertmanagerConfigInterface
type FakeAlertmanagerConfigs struct {
Fake *FakeMonitoringV1
ns string
}
var alertmanagerconfigsResource = schema.GroupVersionResource{Group: "monitoring.coreos.com", Version: "v1", Resource: "alertmanagerconfigs"}
var alertmanagerconfigsKind = schema.GroupVersionKind{Group: "monitoring.coreos.com", Version: "v1", Kind: "AlertmanagerConfig"}
// Get takes name of the alertmanagerConfig, and returns the corresponding alertmanagerConfig object, and an error if there is any.
func (c *FakeAlertmanagerConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *monitoringv1.AlertmanagerConfig, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(alertmanagerconfigsResource, c.ns, name), &monitoringv1.AlertmanagerConfig{})
if obj == nil {
return nil, err
}
return obj.(*monitoringv1.AlertmanagerConfig), err
}
// List takes label and field selectors, and returns the list of AlertmanagerConfigs that match those selectors.
func (c *FakeAlertmanagerConfigs) List(ctx context.Context, opts v1.ListOptions) (result *monitoringv1.AlertmanagerConfigList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(alertmanagerconfigsResource, alertmanagerconfigsKind, c.ns, opts), &monitoringv1.AlertmanagerConfigList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &monitoringv1.AlertmanagerConfigList{ListMeta: obj.(*monitoringv1.AlertmanagerConfigList).ListMeta}
for _, item := range obj.(*monitoringv1.AlertmanagerConfigList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested alertmanagerConfigs.
func (c *FakeAlertmanagerConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(alertmanagerconfigsResource, c.ns, opts))
}
// Create takes the representation of a alertmanagerConfig and creates it. Returns the server's representation of the alertmanagerConfig, and an error, if there is any.
func (c *FakeAlertmanagerConfigs) Create(ctx context.Context, alertmanagerConfig *monitoringv1.AlertmanagerConfig, opts v1.CreateOptions) (result *monitoringv1.AlertmanagerConfig, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(alertmanagerconfigsResource, c.ns, alertmanagerConfig), &monitoringv1.AlertmanagerConfig{})
if obj == nil {
return nil, err
}
return obj.(*monitoringv1.AlertmanagerConfig), err
}
// Update takes the representation of a alertmanagerConfig and updates it. Returns the server's representation of the alertmanagerConfig, and an error, if there is any.
func (c *FakeAlertmanagerConfigs) Update(ctx context.Context, alertmanagerConfig *monitoringv1.AlertmanagerConfig, opts v1.UpdateOptions) (result *monitoringv1.AlertmanagerConfig, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(alertmanagerconfigsResource, c.ns, alertmanagerConfig), &monitoringv1.AlertmanagerConfig{})
if obj == nil {
return nil, err
}
return obj.(*monitoringv1.AlertmanagerConfig), err
}
// Delete takes name of the alertmanagerConfig and deletes it. Returns an error if one occurs.
func (c *FakeAlertmanagerConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(alertmanagerconfigsResource, c.ns, name), &monitoringv1.AlertmanagerConfig{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeAlertmanagerConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(alertmanagerconfigsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &monitoringv1.AlertmanagerConfigList{})
return err
}
// Patch applies the patch and returns the patched alertmanagerConfig.
func (c *FakeAlertmanagerConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *monitoringv1.AlertmanagerConfig, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(alertmanagerconfigsResource, c.ns, name, pt, data, subresources...), &monitoringv1.AlertmanagerConfig{})
if obj == nil {
return nil, err
}
return obj.(*monitoringv1.AlertmanagerConfig), err
}

View file

@ -30,6 +30,10 @@ func (c *FakeMonitoringV1) Alertmanagers(namespace string) v1.AlertmanagerInterf
return &FakeAlertmanagers{c, namespace}
}
func (c *FakeMonitoringV1) AlertmanagerConfigs(namespace string) v1.AlertmanagerConfigInterface {
return &FakeAlertmanagerConfigs{c, namespace}
}
func (c *FakeMonitoringV1) PodMonitors(namespace string) v1.PodMonitorInterface {
return &FakePodMonitors{c, namespace}
}

View file

@ -18,6 +18,8 @@ package v1
type AlertmanagerExpansion interface{}
type AlertmanagerConfigExpansion interface{}
type PodMonitorExpansion interface{}
type ProbeExpansion interface{}

View file

@ -25,6 +25,7 @@ import (
type MonitoringV1Interface interface {
RESTClient() rest.Interface
AlertmanagersGetter
AlertmanagerConfigsGetter
PodMonitorsGetter
ProbesGetter
PrometheusesGetter
@ -42,6 +43,10 @@ func (c *MonitoringV1Client) Alertmanagers(namespace string) AlertmanagerInterfa
return newAlertmanagers(c, namespace)
}
func (c *MonitoringV1Client) AlertmanagerConfigs(namespace string) AlertmanagerConfigInterface {
return newAlertmanagerConfigs(c, namespace)
}
func (c *MonitoringV1Client) PodMonitors(namespace string) PodMonitorInterface {
return newPodMonitors(c, namespace)
}