Skip to content

Commit cf5fdf1

Browse files
egeguneshors
andauthored
K8SPG-682: Merge upstream (#953)
* K8SPG-682: Merge upstream * fix restart after upgrade * fix envtest * delete unneeded files * remove registration.yaml --------- Co-authored-by: Viacheslav Sarzhan <[email protected]>
1 parent af65109 commit cf5fdf1

File tree

322 files changed

+5486
-4762
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+5486
-4762
lines changed

Makefile

+19-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ PGMONITOR_DIR ?= hack/tools/pgmonitor
99
PGMONITOR_VERSION ?= v4.11.0
1010
QUERIES_CONFIG_DIR ?= hack/tools/queries
1111

12+
EXTERNAL_SNAPSHOTTER_DIR ?= hack/tools/external-snapshotter
13+
EXTERNAL_SNAPSHOTTER_VERSION ?= v8.0.1
14+
1215
# Buildah's "build" used to be "bud". Use the alias to be compatible for a while.
1316
BUILDAH_BUILD ?= buildah bud
1417

@@ -52,6 +55,12 @@ get-pgmonitor:
5255
cp -r '$(PGMONITOR_DIR)/postgres_exporter/common/.' '${QUERIES_CONFIG_DIR}'
5356
cp '$(PGMONITOR_DIR)/postgres_exporter/linux/queries_backrest.yml' '${QUERIES_CONFIG_DIR}'
5457

58+
.PHONY: get-external-snapshotter
59+
get-external-snapshotter:
60+
git -C '$(dir $(EXTERNAL_SNAPSHOTTER_DIR))' clone https://github.com/kubernetes-csi/external-snapshotter.git || git -C '$(EXTERNAL_SNAPSHOTTER_DIR)' fetch origin
61+
@git -C '$(EXTERNAL_SNAPSHOTTER_DIR)' checkout '$(EXTERNAL_SNAPSHOTTER_VERSION)'
62+
@git -C '$(EXTERNAL_SNAPSHOTTER_DIR)' config pull.ff only
63+
5564
.PHONY: clean
5665
clean: ## Clean resources
5766
clean: clean-deprecated
@@ -64,6 +73,7 @@ clean: clean-deprecated
6473
[ ! -f hack/tools/setup-envtest ] || rm hack/tools/setup-envtest
6574
[ ! -d hack/tools/envtest ] || { chmod -R u+w hack/tools/envtest && rm -r hack/tools/envtest; }
6675
[ ! -d hack/tools/pgmonitor ] || rm -rf hack/tools/pgmonitor
76+
[ ! -d hack/tools/external-snapshotter ] || rm -rf hack/tools/external-snapshotter
6777
[ ! -n "$$(ls hack/tools)" ] || rm -r hack/tools/*
6878
[ ! -d hack/.kube ] || rm -r hack/.kube
6979

@@ -130,7 +140,10 @@ deploy-dev: createnamespaces
130140
CHECK_FOR_UPGRADES='$(if $(CHECK_FOR_UPGRADES),$(CHECK_FOR_UPGRADES),false)' \
131141
KUBECONFIG=hack/.kube/postgres-operator/pgo \
132142
PGO_NAMESPACE='postgres-operator' \
133-
$(shell $(KUSTOMIZE) build ./config/dev | \
143+
PGO_INSTALLER='deploy-dev' \
144+
PGO_INSTALLER_ORIGIN='postgres-operator-repo' \
145+
BUILD_SOURCE='build-postgres-operator' \
146+
$(shell kubectl kustomize ./config/dev | \
134147
sed -ne '/^kind: Deployment/,/^---/ { \
135148
/RELATED_IMAGE_/ { N; s,.*\(RELATED_[^[:space:]]*\).*value:[[:space:]]*\([^[:space:]]*\),\1="\2",; p; }; \
136149
}') \
@@ -140,8 +153,9 @@ deploy-dev: createnamespaces
140153
##@ Build - Binary
141154
.PHONY: build-postgres-operator
142155
build-postgres-operator: ## Build the postgres-operator binary
143-
$(GO_BUILD) -ldflags '-X "main.versionString=$(PGO_VERSION)"' \
144-
-o bin/postgres-operator ./cmd/postgres-operator
156+
$(GO_BUILD) $(\
157+
) --ldflags '-X "main.versionString=$(PGO_VERSION)"' $(\
158+
) --trimpath -o bin/postgres-operator ./cmd/postgres-operator
145159

146160
##@ Build - Images
147161
.PHONY: build-postgres-operator-image
@@ -193,7 +207,7 @@ check: get-pgmonitor
193207
check-envtest: ## Run check using envtest and a mock kube api
194208
check-envtest: ENVTEST_USE = hack/tools/setup-envtest --bin-dir=$(CURDIR)/hack/tools/envtest use $(ENVTEST_K8S_VERSION)
195209
check-envtest: SHELL = bash
196-
check-envtest: get-pgmonitor
210+
check-envtest: get-pgmonitor get-external-snapshotter
197211
GOBIN='$(CURDIR)/hack/tools' $(GO) install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
198212
@$(ENVTEST_USE) --print=overview && echo
199213
source <($(ENVTEST_USE) --print=env) && PGO_NAMESPACE="postgres-operator" QUERIES_CONFIG_DIR="$(CURDIR)/${QUERIES_CONFIG_DIR}" \
@@ -205,7 +219,7 @@ check-envtest: get-pgmonitor
205219
# make check-envtest-existing PGO_TEST_TIMEOUT_SCALE=1.2
206220
.PHONY: check-envtest-existing
207221
check-envtest-existing: ## Run check using envtest and an existing kube api
208-
check-envtest-existing: get-pgmonitor
222+
check-envtest-existing: get-pgmonitor get-external-snapshotter
209223
check-envtest-existing: createnamespaces
210224
kubectl apply --server-side -k ./config/dev
211225
USE_EXISTING_CLUSTER=true PGO_NAMESPACE="postgres-operator" QUERIES_CONFIG_DIR="$(CURDIR)/${QUERIES_CONFIG_DIR}" \

build/crd/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/generated/
2+
/crunchy/generated/
23
/crunchybridgeclusters/generated/
34
/postgresclusters/generated/
45
/pgupgrades/generated/
56
/pgadmins/generated/
6-
/crunchy/generated/

build/crd/crunchy/generated/postgres-operator.crunchydata.com_pgupgrades.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ spec:
963963
type: object
964964
fromPostgresVersion:
965965
description: The major version of PostgreSQL before the upgrade.
966-
maximum: 16
966+
maximum: 17
967967
minimum: 10
968968
type: integer
969969
image:
@@ -2508,7 +2508,7 @@ spec:
25082508
type: string
25092509
toPostgresVersion:
25102510
description: The major version of PostgreSQL to be upgraded to.
2511-
maximum: 16
2511+
maximum: 17
25122512
minimum: 10
25132513
type: integer
25142514
tolerations:

build/crd/crunchy/generated/postgres-operator.crunchydata.com_postgresclusters.yaml

+13-4
Original file line numberDiff line numberDiff line change
@@ -4766,8 +4766,17 @@ spec:
47664766
required:
47674767
- repos
47684768
type: object
4769-
required:
4770-
- pgbackrest
4769+
snapshots:
4770+
description: VolumeSnapshot configuration
4771+
properties:
4772+
volumeSnapshotClassName:
4773+
description: Name of the VolumeSnapshotClass that should be
4774+
used by VolumeSnapshots
4775+
minLength: 1
4776+
type: string
4777+
required:
4778+
- volumeSnapshotClassName
4779+
type: object
47714780
type: object
47724781
config:
47734782
properties:
@@ -14004,8 +14013,8 @@ spec:
1400414013
postgresVersion:
1400514014
description: The major version of PostgreSQL installed in the PostgreSQL
1400614015
image
14007-
maximum: 16
14008-
minimum: 12
14016+
maximum: 17
14017+
minimum: 10
1400914018
type: integer
1401014019
proxy:
1401114020
description: The specification of a proxy that connects to PostgreSQL.

cmd/postgres-operator/main.go

+5-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
1-
package main
2-
3-
/*
4-
Copyright 2017 - 2024 Crunchy Data Solutions, Inc.
5-
Licensed under the Apache License, Version 2.0 (the "License");
6-
you may not use this file except in compliance with the License.
7-
You may obtain a copy of the License at
1+
// Copyright 2017 - 2024 Crunchy Data Solutions, Inc.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
84

9-
http://www.apache.org/licenses/LICENSE-2.0
10-
11-
Unless required by applicable law or agreed to in writing, software
12-
distributed under the License is distributed on an "AS IS" BASIS,
13-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
See the License for the specific language governing permissions and
15-
limitations under the License.
16-
*/
5+
package main
176

187
import (
198
"context"
@@ -135,7 +124,7 @@ func main() {
135124
log.Info("upgrade checking enabled")
136125
// get the URL for the check for upgrades endpoint if set in the env
137126
assertNoError(upgradecheck.ManagedScheduler(mgr,
138-
isOpenshift(ctx, mgr.GetConfig()), os.Getenv("CHECK_FOR_UPGRADES_URL"), versionString))
127+
isOpenshift(ctx, mgr.GetConfig()), os.Getenv("CHECK_FOR_UPGRADES_URL"), versionString, nil))
139128
}
140129

141130
assertNoError(mgr.Start(ctx))

cmd/postgres-operator/main_test.go

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
1-
/*
2-
Copyright 2017 - 2024 Crunchy Data Solutions, Inc.
3-
Licensed under the Apache License, Version 2.0 (the "License");
4-
you may not use this file except in compliance with the License.
5-
You may obtain a copy of the License at
6-
7-
http://www.apache.org/licenses/LICENSE-2.0
8-
9-
Unless required by applicable law or agreed to in writing, software
10-
distributed under the License is distributed on an "AS IS" BASIS,
11-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
See the License for the specific language governing permissions and
13-
limitations under the License.
14-
*/
1+
// Copyright 2017 - 2024 Crunchy Data Solutions, Inc.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
154

165
package main
176

cmd/postgres-operator/open_telemetry.go

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
1-
package main
2-
3-
/*
4-
Copyright 2021 - 2024 Crunchy Data Solutions, Inc.
5-
Licensed under the Apache License, Version 2.0 (the "License");
6-
you may not use this file except in compliance with the License.
7-
You may obtain a copy of the License at
1+
// Copyright 2021 - 2024 Crunchy Data Solutions, Inc.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
84

9-
http://www.apache.org/licenses/LICENSE-2.0
10-
11-
Unless required by applicable law or agreed to in writing, software
12-
distributed under the License is distributed on an "AS IS" BASIS,
13-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
See the License for the specific language governing permissions and
15-
limitations under the License.
16-
*/
5+
package main
176

187
import (
198
"context"

config/README.md

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
<!--
2-
Copyright 2021 - 2024 Crunchy Data Solutions, Inc.
3-
Licensed under the Apache License, Version 2.0 (the "License");
4-
you may not use this file except in compliance with the License.
5-
You may obtain a copy of the License at
6-
7-
http://www.apache.org/licenses/LICENSE-2.0
8-
9-
Unless required by applicable law or agreed to in writing, software
10-
distributed under the License is distributed on an "AS IS" BASIS,
11-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
See the License for the specific language governing permissions and
13-
limitations under the License.
2+
# Copyright 2021 - 2024 Crunchy Data Solutions, Inc.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
145
-->
156

167

config/crd/bases/postgres-operator.crunchydata.com_crunchybridgeclusters.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ spec:
6464
majorVersion:
6565
description: |-
6666
The ID of the cluster's major Postgres version.
67-
Currently Bridge offers 13-16
68-
maximum: 16
67+
Currently Bridge offers 13-17
68+
maximum: 17
6969
minimum: 13
7070
type: integer
7171
metadata:

config/crd/bases/postgres-operator.crunchydata.com_pgupgrades.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ spec:
965965
type: object
966966
fromPostgresVersion:
967967
description: The major version of PostgreSQL before the upgrade.
968-
maximum: 16
968+
maximum: 17
969969
minimum: 10
970970
type: integer
971971
image:
@@ -2505,7 +2505,7 @@ spec:
25052505
type: string
25062506
toPostgresVersion:
25072507
description: The major version of PostgreSQL to be upgraded to.
2508-
maximum: 16
2508+
maximum: 17
25092509
minimum: 10
25102510
type: integer
25112511
tolerations:

config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml

+13-4
Original file line numberDiff line numberDiff line change
@@ -4756,8 +4756,17 @@ spec:
47564756
required:
47574757
- repos
47584758
type: object
4759-
required:
4760-
- pgbackrest
4759+
snapshots:
4760+
description: VolumeSnapshot configuration
4761+
properties:
4762+
volumeSnapshotClassName:
4763+
description: Name of the VolumeSnapshotClass that should be
4764+
used by VolumeSnapshots
4765+
minLength: 1
4766+
type: string
4767+
required:
4768+
- volumeSnapshotClassName
4769+
type: object
47614770
type: object
47624771
config:
47634772
properties:
@@ -13946,8 +13955,8 @@ spec:
1394613955
postgresVersion:
1394713956
description: The major version of PostgreSQL installed in the PostgreSQL
1394813957
image
13949-
maximum: 16
13950-
minimum: 12
13958+
maximum: 17
13959+
minimum: 10
1395113960
type: integer
1395213961
proxy:
1395313962
description: The specification of a proxy that connects to PostgreSQL.

config/rbac/cluster/role.yaml

+13-10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ rules:
1010
- configmaps
1111
- persistentvolumeclaims
1212
- secrets
13+
- serviceaccounts
1314
- services
1415
verbs:
1516
- create
@@ -55,16 +56,6 @@ rules:
5556
- list
5657
- patch
5758
- watch
58-
- apiGroups:
59-
- ''
60-
resources:
61-
- serviceaccounts
62-
verbs:
63-
- create
64-
- get
65-
- list
66-
- patch
67-
- watch
6859
- apiGroups:
6960
- apps
7061
resources:
@@ -247,6 +238,18 @@ rules:
247238
- roles
248239
verbs:
249240
- create
241+
- delete
242+
- get
243+
- list
244+
- patch
245+
- watch
246+
- apiGroups:
247+
- snapshot.storage.k8s.io
248+
resources:
249+
- volumesnapshots
250+
verbs:
251+
- create
252+
- delete
250253
- get
251254
- list
252255
- patch

config/rbac/namespace/role.yaml

+13-10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ rules:
1010
- configmaps
1111
- persistentvolumeclaims
1212
- secrets
13+
- serviceaccounts
1314
- services
1415
verbs:
1516
- create
@@ -55,16 +56,6 @@ rules:
5556
- list
5657
- patch
5758
- watch
58-
- apiGroups:
59-
- ''
60-
resources:
61-
- serviceaccounts
62-
verbs:
63-
- create
64-
- get
65-
- list
66-
- patch
67-
- watch
6859
- apiGroups:
6960
- apps
7061
resources:
@@ -247,6 +238,18 @@ rules:
247238
- roles
248239
verbs:
249240
- create
241+
- delete
242+
- get
243+
- list
244+
- patch
245+
- watch
246+
- apiGroups:
247+
- snapshot.storage.k8s.io
248+
resources:
249+
- volumesnapshots
250+
verbs:
251+
- create
252+
- delete
250253
- get
251254
- list
252255
- patch

0 commit comments

Comments
 (0)