Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alertmanager: Set a Pod Disruption Budget #1683

Merged
merged 4 commits into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

### Jsonnet

* [CHANGE] Alertmanager: Added a `PodDisruptionBudget` of `withMaxUnavailable = 1`, to ensure we maintain quorum during rollouts. #1683
gotjosh marked this conversation as resolved.
Show resolved Hide resolved
* [FEATURE] Added support for `mimir-continuous-test`. To deploy `mimir-continuous-test` you can use the following configuration: #1675
```jsonnet
_config+: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-pdb
Expand Down
13 changes: 13 additions & 0 deletions operations/mimir-tests/test-gossip-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-pdb
Expand Down
13 changes: 13 additions & 0 deletions operations/mimir-tests/test-gossip-multi-zone-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-rollout-pdb
Expand Down
13 changes: 13 additions & 0 deletions operations/mimir-tests/test-gossip-multikv-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-pdb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-pdb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-pdb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-pdb
Expand Down
13 changes: 13 additions & 0 deletions operations/mimir-tests/test-multi-zone-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-rollout-pdb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-pdb
Expand Down
13 changes: 13 additions & 0 deletions operations/mimir-tests/test-query-sharding-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-pdb
Expand Down
13 changes: 13 additions & 0 deletions operations/mimir-tests/test-shuffle-sharding-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-pdb
Expand Down
13 changes: 13 additions & 0 deletions operations/mimir-tests/test-storage-azure-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-pdb
Expand Down
13 changes: 13 additions & 0 deletions operations/mimir-tests/test-storage-gcs-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-pdb
Expand Down
13 changes: 13 additions & 0 deletions operations/mimir-tests/test-storage-s3-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ metadata:
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: alertmanager-pdb
name: alertmanager-pdb
namespace: default
spec:
maxUnavailable: 1
selector:
matchLabels:
name: alertmanager
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
labels:
name: ingester-pdb
Expand Down
21 changes: 16 additions & 5 deletions operations/mimir/alertmanager.libsonnet
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
local pvc = $.core.v1.persistentVolumeClaim,
local volumeMount = $.core.v1.volumeMount,
local volume = $.core.v1.volume,
local configMap = $.core.v1.configMap,
local container = $.core.v1.container,
local statefulSet = $.apps.v1.statefulSet,
local podDisruptionBudget = $.policy.v1beta1.podDisruptionBudget,
local pvc = $.core.v1.persistentVolumeClaim,
local service = $.core.v1.service,
local configMap = $.core.v1.configMap,
local statefulSet = $.apps.v1.statefulSet,
local volume = $.core.v1.volume,
local volumeMount = $.core.v1.volumeMount,

local hasFallbackConfig = std.length($._config.alertmanager.fallback_config) > 0,

Expand Down Expand Up @@ -88,4 +89,14 @@
$.util.serviceFor($.alertmanager_statefulset, $._config.service_ignored_labels) +
service.mixin.spec.withClusterIp('None')
else {},

alertmanager_pdb:
if $._config.alertmanager_enabled then
podDisruptionBudget.new('alertmanager-pdb') +
podDisruptionBudget.mixin.metadata.withLabels({ name: 'alertmanager-pdb' }) +
podDisruptionBudget.mixin.spec.selector.withMatchLabels({
name: $.alertmanager_statefulset.spec.template.metadata.labels.name,
}) +
podDisruptionBudget.mixin.spec.withMaxUnavailable(1)
else {},
}