Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 19 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ PGMONITOR_DIR ?= hack/tools/pgmonitor
PGMONITOR_VERSION ?= v4.11.0
QUERIES_CONFIG_DIR ?= hack/tools/queries

EXTERNAL_SNAPSHOTTER_DIR ?= hack/tools/external-snapshotter
EXTERNAL_SNAPSHOTTER_VERSION ?= v8.0.1

# Buildah's "build" used to be "bud". Use the alias to be compatible for a while.
BUILDAH_BUILD ?= buildah bud

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

.PHONY: get-external-snapshotter
get-external-snapshotter:
git -C '$(dir $(EXTERNAL_SNAPSHOTTER_DIR))' clone https://github.com/kubernetes-csi/external-snapshotter.git || git -C '$(EXTERNAL_SNAPSHOTTER_DIR)' fetch origin
@git -C '$(EXTERNAL_SNAPSHOTTER_DIR)' checkout '$(EXTERNAL_SNAPSHOTTER_VERSION)'
@git -C '$(EXTERNAL_SNAPSHOTTER_DIR)' config pull.ff only

.PHONY: clean
clean: ## Clean resources
clean: clean-deprecated
Expand All @@ -64,6 +73,7 @@ clean: clean-deprecated
[ ! -f hack/tools/setup-envtest ] || rm hack/tools/setup-envtest
[ ! -d hack/tools/envtest ] || { chmod -R u+w hack/tools/envtest && rm -r hack/tools/envtest; }
[ ! -d hack/tools/pgmonitor ] || rm -rf hack/tools/pgmonitor
[ ! -d hack/tools/external-snapshotter ] || rm -rf hack/tools/external-snapshotter
[ ! -n "$$(ls hack/tools)" ] || rm -r hack/tools/*
[ ! -d hack/.kube ] || rm -r hack/.kube

Expand Down Expand Up @@ -130,7 +140,10 @@ deploy-dev: createnamespaces
CHECK_FOR_UPGRADES='$(if $(CHECK_FOR_UPGRADES),$(CHECK_FOR_UPGRADES),false)' \
KUBECONFIG=hack/.kube/postgres-operator/pgo \
PGO_NAMESPACE='postgres-operator' \
$(shell $(KUSTOMIZE) build ./config/dev | \
PGO_INSTALLER='deploy-dev' \
PGO_INSTALLER_ORIGIN='postgres-operator-repo' \
BUILD_SOURCE='build-postgres-operator' \
$(shell kubectl kustomize ./config/dev | \
sed -ne '/^kind: Deployment/,/^---/ { \
/RELATED_IMAGE_/ { N; s,.*\(RELATED_[^[:space:]]*\).*value:[[:space:]]*\([^[:space:]]*\),\1="\2",; p; }; \
}') \
Expand All @@ -140,8 +153,9 @@ deploy-dev: createnamespaces
##@ Build - Binary
.PHONY: build-postgres-operator
build-postgres-operator: ## Build the postgres-operator binary
$(GO_BUILD) -ldflags '-X "main.versionString=$(PGO_VERSION)"' \
-o bin/postgres-operator ./cmd/postgres-operator
$(GO_BUILD) $(\
) --ldflags '-X "main.versionString=$(PGO_VERSION)"' $(\
) --trimpath -o bin/postgres-operator ./cmd/postgres-operator

##@ Build - Images
.PHONY: build-postgres-operator-image
Expand Down Expand Up @@ -193,7 +207,7 @@ check: get-pgmonitor
check-envtest: ## Run check using envtest and a mock kube api
check-envtest: ENVTEST_USE = hack/tools/setup-envtest --bin-dir=$(CURDIR)/hack/tools/envtest use $(ENVTEST_K8S_VERSION)
check-envtest: SHELL = bash
check-envtest: get-pgmonitor
check-envtest: get-pgmonitor get-external-snapshotter
GOBIN='$(CURDIR)/hack/tools' $(GO) install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
@$(ENVTEST_USE) --print=overview && echo
source <($(ENVTEST_USE) --print=env) && PGO_NAMESPACE="postgres-operator" QUERIES_CONFIG_DIR="$(CURDIR)/${QUERIES_CONFIG_DIR}" \
Expand All @@ -205,7 +219,7 @@ check-envtest: get-pgmonitor
# make check-envtest-existing PGO_TEST_TIMEOUT_SCALE=1.2
.PHONY: check-envtest-existing
check-envtest-existing: ## Run check using envtest and an existing kube api
check-envtest-existing: get-pgmonitor
check-envtest-existing: get-pgmonitor get-external-snapshotter
check-envtest-existing: createnamespaces
kubectl apply --server-side -k ./config/dev
USE_EXISTING_CLUSTER=true PGO_NAMESPACE="postgres-operator" QUERIES_CONFIG_DIR="$(CURDIR)/${QUERIES_CONFIG_DIR}" \
Expand Down
2 changes: 1 addition & 1 deletion build/crd/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/generated/
/crunchy/generated/
/crunchybridgeclusters/generated/
/postgresclusters/generated/
/pgupgrades/generated/
/pgadmins/generated/
/crunchy/generated/
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ spec:
type: object
fromPostgresVersion:
description: The major version of PostgreSQL before the upgrade.
maximum: 16
maximum: 17
minimum: 10
type: integer
image:
Expand Down Expand Up @@ -2508,7 +2508,7 @@ spec:
type: string
toPostgresVersion:
description: The major version of PostgreSQL to be upgraded to.
maximum: 16
maximum: 17
minimum: 10
type: integer
tolerations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4766,8 +4766,17 @@ spec:
required:
- repos
type: object
required:
- pgbackrest
snapshots:
description: VolumeSnapshot configuration
properties:
volumeSnapshotClassName:
description: Name of the VolumeSnapshotClass that should be
used by VolumeSnapshots
minLength: 1
type: string
required:
- volumeSnapshotClassName
type: object
type: object
config:
properties:
Expand Down Expand Up @@ -14004,8 +14013,8 @@ spec:
postgresVersion:
description: The major version of PostgreSQL installed in the PostgreSQL
image
maximum: 16
minimum: 12
maximum: 17
minimum: 10
type: integer
proxy:
description: The specification of a proxy that connects to PostgreSQL.
Expand Down
21 changes: 5 additions & 16 deletions cmd/postgres-operator/main.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
package main

/*
Copyright 2017 - 2024 Crunchy Data Solutions, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
// Copyright 2017 - 2024 Crunchy Data Solutions, Inc.
//
// SPDX-License-Identifier: Apache-2.0

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main

import (
"context"
Expand Down Expand Up @@ -135,7 +124,7 @@ func main() {
log.Info("upgrade checking enabled")
// get the URL for the check for upgrades endpoint if set in the env
assertNoError(upgradecheck.ManagedScheduler(mgr,
isOpenshift(ctx, mgr.GetConfig()), os.Getenv("CHECK_FOR_UPGRADES_URL"), versionString))
isOpenshift(ctx, mgr.GetConfig()), os.Getenv("CHECK_FOR_UPGRADES_URL"), versionString, nil))
}

assertNoError(mgr.Start(ctx))
Expand Down
17 changes: 3 additions & 14 deletions cmd/postgres-operator/main_test.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
/*
Copyright 2017 - 2024 Crunchy Data Solutions, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Copyright 2017 - 2024 Crunchy Data Solutions, Inc.
//
// SPDX-License-Identifier: Apache-2.0

package main

Expand Down
19 changes: 4 additions & 15 deletions cmd/postgres-operator/open_telemetry.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
package main

/*
Copyright 2021 - 2024 Crunchy Data Solutions, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
// Copyright 2021 - 2024 Crunchy Data Solutions, Inc.
//
// SPDX-License-Identifier: Apache-2.0

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main

import (
"context"
Expand Down
15 changes: 3 additions & 12 deletions config/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
<!--
Copyright 2021 - 2024 Crunchy Data Solutions, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# Copyright 2021 - 2024 Crunchy Data Solutions, Inc.
#
# SPDX-License-Identifier: Apache-2.0
-->


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ spec:
majorVersion:
description: |-
The ID of the cluster's major Postgres version.
Currently Bridge offers 13-16
maximum: 16
Currently Bridge offers 13-17
maximum: 17
minimum: 13
type: integer
metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ spec:
type: object
fromPostgresVersion:
description: The major version of PostgreSQL before the upgrade.
maximum: 16
maximum: 17
minimum: 10
type: integer
image:
Expand Down Expand Up @@ -2505,7 +2505,7 @@ spec:
type: string
toPostgresVersion:
description: The major version of PostgreSQL to be upgraded to.
maximum: 16
maximum: 17
minimum: 10
type: integer
tolerations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4756,8 +4756,17 @@ spec:
required:
- repos
type: object
required:
- pgbackrest
snapshots:
description: VolumeSnapshot configuration
properties:
volumeSnapshotClassName:
description: Name of the VolumeSnapshotClass that should be
used by VolumeSnapshots
minLength: 1
type: string
required:
- volumeSnapshotClassName
type: object
type: object
config:
properties:
Expand Down Expand Up @@ -13946,8 +13955,8 @@ spec:
postgresVersion:
description: The major version of PostgreSQL installed in the PostgreSQL
image
maximum: 16
minimum: 12
maximum: 17
minimum: 10
type: integer
proxy:
description: The specification of a proxy that connects to PostgreSQL.
Expand Down
23 changes: 13 additions & 10 deletions config/rbac/cluster/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ rules:
- configmaps
- persistentvolumeclaims
- secrets
- serviceaccounts
- services
verbs:
- create
Expand Down Expand Up @@ -55,16 +56,6 @@ rules:
- list
- patch
- watch
- apiGroups:
- ''
resources:
- serviceaccounts
verbs:
- create
- get
- list
- patch
- watch
- apiGroups:
- apps
resources:
Expand Down Expand Up @@ -247,6 +238,18 @@ rules:
- roles
verbs:
- create
- delete
- get
- list
- patch
- watch
- apiGroups:
- snapshot.storage.k8s.io
resources:
- volumesnapshots
verbs:
- create
- delete
- get
- list
- patch
Expand Down
23 changes: 13 additions & 10 deletions config/rbac/namespace/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ rules:
- configmaps
- persistentvolumeclaims
- secrets
- serviceaccounts
- services
verbs:
- create
Expand Down Expand Up @@ -55,16 +56,6 @@ rules:
- list
- patch
- watch
- apiGroups:
- ''
resources:
- serviceaccounts
verbs:
- create
- get
- list
- patch
- watch
- apiGroups:
- apps
resources:
Expand Down Expand Up @@ -247,6 +238,18 @@ rules:
- roles
verbs:
- create
- delete
- get
- list
- patch
- watch
- apiGroups:
- snapshot.storage.k8s.io
resources:
- volumesnapshots
verbs:
- create
- delete
- get
- list
- patch
Expand Down
Loading
Loading