Skip to content

Commit f4a8d50

Browse files
committed
Add upgrade controller to Kustomize install
Issue: [sc-14201]
1 parent 74df255 commit f4a8d50

26 files changed

+1141
-37
lines changed

kustomize/install/crd/bases/postgres-operator.crunchydata.com_pgupgrades.yaml

Lines changed: 847 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
resources:
22
- bases/postgres-operator.crunchydata.com_postgresclusters.yaml
3+
- bases/postgres-operator.crunchydata.com_pgupgrades.yaml
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
namespace: postgres-operator
22

33
commonLabels:
4-
postgres-operator.crunchydata.com/control-plane: postgres-operator
54
app.kubernetes.io/name: pgo
65
app.kubernetes.io/version: 5.1.0
76

@@ -14,11 +13,12 @@ images:
1413
- name: postgres-operator
1514
newName: registry.developers.crunchydata.com/crunchydata/postgres-operator
1615
newTag: ubi8-5.1.0-0
16+
- name: postgres-operator-upgrade
17+
newName: registry.developers.crunchydata.com/crunchydata/postgres-operator-upgrade
18+
newTag: ubi8-5.1.0-0
1719

1820
patchesJson6902:
19-
- target:
20-
group: apps
21-
version: v1
22-
kind: Deployment
23-
name: pgo
24-
path: manager-selector.yaml
21+
- target: { group: apps, version: v1, kind: Deployment, name: pgo }
22+
path: selectors.yaml
23+
- target: { group: apps, version: v1, kind: Deployment, name: pgo-upgrade }
24+
path: selectors.yaml

kustomize/install/default/manager-selector.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# We add the app version as a "commonLabel" and change it with each release.
2+
# Remove it from selectors until we use "labels" of Kustomize v4.1.
3+
# See: https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/commonlabels/
4+
# See: https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv4.1.0
5+
- op: remove
6+
path: /spec/selector/matchLabels/app.kubernetes.io~1name
7+
- op: remove
8+
path: /spec/selector/matchLabels/app.kubernetes.io~1version
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
resources:
22
- manager.yaml
3+
- manager-upgrade.yaml
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: pgo-upgrade
6+
labels:
7+
postgres-operator.crunchydata.com/control-plane: postgres-operator-upgrade
8+
spec:
9+
replicas: 1
10+
strategy: { type: Recreate }
11+
selector:
12+
matchLabels:
13+
postgres-operator.crunchydata.com/control-plane: postgres-operator-upgrade
14+
template:
15+
metadata:
16+
labels:
17+
postgres-operator.crunchydata.com/control-plane: postgres-operator-upgrade
18+
spec:
19+
containers:
20+
- name: operator
21+
image: postgres-operator-upgrade
22+
env:
23+
- name: PGO_NAMESPACE
24+
valueFrom:
25+
fieldRef:
26+
fieldPath: metadata.namespace
27+
- name: CRUNCHY_DEBUG
28+
value: "true"
29+
- name: RELATED_IMAGE_PGUPGRADE
30+
value: "registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi8-5.1.0-0"
31+
securityContext:
32+
allowPrivilegeEscalation: false
33+
readOnlyRootFilesystem: true
34+
runAsNonRoot: true
35+
serviceAccountName: postgres-operator-upgrade

kustomize/install/manager/manager.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@ apiVersion: apps/v1
33
kind: Deployment
44
metadata:
55
name: pgo
6+
labels:
7+
postgres-operator.crunchydata.com/control-plane: postgres-operator
68
spec:
79
replicas: 1
810
strategy: { type: Recreate }
11+
selector:
12+
matchLabels:
13+
postgres-operator.crunchydata.com/control-plane: postgres-operator
914
template:
15+
metadata:
16+
labels:
17+
postgres-operator.crunchydata.com/control-plane: postgres-operator
1018
spec:
1119
containers:
1220
- name: operator

kustomize/install/rbac/cluster/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ resources:
22
- service_account.yaml
33
- role.yaml
44
- role_binding.yaml
5+
- service_account-upgrade.yaml
6+
- role-upgrade.yaml
7+
- role_binding-upgrade.yaml
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
creationTimestamp: null
6+
name: postgres-operator-upgrade
7+
labels:
8+
postgres-operator.crunchydata.com/control-plane: postgres-operator-upgrade
9+
rules:
10+
- apiGroups:
11+
- ""
12+
resources:
13+
- endpoints
14+
verbs:
15+
- delete
16+
- get
17+
- list
18+
- watch
19+
- apiGroups:
20+
- apps
21+
resources:
22+
- statefulsets
23+
verbs:
24+
- list
25+
- watch
26+
- apiGroups:
27+
- batch
28+
resources:
29+
- jobs
30+
verbs:
31+
- create
32+
- delete
33+
- list
34+
- patch
35+
- watch
36+
- apiGroups:
37+
- postgres-operator.crunchydata.com
38+
resources:
39+
- pgupgrades
40+
verbs:
41+
- get
42+
- list
43+
- watch
44+
- apiGroups:
45+
- postgres-operator.crunchydata.com
46+
resources:
47+
- pgupgrades/finalizers
48+
verbs:
49+
- patch
50+
- update
51+
- apiGroups:
52+
- postgres-operator.crunchydata.com
53+
resources:
54+
- pgupgrades/status
55+
verbs:
56+
- get
57+
- patch
58+
- apiGroups:
59+
- postgres-operator.crunchydata.com
60+
resources:
61+
- postgresclusters
62+
verbs:
63+
- get
64+
- list
65+
- watch
66+
- apiGroups:
67+
- postgres-operator.crunchydata.com
68+
resources:
69+
- postgresclusters/status
70+
verbs:
71+
- patch

0 commit comments

Comments
 (0)