Conversation
6d4a751 to
0ae6b24
Compare
K8SPG-624 Add support for S3ForcePathStyle and verifyTLS for custom extensions
…iner image instead of using the operator image (#1236)
* Add collation mismatch check * Add end of file lines * Skip verification by default and improve failure message --------- Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
* K8SPG-748 update statuses * update status for patroni and pgbackrest * update test * update tests * delete unused * update status naming * fix image --------- Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
* K8SPG-724: fix extension reinstall https://perconadev.atlassian.net/browse/K8SPG-724 * revert test changes * fix merge --------- Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
* K8SPG-718 patroni metrics to pmm * remove hardcoded versions, the tests will fail but they will pass again once we bump the version officially to 2.8 --------- Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
* K8SPG-781 add original error * K8SPG-781 add original error * K8SPG-781 add original error * fix PR comments --------- Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
* K8SPG-768 skip annotation updates * K8SPG-768 skip annotation updates * fix test * add test * fix test * fix version * fix version --------- Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
) * K8SPG-832: add `.spec.backups.pgbackrest.repoHost.sidecars` field https://perconadev.atlassian.net/browse/K8SPG-832 * address comments --------- Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.31.0 to 0.32.0. - [Release notes](https://github.com/aquasecurity/trivy-action/releases) - [Commits](aquasecurity/trivy-action@0.31.0...0.32.0) --- updated-dependencies: - dependency-name: aquasecurity/trivy-action dependency-version: 0.32.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* K8SPG-833: add `env` and `envFrom` fields https://perconadev.atlassian.net/browse/K8SPG-833 * fix misprint * address comment * add envFrom hashes * fix lint * revert formatting --------- Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.33.2 to 0.33.3. - [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md) - [Commits](kubernetes/client-go@v0.33.2...v0.33.3) --- updated-dependencies: - dependency-name: k8s.io/client-go dependency-version: 0.33.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
* CLOUD-727: Bump sigs.k8s.io/yaml from 1.5.0 to 1.6.0 Bumps [sigs.k8s.io/yaml](https://github.com/kubernetes-sigs/yaml) from 1.5.0 to 1.6.0. - [Release notes](https://github.com/kubernetes-sigs/yaml/releases) - [Changelog](https://github.com/kubernetes-sigs/yaml/blob/master/RELEASE.md) - [Commits](kubernetes-sigs/yaml@v1.5.0...v1.6.0) --- updated-dependencies: - dependency-name: sigs.k8s.io/yaml dependency-version: 1.6.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * use hetzner worker * add make * add docker-init * remove docker-ce --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
Bumps [k8s.io/component-base](https://github.com/kubernetes/component-base) from 0.33.2 to 0.33.3. - [Commits](kubernetes/component-base@v0.33.2...v0.33.3) --- updated-dependencies: - dependency-name: k8s.io/component-base dependency-version: 0.33.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/golang-jwt/jwt/v5](https://github.com/golang-jwt/jwt) from 5.2.2 to 5.3.0. - [Release notes](https://github.com/golang-jwt/jwt/releases) - [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md) - [Commits](golang-jwt/jwt@v5.2.2...v5.3.0) --- updated-dependencies: - dependency-name: github.com/golang-jwt/jwt/v5 dependency-version: 5.3.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.73.0 to 1.74.2. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](grpc/grpc-go@v1.73.0...v1.74.2) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-version: 1.74.2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.37.0 to 1.38.0. - [Release notes](https://github.com/onsi/gomega/releases) - [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md) - [Commits](onsi/gomega@v1.37.0...v1.38.0) --- updated-dependencies: - dependency-name: github.com/onsi/gomega dependency-version: 1.38.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1241) Bumps [k8s.io/apiextensions-apiserver](https://github.com/kubernetes/apiextensions-apiserver) from 0.33.2 to 0.33.3. - [Release notes](https://github.com/kubernetes/apiextensions-apiserver/releases) - [Commits](kubernetes/apiextensions-apiserver@v0.33.2...v0.33.3) --- updated-dependencies: - dependency-name: k8s.io/apiextensions-apiserver dependency-version: 0.33.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.55.7 to 1.55.8. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG_PENDING.md) - [Commits](aws/aws-sdk-go@v1.55.7...v1.55.8) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-version: 1.55.8 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.35.0 to 0.36.0. - [Release notes](https://github.com/golang/tools/releases) - [Commits](golang/tools@v0.35.0...v0.36.0) --- updated-dependencies: - dependency-name: golang.org/x/tools dependency-version: 0.36.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1252) Bumps [github.com/go-openapi/errors](https://github.com/go-openapi/errors) from 0.22.1 to 0.22.2. - [Commits](go-openapi/errors@v0.22.1...v0.22.2) --- updated-dependencies: - dependency-name: github.com/go-openapi/errors dependency-version: 0.22.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1253) Bumps [k8s.io/apiextensions-apiserver](https://github.com/kubernetes/apiextensions-apiserver) from 0.33.3 to 0.33.4. - [Release notes](https://github.com/kubernetes/apiextensions-apiserver/releases) - [Commits](kubernetes/apiextensions-apiserver@v0.33.3...v0.33.4) --- updated-dependencies: - dependency-name: k8s.io/apiextensions-apiserver dependency-version: 0.33.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.23.4 to 2.24.0. - [Release notes](https://github.com/onsi/ginkgo/releases) - [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md) - [Commits](onsi/ginkgo@v2.23.4...v2.24.0) --- updated-dependencies: - dependency-name: github.com/onsi/ginkgo/v2 dependency-version: 2.24.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
K8SPG-834 add test for huge pages
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
K8SPG-740 fix error message
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
* K8SPG-694: add `clusterServiceDNSSuffix` https://perconadev.atlassian.net/browse/K8SPG-694 * revert change of `exposeSuperusers` * revert default annotations * fix `cr.yaml` * improve unit-tests --------- Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com> Co-authored-by: Mayank Shah <mayankshah1614@gmail.com>
* wip: add fencing mechanism Signed-off-by: Mayank Shah <mayank.shah@percona.com> * rename to suspended-instances Signed-off-by: Mayank Shah <mayank.shah@percona.com> * add BackupSnapshots feature gate Signed-off-by: Mayank Shah <mayank.shah@percona.com> * implement reconciler logic Signed-off-by: Mayank Shah <mayank.shah@percona.com> * implement offline executor Signed-off-by: Mayank Shah <mayank.shah@percona.com> * naming improvements Signed-off-by: Mayank Shah <mayank.shah@percona.com> * add to scheme Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix reconcile state Signed-off-by: Mayank Shah <mayank.shah@percona.com> * bug fixes and improvements Signed-off-by: Mayank Shah <mayank.shah@percona.com> * naming improvements and fixes Signed-off-by: Mayank Shah <mayank.shah@percona.com> * ran make generate Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix PGBackup field validations Signed-off-by: Mayank Shah <mayank.shah@percona.com> * refactors and stability improvements Signed-off-by: Mayank Shah <mayank.shah@percona.com> * update cr.yaml examples Signed-off-by: Mayank Shah <mayank.shah@percona.com> * organize imports Signed-off-by: Mayank Shah <mayank.shah@percona.com> * misspells Signed-off-by: Mayank Shah <mayank.shah@percona.com> * improve fencing logic Signed-off-by: Mayank Shah <mayank.shah@percona.com> * add extra validation Signed-off-by: Mayank Shah <mayank.shah@percona.com> * improvements to suspended logic Signed-off-by: Mayank Shah <mayank.shah@percona.com> * finalizer renaming Signed-off-by: Mayank Shah <mayank.shah@percona.com> * remove enabled field Signed-off-by: Mayank Shah <mayank.shah@percona.com> * implement snapshot schedules Signed-off-by: Mayank Shah <mayank.shah@percona.com> * linting Signed-off-by: Mayank Shah <mayank.shah@percona.com> * implement in-place restore Signed-off-by: Mayank Shah <mayank.shah@percona.com> * update cr.yaml example Signed-off-by: Mayank Shah <mayank.shah@percona.com> * linting Signed-off-by: Mayank Shah <mayank.shah@percona.com> * no need to use configmap to track Signed-off-by: Mayank Shah <mayank.shah@percona.com> * more improvements Signed-off-by: Mayank Shah <mayank.shah@percona.com> * typo Signed-off-by: Mayank Shah <mayank.shah@percona.com> * wip: PiTR Signed-off-by: Mayank Shah <mayank.shah@percona.com> * support snapshots in WALWatcher Signed-off-by: Mayank Shah <mayank.shah@percona.com> * bug fix Signed-off-by: Mayank Shah <mayank.shah@percona.com> * update comments Signed-off-by: Mayank Shah <mayank.shah@percona.com> * linting Signed-off-by: Mayank Shah <mayank.shah@percona.com> * add PGO_FEATURE_GATES env variable to deploy Signed-off-by: Mayank Shah <mayank.shah@percona.com> * add retry mechanism Signed-off-by: Mayank Shah <mayank.shah@percona.com> * implement checkpointing Signed-off-by: Mayank Shah <mayank.shah@percona.com> * add restore_command wrapper for snapshots Signed-off-by: Mayank Shah <mayank.shah@percona.com> * add logic for creating snapshot signal file Signed-off-by: Mayank Shah <mayank.shah@percona.com> * handle leader ep reconcile Signed-off-by: Mayank Shah <mayank.shah@percona.com> * more improvements Signed-off-by: Mayank Shah <mayank.shah@percona.com> * add e2e test Signed-off-by: Mayank Shah <mayank.shah@percona.com> * wip: fix pitr Signed-off-by: Mayank Shah <mayank.shah@percona.com> * in-place restore improvements Signed-off-by: Mayank Shah <mayank.shah@percona.com> * update e2e test Signed-off-by: Mayank Shah <mayank.shah@percona.com> * update test runs Signed-off-by: Mayank Shah <mayank.shah@percona.com> * test fixes Signed-off-by: Mayank Shah <mayank.shah@percona.com> * Update build/postgres-operator/restore_command.sh Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * support for WAL and Tablespace volumes Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix tests Signed-off-by: Mayank Shah <mayank.shah@percona.com> * workaround improvements Signed-off-by: Mayank Shah <mayank.shah@percona.com> * update examples Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix unit test Signed-off-by: Mayank Shah <mayank.shah@percona.com> * remove unused code Signed-off-by: Mayank Shah <mayank.shah@percona.com> * add unit test shouldFailSnapshot Signed-off-by: Mayank Shah <mayank.shah@percona.com> * add unit tests for backup helpers Signed-off-by: Mayank Shah <mayank.shah@percona.com> * linting Signed-off-by: Mayank Shah <mayank.shah@percona.com> * cleanup unused code Signed-off-by: Mayank Shah <mayank.shah@percona.com> * formatting Signed-off-by: Mayank Shah <mayank.shah@percona.com> * code cleanup Signed-off-by: Mayank Shah <mayank.shah@percona.com> * status improvements Signed-off-by: Mayank Shah <mayank.shah@percona.com> * add more unit tests Signed-off-by: Mayank Shah <mayank.shah@percona.com> * update e2e test assertions Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix inconsistencies & address copilot comments Signed-off-by: Mayank Shah <mayank.shah@percona.com> * remove sh prefix Signed-off-by: Mayank Shah <mayank.shah@percona.com> * checkpoint timeout default to 5m Signed-off-by: Mayank Shah <mayank.shah@percona.com> * linting Signed-off-by: Mayank Shah <mayank.shah@percona.com> * POSIX-compliant script Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix potential nil-ptr Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix error messag Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix invalid status update Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix retries to get latest objecgt Signed-off-by: Mayank Shah <mayank.shah@percona.com> * bugfix: restore reconcile can use incorrect volume spec Signed-off-by: Mayank Shah <mayank.shah@percona.com> * add unit test Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix linting suggestions Signed-off-by: Mayank Shah <mayank.shah@percona.com> * prepare job should work when using separate wal volumes Signed-off-by: Mayank Shah <mayank.shah@percona.com> * update unit tests Signed-off-by: Mayank Shah <mayank.shah@percona.com> * spelling errors Signed-off-by: Mayank Shah <mayank.shah@percona.com> * allow configuring checkpoint timeout Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix restore wrapper Signed-off-by: Mayank Shah <mayank.shah@percona.com> * consistent field naming Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix retry loop Signed-off-by: Mayank Shah <mayank.shah@percona.com> * no need to check PITR while unsuspending Signed-off-by: Mayank Shah <mayank.shah@percona.com> * error message consistency Signed-off-by: Mayank Shah <mayank.shah@percona.com> * remove duplicate code Signed-off-by: Mayank Shah <mayank.shah@percona.com> * use fmt.Errorf Signed-off-by: Mayank Shah <mayank.shah@percona.com> * catch potential nil error Signed-off-by: Mayank Shah <mayank.shah@percona.com> * allow skipping checkpointing Signed-off-by: Mayank Shah <mayank.shah@percona.com> * address copilot comments Signed-off-by: Mayank Shah <mayank.shah@percona.com> * fix error message Signed-off-by: Mayank Shah <mayank.shah@percona.com> --------- Signed-off-by: Mayank Shah <mayank.shah@percona.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* bump golang to 1.26.0 Signed-off-by: Mayank Shah <mayank.shah@percona.com>
* K8SPG-938 fix conditions * add test * add unit test * delete comment
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
shfmt
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Lines 1588 to 1594 in dc1d761
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Lines 1598 to 1600 in dc1d761
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Line 1602 in dc1d761
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Lines 1604 to 1605 in dc1d761
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Lines 1607 to 1608 in dc1d761
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Lines 1610 to 1611 in dc1d761
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Line 1613 in dc1d761
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Lines 1615 to 1618 in dc1d761
[shfmt] reported by reviewdog 🐶
percona-postgresql-operator/e2e-tests/functions
Lines 1620 to 1627 in dc1d761
| kubectl -n "${NAMESPACE}" create secret generic "${test_name}-pgbackrest-secrets" --from-file=cloud.conf="${TEMP_DIR}/pgbackrest-secret.ini" --from-file=gcs-key.json=${TEMP_DIR}/gcs-key.json | ||
| ;; | ||
| "custom-extensions" | "major-upgrade") | ||
| "custom-extensions"| "builtin-extensions"| major-upgrade*) |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| "custom-extensions"| "builtin-extensions"| major-upgrade*) | |
| "custom-extensions" | "builtin-extensions" | major-upgrade*) |
| local namespace=$1 | ||
| local pod=$2 | ||
| local container=$3 |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| local namespace=$1 | |
| local pod=$2 | |
| local container=$3 | |
| local namespace=$1 | |
| local pod=$2 | |
| local container=$3 |
| if [ -n "$container" ]; then | ||
| kubectl exec -n "$namespace" "$pod" -c "$container" -- printenv 2>/dev/null || true | ||
| else | ||
| kubectl exec -n "$namespace" "$pod" -- printenv 2>/dev/null || true | ||
| fi |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| if [ -n "$container" ]; then | |
| kubectl exec -n "$namespace" "$pod" -c "$container" -- printenv 2>/dev/null || true | |
| else | |
| kubectl exec -n "$namespace" "$pod" -- printenv 2>/dev/null || true | |
| fi | |
| if [ -n "$container" ]; then | |
| kubectl exec -n "$namespace" "$pod" -c "$container" -- printenv 2>/dev/null || true | |
| else | |
| kubectl exec -n "$namespace" "$pod" -- printenv 2>/dev/null || true | |
| fi |
| local check_type=$1 | ||
| local pod=$2 | ||
| local var_name=$3 | ||
| local expected_value=$4 | ||
| local env_content=$5 | ||
|
|
||
| local actual_value | ||
| actual_value=$(echo "$env_content" | grep -E "^${var_name}=" | cut -d'=' -f2- || true) | ||
|
|
||
| if [[ "$check_type" == "add" ]]; then | ||
| if [ "$actual_value" != "$expected_value" ]; then | ||
| echo "ERROR: $var_name in $pod — expected '$expected_value', got '${actual_value:-<missing>}'" | ||
| return 1 | ||
| else | ||
| echo "OK: $var_name=$actual_value in $pod" | ||
| fi | ||
| elif [[ "$check_type" == "delete" ]]; then | ||
| if [ -n "$actual_value" ]; then | ||
| echo "ERROR: $var_name exists in $pod (should not exist)" | ||
| return 1 | ||
| else | ||
| echo "OK: $var_name deleted in $pod" | ||
| fi | ||
| else | ||
| echo "ERROR: unknown check type '$check_type'" | ||
| return 1 | ||
| fi |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| local check_type=$1 | |
| local pod=$2 | |
| local var_name=$3 | |
| local expected_value=$4 | |
| local env_content=$5 | |
| local actual_value | |
| actual_value=$(echo "$env_content" | grep -E "^${var_name}=" | cut -d'=' -f2- || true) | |
| if [[ "$check_type" == "add" ]]; then | |
| if [ "$actual_value" != "$expected_value" ]; then | |
| echo "ERROR: $var_name in $pod — expected '$expected_value', got '${actual_value:-<missing>}'" | |
| return 1 | |
| else | |
| echo "OK: $var_name=$actual_value in $pod" | |
| fi | |
| elif [[ "$check_type" == "delete" ]]; then | |
| if [ -n "$actual_value" ]; then | |
| echo "ERROR: $var_name exists in $pod (should not exist)" | |
| return 1 | |
| else | |
| echo "OK: $var_name deleted in $pod" | |
| fi | |
| else | |
| echo "ERROR: unknown check type '$check_type'" | |
| return 1 | |
| fi | |
| local check_type=$1 | |
| local pod=$2 | |
| local var_name=$3 | |
| local expected_value=$4 | |
| local env_content=$5 | |
| local actual_value | |
| actual_value=$(echo "$env_content" | grep -E "^${var_name}=" | cut -d'=' -f2- || true) | |
| if [[ $check_type == "add" ]]; then | |
| if [ "$actual_value" != "$expected_value" ]; then | |
| echo "ERROR: $var_name in $pod — expected '$expected_value', got '${actual_value:-<missing>}'" | |
| return 1 | |
| else | |
| echo "OK: $var_name=$actual_value in $pod" | |
| fi | |
| elif [[ $check_type == "delete" ]]; then | |
| if [ -n "$actual_value" ]; then | |
| echo "ERROR: $var_name exists in $pod (should not exist)" | |
| return 1 | |
| else | |
| echo "OK: $var_name deleted in $pod" | |
| fi | |
| else | |
| echo "ERROR: unknown check type '$check_type'" | |
| return 1 | |
| fi |
| local check_type=$1 # add | delete | ||
| local component=$2 # instance | pgbouncer | repohost | ||
| local vars=("${@:3}") # everything after the 2nd argument | ||
|
|
||
| case "$component" in | ||
| instance) | ||
| POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/instance-set=instance1 -o 'jsonpath={.items[0].metadata.name}') | ||
| CONTAINER="" | ||
| ;; | ||
| pgbouncer) | ||
| POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/role=pgbouncer -o 'jsonpath={.items[0].metadata.name}') | ||
| CONTAINER="pgbouncer" | ||
| ;; | ||
| repohost) | ||
| POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/data=pgbackrest -o 'jsonpath={.items[0].metadata.name}') | ||
| CONTAINER="pgbackrest" | ||
| ;; | ||
| *) | ||
| echo "ERROR: unknown component '$component'" | ||
| return 1 | ||
| ;; | ||
| esac | ||
|
|
||
| echo "Fetching environment variables for $component pod $POD..." | ||
| local env_content | ||
| env_content=$(get_envs_from_pod "${NAMESPACE}" "$POD" "$CONTAINER") | ||
|
|
||
| local errors=0 | ||
| for var_entry in "${vars[@]}"; do | ||
| if [[ "$check_type" == "add" ]]; then | ||
| local var_name="${var_entry%%=*}" | ||
| local var_expected="${var_entry#*=}" | ||
| check_env_in_pod add "$POD" "$var_name" "$var_expected" "$env_content" || errors=$((errors+1)) | ||
| else | ||
| check_env_in_pod delete "$POD" "$var_entry" "" "$env_content" || errors=$((errors+1)) | ||
| fi | ||
| done | ||
|
|
||
| if (( errors > 0 )); then | ||
| echo "$errors environment check(s) failed for component '$component'" | ||
| return 1 | ||
| else | ||
| echo "All environment checks passed for component '$component'" | ||
| fi |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| local check_type=$1 # add | delete | |
| local component=$2 # instance | pgbouncer | repohost | |
| local vars=("${@:3}") # everything after the 2nd argument | |
| case "$component" in | |
| instance) | |
| POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/instance-set=instance1 -o 'jsonpath={.items[0].metadata.name}') | |
| CONTAINER="" | |
| ;; | |
| pgbouncer) | |
| POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/role=pgbouncer -o 'jsonpath={.items[0].metadata.name}') | |
| CONTAINER="pgbouncer" | |
| ;; | |
| repohost) | |
| POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/data=pgbackrest -o 'jsonpath={.items[0].metadata.name}') | |
| CONTAINER="pgbackrest" | |
| ;; | |
| *) | |
| echo "ERROR: unknown component '$component'" | |
| return 1 | |
| ;; | |
| esac | |
| echo "Fetching environment variables for $component pod $POD..." | |
| local env_content | |
| env_content=$(get_envs_from_pod "${NAMESPACE}" "$POD" "$CONTAINER") | |
| local errors=0 | |
| for var_entry in "${vars[@]}"; do | |
| if [[ "$check_type" == "add" ]]; then | |
| local var_name="${var_entry%%=*}" | |
| local var_expected="${var_entry#*=}" | |
| check_env_in_pod add "$POD" "$var_name" "$var_expected" "$env_content" || errors=$((errors+1)) | |
| else | |
| check_env_in_pod delete "$POD" "$var_entry" "" "$env_content" || errors=$((errors+1)) | |
| fi | |
| done | |
| if (( errors > 0 )); then | |
| echo "$errors environment check(s) failed for component '$component'" | |
| return 1 | |
| else | |
| echo "All environment checks passed for component '$component'" | |
| fi | |
| local check_type=$1 # add | delete | |
| local component=$2 # instance | pgbouncer | repohost | |
| local vars=("${@:3}") # everything after the 2nd argument | |
| case "$component" in | |
| instance) | |
| POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/instance-set=instance1 -o 'jsonpath={.items[0].metadata.name}') | |
| CONTAINER="" | |
| ;; | |
| pgbouncer) | |
| POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/role=pgbouncer -o 'jsonpath={.items[0].metadata.name}') | |
| CONTAINER="pgbouncer" | |
| ;; | |
| repohost) | |
| POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/data=pgbackrest -o 'jsonpath={.items[0].metadata.name}') | |
| CONTAINER="pgbackrest" | |
| ;; | |
| *) | |
| echo "ERROR: unknown component '$component'" | |
| return 1 | |
| ;; | |
| esac | |
| echo "Fetching environment variables for $component pod $POD..." | |
| local env_content | |
| env_content=$(get_envs_from_pod "${NAMESPACE}" "$POD" "$CONTAINER") | |
| local errors=0 | |
| for var_entry in "${vars[@]}"; do | |
| if [[ $check_type == "add" ]]; then | |
| local var_name="${var_entry%%=*}" | |
| local var_expected="${var_entry#*=}" | |
| check_env_in_pod add "$POD" "$var_name" "$var_expected" "$env_content" || errors=$((errors + 1)) | |
| else | |
| check_env_in_pod delete "$POD" "$var_entry" "" "$env_content" || errors=$((errors + 1)) | |
| fi | |
| done | |
| if ((errors > 0)); then | |
| echo "$errors environment check(s) failed for component '$component'" | |
| return 1 | |
| else | |
| echo "All environment checks passed for component '$component'" | |
| fi |
| if [ "${hugepages_total}" -gt 0 ]; then | ||
| echo "Hugepages are available in pod" | ||
| return 0 | ||
| else | ||
| echo "No hugepages in pod" | ||
| return 1 | ||
| fi |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| if [ "${hugepages_total}" -gt 0 ]; then | |
| echo "Hugepages are available in pod" | |
| return 0 | |
| else | |
| echo "No hugepages in pod" | |
| return 1 | |
| fi | |
| if [ "${hugepages_total}" -gt 0 ]; then | |
| echo "Hugepages are available in pod" | |
| return 0 | |
| else | |
| echo "No hugepages in pod" | |
| return 1 | |
| fi |
| local cluster_name=$1 | ||
| local expected_value=${2:-try} |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| local cluster_name=$1 | |
| local expected_value=${2:-try} | |
| local cluster_name=$1 | |
| local expected_value=${2:-try} |
| local cluster_name=$1 | ||
| local expected_value=${2:-try} | ||
|
|
||
| echo "Verifying PostgreSQL huge_pages setting..." |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| echo "Verifying PostgreSQL huge_pages setting..." | |
| echo "Verifying PostgreSQL huge_pages setting..." |
| local huge_pages=$(run_psql_local \ | ||
| "SHOW huge_pages;" \ | ||
| "postgres:$(get_psql_user_pass ${cluster_name}-pguser-postgres)@$(get_psql_user_host ${cluster_name}-pguser-postgres)") |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| local huge_pages=$(run_psql_local \ | |
| "SHOW huge_pages;" \ | |
| "postgres:$(get_psql_user_pass ${cluster_name}-pguser-postgres)@$(get_psql_user_host ${cluster_name}-pguser-postgres)") | |
| local huge_pages=$(run_psql_local \ | |
| "SHOW huge_pages;" \ | |
| "postgres:$(get_psql_user_pass ${cluster_name}-pguser-postgres)@$(get_psql_user_host ${cluster_name}-pguser-postgres)") |
| "SHOW huge_pages;" \ | ||
| "postgres:$(get_psql_user_pass ${cluster_name}-pguser-postgres)@$(get_psql_user_host ${cluster_name}-pguser-postgres)") | ||
|
|
||
| echo "huge_pages: ${huge_pages}" |
There was a problem hiding this comment.
[shfmt] reported by reviewdog 🐶
| echo "huge_pages: ${huge_pages}" | |
| echo "huge_pages: ${huge_pages}" |
| "github.com/percona/percona-postgresql-operator/internal/bridge" | ||
| "github.com/percona/percona-postgresql-operator/internal/initialize" | ||
| "github.com/percona/percona-postgresql-operator/v2/internal/bridge" | ||
| "github.com/percona/percona-postgresql-operator/v2/internal/initialize" | ||
|
|
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| @@ -15,9 +15,9 @@ import ( | |||
| apierrors "k8s.io/apimachinery/pkg/api/errors" | |||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |||
|
|
|||
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| "sigs.k8s.io/controller-runtime/pkg/client" | |
| @@ -13,7 +13,7 @@ import ( | |||
| . "github.com/onsi/ginkgo/v2" | |||
| . "github.com/onsi/gomega" | |||
| . "github.com/onsi/gomega/gstruct" | |||
| "github.com/pkg/errors" | |||
| "github.com/pkg/errors" //nolint:depguard // This legacy test covers so much code, it logs the origin of unexpected errors. | |||
|
|
|||
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1" | ||
|
|
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1" |
| @@ -16,9 +16,9 @@ import ( | |||
|
|
|||
| "github.com/pkg/errors" | |||
|
|
|||
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| corev1 "k8s.io/api/core/v1" | |
| "strings" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" |
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| "github.com/stretchr/testify/assert" | |
| volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1" | |
| "github.com/stretchr/testify/assert" |
| "sigs.k8s.io/controller-runtime/pkg/client" | ||
| "sigs.k8s.io/controller-runtime/pkg/client/fake" | ||
|
|
||
| volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1" |
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1" |
| @@ -6,10 +6,12 @@ import ( | |||
| "github.com/pkg/errors" | |||
| "github.com/stretchr/testify/assert" | |||
| "github.com/stretchr/testify/require" | |||
|
|
|||
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/percona/percona-postgresql-operator/v2/percona/version" |
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| "github.com/percona/percona-postgresql-operator/v2/percona/version" |
| "sigs.k8s.io/controller-runtime/pkg/client" | ||
|
|
||
| "github.com/percona/percona-postgresql-operator/v2/percona/testutils" | ||
| pgv2 "github.com/percona/percona-postgresql-operator/v2/pkg/apis/pgv2.percona.com/v2" |
There was a problem hiding this comment.
[goimports-reviser] reported by reviewdog 🐶
| pgv2 "github.com/percona/percona-postgresql-operator/v2/pkg/apis/pgv2.percona.com/v2" | |
| "github.com/percona/percona-postgresql-operator/v2/percona/version" | |
| pgv2 "github.com/percona/percona-postgresql-operator/v2/pkg/apis/pgv2.percona.com/v2" |
commit: dc1d761 |
CHANGE DESCRIPTION
Problem:
Short explanation of the problem.
Cause:
Short explanation of the root cause of the issue if applicable.
Solution:
Short explanation of the solution we are providing with this PR.
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability