diff --git a/jsonnet/kube-prometheus/components/prometheus-adapter.libsonnet b/jsonnet/kube-prometheus/components/prometheus-adapter.libsonnet index 341a2f5a89d8ba1bfd700207781cfe5a496aff9c..8312183cbb128e9741d4bcb478b894357680eeff 100644 --- a/jsonnet/kube-prometheus/components/prometheus-adapter.libsonnet +++ b/jsonnet/kube-prometheus/components/prometheus-adapter.libsonnet @@ -300,4 +300,20 @@ function(params) { namespace: pa._config.namespace, }], }, + + [if (defaults + params).replicas > 1 then 'podDisruptionBudget']: { + apiVersion: 'policy/v1beta1', + kind: 'PodDisruptionBudget', + metadata: { + name: pa._config.name, + namespace: pa._config.namespace, + labels: pa._config.commonLabels, + }, + spec: { + minAvailable: 1, + selector: { + matchLabels: pa._config.selectorLabels, + }, + }, + }, } diff --git a/kustomization.yaml b/kustomization.yaml index e23e2e6aa203e853e7470eab380150922035b9de..2f5b872e1ff49892e3d74bdf0cc95b63c4ad7369 100644 --- a/kustomization.yaml +++ b/kustomization.yaml @@ -51,6 +51,7 @@ resources: - ./manifests/prometheus-adapter-clusterRoleServerResources.yaml - ./manifests/prometheus-adapter-configMap.yaml - ./manifests/prometheus-adapter-deployment.yaml +- ./manifests/prometheus-adapter-podDisruptionBudget.yaml - ./manifests/prometheus-adapter-roleBindingAuthReader.yaml - ./manifests/prometheus-adapter-service.yaml - ./manifests/prometheus-adapter-serviceAccount.yaml diff --git a/manifests/prometheus-adapter-podDisruptionBudget.yaml b/manifests/prometheus-adapter-podDisruptionBudget.yaml new file mode 100644 index 0000000000000000000000000000000000000000..cbb4a8a8f2254449574d0a8ecf548553cc2be22c --- /dev/null +++ b/manifests/prometheus-adapter-podDisruptionBudget.yaml @@ -0,0 +1,17 @@ +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + labels: + app.kubernetes.io/component: metrics-adapter + app.kubernetes.io/name: prometheus-adapter + app.kubernetes.io/part-of: kube-prometheus + app.kubernetes.io/version: 0.8.4 + name: prometheus-adapter + namespace: monitoring +spec: + minAvailable: 1 + selector: + matchLabels: + app.kubernetes.io/component: metrics-adapter + app.kubernetes.io/name: prometheus-adapter + app.kubernetes.io/part-of: kube-prometheus