diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index c487935a7f..7dc78a30c0 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -2,69 +2,29 @@ name: Linters on: pull_request: - branches: - - master jobs: - documentation: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - # Some versions of Ubuntu have an awk that does not recognize POSIX classes. - # Log the version of awk and abort when it cannot match space U+0020. - # - https://bugs.launchpad.net/ubuntu/+source/mawk/+bug/69724 - - run: awk -W version && awk '{ exit 1 != match($0, /[[:space:]]/) }' <<< ' ' - - run: | - find docs/content -not -type d -not -name crd.md -print0 | xargs -0 awk ' - BEGIN { print "::add-matcher::.github/actions/awk-matcher.json" } - - /[[:space:]]$/ { errors++; print FILENAME ":" FNR " error: Trailing space" } - /TODO/ { errors++; print FILENAME ":" FNR " error: Found TODO. Try running hack/create-todo-patch.sh" } - - END { print "::remove-matcher owner=awk::" } - END { exit errors != 0 } - ' - - documentation-crd: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - # The `documentation-crd` job only checks the crd.md for `TODO`, - # as some of the upstream documentation has trailing spaces - - run: | - find docs/content -name crd.md -print0 | xargs -0 awk ' - BEGIN { print "::add-matcher::.github/actions/awk-matcher.json" } - - /TODO/ { errors++; print FILENAME ":" FNR " error: Found TODO. Try running hack/create-todo-patch.sh" } - - END { print "::remove-matcher owner=awk::" } - END { exit errors != 0 } - ' - golangci-lint: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 + permissions: + contents: read + checks: write steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 - with: { go-version: 1.x } + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 + with: { go-version: stable } - - uses: golangci/golangci-lint-action@v3 + - uses: golangci/golangci-lint-action@v9 with: - version: v1.60.1 + version: latest args: --timeout=5m # Count issues reported by disabled linters. The command always # exits zero to ensure it does not fail the pull request check. - name: Count non-blocking issues run: | - golangci-lint run --config .golangci.next.yaml \ - --issues-exit-code 0 \ - --max-issues-per-linter 0 \ - --max-same-issues 0 \ - --out-format json | - jq --sort-keys 'reduce .Issues[] as $i ({}; .[$i.FromLinter] += 1)' | - awk >> "${GITHUB_STEP_SUMMARY}" ' - NR == 1 { print "```json" } { print } END { if (NR > 0) print "```" } - ' || true \ No newline at end of file + golangci-lint run --config .golangci.next.yaml --show-stats >> "${GITHUB_STEP_SUMMARY}" \ + --max-issues-per-linter=0 \ + --max-same-issues=0 \ + --uniq-by-line=0 \ + --output.text.path=/dev/null ||: \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 21cc29c416..51f034f52a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -64,9 +64,9 @@ jobs: with: k3s-channel: "${{ matrix.kubernetes }}" prefetch-images: | - docker.io/ivorysql/pgbackrest:ubi8-2.56.0-5.0-1 - docker.io/ivorysql/pgbouncer:ubi8-1.23.0-5.0-1 - docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1 + docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1 + docker.io/ivorysql/pgbouncer:ubi9-1.24.0-5.1-1 + docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1 - run: make createnamespaces check-envtest-existing env: @@ -98,13 +98,13 @@ jobs: with: k3s-channel: "${{ matrix.kubernetes }}" prefetch-images: | - docker.io/ivorysql/pgadmin:ubi8-9.9-5.0-1 - docker.io/ivorysql/pgbackrest:ubi8-2.56.0-5.0-1 - docker.io/ivorysql/pgbouncer:ubi8-1.23.0-5.0-1 - docker.io/ivorysql/postgres-exporter:ubi8-0.17.0-5.0-1 - docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1 - docker.io/ivorysql/postgis:ubi8-3.5-5.0-1 - registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi8-5.3.1-0 + docker.io/ivorysql/pgadmin:ubi9-9.9-5.1-1 + docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1 + docker.io/ivorysql/pgbouncer:ubi9-1.24.0-5.1-1 + docker.io/ivorysql/postgres-exporter:ubi9-0.17.0-5.1-1 + docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1 + docker.io/ivorysql/postgis:ubi9-3.5-5.1-1 + registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi9-5.3.1-0 - run: go mod download - name: Build executable run: IVYO_VERSION='${{ github.sha }}' make build-ivory-operator @@ -118,13 +118,13 @@ jobs: docker run --detach --network host --read-only \ --volume "$(pwd):/mnt" --workdir '/mnt' --env 'PATH=/mnt/bin' \ --env 'KUBECONFIG=hack/.kube/ivory-operator/ivyo' \ - --env 'RELATED_IMAGE_PGADMIN=docker.io/ivorysql/pgadmin:ubi8-9.9-5.0-1' \ - --env 'RELATED_IMAGE_PGBACKREST=docker.io/ivorysql/pgbackrest:ubi8-2.56.0-5.0-1' \ - --env 'RELATED_IMAGE_PGBOUNCER=docker.io/ivorysql/pgbouncer:ubi8-1.23.0-5.0-1' \ - --env 'RELATED_IMAGE_PGEXPORTER=docker.io/ivorysql/postgres-exporter:ubi8-0.17.0-5.0-1' \ - --env 'RELATED_IMAGE_PGUPGRADE=registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi8-5.3.1-0' \ - --env 'RELATED_IMAGE_IVORY_18=docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1' \ - --env 'RELATED_IMAGE_IVORY_18_GIS_3.5=docker.io/ivorysql/postgis:ubi8-3.5-5.0-1' \ + --env 'RELATED_IMAGE_PGADMIN=docker.io/ivorysql/pgadmin:ubi9-9.9-5.1-1' \ + --env 'RELATED_IMAGE_PGBACKREST=docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1' \ + --env 'RELATED_IMAGE_PGBOUNCER=docker.io/ivorysql/pgbouncer:ubi9-1.24.0-5.1-1' \ + --env 'RELATED_IMAGE_PGEXPORTER=docker.io/ivorysql/postgres-exporter:ubi9-0.17.0-5.1-1' \ + --env 'RELATED_IMAGE_PGUPGRADE=registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi9-5.3.1-0' \ + --env 'RELATED_IMAGE_IVORY_18=docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1' \ + --env 'RELATED_IMAGE_IVORY_18_GIS_3.5=docker.io/ivorysql/postgis:ubi9-3.5-5.1-1' \ --env 'IVYO_FEATURE_GATES=TablespaceVolumes=true' \ --name 'ivory-operator' ubuntu \ ivory-operator @@ -139,7 +139,7 @@ jobs: KUTTL_PG_UPGRADE_TO_VERSION: '18' KUTTL_PG_VERSION: '18' KUTTL_POSTGIS_VERSION: '3.5' - KUTTL_IVORY_IMAGE: 'docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1' + KUTTL_IVORY_IMAGE: 'docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1' - run: | make check-kuttl && exit failed=$? diff --git a/.golangci.next.yaml b/.golangci.next.yaml index 8973702226..7a22d5c1cb 100644 --- a/.golangci.next.yaml +++ b/.golangci.next.yaml @@ -1,9 +1,4 @@ -# https://golangci-lint.run/usage/configuration/ -# -# This file is for linters that might be interesting to enforce in the future. -# Rules that should be enforced immediately belong in [.golangci.yaml]. -# -# Both files are used by [.github/workflows/lint.yaml]. +version: "2" linters: disable-all: true @@ -15,19 +10,18 @@ linters: - godox - goerr113 - gofumpt - - gosec # exclude-use-default + - gosec - nilnil - nolintlint - predeclared - revive - - staticcheck # exclude-use-default + - staticcheck - tenv - thelper - tparallel - wastedassign issues: - # https://github.com/golangci/golangci-lint/issues/2239 exclude-use-default: false linters-settings: @@ -35,10 +29,14 @@ linters-settings: check-error-free-encoding: true thelper: - # https://github.com/kulti/thelper/issues/27 - tb: { begin: true, first: true } - test: { begin: true, first: true, name: true } + tb: + begin: true + first: true + test: + begin: true + first: true + name: true run: build-tags: - - envtest + - envtest \ No newline at end of file diff --git a/.golangci.yaml b/.golangci.yaml index 9b708a357c..fa2fbfba3b 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,75 +1,62 @@ -# https://golangci-lint.run/usage/configuration/ +version: "2" linters: disable: - contextcheck - errchkjson - - gci - - gofumpt - - scopelint enable: - depguard - gomodguard - - gosimple - importas - misspell - unconvert - presets: - - bugs - - format - - unused - -linters-settings: - depguard: - rules: - everything: - deny: - - pkg: io/ioutil - desc: > - Use the "io" and "os" packages instead. - See https://go.dev/doc/go1.16#ioutil - - not-tests: - files: ['!$test'] - deny: - - pkg: net/http/httptest - desc: Should be used only in tests. - - - pkg: testing/* - desc: The "testing" packages should be used only in tests. - - - pkg: github.com/ivorysql/ivory-operator/internal/testing/* - desc: The "internal/testing" packages should be used only in tests. - - exhaustive: - default-signifies-exhaustive: true - - goimports: - local-prefixes: github.com/ivorysql/ivory-operator - - gomodguard: - blocked: - modules: - - gopkg.in/yaml.v2: { recommendations: [sigs.k8s.io/yaml] } - - gopkg.in/yaml.v3: { recommendations: [sigs.k8s.io/yaml] } - - gotest.tools: { recommendations: [gotest.tools/v3] } - - k8s.io/kubernetes: - reason: > - k8s.io/kubernetes is for managing dependencies of the Kubernetes - project, i.e. building kubelet and kubeadm. - - importas: - alias: - - pkg: k8s.io/api/(\w+)/(v[\w\w]+) - alias: $1$2 - - pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+) - alias: $1$2 - - pkg: k8s.io/apimachinery/pkg/api/errors - alias: apierrors - no-unaliased: true + settings: + dupword: + ignore: + # We might see duplicate instances of 'fi' if we end two bash 'if' statements + - fi + + depguard: + rules: + everything: + deny: + - pkg: io/ioutil + desc: > + Use the "io" and "os" packages instead. + See https://go.dev/doc/go1.16#ioutil + not-tests: + files: ['!$test'] + deny: + - pkg: net/http/httptest + desc: Should be used only in tests. + - pkg: testing/* + desc: The "testing" packages should be used only in tests. + - pkg: github.com/ivorysql/ivory-operator/internal/testing/* + desc: The "internal/testing" packages should be used only in tests. + + exhaustive: + default-signifies-exhaustive: true + + gomodguard: + blocked: + modules: + - gopkg.in/yaml.v2: { recommendations: [sigs.k8s.io/yaml] } + - gopkg.in/yaml.v3: { recommendations: [sigs.k8s.io/yaml] } + - gotest.tools: { recommendations: [gotest.tools/v3] } + - k8s.io/kubernetes: + reason: > + k8s.io/kubernetes is for managing dependencies of the Kubernetes project. + + importas: + alias: + - pkg: k8s.io/api/(\w+)/(v[\w\w]+) + alias: $1$2 + - pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+) + alias: $1$2 + - pkg: k8s.io/apimachinery/pkg/api/errors + alias: apierrors + no-unaliased: true run: build-tags: - - envtest - skip-dirs: - - pkg/generated + - envtest \ No newline at end of file diff --git a/Makefile b/Makefile index 38d95a47d9..8b0f4db0db 100644 --- a/Makefile +++ b/Makefile @@ -206,7 +206,7 @@ generate-kuttl: export KUTTL_PG_UPGRADE_FROM_VERSION ?= 14 generate-kuttl: export KUTTL_PG_UPGRADE_TO_VERSION ?= 15 generate-kuttl: export KUTTL_PG_VERSION ?= 15 generate-kuttl: export KUTTL_POSTGIS_VERSION ?= 3.3 -generate-kuttl: export KUTTL_IVORY_IMAGE ?= docker.io/ivorysql/ivorysql:ubi8-2.2-1.1-1 +generate-kuttl: export KUTTL_IVORY_IMAGE ?= docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1 generate-kuttl: ## Generate kuttl tests [ ! -d testing/kuttl/e2e-generated ] || rm -r testing/kuttl/e2e-generated [ ! -d testing/kuttl/e2e-generated-other ] || rm -r testing/kuttl/e2e-generated-other diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index eeb09bd298..d03c5e4a23 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -19,19 +19,19 @@ spec: - name: IVORY_DEBUG value: "true" - name: RELATED_IMAGE_IVORY_18 - value: "docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1" + value: "docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1" - name: RELATED_IMAGE_PGADMIN - value: "docker.io/ivorysql/pgadmin:ubi8-9.9-5.0-1" + value: "docker.io/ivorysql/pgadmin:ubi9-9.9-5.1-1" - name: RELATED_IMAGE_PGBACKREST - value: "docker.io/ivorysql/pgbackrest:ubi8-2.56.0-5.0-1" + value: "docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1" - name: RELATED_IMAGE_PGBOUNCER - value: "docker.io/ivorysql/pgbouncer:ubi8-1.23.0-5.0-1" + value: "docker.io/ivorysql/pgbouncer:ubi9-1.24.0-5.1-1" - name: RELATED_IMAGE_PGEXPORTER - value: "docker.io/ivorysql/postgres-exporter:ubi8-0.17.0-5.0-1" + value: "docker.io/ivorysql/postgres-exporter:ubi9-0.17.0-5.1-1" - name: RELATED_IMAGE_PGUPGRADE - value: "registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi8-5.3.1-0" + value: "registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi9-5.3.1-0" - name: RELATED_IMAGE_POSTGRES_18_GIS_3.5 - value: "docker.io/ivorysql/ivorysql-postgis:ubi8-3.5-5.0-1" + value: "docker.io/ivorysql/ivorysql-postgis:ubi9-3.5-5.1-1" securityContext: allowPrivilegeEscalation: false capabilities: { drop: [ALL] } diff --git a/examples/ivorycluster/ivorycluster.yaml b/examples/ivorycluster/ivorycluster.yaml index 26cb723e67..af63bac349 100644 --- a/examples/ivorycluster/ivorycluster.yaml +++ b/examples/ivorycluster/ivorycluster.yaml @@ -3,7 +3,7 @@ kind: IvoryCluster metadata: name: hippo spec: - image: docker.io/ivorysql/ivorysql:ubi8-2.2-1.1-1 + image: docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1 postgresVersion: 15 instances: - name: instance1 @@ -15,7 +15,7 @@ spec: storage: 1Gi backups: pgbackrest: - image: docker.io/ivorysql/pgbackrest:ubi8-2.45-1.1-1 + image: docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1 repos: - name: repo1 volume: diff --git a/examples/kustomize/azure/ivory.yaml b/examples/kustomize/azure/ivory.yaml index de801b971f..6ac5f31090 100644 --- a/examples/kustomize/azure/ivory.yaml +++ b/examples/kustomize/azure/ivory.yaml @@ -3,7 +3,7 @@ kind: IvoryCluster metadata: name: hippo-azure spec: - image: docker.io/ivorysql/ivorysql:ubi8-2.2-1.1-1 + image: docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1 postgresVersion: 15 instances: - dataVolumeClaimSpec: @@ -14,7 +14,7 @@ spec: storage: 1Gi backups: pgbackrest: - image: docker.io/ivorysql/pgbackrest:ubi8-2.45-1.1-1 + image: docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1 configuration: - secret: name: ivyo-azure-creds diff --git a/examples/kustomize/gcs/ivory.yaml b/examples/kustomize/gcs/ivory.yaml index ff828c4d68..030a601355 100644 --- a/examples/kustomize/gcs/ivory.yaml +++ b/examples/kustomize/gcs/ivory.yaml @@ -3,7 +3,7 @@ kind: IvoryCluster metadata: name: hippo-gcs spec: - image: docker.io/ivorysql/ivorysql:ubi8-2.2-1.1-1 + image: docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1 postgresVersion: 15 instances: - dataVolumeClaimSpec: @@ -14,7 +14,7 @@ spec: storage: 1Gi backups: pgbackrest: - image: docker.io/ivorysql/pgbackrest:ubi8-2.45-1.1-1 + image: docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1 configuration: - secret: name: ivyo-gcs-creds diff --git a/examples/kustomize/high-availability/ha-ivory.yaml b/examples/kustomize/high-availability/ha-ivory.yaml index 5096ec44b0..2f7ea53ea8 100644 --- a/examples/kustomize/high-availability/ha-ivory.yaml +++ b/examples/kustomize/high-availability/ha-ivory.yaml @@ -3,7 +3,7 @@ kind: IvoryCluster metadata: name: hippo-ha spec: - image: docker.io/ivorysql/ivorysql:ubi8-2.2-1.1-1 + image: docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1 postgresVersion: 15 instances: - name: pgha1 @@ -26,7 +26,7 @@ spec: ivory-operator.ivorysql.org/instance-set: pgha1 backups: pgbackrest: - image: docker.io/ivorysql/pgbackrest:ubi8-2.45-1.1-1 + image: docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1 repos: - name: repo1 volume: diff --git a/examples/kustomize/install/manager/manager.yaml b/examples/kustomize/install/manager/manager.yaml index 0bb9bc8dce..6e3afde6ba 100644 --- a/examples/kustomize/install/manager/manager.yaml +++ b/examples/kustomize/install/manager/manager.yaml @@ -27,9 +27,9 @@ spec: - name: IVORY_DEBUG value: "true" - name: RELATED_IMAGE_IVORY_5 - value: "docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1" + value: "docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1" - name: RELATED_IMAGE_PGBACKREST - value: "docker.io/ivorysql/pgbackrest:ubi8-2.56.0-5.0-1" + value: "docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1" securityContext: allowPrivilegeEscalation: false diff --git a/examples/kustomize/ivory/ivory.yaml b/examples/kustomize/ivory/ivory.yaml index 2828023db3..c826c93a11 100644 --- a/examples/kustomize/ivory/ivory.yaml +++ b/examples/kustomize/ivory/ivory.yaml @@ -3,7 +3,7 @@ kind: IvoryCluster metadata: name: hippo spec: - image: docker.io/ivorysql/ivorysql:ubi8-2.2-1.1-1 + image: docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1 postgresVersion: 15 instances: - name: instance1 @@ -15,7 +15,7 @@ spec: storage: 1Gi backups: pgbackrest: - image: docker.io/ivorysql/pgbackrest:ubi8-2.45-1.1-1 + image: docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1 repos: - name: repo1 volume: diff --git a/examples/kustomize/keycloak/ivory.yaml b/examples/kustomize/keycloak/ivory.yaml index 80c1f746cd..02bd1cdea6 100644 --- a/examples/kustomize/keycloak/ivory.yaml +++ b/examples/kustomize/keycloak/ivory.yaml @@ -3,7 +3,7 @@ kind: IvoryCluster metadata: name: keycloakdb spec: - image: docker.io/ivorysql/ivorysql:ubi8-2.2-1.1-1 + image: docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1 postgresVersion: 15 instances: - replicas: 2 @@ -25,7 +25,7 @@ spec: ivory-operator.ivorysql.org/instance-set: "00" backups: pgbackrest: - image: docker.io/ivorysql/pgbackrest:ubi8-2.45-1.1-1 + image: docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1 repos: - name: repo1 volume: diff --git a/examples/kustomize/multi-backup-repo/ivory.yaml b/examples/kustomize/multi-backup-repo/ivory.yaml index b47c17fc99..62a1567825 100644 --- a/examples/kustomize/multi-backup-repo/ivory.yaml +++ b/examples/kustomize/multi-backup-repo/ivory.yaml @@ -3,7 +3,7 @@ kind: IvoryCluster metadata: name: hippo-multi-repo spec: - image: docker.io/ivorysql/ivorysql:ubi8-2.2-1.1-1 + image: docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1 postgresVersion: 15 instances: - dataVolumeClaimSpec: @@ -14,7 +14,7 @@ spec: storage: 1Gi backups: pgbackrest: - image: docker.io/ivorysql/pgbackrest:ubi8-2.45-1.1-1 + image: docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1 configuration: - secret: name: ivyo-multi-repo-creds diff --git a/examples/kustomize/s3/ivory.yaml b/examples/kustomize/s3/ivory.yaml index cc65fe7e96..6d2dab9697 100644 --- a/examples/kustomize/s3/ivory.yaml +++ b/examples/kustomize/s3/ivory.yaml @@ -3,7 +3,7 @@ kind: IvoryCluster metadata: name: hippo-s3 spec: - image: docker.io/ivorysql/ivorysql:ubi8-2.2-1.1-1 + image: docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1 postgresVersion: 15 instances: - dataVolumeClaimSpec: @@ -14,7 +14,7 @@ spec: storage: 1Gi backups: pgbackrest: - image: docker.io/ivorysql/pgbackrest:ubi8-2.45-1.1-1 + image: docker.io/ivorysql/pgbackrest:ubi9-2.56.0-5.1-1 configuration: - secret: name: ivyo-s3-creds diff --git a/internal/bridge/client.go b/internal/bridge/client.go index d1a3137157..172aa996d2 100644 --- a/internal/bridge/client.go +++ b/internal/bridge/client.go @@ -101,7 +101,7 @@ func (c *Client) doWithBackoff( request.Header = headers.Clone() //nolint:bodyclose // This response is returned to the caller. - response, err = c.Client.Do(request) + response, err = c.Client.Do(request) // nolint:staticcheck } // An error indicates there was no response from the server, and the @@ -187,7 +187,7 @@ func (c *Client) CreateInstallation(ctx context.Context) (Installation, error) { }) if err == nil { - defer response.Body.Close() + defer response.Body.Close() // nolint:errcheck var body bytes.Buffer _, _ = io.Copy(&body, response.Body) diff --git a/internal/bridge/client_test.go b/internal/bridge/client_test.go index d83fa1e239..964240af6c 100644 --- a/internal/bridge/client_test.go +++ b/internal/bridge/client_test.go @@ -34,8 +34,8 @@ func TestClientBackoff(t *testing.T) { client := NewClient("", "") var total time.Duration - for i := 1; i <= 50 && client.Backoff.Steps > 0; i++ { - step := client.Backoff.Step() + for i := 1; i <= 50 && client.Backoff.Steps > 0; i++ { // nolint:staticcheck + step := client.Backoff.Step() // nolint:staticcheck total += step t.Logf("%02d:%20v%20v", i, step, total) @@ -71,7 +71,7 @@ func TestClientDoWithBackoff(t *testing.T) { // Client with one attempt, i.e. no backoff. client := NewClient(server.URL, "xyz") - client.Backoff.Steps = 1 + client.Backoff.Steps = 1 // nolint:staticcheck assert.Equal(t, client.BaseURL.String(), server.URL) ctx := context.Background() @@ -114,8 +114,8 @@ func TestClientDoWithBackoff(t *testing.T) { // Client with brief backoff. client := NewClient(server.URL, "") - client.Backoff.Duration = time.Millisecond - client.Backoff.Steps = 5 + client.Backoff.Duration = time.Millisecond // nolint:staticcheck + client.Backoff.Steps = 5 // nolint:staticcheck assert.Equal(t, client.BaseURL.String(), server.URL) ctx := context.Background() @@ -171,8 +171,8 @@ func TestClientDoWithBackoff(t *testing.T) { // Client with brief backoff. client := NewClient(server.URL, "") - client.Backoff.Duration = time.Millisecond - client.Backoff.Steps = 5 + client.Backoff.Duration = time.Millisecond // nolint:staticcheck + client.Backoff.Steps = 5 // nolint:staticcheck assert.Equal(t, client.BaseURL.String(), server.URL) ctx := context.Background() @@ -191,8 +191,8 @@ func TestClientDoWithBackoff(t *testing.T) { // Client with lots of brief backoff. client := NewClient(server.URL, "") - client.Backoff.Duration = time.Millisecond - client.Backoff.Steps = 100 + client.Backoff.Duration = time.Millisecond // nolint:staticcheck + client.Backoff.Steps = 100 // nolint:staticcheck assert.Equal(t, client.BaseURL.String(), server.URL) ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond) diff --git a/internal/bridge/installation_test.go b/internal/bridge/installation_test.go index 35987d1d9f..6160a7f865 100644 --- a/internal/bridge/installation_test.go +++ b/internal/bridge/installation_test.go @@ -108,7 +108,7 @@ func TestInstallationReconcile(t *testing.T) { reconciler.NewClient = func() *Client { c := NewClient(server.URL, "") - c.Backoff.Steps = 1 + c.Backoff.Steps = 1 // nolint:staticcheck assert.Equal(t, c.BaseURL.String(), server.URL) return c } @@ -163,7 +163,7 @@ func TestInstallationReconcile(t *testing.T) { reconciler.NewClient = func() *Client { c := NewClient(server.URL, "") - c.Backoff.Steps = 1 + c.Backoff.Steps = 1 // nolint:staticcheck assert.Equal(t, c.BaseURL.String(), server.URL) return c } diff --git a/internal/config/config_test.go b/internal/config/config_test.go index c19ac4a87d..c9c31851a0 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -30,9 +30,9 @@ func saveEnv(t testing.TB, key string) { previous, ok := os.LookupEnv(key) t.Cleanup(func() { if ok { - os.Setenv(key, previous) + os.Setenv(key, previous) // nolint:errcheck } else { - os.Unsetenv(key) + os.Unsetenv(key) // nolint:errcheck } }) } diff --git a/internal/controller/ivorycluster/cluster.go b/internal/controller/ivorycluster/cluster.go index 7e80c3ae2c..c6bf92fd61 100644 --- a/internal/controller/ivorycluster/cluster.go +++ b/internal/controller/ivorycluster/cluster.go @@ -128,7 +128,7 @@ func (r *Reconciler) generateClusterPrimaryService( // Endpoints for a Service have the same name as the Service. Copy labels, // annotations, and ownership, too. endpoints := &corev1.Endpoints{} - service.ObjectMeta.DeepCopyInto(&endpoints.ObjectMeta) + service.ObjectMeta.DeepCopyInto(&endpoints.ObjectMeta) // nolint:staticcheck endpoints.SetGroupVersionKind(corev1.SchemeGroupVersion.WithKind("Endpoints")) if leader == nil { diff --git a/internal/controller/ivorycluster/cluster_test.go b/internal/controller/ivorycluster/cluster_test.go index 452f774eac..c6734e06b4 100644 --- a/internal/controller/ivorycluster/cluster_test.go +++ b/internal/controller/ivorycluster/cluster_test.go @@ -154,8 +154,8 @@ func TestCustomLabels(t *testing.T) { t.Run("Cluster", func(t *testing.T) { cluster := testCluster() - cluster.ObjectMeta.Name = "global-cluster" - cluster.ObjectMeta.Namespace = ns.Name + cluster.ObjectMeta.Name = "global-cluster" // nolint:staticcheck + cluster.ObjectMeta.Namespace = ns.Name // nolint:staticcheck cluster.Spec.InstanceSets = []v1beta1.IvoryInstanceSetSpec{{ Name: "daisy-instance1", Replicas: initialize.Int32(1), @@ -204,8 +204,8 @@ func TestCustomLabels(t *testing.T) { t.Run("Instance", func(t *testing.T) { cluster := testCluster() - cluster.ObjectMeta.Name = "instance-cluster" - cluster.ObjectMeta.Namespace = ns.Name + cluster.ObjectMeta.Name = "instance-cluster" // nolint:staticcheck + cluster.ObjectMeta.Namespace = ns.Name // nolint:staticcheck cluster.Spec.InstanceSets = []v1beta1.IvoryInstanceSetSpec{{ Name: "max-instance", Replicas: initialize.Int32(1), @@ -258,8 +258,8 @@ func TestCustomLabels(t *testing.T) { t.Run("PGBackRest", func(t *testing.T) { cluster := testCluster() - cluster.ObjectMeta.Name = "pgbackrest-cluster" - cluster.ObjectMeta.Namespace = ns.Name + cluster.ObjectMeta.Name = "pgbackrest-cluster" // nolint:staticcheck + cluster.ObjectMeta.Namespace = ns.Name // nolint:staticcheck cluster.Spec.Backups.PGBackRest.Metadata = &v1beta1.Metadata{ Labels: map[string]string{"my.pgbackrest.label": "lucy"}, } @@ -305,8 +305,8 @@ func TestCustomLabels(t *testing.T) { t.Run("PGBouncer", func(t *testing.T) { cluster := testCluster() - cluster.ObjectMeta.Name = "pgbouncer-cluster" - cluster.ObjectMeta.Namespace = ns.Name + cluster.ObjectMeta.Name = "pgbouncer-cluster" // nolint:staticcheck + cluster.ObjectMeta.Namespace = ns.Name // nolint:staticcheck cluster.Spec.Proxy.PGBouncer.Metadata = &v1beta1.Metadata{ Labels: map[string]string{"my.pgbouncer.label": "lucy"}, } @@ -407,8 +407,8 @@ func TestCustomAnnotations(t *testing.T) { t.Run("Cluster", func(t *testing.T) { cluster := testCluster() - cluster.ObjectMeta.Name = "global-cluster" - cluster.ObjectMeta.Namespace = ns.Name + cluster.ObjectMeta.Name = "global-cluster" // nolint:staticcheck + cluster.ObjectMeta.Namespace = ns.Name // nolint:staticcheck cluster.Spec.InstanceSets = []v1beta1.IvoryInstanceSetSpec{{ Name: "daisy-instance1", Replicas: initialize.Int32(1), @@ -458,8 +458,8 @@ func TestCustomAnnotations(t *testing.T) { t.Run("Instance", func(t *testing.T) { cluster := testCluster() - cluster.ObjectMeta.Name = "instance-cluster" - cluster.ObjectMeta.Namespace = ns.Name + cluster.ObjectMeta.Name = "instance-cluster" // nolint:staticcheck + cluster.ObjectMeta.Namespace = ns.Name // nolint:staticcheck cluster.Spec.InstanceSets = []v1beta1.IvoryInstanceSetSpec{{ Name: "max-instance", Replicas: initialize.Int32(1), @@ -512,8 +512,8 @@ func TestCustomAnnotations(t *testing.T) { t.Run("PGBackRest", func(t *testing.T) { cluster := testCluster() - cluster.ObjectMeta.Name = "pgbackrest-cluster" - cluster.ObjectMeta.Namespace = ns.Name + cluster.ObjectMeta.Name = "pgbackrest-cluster" // nolint:staticcheck + cluster.ObjectMeta.Namespace = ns.Name // nolint:staticcheck cluster.Spec.Backups.PGBackRest.Metadata = &v1beta1.Metadata{ Annotations: map[string]string{"my.pgbackrest.annotation": "lucy"}, } @@ -559,8 +559,8 @@ func TestCustomAnnotations(t *testing.T) { t.Run("PGBouncer", func(t *testing.T) { cluster := testCluster() - cluster.ObjectMeta.Name = "pgbouncer-cluster" - cluster.ObjectMeta.Namespace = ns.Name + cluster.ObjectMeta.Name = "pgbouncer-cluster" // nolint:staticcheck + cluster.ObjectMeta.Namespace = ns.Name // nolint:staticcheck cluster.Spec.Proxy.PGBouncer.Metadata = &v1beta1.Metadata{ Annotations: map[string]string{"my.pgbouncer.annotation": "lucy"}, } @@ -774,12 +774,14 @@ type: ClusterIP assert.NilError(t, err) // Annotations present in the metadata. - assert.Assert(t, marshalMatches(service.ObjectMeta.Annotations, ` + assert.Assert(t, marshalMatches(service.ObjectMeta.Annotations, // nolint:staticcheck + ` some: note - `)) + `)) // nolint:staticcheck // Labels present in the metadata. - assert.Assert(t, marshalMatches(service.ObjectMeta.Labels, ` + assert.Assert(t, marshalMatches(service.ObjectMeta.Labels, // nolint:staticcheck + ` happy: label ivory-operator.ivorysql.org/cluster: pg2 ivory-operator.ivorysql.org/role: replica diff --git a/internal/controller/ivorycluster/controller.go b/internal/controller/ivorycluster/controller.go index c6c86970fb..79ed3c55e9 100644 --- a/internal/controller/ivorycluster/controller.go +++ b/internal/controller/ivorycluster/controller.go @@ -379,7 +379,7 @@ func (r *Reconciler) patch( patch client.Patch, options ...client.PatchOption, ) error { options = append([]client.PatchOption{r.Owner}, options...) - return r.Client.Patch(ctx, object, patch, options...) + return r.Client.Patch(ctx, object, patch, options...) // nolint:staticcheck } // The owner reference created by controllerutil.SetControllerReference blocks diff --git a/internal/controller/ivorycluster/helpers_test.go b/internal/controller/ivorycluster/helpers_test.go index 2eb72460f9..7de8b8f682 100644 --- a/internal/controller/ivorycluster/helpers_test.go +++ b/internal/controller/ivorycluster/helpers_test.go @@ -43,9 +43,9 @@ import ( var ( //TODO(tjmoore4): With the new RELATED_IMAGES defaulting behavior, tests could be refactored // to reference those environment variables instead of hard coded image values - IvoryHAImage = "registry.developers.ivorysql.org/highgo/highgo-ivory:ubi8-13.6-1" - IvoryBackRestImage = "registry.developers.ivorysql.org/highgo/highgo-pgbackrest:ubi8-2.38-0" - IvoryBouncerImage = "registry.developers.ivorysql.org/highgo/highgo-pgbouncer:ubi8-1.16-2" + IvoryHAImage = "registry.developers.ivorysql.org/highgo/highgo-ivory:ubi9-13.6-1" + IvoryBackRestImage = "registry.developers.ivorysql.org/highgo/highgo-pgbackrest:ubi9-2.38-0" + IvoryBouncerImage = "registry.developers.ivorysql.org/highgo/highgo-pgbouncer:ubi9-1.16-2" ) // Scale extends d according to IVYO_TEST_TIMEOUT_SCALE. diff --git a/internal/controller/ivorycluster/patroni_test.go b/internal/controller/ivorycluster/patroni_test.go index c8fb3280e8..0c2a24b97d 100644 --- a/internal/controller/ivorycluster/patroni_test.go +++ b/internal/controller/ivorycluster/patroni_test.go @@ -111,12 +111,12 @@ ownerReferences: assert.NilError(t, err) // Annotations present in the metadata. - assert.DeepEqual(t, service.ObjectMeta.Annotations, map[string]string{ + assert.DeepEqual(t, service.ObjectMeta.Annotations, map[string]string{ // nolint:staticcheck "a": "v1", }) // Labels present in the metadata. - assert.DeepEqual(t, service.ObjectMeta.Labels, map[string]string{ + assert.DeepEqual(t, service.ObjectMeta.Labels, map[string]string{ // nolint:staticcheck "b": "v2", "ivory-operator.ivorysql.org/cluster": "pg2", "ivory-operator.ivorysql.org/patroni": "pg2-ha", @@ -139,13 +139,13 @@ ownerReferences: assert.NilError(t, err) // Annotations present in the metadata. - assert.DeepEqual(t, service.ObjectMeta.Annotations, map[string]string{ + assert.DeepEqual(t, service.ObjectMeta.Annotations, map[string]string{ // nolint:staticcheck "a": "v1", "c": "v3", }) // Labels present in the metadata. - assert.DeepEqual(t, service.ObjectMeta.Labels, map[string]string{ + assert.DeepEqual(t, service.ObjectMeta.Labels, map[string]string{ // nolint:staticcheck "b": "v2", "d": "v4", "ivory-operator.ivorysql.org/cluster": "pg2", @@ -486,8 +486,8 @@ func TestReconcilePatroniStatus(t *testing.T) { ObjectMeta: naming.PatroniDistributedConfiguration(ivoryCluster), } if writeAnnotation { - endpoints.ObjectMeta.Annotations = make(map[string]string) - endpoints.ObjectMeta.Annotations["initialize"] = systemIdentifier + endpoints.ObjectMeta.Annotations = make(map[string]string) // nolint:staticcheck + endpoints.ObjectMeta.Annotations["initialize"] = systemIdentifier // nolint:staticcheck } assert.NilError(t, tClient.Create(ctx, endpoints, &client.CreateOptions{})) @@ -553,17 +553,17 @@ func TestReconcilePatroniSwitchover(t *testing.T) { switch { case timelineCall: timelineCall = false - stdout.Write([]byte(`[{"Cluster": "hippo-ha", "Member": "hippo-instance1-67mc-0", "Host": "hippo-instance1-67mc-0.hippo-pods", "Role": "Leader", "State": "running", "TL": 4}, {"Cluster": "hippo-ha", "Member": "hippo-instance1-ltcf-0", "Host": "hippo-instance1-ltcf-0.hippo-pods", "Role": "Replica", "State": "running", "TL": 4, "Lag in MB": 0}]`)) + stdout.Write([]byte(`[{"Cluster": "hippo-ha", "Member": "hippo-instance1-67mc-0", "Host": "hippo-instance1-67mc-0.hippo-pods", "Role": "Leader", "State": "running", "TL": 4}, {"Cluster": "hippo-ha", "Member": "hippo-instance1-ltcf-0", "Host": "hippo-instance1-ltcf-0.hippo-pods", "Role": "Replica", "State": "running", "TL": 4, "Lag in MB": 0}]`)) // nolint:errcheck case timelineCallNoLeader: - stdout.Write([]byte(`[{"Cluster": "hippo-ha", "Member": "hippo-instance1-ltcf-0", "Host": "hippo-instance1-ltcf-0.hippo-pods", "Role": "Replica", "State": "running", "TL": 4, "Lag in MB": 0}]`)) + stdout.Write([]byte(`[{"Cluster": "hippo-ha", "Member": "hippo-instance1-ltcf-0", "Host": "hippo-instance1-ltcf-0.hippo-pods", "Role": "Replica", "State": "running", "TL": 4, "Lag in MB": 0}]`)) // nolint:errcheck case callError: return errors.New("boom") case callFails: - stdout.Write([]byte("bang")) + stdout.Write([]byte("bang")) // nolint:errcheck case failover: - stdout.Write([]byte("failed over")) + stdout.Write([]byte("failed over")) // nolint:errcheck default: - stdout.Write([]byte("switched over")) + stdout.Write([]byte("switched over")) // nolint:errcheck } return nil }, diff --git a/internal/controller/ivorycluster/pgadmin_test.go b/internal/controller/ivorycluster/pgadmin_test.go index b1ac9d3d6c..d95895c444 100644 --- a/internal/controller/ivorycluster/pgadmin_test.go +++ b/internal/controller/ivorycluster/pgadmin_test.go @@ -118,12 +118,12 @@ ownerReferences: assert.Assert(t, specified) // Annotations present in the metadata. - assert.DeepEqual(t, configmap.ObjectMeta.Annotations, map[string]string{ + assert.DeepEqual(t, configmap.ObjectMeta.Annotations, map[string]string{ // nolint:staticcheck "a": "v5", "b": "v2", "e": "v6", }) // Labels present in the metadata. - assert.DeepEqual(t, configmap.ObjectMeta.Labels, map[string]string{ + assert.DeepEqual(t, configmap.ObjectMeta.Labels, map[string]string{ // nolint:staticcheck "c": "v7", "d": "v4", "f": "v8", "ivory-operator.ivorysql.org/cluster": "pg1", "ivory-operator.ivorysql.org/role": "pgadmin", @@ -208,12 +208,12 @@ ownerReferences: assert.Assert(t, specified) // Annotations present in the metadata. - assert.DeepEqual(t, service.ObjectMeta.Annotations, map[string]string{ + assert.DeepEqual(t, service.ObjectMeta.Annotations, map[string]string{ // nolint:staticcheck "a": "v1", }) // Labels present in the metadata. - assert.DeepEqual(t, service.ObjectMeta.Labels, map[string]string{ + assert.DeepEqual(t, service.ObjectMeta.Labels, map[string]string{ // nolint:staticcheck "b": "v2", "ivory-operator.ivorysql.org/cluster": "my-cluster", "ivory-operator.ivorysql.org/role": "pgadmin", @@ -239,13 +239,13 @@ ownerReferences: assert.Assert(t, specified) // Annotations present in the metadata. - assert.DeepEqual(t, service.ObjectMeta.Annotations, map[string]string{ + assert.DeepEqual(t, service.ObjectMeta.Annotations, map[string]string{ // nolint:staticcheck "a": "v1", "c": "v3", }) // Labels present in the metadata. - assert.DeepEqual(t, service.ObjectMeta.Labels, map[string]string{ + assert.DeepEqual(t, service.ObjectMeta.Labels, map[string]string{ // nolint:staticcheck "b": "v2", "d": "v4", "ivory-operator.ivorysql.org/cluster": "my-cluster", @@ -253,7 +253,7 @@ ownerReferences: }) // Labels not in the selector. - assert.DeepEqual(t, service.Spec.Selector, map[string]string{ + assert.DeepEqual(t, service.Spec.Selector, map[string]string{ // nolint:staticcheck "ivory-operator.ivorysql.org/cluster": "my-cluster", "ivory-operator.ivorysql.org/role": "pgadmin", }) diff --git a/internal/controller/ivorycluster/pgbackrest.go b/internal/controller/ivorycluster/pgbackrest.go index 960228f44c..cac098dd9f 100644 --- a/internal/controller/ivorycluster/pgbackrest.go +++ b/internal/controller/ivorycluster/pgbackrest.go @@ -2066,7 +2066,7 @@ func (r *Reconciler) reconcileDedicatedRepoHost(ctx context.Context, if isCreate { r.Recorder.Eventf(ivoryCluster, corev1.EventTypeNormal, EventRepoHostCreated, - "created pgBackRest repository host %s/%s", repoHost.TypeMeta.Kind, repoHostName) + "created pgBackRest repository host %s/%s", repoHost.TypeMeta.Kind, repoHostName) // nolint:staticcheck } return repoHost, nil @@ -2252,7 +2252,7 @@ func (r *Reconciler) reconcileManualBackup(ctx context.Context, backupJob := &batchv1.Job{} backupJob.ObjectMeta = naming.PGBackRestBackupJob(ivoryCluster) if currentBackupJob != nil { - backupJob.ObjectMeta.Name = currentBackupJob.ObjectMeta.Name + backupJob.ObjectMeta.Name = currentBackupJob.ObjectMeta.Name // nolint:staticcheck } var labels, annotations map[string]string @@ -2265,8 +2265,8 @@ func (r *Reconciler) reconcileManualBackup(ctx context.Context, map[string]string{ naming.PGBackRestBackup: manualAnnotation, }) - backupJob.ObjectMeta.Labels = labels - backupJob.ObjectMeta.Annotations = annotations + backupJob.ObjectMeta.Labels = labels // nolint:staticcheck + backupJob.ObjectMeta.Annotations = annotations // nolint:staticcheck spec, err := generateBackupJobSpecIntent(ivoryCluster, repo, serviceAccount.GetName(), labels, annotations, backupOpts...) @@ -2427,7 +2427,7 @@ func (r *Reconciler) reconcileReplicaCreateBackup(ctx context.Context, backupJob := &batchv1.Job{} backupJob.ObjectMeta = naming.PGBackRestBackupJob(ivoryCluster) if job != nil { - backupJob.ObjectMeta.Name = job.ObjectMeta.Name + backupJob.ObjectMeta.Name = job.ObjectMeta.Name // nolint:staticcheck } var labels, annotations map[string]string @@ -2441,8 +2441,8 @@ func (r *Reconciler) reconcileReplicaCreateBackup(ctx context.Context, naming.PGBackRestCurrentConfig: containerName, naming.PGBackRestConfigHash: configHash, }) - backupJob.ObjectMeta.Labels = labels - backupJob.ObjectMeta.Annotations = annotations + backupJob.ObjectMeta.Labels = labels // nolint:staticcheck + backupJob.ObjectMeta.Annotations = annotations // nolint:staticcheck spec, err := generateBackupJobSpecIntent(ivoryCluster, replicaCreateRepo, serviceAccount.GetName(), labels, annotations) diff --git a/internal/controller/ivorycluster/pgbackrest_test.go b/internal/controller/ivorycluster/pgbackrest_test.go index 5a17a94f80..9081ca3ab4 100644 --- a/internal/controller/ivorycluster/pgbackrest_test.go +++ b/internal/controller/ivorycluster/pgbackrest_test.go @@ -483,7 +483,7 @@ topologySpreadConstraints: var instanceConfFound, dedicatedRepoConfFound bool for k, v := range config.Data { if v != "" { - if k == pgbackrest.CMInstanceKey { + if k == pgbackrest.CMInstanceKey { // nolint:staticcheck instanceConfFound = true } else if k == pgbackrest.CMRepoKey { dedicatedRepoConfFound = true @@ -923,7 +923,7 @@ func TestReconcileReplicaCreateBackup(t *testing.T) { var foundOwnershipRef bool // verify ownership refs - for _, ref := range backupJob.ObjectMeta.GetOwnerReferences() { + for _, ref := range backupJob.ObjectMeta.GetOwnerReferences() { // nolint:staticcheck if ref.Name == clusterName { foundOwnershipRef = true break @@ -2851,11 +2851,11 @@ func TestGenerateRestoreJobIntent(t *testing.T) { t.Run(fmt.Sprintf("openshift-%v", openshift), func(t *testing.T) { t.Run("ObjectMeta", func(t *testing.T) { t.Run("Name", func(t *testing.T) { - assert.Equal(t, job.ObjectMeta.Name, + assert.Equal(t, job.ObjectMeta.Name, // nolint:staticcheck naming.PGBackRestRestoreJob(cluster).Name) }) t.Run("Namespace", func(t *testing.T) { - assert.Equal(t, job.ObjectMeta.Namespace, + assert.Equal(t, job.ObjectMeta.Namespace, // nolint:staticcheck naming.PGBackRestRestoreJob(cluster).Namespace) }) t.Run("Annotations", func(t *testing.T) { @@ -3064,15 +3064,15 @@ func TestObserveRestoreEnv(t *testing.T) { createResources: func(t *testing.T, cluster *v1beta1.IvoryCluster) { fakeLeaderEP := &corev1.Endpoints{} fakeLeaderEP.ObjectMeta = naming.PatroniLeaderEndpoints(cluster) - fakeLeaderEP.ObjectMeta.Namespace = namespace + fakeLeaderEP.ObjectMeta.Namespace = namespace // nolint:staticcheck assert.NilError(t, r.Client.Create(ctx, fakeLeaderEP)) fakeDCSEP := &corev1.Endpoints{} fakeDCSEP.ObjectMeta = naming.PatroniDistributedConfiguration(cluster) - fakeDCSEP.ObjectMeta.Namespace = namespace + fakeDCSEP.ObjectMeta.Namespace = namespace // nolint:staticcheck assert.NilError(t, r.Client.Create(ctx, fakeDCSEP)) fakeFailoverEP := &corev1.Endpoints{} fakeFailoverEP.ObjectMeta = naming.PatroniTrigger(cluster) - fakeFailoverEP.ObjectMeta.Namespace = namespace + fakeFailoverEP.ObjectMeta.Namespace = namespace // nolint:staticcheck assert.NilError(t, r.Client.Create(ctx, fakeFailoverEP)) job := generateJob(cluster.Name, initialize.Bool(false), initialize.Bool(false)) @@ -3088,15 +3088,15 @@ func TestObserveRestoreEnv(t *testing.T) { createResources: func(t *testing.T, cluster *v1beta1.IvoryCluster) { fakeLeaderEP := &corev1.Endpoints{} fakeLeaderEP.ObjectMeta = naming.PatroniLeaderEndpoints(cluster) - fakeLeaderEP.ObjectMeta.Namespace = namespace + fakeLeaderEP.ObjectMeta.Namespace = namespace // nolint:staticcheck assert.NilError(t, r.Client.Create(ctx, fakeLeaderEP)) fakeDCSEP := &corev1.Endpoints{} fakeDCSEP.ObjectMeta = naming.PatroniDistributedConfiguration(cluster) - fakeDCSEP.ObjectMeta.Namespace = namespace + fakeDCSEP.ObjectMeta.Namespace = namespace // nolint:staticcheck assert.NilError(t, r.Client.Create(ctx, fakeDCSEP)) fakeFailoverEP := &corev1.Endpoints{} fakeFailoverEP.ObjectMeta = naming.PatroniTrigger(cluster) - fakeFailoverEP.ObjectMeta.Namespace = namespace + fakeFailoverEP.ObjectMeta.Namespace = namespace // nolint:staticcheck assert.NilError(t, r.Client.Create(ctx, fakeFailoverEP)) }, result: testResult{ @@ -3266,15 +3266,15 @@ func TestPrepareForRestore(t *testing.T) { cluster *v1beta1.IvoryCluster) (*batchv1.Job, []corev1.Endpoints) { fakeLeaderEP := corev1.Endpoints{} fakeLeaderEP.ObjectMeta = naming.PatroniLeaderEndpoints(cluster) - fakeLeaderEP.ObjectMeta.Namespace = namespace + fakeLeaderEP.ObjectMeta.Namespace = namespace // nolint:staticcheck assert.NilError(t, r.Client.Create(ctx, &fakeLeaderEP)) fakeDCSEP := corev1.Endpoints{} fakeDCSEP.ObjectMeta = naming.PatroniDistributedConfiguration(cluster) - fakeDCSEP.ObjectMeta.Namespace = namespace + fakeDCSEP.ObjectMeta.Namespace = namespace // nolint:staticcheck assert.NilError(t, r.Client.Create(ctx, &fakeDCSEP)) fakeFailoverEP := corev1.Endpoints{} fakeFailoverEP.ObjectMeta = naming.PatroniTrigger(cluster) - fakeFailoverEP.ObjectMeta.Namespace = namespace + fakeFailoverEP.ObjectMeta.Namespace = namespace // nolint:staticcheck assert.NilError(t, r.Client.Create(ctx, &fakeFailoverEP)) return nil, []corev1.Endpoints{fakeLeaderEP, fakeDCSEP, fakeFailoverEP} }, diff --git a/internal/controller/ivorycluster/pgbouncer_test.go b/internal/controller/ivorycluster/pgbouncer_test.go index a8e2cc3376..1461502fab 100644 --- a/internal/controller/ivorycluster/pgbouncer_test.go +++ b/internal/controller/ivorycluster/pgbouncer_test.go @@ -117,12 +117,12 @@ ownerReferences: assert.Assert(t, specified) // Annotations present in the metadata. - assert.DeepEqual(t, service.ObjectMeta.Annotations, map[string]string{ + assert.DeepEqual(t, service.ObjectMeta.Annotations, map[string]string{ // nolint:staticcheck "a": "v1", }) // Labels present in the metadata. - assert.DeepEqual(t, service.ObjectMeta.Labels, map[string]string{ + assert.DeepEqual(t, service.ObjectMeta.Labels, map[string]string{ // nolint:staticcheck "b": "v2", "ivory-operator.ivorysql.org/cluster": "pg7", "ivory-operator.ivorysql.org/role": "pgbouncer", @@ -148,13 +148,13 @@ ownerReferences: assert.Assert(t, specified) // Annotations present in the metadata. - assert.DeepEqual(t, service.ObjectMeta.Annotations, map[string]string{ + assert.DeepEqual(t, service.ObjectMeta.Annotations, map[string]string{ // nolint:staticcheck "a": "v1", "c": "v3", }) // Labels present in the metadata. - assert.DeepEqual(t, service.ObjectMeta.Labels, map[string]string{ + assert.DeepEqual(t, service.ObjectMeta.Labels, map[string]string{ // nolint:staticcheck "b": "v2", "d": "v4", "ivory-operator.ivorysql.org/cluster": "pg7", @@ -431,12 +431,12 @@ namespace: ns3 assert.Assert(t, specified) // Annotations present in the metadata. - assert.DeepEqual(t, deploy.ObjectMeta.Annotations, map[string]string{ + assert.DeepEqual(t, deploy.ObjectMeta.Annotations, map[string]string{ // nolint:staticcheck "a": "v1", }) // Labels present in the metadata. - assert.DeepEqual(t, deploy.ObjectMeta.Labels, map[string]string{ + assert.DeepEqual(t, deploy.ObjectMeta.Labels, map[string]string{ // nolint:staticcheck "b": "v2", "ivory-operator.ivorysql.org/cluster": "test-cluster", "ivory-operator.ivorysql.org/role": "pgbouncer", diff --git a/internal/controller/ivorycluster/pki.go b/internal/controller/ivorycluster/pki.go index 65f6a3e2ed..72d803b56f 100644 --- a/internal/controller/ivorycluster/pki.go +++ b/internal/controller/ivorycluster/pki.go @@ -74,7 +74,7 @@ func (r *Reconciler) reconcileRootCertificate( intent.SetGroupVersionKind(corev1.SchemeGroupVersion.WithKind("Secret")) intent.Namespace, intent.Name = cluster.Namespace, naming.RootCertSecret intent.Data = make(map[string][]byte) - intent.ObjectMeta.OwnerReferences = existing.ObjectMeta.OwnerReferences + intent.ObjectMeta.OwnerReferences = existing.ObjectMeta.OwnerReferences // nolint:staticcheck // A root secret is scoped to the namespace where ivorycluster(s) // are deployed. For operator deployments with ivoryclusters in more than @@ -150,7 +150,7 @@ func (r *Reconciler) reconcileClusterCertificate( intent := &corev1.Secret{ObjectMeta: naming.IvoryTLSSecret(cluster)} intent.SetGroupVersionKind(corev1.SchemeGroupVersion.WithKind("Secret")) intent.Data = make(map[string][]byte) - intent.ObjectMeta.OwnerReferences = existing.ObjectMeta.OwnerReferences + intent.ObjectMeta.OwnerReferences = existing.ObjectMeta.OwnerReferences // nolint:staticcheck intent.Annotations = naming.Merge(cluster.Spec.Metadata.GetAnnotationsOrNil()) intent.Labels = naming.Merge( diff --git a/internal/controller/ivorycluster/pki_test.go b/internal/controller/ivorycluster/pki_test.go index 7be05ece10..08a13ef533 100644 --- a/internal/controller/ivorycluster/pki_test.go +++ b/internal/controller/ivorycluster/pki_test.go @@ -100,7 +100,7 @@ func TestReconcileCerts(t *testing.T) { err := tClient.Get(ctx, client.ObjectKeyFromObject(rootSecret), rootSecret) assert.NilError(t, err) - assert.Check(t, len(rootSecret.ObjectMeta.OwnerReferences) == 1, "first owner reference not set") + assert.Check(t, len(rootSecret.ObjectMeta.OwnerReferences) == 1, "first owner reference not set") // nolint:staticcheck expectedOR := metav1.OwnerReference{ APIVersion: "ivory-operator.ivorysql.org/v1beta1", @@ -109,8 +109,8 @@ func TestReconcileCerts(t *testing.T) { UID: cluster1.UID, } - if len(rootSecret.ObjectMeta.OwnerReferences) > 0 { - assert.Equal(t, rootSecret.ObjectMeta.OwnerReferences[0], expectedOR) + if len(rootSecret.ObjectMeta.OwnerReferences) > 0 { // nolint:staticcheck + assert.Equal(t, rootSecret.ObjectMeta.OwnerReferences[0], expectedOR) // nolint:staticcheck } }) @@ -125,7 +125,7 @@ func TestReconcileCerts(t *testing.T) { clist := &v1beta1.IvoryClusterList{} assert.NilError(t, tClient.List(ctx, clist)) - assert.Check(t, len(rootSecret.ObjectMeta.OwnerReferences) == 2, "second owner reference not set") + assert.Check(t, len(rootSecret.ObjectMeta.OwnerReferences) == 2, "second owner reference not set") // nolint:staticcheck expectedOR := metav1.OwnerReference{ APIVersion: "ivory-operator.ivorysql.org/v1beta1", @@ -134,8 +134,8 @@ func TestReconcileCerts(t *testing.T) { UID: cluster2.UID, } - if len(rootSecret.ObjectMeta.OwnerReferences) > 1 { - assert.Equal(t, rootSecret.ObjectMeta.OwnerReferences[1], expectedOR) + if len(rootSecret.ObjectMeta.OwnerReferences) > 1 { // nolint:staticcheck + assert.Equal(t, rootSecret.ObjectMeta.OwnerReferences[1], expectedOR) // nolint:staticcheck } }) @@ -313,7 +313,7 @@ func TestReconcileCerts(t *testing.T) { testSecret := &corev1.Secret{} testSecret.Namespace, testSecret.Name = namespace, "newcustomsecret" // simulate cluster spec update - cluster2.Spec.CustomTLSSecret.LocalObjectReference.Name = "newcustomsecret" + cluster2.Spec.CustomTLSSecret.LocalObjectReference.Name = "newcustomsecret" // nolint:staticcheck // get the expected secret projection testSecretProjection := clusterCertSecretProjection(testSecret) diff --git a/internal/controller/ivorycluster/util_test.go b/internal/controller/ivorycluster/util_test.go index be99f35d82..a49ad3bffb 100644 --- a/internal/controller/ivorycluster/util_test.go +++ b/internal/controller/ivorycluster/util_test.go @@ -229,7 +229,7 @@ func TestAddDevSHM(t *testing.T) { // check there is an empty dir mounted under the dshm volume for _, v := range template.Spec.Volumes { - if v.Name == "dshm" && v.VolumeSource.EmptyDir != nil && v.VolumeSource.EmptyDir.Medium == corev1.StorageMediumMemory { + if v.Name == "dshm" && v.VolumeSource.EmptyDir != nil && v.VolumeSource.EmptyDir.Medium == corev1.StorageMediumMemory { // nolint:staticcheck found = true break } @@ -371,7 +371,7 @@ func TestAddNSSWrapper(t *testing.T) { // Each container that requires the nss_wrapper envs should be updated var actualUpdatedContainerCount int for i, c := range template.Spec.Containers { - if c.Name == naming.ContainerDatabase || + if c.Name == naming.ContainerDatabase || // nolint:staticcheck c.Name == naming.PGBackRestRepoContainerName || c.Name == naming.PGBackRestRestoreContainerName { assert.DeepEqual(t, expectedEnv, c.Env) diff --git a/internal/controller/ivorycluster/volumes.go b/internal/controller/ivorycluster/volumes.go index 100ed245af..53ac5a9431 100644 --- a/internal/controller/ivorycluster/volumes.go +++ b/internal/controller/ivorycluster/volumes.go @@ -222,7 +222,7 @@ func (r *Reconciler) configureExistingPGVolumes( Spec: cluster.Spec.InstanceSets[0].DataVolumeClaimSpec, } - volume.ObjectMeta.Labels = map[string]string{ + volume.ObjectMeta.Labels = map[string]string{ // nolint:staticcheck naming.LabelCluster: cluster.Name, naming.LabelInstanceSet: cluster.Spec.InstanceSets[0].Name, naming.LabelInstance: instanceName, @@ -275,7 +275,7 @@ func (r *Reconciler) configureExistingPGWALVolume( Spec: cluster.Spec.InstanceSets[0].DataVolumeClaimSpec, } - volume.ObjectMeta.Labels = map[string]string{ + volume.ObjectMeta.Labels = map[string]string{ // nolint:staticcheck naming.LabelCluster: cluster.Name, naming.LabelInstanceSet: cluster.Spec.InstanceSets[0].Name, naming.LabelInstance: instanceName, @@ -429,14 +429,14 @@ func (r *Reconciler) reconcileMovePGDataDir(ctx context.Context, // at this point, the Job either wasn't found or it has failed, so the it // should be created - moveDirJob.ObjectMeta.Annotations = naming.Merge(cluster.Spec.Metadata. + moveDirJob.ObjectMeta.Annotations = naming.Merge(cluster.Spec.Metadata. // nolint:staticcheck GetAnnotationsOrNil()) labels := naming.Merge(cluster.Spec.Metadata.GetLabelsOrNil(), naming.DirectoryMoveJobLabels(cluster.Name), map[string]string{ naming.LabelMovePGDataDir: "", }) - moveDirJob.ObjectMeta.Labels = labels + moveDirJob.ObjectMeta.Labels = labels // nolint:staticcheck // `patroni.dynamic.json` holds the previous state of the DCS. Since we are // migrating the volumes, we want to clear out any obsolete configuration info. @@ -551,14 +551,14 @@ func (r *Reconciler) reconcileMoveWALDir(ctx context.Context, } } - moveDirJob.ObjectMeta.Annotations = naming.Merge(cluster.Spec.Metadata. + moveDirJob.ObjectMeta.Annotations = naming.Merge(cluster.Spec.Metadata. // nolint:staticcheck GetAnnotationsOrNil()) labels := naming.Merge(cluster.Spec.Metadata.GetLabelsOrNil(), naming.DirectoryMoveJobLabels(cluster.Name), map[string]string{ naming.LabelMovePGWalDir: "", }) - moveDirJob.ObjectMeta.Labels = labels + moveDirJob.ObjectMeta.Labels = labels // nolint:staticcheck script := fmt.Sprintf(`echo "Preparing cluster %s volumes for IVO v5.x" echo "pg_wal_pvc=%s" @@ -573,7 +573,7 @@ func (r *Reconciler) reconcileMoveWALDir(ctx context.Context, cluster.Spec.DataSource.Volumes.PGWALVolume.PVCName, cluster.Spec.DataSource.Volumes.PGWALVolume.Directory, cluster.Spec.DataSource.Volumes.PGWALVolume.Directory, - cluster.ObjectMeta.Name) + cluster.ObjectMeta.Name) // nolint:staticcheck container := corev1.Container{ Command: []string{"bash", "-ceu", script}, @@ -669,14 +669,14 @@ func (r *Reconciler) reconcileMoveRepoDir(ctx context.Context, } } - moveDirJob.ObjectMeta.Annotations = naming.Merge( + moveDirJob.ObjectMeta.Annotations = naming.Merge( // nolint:staticcheck cluster.Spec.Metadata.GetAnnotationsOrNil()) labels := naming.Merge(cluster.Spec.Metadata.GetLabelsOrNil(), naming.DirectoryMoveJobLabels(cluster.Name), map[string]string{ naming.LabelMovePGBackRestRepoDir: "", }) - moveDirJob.ObjectMeta.Labels = labels + moveDirJob.ObjectMeta.Labels = labels // nolint:staticcheck script := fmt.Sprintf(`echo "Preparing cluster %s pgBackRest repo volume for IVO v5.x" echo "repo_pvc=%s" diff --git a/internal/controller/ivyupgrade/apply.go b/internal/controller/ivyupgrade/apply.go index 18401d141d..0c41ab15c6 100644 --- a/internal/controller/ivyupgrade/apply.go +++ b/internal/controller/ivyupgrade/apply.go @@ -141,7 +141,7 @@ func (r *IvyUpgradeReconciler) patch( patch client.Patch, options ...client.PatchOption, ) error { options = append([]client.PatchOption{r.Owner}, options...) - return r.Client.Patch(ctx, object, patch, options...) + return r.Client.Patch(ctx, object, patch, options...) // nolint:staticcheck } // apply sends an apply patch to object's endpoint in the Kubernetes API and diff --git a/internal/controller/ivyupgrade/ivyupgrade_controller.go b/internal/controller/ivyupgrade/ivyupgrade_controller.go index f239a9d418..9675acc170 100644 --- a/internal/controller/ivyupgrade/ivyupgrade_controller.go +++ b/internal/controller/ivyupgrade/ivyupgrade_controller.go @@ -407,7 +407,7 @@ func (r *IvyUpgradeReconciler) Reconcile(ctx context.Context, req ctrl.Request) // - https://kubernetes.io/docs/concepts/workloads/controllers/job/ // - https://github.com/kubernetes/kubernetes/blob/master/pkg/registry/batch/job/strategy.go#L58 propagate := client.PropagationPolicy(metav1.DeletePropagationBackground) - err = client.IgnoreNotFound(r.Client.Delete(ctx, object, exactly, propagate)) + err = client.IgnoreNotFound(r.Client.Delete(ctx, object, exactly, propagate)) // nolint:staticcheck } } @@ -459,7 +459,7 @@ func (r *IvyUpgradeReconciler) Reconcile(ctx context.Context, req ctrl.Request) uid := object.GetUID() version := object.GetResourceVersion() exactly := client.Preconditions{UID: &uid, ResourceVersion: &version} - err = client.IgnoreNotFound(r.Client.Delete(ctx, object, exactly)) + err = client.IgnoreNotFound(r.Client.Delete(ctx, object, exactly)) // nolint:staticcheck } // Requeue to verify that Patroni endpoints are deleted diff --git a/internal/patroni/api_test.go b/internal/patroni/api_test.go index 5f5a6fdc58..97ef5fae4b 100644 --- a/internal/patroni/api_test.go +++ b/internal/patroni/api_test.go @@ -74,7 +74,7 @@ func TestExecutorChangePrimaryAndWait(t *testing.T) { success, _ := Executor(func( _ context.Context, _ io.Reader, stdout, _ io.Writer, _ ...string, ) error { - _, _ = stdout.Write([]byte(`no luck`)) + _, _ = stdout.Write([]byte(`no luck`)) // nolint:errcheck return nil }).ChangePrimaryAndWait(context.Background(), "any", "thing") @@ -126,7 +126,7 @@ func TestExecutorSwitchoverAndWait(t *testing.T) { success, _ := Executor(func( _ context.Context, _ io.Reader, stdout, _ io.Writer, _ ...string, ) error { - _, _ = stdout.Write([]byte(`no luck`)) + _, _ = stdout.Write([]byte(`no luck`)) // nolint:errcheck return nil }).SwitchoverAndWait(context.Background(), "next") @@ -178,7 +178,7 @@ func TestExecutorFailoverAndWait(t *testing.T) { success, _ := Executor(func( _ context.Context, _ io.Reader, stdout, _ io.Writer, _ ...string, ) error { - _, _ = stdout.Write([]byte(`no luck`)) + _, _ = stdout.Write([]byte(`no luck`)) // nolint:errcheck return nil }).FailoverAndWait(context.Background(), "next") @@ -254,7 +254,7 @@ func TestExecutorGetTimeline(t *testing.T) { tl, actual := Executor(func( _ context.Context, stdin io.Reader, stdout, stderr io.Writer, command ...string, ) error { - stderr.Write([]byte(`no luck`)) + stderr.Write([]byte(`no luck`)) // nolint:errcheck return nil }).GetTimeline(context.Background()) @@ -266,7 +266,7 @@ func TestExecutorGetTimeline(t *testing.T) { tl, actual := Executor(func( _ context.Context, stdin io.Reader, stdout, stderr io.Writer, command ...string, ) error { - stdout.Write([]byte(`no luck`)) + stdout.Write([]byte(`no luck`)) // nolint:errcheck return nil }).GetTimeline(context.Background()) @@ -278,7 +278,7 @@ func TestExecutorGetTimeline(t *testing.T) { tl, actual := Executor(func( _ context.Context, stdin io.Reader, stdout, stderr io.Writer, command ...string, ) error { - stdout.Write([]byte(`[{"Cluster": "hippo-ha", "Member": "hippo-instance1-ltcf-0", "Host": "hippo-instance1-ltcf-0.hippo-pods", "Role": "Replica", "State": "running", "TL": 4, "Lag in MB": 0}]`)) + stdout.Write([]byte(`[{"Cluster": "hippo-ha", "Member": "hippo-instance1-ltcf-0", "Host": "hippo-instance1-ltcf-0.hippo-pods", "Role": "Replica", "State": "running", "TL": 4, "Lag in MB": 0}]`)) // nolint:errcheck return nil }).GetTimeline(context.Background()) @@ -290,7 +290,7 @@ func TestExecutorGetTimeline(t *testing.T) { tl, actual := Executor(func( _ context.Context, stdin io.Reader, stdout, stderr io.Writer, command ...string, ) error { - stdout.Write([]byte(`[{"Cluster": "hippo-ha", "Member": "hippo-instance1-67mc-0", "Host": "hippo-instance1-67mc-0.hippo-pods", "Role": "Leader", "State": "running", "TL": 4}, {"Cluster": "hippo-ha", "Member": "hippo-instance1-ltcf-0", "Host": "hippo-instance1-ltcf-0.hippo-pods", "Role": "Replica", "State": "running", "TL": 4, "Lag in MB": 0}]`)) + stdout.Write([]byte(`[{"Cluster": "hippo-ha", "Member": "hippo-instance1-67mc-0", "Host": "hippo-instance1-67mc-0.hippo-pods", "Role": "Leader", "State": "running", "TL": 4}, {"Cluster": "hippo-ha", "Member": "hippo-instance1-ltcf-0", "Host": "hippo-instance1-ltcf-0.hippo-pods", "Role": "Replica", "State": "running", "TL": 4, "Lag in MB": 0}]`)) // nolint:errcheck return nil }).GetTimeline(context.Background()) diff --git a/internal/pgbackrest/reconcile_test.go b/internal/pgbackrest/reconcile_test.go index 881b3c1397..5560e940f2 100644 --- a/internal/pgbackrest/reconcile_test.go +++ b/internal/pgbackrest/reconcile_test.go @@ -138,7 +138,7 @@ func TestAddRepoVolumesToPod(t *testing.T) { for _, r := range tc.repos { var foundVolume bool for _, v := range template.Spec.Volumes { - if v.Name == r.Name && v.VolumeSource.PersistentVolumeClaim.ClaimName == + if v.Name == r.Name && v.VolumeSource.PersistentVolumeClaim.ClaimName == // nolint:staticcheck naming.PGBackRestRepoVolume(ivoryCluster, r.Name).Name { foundVolume = true break diff --git a/internal/pgmonitor/api.go b/internal/pgmonitor/api.go index dec62babff..1482268de2 100644 --- a/internal/pgmonitor/api.go +++ b/internal/pgmonitor/api.go @@ -56,7 +56,7 @@ func (exec Executor) GetExporterSetupSQL(ctx context.Context, version int) (stri "/opt/crunchy/bin/postgres/pgbackrest_info.sh") } - log.V(1).Info("updated pgMonitor default configration", "sql", sql) + log.V(1).Info("updated pgMonitor default configuration", "sql", sql) return sql, stderr.String(), err } diff --git a/internal/upgradecheck/helpers_test.go b/internal/upgradecheck/helpers_test.go index f3c6f905bc..3c94ec93d5 100644 --- a/internal/upgradecheck/helpers_test.go +++ b/internal/upgradecheck/helpers_test.go @@ -57,7 +57,7 @@ func (f *fakeClientWithError) Get(ctx context.Context, key types.NamespacedName, // Once that gets fixed, we can test without envtest func (f *fakeClientWithError) Patch(ctx context.Context, obj crclient.Object, patch crclient.Patch, opts ...crclient.PatchOption) error { - switch { + switch { // nolint:staticcheck case f.errorType == "patch error": return fmt.Errorf("patch error") default: diff --git a/internal/upgradecheck/http.go b/internal/upgradecheck/http.go index 8934f98154..f69c8d78cd 100644 --- a/internal/upgradecheck/http.go +++ b/internal/upgradecheck/http.go @@ -107,7 +107,7 @@ func checkForUpgrades(ctx context.Context, url, versionString string, backoff wa res, err = client.Do(req) if err == nil { - defer res.Body.Close() + defer res.Body.Close() // nolint:errcheck status = res.StatusCode // This is a very basic check, ignoring nuances around diff --git a/internal/util/util.go b/internal/util/util.go index 4406a7323f..41e7dd8625 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -35,7 +35,7 @@ func SQLQuoteIdentifier(identifier string) string { identifier = identifier[:end] } - return `"` + strings.Replace(identifier, `"`, `""`, -1) + `"` + return `"` + strings.Replace(identifier, `"`, `""`, -1) + `"` // nolint:staticcheck } // SQLQuoteLiteral quotes a 'literal' (e.g. a parameter, often used to pass literal @@ -56,14 +56,14 @@ func SQLQuoteLiteral(literal string) string { // https://git.ivorysql.org/gitweb/?p=ivorysql.git;a=blob;f=src/interfaces/libpq/fe-exec.c // // substitute any single-quotes (') with two single-quotes ('') - literal = strings.Replace(literal, `'`, `''`, -1) + literal = strings.Replace(literal, `'`, `''`, -1) // nolint:staticcheck // determine if the string has any backslashes (\) in it. // if it does, replace any backslashes (\) with two backslashes (\\) // then, we need to wrap the entire string with a IvorySQL // C-style escape. Per how "PQEscapeStringInternal" handles this case, we // also add a space before the "E" if strings.Contains(literal, `\`) { - literal = strings.Replace(literal, `\`, `\\`, -1) + literal = strings.Replace(literal, `\`, `\\`, -1) // nolint:staticcheck literal = ` E'` + literal + `'` } else { // otherwise, we can just wrap the literal with a pair of single quotes diff --git a/testing/kuttl/e2e-other/exporter-upgrade/00--cluster.yaml b/testing/kuttl/e2e-other/exporter-upgrade/00--cluster.yaml index e169494f11..fdc1512fdd 100644 --- a/testing/kuttl/e2e-other/exporter-upgrade/00--cluster.yaml +++ b/testing/kuttl/e2e-other/exporter-upgrade/00--cluster.yaml @@ -4,7 +4,7 @@ metadata: name: exporter spec: postgresVersion: 18 - image: docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1 + image: docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1 instances: - name: instance1 dataVolumeClaimSpec: diff --git a/testing/kuttl/e2e-other/exporter-upgrade/02--update-cluster.yaml b/testing/kuttl/e2e-other/exporter-upgrade/02--update-cluster.yaml index c3acdb4e8a..b03a11486f 100644 --- a/testing/kuttl/e2e-other/exporter-upgrade/02--update-cluster.yaml +++ b/testing/kuttl/e2e-other/exporter-upgrade/02--update-cluster.yaml @@ -4,4 +4,4 @@ metadata: name: exporter spec: postgresVersion: 18 - image: docker.io/ivorysql/ivorysql:ubi8-5.0-5.0-1 + image: docker.io/ivorysql/ivorysql:ubi9-5.1-5.1-1