Skip to content

Commit 7b2a796

Browse files
authored
Merge branch 'main' into K8SPG-628
2 parents 671b124 + 76b98e6 commit 7b2a796

File tree

335 files changed

+5887
-4842
lines changed

Some content is hidden

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

335 files changed

+5887
-4842
lines changed

.github/workflows/scan.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ jobs:
3131
make build-docker-image
3232
3333
- name: Run Trivy vulnerability scanner image (linux/arm64)
34-
uses: aquasecurity/trivy-action@0.28.0
34+
uses: aquasecurity/trivy-action@0.29.0
3535
with:
3636
image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-arm64'
3737
format: 'table'
3838
exit-code: '1'
3939
ignore-unfixed: true
4040
vuln-type: 'os,library'
4141
severity: 'CRITICAL,HIGH'
42+
version: 'v0.57.1'
4243

4344
- name: Build an image from Dockerfile (linux/amd64)
4445
run: |
@@ -49,11 +50,12 @@ jobs:
4950
make build-docker-image
5051
5152
- name: Run Trivy vulnerability scanner image (linux/amd64)
52-
uses: aquasecurity/trivy-action@0.28.0
53+
uses: aquasecurity/trivy-action@0.29.0
5354
with:
5455
image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-amd64'
5556
format: 'table'
5657
exit-code: '1'
5758
ignore-unfixed: true
5859
vuln-type: 'os,library'
5960
severity: 'CRITICAL,HIGH'
61+
version: 'v0.57.1'

Makefile

Lines changed: 19 additions & 5 deletions
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}" \

README.md

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
## Introduction
1313

14-
Percona Operator for PostgreSQL automates and simplifies deploying and managing open source PostgreSQL clusters on Kubernetes. Percona Operator for PostgreSQL is based on [Postgres Operator](https://crunchydata.github.io/postgres-operator/latest/) developed by Crunchy Data.
14+
[Percona Operator for PostgreSQL](https://docs.percona.com/percona-operator-for-postgresql/2.0/index.html) automates and simplifies deploying and managing open source PostgreSQL clusters on Kubernetes. It is based on [Postgres Operator](https://crunchydata.github.io/postgres-operator/latest/) developed by Crunchy Data.
1515

1616
Whether you need to get a simple PostgreSQL cluster up and running, need to deploy a high availability, fault tolerant cluster in production, or are running your own database-as-a-service, the Operator provides the essential features you need to keep your clusters healthy:
1717

@@ -23,7 +23,7 @@ Whether you need to get a simple PostgreSQL cluster up and running, need to depl
2323
- Scheduled and manual backups
2424
- Integrated monitoring with [Percona Monitoring and Management](https://www.percona.com/software/database-tools/percona-monitoring-and-management)
2525

26-
You interact with Percona Operator mostly via the command line tool. If you feel more comfortable with operating the Operator and database clusters via the web interface, there is [Percona Everest](https://docs.percona.com/everest/index.html) - an open-source web-based database provisioning tool available for you. It automates day-to-day database management operations for you, reducing the overall administrative overhead. [Get started with Percona Everest](https://docs.percona.com/everest/quickstart-guide/quick-install.html).
26+
While the Percona Operator is primarily managed through the command line, you can also use **[Percona Everest](https://docs.percona.com/everest/index.html)** for a web-based user interface. This open-source tool provides a streamlined experience for provisioning and managing your databases, simplifying day-to-day tasks and reducing administrative overhead. Learn more about Percona Everest in the [documentation](https://docs.percona.com/everest/index.html) or jump right in with the [quickstart guide](https://docs.percona.com/everest/quickstart-guide/quick-install.html).
2727

2828
## Architecture
2929

@@ -55,35 +55,18 @@ kubectl apply --server-side -f https://raw.githubusercontent.com/percona/percona
5555
kubectl apply -f https://raw.githubusercontent.com/percona/percona-postgresql-operator/main/deploy/cr.yaml
5656
```
5757

58-
## Contributing
58+
# Need help?
5959

60-
Percona welcomes and encourages community contributions to help improve Percona Operator for PostgreSQL.
60+
**Commercial Support** | **Community Support** |
61+
:-: | :-: |
62+
| <br/>Enterprise-grade assistance for your mission-critical PostgreSQL deployments with the Percona Operator for PostgreSQL. Get expert guidance for complex tasks like multi-cloud replication, database migration and building platforms.<br/><br/> | <br/>Connect with our engineers and fellow users for general questions, troubleshooting, and sharing feedback and ideas.<br/><br/> |
63+
| **[Get Percona Support](https://hubs.ly/Q02ZTH9s0)** | **[Visit our Forum](https://forums.percona.com/c/postgresql/percona-kubernetes-operator-for-postgresql/68)** |
6164

62-
See the [Contribution Guide](CONTRIBUTING.md) on how you can contribute.
65+
# Contributing
6366

64-
## Communication
65-
66-
We would love to hear from you! Reach out to us on [Forum](https://forums.percona.com/c/postgresql/percona-kubernetes-operator-for-postgresql/68) with your questions, feedback and ideas
67-
68-
## Join Percona Kubernetes Squad!
69-
```
70-
% _____
71-
%%% | __ \
72-
###%%%%%%%%%%%%* | |__) |__ _ __ ___ ___ _ __ __ _
73-
### ##%% %%%% | ___/ _ \ '__/ __/ _ \| '_ \ / _` |
74-
#### ##% %%%% | | | __/ | | (_| (_) | | | | (_| |
75-
### #### %%% |_| \___|_| \___\___/|_| |_|\__,_|
76-
,((### ### %%% _ _ _____ _
77-
(((( (### #### %%%% | | / _ \ / ____| | |
78-
((( ((# ###### | | _| (_) |___ | (___ __ _ _ _ __ _ __| |
79-
(((( (((# #### | |/ /> _ </ __| \___ \ / _` | | | |/ _` |/ _` |
80-
/(( ,((( *### | <| (_) \__ \ ____) | (_| | |_| | (_| | (_| |
81-
//// ((( #### |_|\_\\___/|___/ |_____/ \__, |\__,_|\__,_|\__,_|
82-
/// (((( #### | |
83-
/////////////(((((((((((((((((######## |_| Join @ percona.com/k8s
84-
```
67+
Percona welcomes and encourages community contributions to help improve Percona Operator for PostgreSQL.
8568

86-
You can get early access to new product features, invite-only ”ask me anything” sessions with Percona Kubernetes experts, and monthly swag raffles. Interested? Fill in the form at [percona.com/k8s](https://www.percona.com/k8s).
69+
See the [Contribution Guide](CONTRIBUTING.md) on how you can contribute.
8770

8871
## Roadmap
8972

build/crd/.gitignore

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,6 +3274,7 @@ spec:
32743274
- bucket
32753275
type: object
32763276
name:
3277+
default: repo1
32773278
description: The name of the repository
32783279
pattern: ^repo[1-4]
32793280
type: string
@@ -4515,6 +4516,7 @@ spec:
45154516
More info: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/
45164517
type: string
45174518
repoName:
4519+
default: repo1
45184520
description: |-
45194521
The name of the pgBackRest repo within the source PostgresCluster that contains the backups
45204522
that should be utilized to perform a pgBackRest restore when initializing the data source
@@ -4764,8 +4766,17 @@ spec:
47644766
required:
47654767
- repos
47664768
type: object
4767-
required:
4768-
- 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
47694780
type: object
47704781
config:
47714782
properties:
@@ -6598,6 +6609,7 @@ spec:
65986609
- bucket
65996610
type: object
66006611
name:
6612+
default: repo1
66016613
description: The name of the repository
66026614
pattern: ^repo[1-4]
66036615
type: string
@@ -7938,6 +7950,7 @@ spec:
79387950
More info: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/
79397951
type: string
79407952
repoName:
7953+
default: repo1
79417954
description: |-
79427955
The name of the pgBackRest repo within the source PostgresCluster that contains the backups
79437956
that should be utilized to perform a pgBackRest restore when initializing the data source
@@ -13946,6 +13959,7 @@ spec:
1394613959
in a PostgresCluster.
1394713960
properties:
1394813961
enabled:
13962+
default: false
1394913963
description: Whether or not the operator should allow switchovers
1395013964
in a PostgresCluster
1395113965
type: boolean
@@ -13999,8 +14013,8 @@ spec:
1399914013
postgresVersion:
1400014014
description: The major version of PostgreSQL installed in the PostgreSQL
1400114015
image
14002-
maximum: 16
14003-
minimum: 12
14016+
maximum: 17
14017+
minimum: 10
1400414018
type: integer
1400514019
proxy:
1400614020
description: The specification of a proxy that connects to PostgreSQL.

build/crd/percona/generated/pgv2.percona.com_perconapgbackups.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ spec:
132132
- bucket
133133
type: object
134134
name:
135+
default: repo1
135136
description: The name of the repository
136137
pattern: ^repo[1-4]
137138
type: string

build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3425,6 +3425,7 @@ spec:
34253425
- bucket
34263426
type: object
34273427
name:
3428+
default: repo1
34283429
description: The name of the repository
34293430
pattern: ^repo[1-4]
34303431
type: string
@@ -4666,6 +4667,7 @@ spec:
46664667
More info: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/
46674668
type: string
46684669
repoName:
4670+
default: repo1
46694671
description: |-
46704672
The name of the pgBackRest repo within the source PostgresCluster that contains the backups
46714673
that should be utilized to perform a pgBackRest restore when initializing the data source
@@ -6248,6 +6250,7 @@ spec:
62486250
- bucket
62496251
type: object
62506252
name:
6253+
default: repo1
62516254
description: The name of the repository
62526255
pattern: ^repo[1-4]
62536256
type: string
@@ -7588,6 +7591,7 @@ spec:
75887591
More info: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/
75897592
type: string
75907593
repoName:
7594+
default: repo1
75917595
description: |-
75927596
The name of the pgBackRest repo within the source PostgresCluster that contains the backups
75937597
that should be utilized to perform a pgBackRest restore when initializing the data source
@@ -13282,6 +13286,7 @@ spec:
1328213286
in a PostgresCluster.
1328313287
properties:
1328413288
enabled:
13289+
default: false
1328513290
description: Whether or not the operator should allow switchovers
1328613291
in a PostgresCluster
1328713292
type: boolean

cmd/postgres-operator/main.go

Lines changed: 6 additions & 16 deletions
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"
@@ -90,6 +79,7 @@ func main() {
9079
features := feature.NewGate()
9180
err = features.SetFromMap(map[string]bool{
9281
string(feature.InstanceSidecars): true, // needed for PMM
82+
string(feature.PGBouncerSidecars): true, // K8SPG-645
9383
string(feature.TablespaceVolumes): true,
9484
})
9585
assertNoError(err)
@@ -135,7 +125,7 @@ func main() {
135125
log.Info("upgrade checking enabled")
136126
// get the URL for the check for upgrades endpoint if set in the env
137127
assertNoError(upgradecheck.ManagedScheduler(mgr,
138-
isOpenshift(ctx, mgr.GetConfig()), os.Getenv("CHECK_FOR_UPGRADES_URL"), versionString))
128+
isOpenshift(ctx, mgr.GetConfig()), os.Getenv("CHECK_FOR_UPGRADES_URL"), versionString, nil))
139129
}
140130

141131
assertNoError(mgr.Start(ctx))

cmd/postgres-operator/main_test.go

Lines changed: 3 additions & 14 deletions
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

Lines changed: 4 additions & 15 deletions
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"

0 commit comments

Comments
 (0)