Skip to content

Commit 58ecd3f

Browse files
egeguneshorspooknull
authored
K8SPG-260: Merge upstream (#860)
* K8SPG-260: Merge upstream * remove golicense * fix envtest * fix crd * fix e2e-tests * fix envtest * fix envtest (for real this time) * fix cw-rbac * fix scan build * fix cw-rbac (for real this time) * fix custom users secret * fix demand-backup * fix demand-backup * fix tablespaces * fix upgrade-minor * fix major-upgrade * fix unit tests * fix upgrade-minor * fix tests * fix arm64 build * fix golangci-lint errors * use controller-gen v0.15.0 * fix golangci-lint errors * fix misspell errors * fix upgrade-minor * fix upgrade-minor test * remove images * remove files in .github * fix previous commit * remove pgo files --------- Co-authored-by: Viacheslav Sarzhan <[email protected]> Co-authored-by: Andrii Dema <[email protected]>
1 parent 8b5de58 commit 58ecd3f

File tree

355 files changed

+12668
-3199
lines changed

Some content is hidden

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

355 files changed

+12668
-3199
lines changed

.github/workflows/reviewdog.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
steps:
88
- uses: actions/setup-go@v5
99
with:
10-
go-version: '^1.20'
10+
go-version: '^1.22'
1111
- uses: actions/checkout@v4
1212
- name: golangci-lint
1313
uses: golangci/golangci-lint-action@v6
@@ -33,7 +33,7 @@ jobs:
3333
- uses: actions/checkout@v4
3434
- uses: actions/setup-go@v5
3535
with:
36-
go-version: '^1.20'
36+
go-version: '^1.22'
3737
- run: go install mvdan.cc/sh/v3/cmd/shfmt@latest
3838
- run: $(go env GOPATH)/bin/shfmt -bn -ci -s -w .
3939
- name: suggester / shfmt

.github/workflows/scan.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
export DOCKER_PUSH=0
2929
export DOCKER_SQUASH=0
3030
export DOCKER_DEFAULT_PLATFORM='linux/arm64'
31-
./e2e-tests/build
31+
make build-docker-image
3232
3333
- name: Run Trivy vulnerability scanner image (linux/arm64)
3434
uses: aquasecurity/[email protected]
@@ -46,7 +46,7 @@ jobs:
4646
export DOCKER_PUSH=0
4747
export DOCKER_SQUASH=0
4848
export DOCKER_DEFAULT_PLATFORM='linux/amd64'
49-
./e2e-tests/build
49+
make build-docker-image
5050
5151
- name: Run Trivy vulnerability scanner image (linux/amd64)
5252
uses: aquasecurity/[email protected]

.golangci.next.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ linters:
99
disable-all: true
1010
enable:
1111
- contextcheck
12+
- err113
1213
- errchkjson
1314
- gocritic
1415
- godot

.golangci.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ linters:
66
- errchkjson
77
- gci
88
- gofumpt
9-
- scopelint
109
enable:
1110
- depguard
1211
- gomodguard
@@ -70,8 +69,6 @@ linters-settings:
7069
alias: $1$2
7170
- pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+)
7271
alias: $1$2
73-
- pkg: k8s.io/apimachinery/pkg/api/errors
74-
alias: k8serrors
7572
no-unaliased: true
7673

7774
run:

Jenkinsfile

+1-32
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,6 @@ repo_gpgcheck=0
247247
gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
248248
EOF
249249
sudo yum install -y google-cloud-cli google-cloud-cli-gke-gcloud-auth-plugin
250-
251-
curl -sL https://github.com/mitchellh/golicense/releases/download/v0.2.0/golicense_0.2.0_linux_x86_64.tar.gz | sudo tar -C /usr/local/bin -xzf - golicense
252250
"""
253251
}
254252

@@ -323,7 +321,7 @@ pipeline {
323321
export RELEASE=0
324322
export IMAGE=\$DOCKER_TAG
325323
docker buildx create --use
326-
./e2e-tests/build
324+
make build-docker-image
327325
docker logout
328326
"
329327
sudo rm -rf ./build
@@ -363,35 +361,6 @@ pipeline {
363361
"""
364362
}
365363
}
366-
stage('GoLicense test') {
367-
steps {
368-
sh '''
369-
mkdir -p $WORKSPACE/src/github.com/percona
370-
ln -s $WORKSPACE $WORKSPACE/src/github.com/percona/percona-postgresql-operator
371-
sg docker -c "
372-
docker run \
373-
--rm \
374-
-v $WORKSPACE/src/github.com/percona/percona-postgresql-operator:/go/src/github.com/percona/percona-postgresql-operator \
375-
-w /go/src/github.com/percona/percona-postgresql-operator \
376-
-e GO111MODULE=on \
377-
-e GOFLAGS='-buildvcs=false' \
378-
golang:1.22 sh -c 'go build -v -o percona-postgresql-operator github.com/percona/percona-postgresql-operator/cmd/postgres-operator'
379-
"
380-
'''
381-
382-
withCredentials([string(credentialsId: 'GITHUB_API_TOKEN', variable: 'GITHUB_TOKEN')]) {
383-
sh """
384-
golicense -plain ./percona-postgresql-operator \
385-
| grep -v 'license not found' \
386-
| sed -r 's/^[^ ]+[ ]+//' \
387-
| sort \
388-
| uniq \
389-
> golicense-new || true
390-
diff -u ./e2e-tests/license/compare/golicense golicense-new
391-
"""
392-
}
393-
}
394-
}
395364
}
396365
}
397366
stage('Run E2E tests') {

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
END OF TERMS AND CONDITIONS
178178

179179
Copyright 2017 - 2024 Crunchy Data Solutions, Inc.
180-
Copyright 2021 Percona, LLC
180+
Copyright 2021 - 2024 Percona, LLC
181181

182182
Licensed under the Apache License, Version 2.0 (the "License");
183183
you may not use this file except in compliance with the License.

Makefile

+10-23
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,12 @@ QUERIES_CONFIG_DIR ?= hack/tools/queries
1212
# Buildah's "build" used to be "bud". Use the alias to be compatible for a while.
1313
BUILDAH_BUILD ?= buildah bud
1414

15-
DEBUG_BUILD ?= false
16-
GO ?= go
17-
GO_BUILD = $(GO_CMD) build -trimpath
18-
GO_CMD = $(GO_ENV) $(GO)
15+
GO ?= CGO_ENABLED=1 go
16+
GO_BUILD = $(GO) build -trimpath
1917
GO_TEST ?= $(GO) test
2018
KUTTL ?= kubectl-kuttl
2119
KUTTL_TEST ?= $(KUTTL) test
2220

23-
# Disable optimizations if creating a debug build
24-
ifeq ("$(DEBUG_BUILD)", "true")
25-
GO_BUILD = $(GO_CMD) build -gcflags='all=-N -l'
26-
endif
27-
2821
##@ General
2922

3023
# The help target prints out all targets with their descriptions organized
@@ -191,7 +184,8 @@ build-postgres-operator-image: build/postgres-operator/Dockerfile
191184
##@ Test
192185
.PHONY: check
193186
check: ## Run basic go tests with coverage output
194-
$(GO_TEST) -cover ./...
187+
check: get-pgmonitor
188+
QUERIES_CONFIG_DIR="$(CURDIR)/${QUERIES_CONFIG_DIR}" $(GO_TEST) -cover ./...
195189

196190
# Available versions: curl -s 'https://storage.googleapis.com/kubebuilder-tools/' | grep -o '<Key>[^<]*</Key>'
197191
# - KUBEBUILDER_ATTACH_CONTROL_PLANE_OUTPUT=true
@@ -206,7 +200,7 @@ check-envtest: get-pgmonitor
206200
$(GO_TEST) -count=1 -cover -tags=envtest ./...
207201

208202
# The "PGO_TEST_TIMEOUT_SCALE" environment variable (default: 1) can be set to a
209-
# positive number that extends test timeouts. The following runs tests with
203+
# positive number that extends test timeouts. The following runs tests with
210204
# timeouts that are 20% longer than normal:
211205
# make check-envtest-existing PGO_TEST_TIMEOUT_SCALE=1.2
212206
.PHONY: check-envtest-existing
@@ -230,7 +224,7 @@ generate-kuttl: export KUTTL_PG_UPGRADE_FROM_VERSION ?= 15
230224
generate-kuttl: export KUTTL_PG_UPGRADE_TO_VERSION ?= 16
231225
generate-kuttl: export KUTTL_PG_VERSION ?= 16
232226
generate-kuttl: export KUTTL_POSTGIS_VERSION ?= 3.4
233-
generate-kuttl: export KUTTL_PSQL_IMAGE ?= registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.2-0
227+
generate-kuttl: export KUTTL_PSQL_IMAGE ?= registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.3-1
234228
generate-kuttl: export KUTTL_TEST_DELETE_NAMESPACE ?= kuttl-test-delete-namespace
235229
generate-kuttl: ## Generate kuttl tests
236230
[ ! -d testing/kuttl/e2e-generated ] || rm -r testing/kuttl/e2e-generated
@@ -242,7 +236,6 @@ generate-kuttl: ## Generate kuttl tests
242236
14 ) export KUTTL_BITNAMI_IMAGE_TAG=14.5.0-debian-11-r37 ;; \
243237
13 ) export KUTTL_BITNAMI_IMAGE_TAG=13.8.0-debian-11-r39 ;; \
244238
12 ) export KUTTL_BITNAMI_IMAGE_TAG=12.12.0-debian-11-r40 ;; \
245-
11 ) export KUTTL_BITNAMI_IMAGE_TAG=11.17.0-debian-11-r39 ;; \
246239
esac; \
247240
render() { envsubst '"'"' \
248241
$$KUTTL_PG_UPGRADE_FROM_VERSION $$KUTTL_PG_UPGRADE_TO_VERSION \
@@ -346,7 +339,6 @@ generate-cw-bundle:
346339
$(KUSTOMIZE) build ./config/cw-bundle/ > ./deploy/cw-bundle.yaml
347340

348341

349-
350342
##@ Release
351343

352344
.PHONY: license licenses
@@ -380,17 +372,12 @@ KUSTOMIZE = $(shell pwd)/bin/kustomize
380372
kustomize: ## Download kustomize locally if necessary.
381373
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
382374

383-
# Available versions: curl -s 'https://storage.googleapis.com/kubebuilder-tools/' | grep -o '<Key>[^<]*</Key>'
384-
# - ENVTEST_K8S_VERSION=1.19.2
385-
hack/tools/envtest: SHELL = bash
386-
hack/tools/envtest:
387-
source '$(shell $(GO) list -f '{{ .Dir }}' -m 'sigs.k8s.io/controller-runtime')/hack/setup-envtest.sh' && fetch_envtest_tools $@
388-
389-
ENVTEST = $(shell pwd)/bin/setup-envtest
390-
envtest: ## Download envtest-setup locally if necessary.
375+
ENVTEST ?= hack/tools/setup-envtest
376+
tools: tools/setup-envtest
377+
tools/setup-envtest:
391378
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
392379

393-
build-docker-image:
380+
build-docker-image: get-pgmonitor
394381
ROOT_REPO=$(ROOT_REPO) VERSION=$(VERSION) IMAGE=$(IMAGE) $(ROOT_REPO)/e2e-tests/build
395382

396383
build-extension-installer-image:

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.14.0
6+
controller-gen.kubebuilder.io/version: v0.15.0
77
name: pgupgrades.postgres-operator.crunchydata.com
88
spec:
99
group: postgres-operator.crunchydata.com

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

+57-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.14.0
6+
controller-gen.kubebuilder.io/version: v0.15.0
77
name: postgresclusters.postgres-operator.crunchydata.com
88
spec:
99
group: postgres-operator.crunchydata.com
@@ -13863,7 +13863,7 @@ spec:
1386313863
Patroni dynamic configuration settings. Changes to this value will be
1386413864
automatically reloaded without validation. Changes to certain PostgreSQL
1386513865
parameters cause PostgreSQL to restart.
13866-
More info: https://patroni.readthedocs.io/en/latest/SETTINGS.html
13866+
More info: https://patroni.readthedocs.io/en/latest/dynamic_configuration.html
1386713867
type: object
1386813868
x-kubernetes-preserve-unknown-fields: true
1386913869
leaderLeaseDurationSeconds:
@@ -17079,6 +17079,18 @@ spec:
1707917079
service:
1708017080
description: Specification of the service that exposes PgBouncer.
1708117081
properties:
17082+
externalTrafficPolicy:
17083+
description: 'More info: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-policies'
17084+
enum:
17085+
- Cluster
17086+
- Local
17087+
type: string
17088+
internalTrafficPolicy:
17089+
description: 'More info: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-policies'
17090+
enum:
17091+
- Cluster
17092+
- Local
17093+
type: string
1708217094
loadBalancerSourceRanges:
1708317095
description: |-
1708417096
LoadBalancerSourceRanges is a list of IP CIDRs allowed access to load.
@@ -17413,6 +17425,18 @@ spec:
1741317425
description: Specification of the service that exposes PostgreSQL
1741417426
replica instances
1741517427
properties:
17428+
externalTrafficPolicy:
17429+
description: 'More info: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-policies'
17430+
enum:
17431+
- Cluster
17432+
- Local
17433+
type: string
17434+
internalTrafficPolicy:
17435+
description: 'More info: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-policies'
17436+
enum:
17437+
- Cluster
17438+
- Local
17439+
type: string
1741617440
loadBalancerSourceRanges:
1741717441
description: |-
1741817442
LoadBalancerSourceRanges is a list of IP CIDRs allowed access to load.
@@ -17453,6 +17477,18 @@ spec:
1745317477
description: Specification of the service that exposes the PostgreSQL
1745417478
primary instance.
1745517479
properties:
17480+
externalTrafficPolicy:
17481+
description: 'More info: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-policies'
17482+
enum:
17483+
- Cluster
17484+
- Local
17485+
type: string
17486+
internalTrafficPolicy:
17487+
description: 'More info: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-policies'
17488+
enum:
17489+
- Cluster
17490+
- Local
17491+
type: string
1745617492
loadBalancerSourceRanges:
1745717493
description: |-
1745817494
LoadBalancerSourceRanges is a list of IP CIDRs allowed access to load.
@@ -19143,6 +19179,18 @@ spec:
1914319179
service:
1914419180
description: Specification of the service that exposes pgAdmin.
1914519181
properties:
19182+
externalTrafficPolicy:
19183+
description: 'More info: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-policies'
19184+
enum:
19185+
- Cluster
19186+
- Local
19187+
type: string
19188+
internalTrafficPolicy:
19189+
description: 'More info: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-policies'
19190+
enum:
19191+
- Cluster
19192+
- Local
19193+
type: string
1914619194
loadBalancerSourceRanges:
1914719195
description: |-
1914819196
LoadBalancerSourceRanges is a list of IP CIDRs allowed access to load.
@@ -19444,6 +19492,7 @@ spec:
1944419492
ALTER ROLE options except for PASSWORD. This field is ignored for the
1944519493
"postgres" user.
1944619494
More info: https://www.postgresql.org/docs/current/role-attributes.html
19495+
maxLength: 200
1944719496
pattern: ^[^;]*$
1944819497
type: string
1944919498
password:
@@ -19472,6 +19521,7 @@ spec:
1947219521
required:
1947319522
- name
1947419523
type: object
19524+
maxItems: 64
1947519525
type: array
1947619526
x-kubernetes-list-map-keys:
1947719527
- name
@@ -19572,6 +19622,11 @@ spec:
1957219622
description: Current state of PostgreSQL instances.
1957319623
items:
1957419624
properties:
19625+
desiredPGDataVolume:
19626+
additionalProperties:
19627+
type: string
19628+
description: Desired Size of the pgData volume
19629+
type: object
1957519630
name:
1957619631
type: string
1957719632
readyReplicas:
@@ -19844,8 +19899,6 @@ spec:
1984419899
type: object
1984519900
type: object
1984619901
registrationRequired:
19847-
description: Version information for installations with a registration
19848-
requirement.
1984919902
properties:
1985019903
pgoVersion:
1985119904
type: string
@@ -19859,8 +19912,6 @@ spec:
1985919912
description: The instance set associated with the startupInstance
1986019913
type: string
1986119914
tokenRequired:
19862-
description: Signals the need for a token to be applied when registration
19863-
is required.
1986419915
type: string
1986519916
userInterface:
1986619917
description: Current state of the PostgreSQL user interface.

build/crd/crunchybridgeclusters/kustomization.yaml

-18
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,6 @@ resources:
55
- generated/postgres-operator.crunchydata.com_crunchybridgeclusters.yaml
66

77
patches:
8-
# Remove the zero status field included by [email protected]. These zero
9-
# values conflict with the CRD controller in Kubernetes before v1.22.
10-
# - https://github.com/kubernetes-sigs/controller-tools/pull/630
11-
# - https://pr.k8s.io/100970
12-
#- target:
13-
# group: apiextensions.k8s.io
14-
# version: v1
15-
# kind: CustomResourceDefinition
16-
# name: crunchybridgeclusters.postgres-operator.crunchydata.com
17-
# patch: |-
18-
# - op: remove
19-
# path: /status
208
- target:
219
group: apiextensions.k8s.io
2210
version: v1
@@ -29,9 +17,3 @@ patches:
2917
value:
3018
app.kubernetes.io/name: pgo
3119
app.kubernetes.io/version: latest
32-
- target:
33-
group: apiextensions.k8s.io
34-
version: v1
35-
kind: CustomResourceDefinition
36-
name: crunchybridgeclusters.postgres-operator.crunchydata.com
37-
path: immutable.yaml

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.14.0
6+
controller-gen.kubebuilder.io/version: v0.15.0
77
name: perconapgbackups.pgv2.percona.com
88
spec:
99
group: pgv2.percona.com

0 commit comments

Comments
 (0)