Skip to content

Commit 5ed8cf4

Browse files
authored
add PDB to make sure at least 1 pod is always available during upgrade (#2362)
1 parent 045989d commit 5ed8cf4

File tree

8 files changed

+190
-1
lines changed

8 files changed

+190
-1
lines changed

hack/test/install-prometheus.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ echo "Patching namespace to ${PROMETHEUS_NAMESPACE}..."
3838
echo "Applying Prometheus base..."
3939
kubectl apply -k "$TMPDIR" --server-side
4040

41+
echo "Waiting for Prometheus Operator deployment to become available..."
42+
kubectl wait --for=condition=Available deployment/prometheus-operator -n "$PROMETHEUS_NAMESPACE" --timeout=180s
43+
4144
echo "Waiting for Prometheus Operator pod to become ready..."
42-
kubectl wait --for=condition=Ready pod -n "$PROMETHEUS_NAMESPACE" -l app.kubernetes.io/name=prometheus-operator
45+
kubectl wait --for=condition=Ready pod -n "$PROMETHEUS_NAMESPACE" -l app.kubernetes.io/name=prometheus-operator --timeout=120s
4346

4447
echo "Applying prometheus Helm chart..."
4548
${HELM} template prometheus helm/prometheus ${PROMETHEUS_VALUES} | sed "s/cert-git-version/cert-${VERSION}/g" | kubectl apply -f -
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- if and .Values.options.catalogd.enabled .Values.options.catalogd.podDisruptionBudget.enabled }}
2+
apiVersion: policy/v1
3+
kind: PodDisruptionBudget
4+
metadata:
5+
name: catalogd-controller-manager
6+
namespace: {{ .Values.namespaces.olmv1.name }}
7+
labels:
8+
app.kubernetes.io/name: catalogd
9+
{{- include "olmv1.labels" . | nindent 4 }}
10+
annotations:
11+
{{- include "olmv1.annotations" . | nindent 4 }}
12+
spec:
13+
{{- if .Values.options.catalogd.podDisruptionBudget.minAvailable }}
14+
minAvailable: {{ .Values.options.catalogd.podDisruptionBudget.minAvailable }}
15+
{{- end }}
16+
{{- if .Values.options.catalogd.podDisruptionBudget.maxUnavailable }}
17+
maxUnavailable: {{ .Values.options.catalogd.podDisruptionBudget.maxUnavailable }}
18+
{{- end }}
19+
selector:
20+
matchLabels:
21+
control-plane: catalogd-controller-manager
22+
{{- end }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- if and .Values.options.operatorController.enabled .Values.options.operatorController.podDisruptionBudget.enabled }}
2+
apiVersion: policy/v1
3+
kind: PodDisruptionBudget
4+
metadata:
5+
name: operator-controller-controller-manager
6+
namespace: {{ .Values.namespaces.olmv1.name }}
7+
labels:
8+
app.kubernetes.io/name: operator-controller
9+
{{- include "olmv1.labels" . | nindent 4 }}
10+
annotations:
11+
{{- include "olmv1.annotations" . | nindent 4 }}
12+
spec:
13+
{{- if .Values.options.operatorController.podDisruptionBudget.minAvailable }}
14+
minAvailable: {{ .Values.options.operatorController.podDisruptionBudget.minAvailable }}
15+
{{- end }}
16+
{{- if .Values.options.operatorController.podDisruptionBudget.maxUnavailable }}
17+
maxUnavailable: {{ .Values.options.operatorController.podDisruptionBudget.maxUnavailable }}
18+
{{- end }}
19+
selector:
20+
matchLabels:
21+
control-plane: operator-controller-controller-manager
22+
{{- end }}

helm/olmv1/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ options:
1212
features:
1313
enabled: []
1414
disabled: []
15+
podDisruptionBudget:
16+
enabled: true
17+
minAvailable: 1
1518
catalogd:
1619
enabled: true
1720
deployment:
@@ -20,6 +23,9 @@ options:
2023
features:
2124
enabled: []
2225
disabled: []
26+
podDisruptionBudget:
27+
enabled: true
28+
minAvailable: 1
2329
certManager:
2430
enabled: false
2531
e2e:

manifests/experimental-e2e.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,40 @@ spec:
8787
- Ingress
8888
- Egress
8989
---
90+
# Source: olmv1/templates/poddisruptionbudget-olmv1-system-catalogd.yml
91+
apiVersion: policy/v1
92+
kind: PodDisruptionBudget
93+
metadata:
94+
name: catalogd-controller-manager
95+
namespace: olmv1-system
96+
labels:
97+
app.kubernetes.io/name: catalogd
98+
app.kubernetes.io/part-of: olm
99+
annotations:
100+
olm.operatorframework.io/feature-set: experimental-e2e
101+
spec:
102+
minAvailable: 1
103+
selector:
104+
matchLabels:
105+
control-plane: catalogd-controller-manager
106+
---
107+
# Source: olmv1/templates/poddisruptionbudget-olmv1-system-operator-controller.yml
108+
apiVersion: policy/v1
109+
kind: PodDisruptionBudget
110+
metadata:
111+
name: operator-controller-controller-manager
112+
namespace: olmv1-system
113+
labels:
114+
app.kubernetes.io/name: operator-controller
115+
app.kubernetes.io/part-of: olm
116+
annotations:
117+
olm.operatorframework.io/feature-set: experimental-e2e
118+
spec:
119+
minAvailable: 1
120+
selector:
121+
matchLabels:
122+
control-plane: operator-controller-controller-manager
123+
---
90124
# Source: olmv1/templates/serviceaccount-olmv1-system-common-controller-manager.yml
91125
apiVersion: v1
92126
kind: ServiceAccount

manifests/experimental.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,40 @@ spec:
8787
- Ingress
8888
- Egress
8989
---
90+
# Source: olmv1/templates/poddisruptionbudget-olmv1-system-catalogd.yml
91+
apiVersion: policy/v1
92+
kind: PodDisruptionBudget
93+
metadata:
94+
name: catalogd-controller-manager
95+
namespace: olmv1-system
96+
labels:
97+
app.kubernetes.io/name: catalogd
98+
app.kubernetes.io/part-of: olm
99+
annotations:
100+
olm.operatorframework.io/feature-set: experimental
101+
spec:
102+
minAvailable: 1
103+
selector:
104+
matchLabels:
105+
control-plane: catalogd-controller-manager
106+
---
107+
# Source: olmv1/templates/poddisruptionbudget-olmv1-system-operator-controller.yml
108+
apiVersion: policy/v1
109+
kind: PodDisruptionBudget
110+
metadata:
111+
name: operator-controller-controller-manager
112+
namespace: olmv1-system
113+
labels:
114+
app.kubernetes.io/name: operator-controller
115+
app.kubernetes.io/part-of: olm
116+
annotations:
117+
olm.operatorframework.io/feature-set: experimental
118+
spec:
119+
minAvailable: 1
120+
selector:
121+
matchLabels:
122+
control-plane: operator-controller-controller-manager
123+
---
90124
# Source: olmv1/templates/serviceaccount-olmv1-system-common-controller-manager.yml
91125
apiVersion: v1
92126
kind: ServiceAccount

manifests/standard-e2e.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,40 @@ spec:
8787
- Ingress
8888
- Egress
8989
---
90+
# Source: olmv1/templates/poddisruptionbudget-olmv1-system-catalogd.yml
91+
apiVersion: policy/v1
92+
kind: PodDisruptionBudget
93+
metadata:
94+
name: catalogd-controller-manager
95+
namespace: olmv1-system
96+
labels:
97+
app.kubernetes.io/name: catalogd
98+
app.kubernetes.io/part-of: olm
99+
annotations:
100+
olm.operatorframework.io/feature-set: standard-e2e
101+
spec:
102+
minAvailable: 1
103+
selector:
104+
matchLabels:
105+
control-plane: catalogd-controller-manager
106+
---
107+
# Source: olmv1/templates/poddisruptionbudget-olmv1-system-operator-controller.yml
108+
apiVersion: policy/v1
109+
kind: PodDisruptionBudget
110+
metadata:
111+
name: operator-controller-controller-manager
112+
namespace: olmv1-system
113+
labels:
114+
app.kubernetes.io/name: operator-controller
115+
app.kubernetes.io/part-of: olm
116+
annotations:
117+
olm.operatorframework.io/feature-set: standard-e2e
118+
spec:
119+
minAvailable: 1
120+
selector:
121+
matchLabels:
122+
control-plane: operator-controller-controller-manager
123+
---
90124
# Source: olmv1/templates/serviceaccount-olmv1-system-common-controller-manager.yml
91125
apiVersion: v1
92126
kind: ServiceAccount

manifests/standard.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,40 @@ spec:
8787
- Ingress
8888
- Egress
8989
---
90+
# Source: olmv1/templates/poddisruptionbudget-olmv1-system-catalogd.yml
91+
apiVersion: policy/v1
92+
kind: PodDisruptionBudget
93+
metadata:
94+
name: catalogd-controller-manager
95+
namespace: olmv1-system
96+
labels:
97+
app.kubernetes.io/name: catalogd
98+
app.kubernetes.io/part-of: olm
99+
annotations:
100+
olm.operatorframework.io/feature-set: standard
101+
spec:
102+
minAvailable: 1
103+
selector:
104+
matchLabels:
105+
control-plane: catalogd-controller-manager
106+
---
107+
# Source: olmv1/templates/poddisruptionbudget-olmv1-system-operator-controller.yml
108+
apiVersion: policy/v1
109+
kind: PodDisruptionBudget
110+
metadata:
111+
name: operator-controller-controller-manager
112+
namespace: olmv1-system
113+
labels:
114+
app.kubernetes.io/name: operator-controller
115+
app.kubernetes.io/part-of: olm
116+
annotations:
117+
olm.operatorframework.io/feature-set: standard
118+
spec:
119+
minAvailable: 1
120+
selector:
121+
matchLabels:
122+
control-plane: operator-controller-controller-manager
123+
---
90124
# Source: olmv1/templates/serviceaccount-olmv1-system-common-controller-manager.yml
91125
apiVersion: v1
92126
kind: ServiceAccount

0 commit comments

Comments
 (0)