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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .golangci.next.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ linters:
- thelper
- tparallel
- wastedassign
presets:
- performance

issues:
exclude-rules:
Expand Down
13 changes: 7 additions & 6 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@
linters:
disable:
- contextcheck
- gci
- gofumpt
enable:
- depguard
- goheader
- gomodguard
- gosimple
- importas
- misspell
- unconvert
presets:
- bugs
- format
- import
- unused

linters-settings:
Expand Down Expand Up @@ -61,6 +59,12 @@ linters-settings:
exhaustive:
default-signifies-exhaustive: true

gci:
sections:
- standard
- default
- localmodule

goheader:
template: |-
Copyright {{ DATES }} Crunchy Data Solutions, Inc.
Expand All @@ -70,9 +74,6 @@ linters-settings:
regexp:
DATES: '((201[7-9]|202[0-4]) - 2025|2025)'

goimports:
local-prefixes: github.com/crunchydata/postgres-operator

gomodguard:
blocked:
modules:
Expand Down
1 change: 0 additions & 1 deletion internal/bridge/crunchybridgecluster/mock_bridge_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

"github.com/crunchydata/postgres-operator/internal/bridge"
"github.com/crunchydata/postgres-operator/internal/initialize"

"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
)

Expand Down
1 change: 0 additions & 1 deletion internal/bridge/crunchybridgecluster/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

Expand Down
3 changes: 1 addition & 2 deletions internal/bridge/crunchybridgecluster/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import (
"context"
"testing"

"sigs.k8s.io/controller-runtime/pkg/client"

"gotest.tools/v3/assert"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crunchydata/postgres-operator/internal/bridge"
"github.com/crunchydata/postgres-operator/internal/testing/require"
Expand Down
1 change: 0 additions & 1 deletion internal/controller/postgrescluster/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gstruct"
"github.com/pkg/errors" //nolint:depguard // This legacy test covers so much code, it logs the origin of unexpected errors.

"gotest.tools/v3/assert"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/postgrescluster/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,11 +644,11 @@ func (r *Reconciler) reconcilePostgresUsersInPostgreSQL(
running, known := instance.IsRunning(container)
if running && known && len(instance.Pods) > 0 {
pod := instance.Pods[0]
ctx = logging.NewContext(ctx, logging.FromContext(ctx).WithValues("pod", pod.Name))

podExecutor = func(
ctx context.Context, stdin io.Reader, stdout, stderr io.Writer, command ...string,
) error {
ctx = logging.NewContext(ctx, logging.FromContext(ctx).WithValues("pod", pod.Name))
return r.PodExec(ctx, pod.Namespace, pod.Name, container, stdin, stdout, stderr, command...)
}
break
Expand Down
3 changes: 1 addition & 2 deletions internal/controller/postgrescluster/snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import (
"strings"
"time"

volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1"
"github.com/pkg/errors"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"sigs.k8s.io/controller-runtime/pkg/client"

volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1"

"github.com/crunchydata/postgres-operator/internal/config"
"github.com/crunchydata/postgres-operator/internal/feature"
"github.com/crunchydata/postgres-operator/internal/initialize"
Expand Down
3 changes: 1 addition & 2 deletions internal/controller/postgrescluster/snapshots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"testing"
"time"

volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1"
"gotest.tools/v3/assert"
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
Expand All @@ -27,8 +28,6 @@ import (
"github.com/crunchydata/postgres-operator/internal/testing/events"
"github.com/crunchydata/postgres-operator/internal/testing/require"
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"

volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1"
)

func TestReconcileVolumeSnapshots(t *testing.T) {
Expand Down
3 changes: 0 additions & 3 deletions internal/controller/postgrescluster/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ import (
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/util/version"
"k8s.io/client-go/discovery"

// Google Kubernetes Engine / Google Cloud Platform authentication provider
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
Expand Down
3 changes: 1 addition & 2 deletions internal/controller/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package runtime

import (
volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
Expand All @@ -15,8 +16,6 @@ import (

"github.com/crunchydata/postgres-operator/internal/logging"
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"

volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1"
)

type (
Expand Down
3 changes: 1 addition & 2 deletions internal/controller/standalone_pgadmin/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ import (
"strconv"
"strings"

corev1 "k8s.io/api/core/v1"

"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"

"github.com/crunchydata/postgres-operator/internal/collector"
"github.com/crunchydata/postgres-operator/internal/initialize"
Expand Down
6 changes: 3 additions & 3 deletions internal/controller/standalone_pgadmin/related.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ package standalone_pgadmin
import (
"context"

"k8s.io/apimachinery/pkg/labels"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crunchydata/postgres-operator/internal/initialize"
"github.com/crunchydata/postgres-operator/internal/naming"
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"

"k8s.io/apimachinery/pkg/labels"
"sigs.k8s.io/controller-runtime/pkg/client"
)

//+kubebuilder:rbac:groups="postgres-operator.crunchydata.com",resources="pgadmins",verbs={list}
Expand Down
6 changes: 2 additions & 4 deletions internal/controller/standalone_pgadmin/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ package standalone_pgadmin
import (
"context"

"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
"sigs.k8s.io/controller-runtime/pkg/client"

apierrors "k8s.io/apimachinery/pkg/api/errors"

"github.com/pkg/errors"

"github.com/crunchydata/postgres-operator/internal/logging"
"github.com/crunchydata/postgres-operator/internal/naming"
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
Expand Down
3 changes: 1 addition & 2 deletions internal/controller/standalone_pgadmin/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ package standalone_pgadmin
import (
"context"

"github.com/pkg/errors"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/pkg/errors"

"github.com/crunchydata/postgres-operator/internal/collector"
"github.com/crunchydata/postgres-operator/internal/controller/postgrescluster"
"github.com/crunchydata/postgres-operator/internal/initialize"
Expand Down
3 changes: 1 addition & 2 deletions internal/controller/standalone_pgadmin/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ package standalone_pgadmin
import (
"context"

"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation/field"

"github.com/pkg/errors"

"github.com/crunchydata/postgres-operator/internal/naming"
"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
)
Expand Down
4 changes: 1 addition & 3 deletions internal/pgbackrest/pgbackrest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ import (
"testing"

"gotest.tools/v3/assert"
"k8s.io/apimachinery/pkg/api/resource"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"

"github.com/crunchydata/postgres-operator/internal/testing/require"

"github.com/crunchydata/postgres-operator/pkg/apis/postgres-operator.crunchydata.com/v1beta1"
)

Expand Down
1 change: 0 additions & 1 deletion internal/postgres/password/md5.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package password

import (

// #nosec G501
"crypto/md5"
"errors"
Expand Down
3 changes: 0 additions & 3 deletions internal/upgradecheck/header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/uuid"

// Google Kubernetes Engine / Google Cloud Platform authentication provider
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"

"github.com/crunchydata/postgres-operator/internal/feature"
"github.com/crunchydata/postgres-operator/internal/kubernetes"
"github.com/crunchydata/postgres-operator/internal/naming"
Expand Down