Skip to content

Commit

Permalink
Merge pull request #1009 from percona/dependabot/go_modules/sigs.k8s.…
Browse files Browse the repository at this point in the history
…io/controller-runtime-0.20.0

CLOUD-727: Bump sigs.k8s.io/controller-runtime from 0.19.4 to 0.20.0
  • Loading branch information
gkech authored Jan 23, 2025
2 parents 8894064 + eb2b497 commit 67d3e15
Show file tree
Hide file tree
Showing 21 changed files with 105 additions and 52 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
k8s.io/apimachinery v0.32.1
k8s.io/client-go v0.32.1
k8s.io/component-base v0.32.1
sigs.k8s.io/controller-runtime v0.19.4
sigs.k8s.io/controller-runtime v0.20.0
sigs.k8s.io/yaml v1.4.0
)

Expand All @@ -45,6 +45,7 @@ require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
Expand Down Expand Up @@ -111,7 +112,6 @@ require (
go.opentelemetry.io/otel/metric v1.34.0 // indirect
go.opentelemetry.io/proto/otlp v1.4.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/oauth2 v0.24.0 // indirect
golang.org/x/sync v0.10.0 // indirect
Expand All @@ -126,7 +126,7 @@ require (
google.golang.org/protobuf v1.36.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.31.0 // indirect
k8s.io/apiextensions-apiserver v0.32.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaW
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg=
github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
Expand Down Expand Up @@ -274,8 +276,6 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
Expand Down Expand Up @@ -394,8 +394,8 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.32.1 h1:f562zw9cy+GvXzXf0CKlVQ7yHJVYzLfL6JAS4kOAaOc=
k8s.io/api v0.32.1/go.mod h1:/Yi/BqkuueW1BgpoePYBRdDYfjPF5sgTr5+YqDZra5k=
k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk=
k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk=
k8s.io/apiextensions-apiserver v0.32.0 h1:S0Xlqt51qzzqjKPxfgX1xh4HBZE+p8KKBq+k2SWNOE0=
k8s.io/apiextensions-apiserver v0.32.0/go.mod h1:86hblMvN5yxMvZrZFX2OhIHAuFIMJIZ19bTvzkP+Fmw=
k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs=
k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE=
k8s.io/client-go v0.32.1 h1:otM0AxdhdBIaQh7l1Q0jQpmo7WOFIk5FFa4bg6YMdUU=
Expand All @@ -408,8 +408,8 @@ k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJ
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro=
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/controller-runtime v0.19.4 h1:SUmheabttt0nx8uJtoII4oIP27BVVvAKFvdvGFwV/Qo=
sigs.k8s.io/controller-runtime v0.19.4/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4=
sigs.k8s.io/controller-runtime v0.20.0 h1:jjkMo29xEXH+02Md9qaVXfEIaMESSpy3TBWPrsfQkQs=
sigs.k8s.io/controller-runtime v0.20.0/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA=
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/postgrescluster/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (r *Reconciler) Reconcile(
// Set any defaults that may not have been stored in the API. No DeepCopy
// is necessary because controller-runtime makes a copy before returning
// from its cache.
cluster.Default()
_ = cluster.Default(ctx, nil)

if cluster.Spec.OpenShift == nil {
cluster.Spec.OpenShift = &r.IsOpenShift
Expand Down
6 changes: 4 additions & 2 deletions internal/controller/postgrescluster/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,8 @@ func TestAddPGBackRestToInstancePodSpec(t *testing.T) {
ctx := context.Background()
cluster := v1beta1.PostgresCluster{}
cluster.Name = "hippo"
cluster.Default()
err := cluster.Default(ctx, nil)
assert.NilError(t, err)
cluster.SetLabels(map[string]string{
naming.LabelVersion: "2.5.0",
})
Expand Down Expand Up @@ -1725,7 +1726,8 @@ func TestGenerateInstanceStatefulSetIntent(t *testing.T) {
cluster = testCluster()
}

cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.UID = types.UID("hippouid")
cluster.Namespace = test.name + "-ns"
cluster.Spec.Shutdown = &test.ip.shutdown
Expand Down
3 changes: 2 additions & 1 deletion internal/controller/postgrescluster/pgbouncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ namespace: ns3
cluster.Spec.Proxy = &v1beta1.PostgresProxySpec{
PGBouncer: &v1beta1.PGBouncerPodSpec{},
}
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

configmap := &corev1.ConfigMap{}
configmap.Name = "some-cm2"
Expand Down
6 changes: 4 additions & 2 deletions internal/controller/postgrescluster/pgmonitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,8 @@ func TestReconcileMonitoringSecret(t *testing.T) {
reconciler := &Reconciler{Client: cc, Owner: client.FieldOwner(t.Name())}

cluster := testCluster()
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.UID = types.UID("hippouid")
cluster.Namespace = setupNamespace(t, cc).Name

Expand Down Expand Up @@ -787,7 +788,8 @@ func TestReconcileExporterQueriesConfig(t *testing.T) {
reconciler := &Reconciler{Client: cc, Owner: client.FieldOwner(t.Name())}

cluster := testCluster()
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.UID = types.UID("hippouid")
cluster.Namespace = setupNamespace(t, cc).Name

Expand Down
2 changes: 1 addition & 1 deletion internal/controller/standalone_pgadmin/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (r *PGAdminReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
log.V(1).Info("Reconciling pgAdmin")

// Set defaults if unset
pgAdmin.Default()
_ = pgAdmin.Default(ctx, nil)

var (
configmap *corev1.ConfigMap
Expand Down
13 changes: 9 additions & 4 deletions internal/patroni/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package patroni

import (
"context"
"os"
"os/exec"
"path/filepath"
Expand All @@ -29,7 +30,8 @@ func TestClusterYAML(t *testing.T) {

t.Run("PG version defaulted", func(t *testing.T) {
cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.Namespace = "some-namespace"
cluster.Name = "cluster-name"

Expand Down Expand Up @@ -86,7 +88,8 @@ watchdog:

t.Run(">PG10", func(t *testing.T) {
cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.Namespace = "some-namespace"
cluster.Name = "cluster-name"
cluster.Spec.PostgresVersion = 14
Expand Down Expand Up @@ -759,7 +762,8 @@ func TestDynamicConfiguration(t *testing.T) {
if cluster.Spec.PostgresVersion == 0 {
cluster.Spec.PostgresVersion = 14
}
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
actual := DynamicConfiguration(cluster, tt.input, tt.hbas, tt.params)
assert.DeepEqual(t, tt.expected, actual)
})
Expand Down Expand Up @@ -792,7 +796,8 @@ func TestInstanceEnvironment(t *testing.T) {
t.Parallel()

cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.Spec.PostgresVersion = 12
leaderService := new(corev1.Service)
podService := new(corev1.Service)
Expand Down
4 changes: 3 additions & 1 deletion internal/patroni/rbac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package patroni

import (
"context"
"testing"

"gotest.tools/v3/assert"
Expand All @@ -28,7 +29,8 @@ func isUniqueAndSorted(slice []string) bool {

func TestPermissions(t *testing.T) {
cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

t.Run("Upstream", func(t *testing.T) {
permissions := Permissions(cluster)
Expand Down
6 changes: 4 additions & 2 deletions internal/patroni/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ func TestClusterConfigMap(t *testing.T) {
pgHBAs := postgres.HBAs{}
pgParameters := postgres.Parameters{}

cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
config := new(corev1.ConfigMap)
assert.NilError(t, ClusterConfigMap(ctx, cluster, pgHBAs, pgParameters, config))

Expand Down Expand Up @@ -114,7 +115,8 @@ func TestInstancePod(t *testing.T) {
t.Parallel()

cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.Name = "some-such"
cluster.Spec.PostgresVersion = 11
cluster.Spec.Image = "image"
Expand Down
10 changes: 7 additions & 3 deletions internal/pgadmin/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package pgadmin

import (
"context"
"testing"

"gotest.tools/v3/assert"
Expand Down Expand Up @@ -33,7 +34,8 @@ func TestConfigMap(t *testing.T) {
t.Run("Defaults", func(t *testing.T) {
cluster.Spec.UserInterface = new(v1beta1.UserInterfaceSpec)
cluster.Spec.UserInterface.PGAdmin = new(v1beta1.PGAdminPodSpec)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

assert.NilError(t, ConfigMap(cluster, config))

Expand All @@ -52,7 +54,8 @@ pgadmin-settings.json: |
"some": "thing",
"UPPER_CASE": false,
}
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

assert.NilError(t, ConfigMap(cluster, config))

Expand Down Expand Up @@ -92,7 +95,8 @@ func TestPod(t *testing.T) {
t.Run("Defaults", func(t *testing.T) {
cluster.Spec.UserInterface = new(v1beta1.UserInterfaceSpec)
cluster.Spec.UserInterface.PGAdmin = new(v1beta1.PGAdminPodSpec)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

call()

Expand Down
4 changes: 3 additions & 1 deletion internal/pgbackrest/rbac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package pgbackrest

import (
"context"
"testing"

"gotest.tools/v3/assert"
Expand All @@ -28,7 +29,8 @@ func isUniqueAndSorted(slice []string) bool {

func TestPermissions(t *testing.T) {
cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

permissions := Permissions(cluster)
for _, rule := range permissions {
Expand Down
15 changes: 10 additions & 5 deletions internal/pgbackrest/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ func TestAddConfigToInstancePod(t *testing.T) {
},
}
cluster.Name = "hippo"
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

pod := corev1.PodSpec{
Containers: []corev1.Container{
Expand Down Expand Up @@ -332,7 +333,8 @@ func TestAddConfigToInstancePod(t *testing.T) {
func TestAddConfigToRepoPod(t *testing.T) {
cluster := v1beta1.PostgresCluster{}
cluster.Name = "hippo"
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

pod := corev1.PodSpec{
Containers: []corev1.Container{
Expand Down Expand Up @@ -405,7 +407,8 @@ func TestAddConfigToRepoPod(t *testing.T) {
func TestAddConfigToRestorePod(t *testing.T) {
cluster := v1beta1.PostgresCluster{}
cluster.Name = "source"
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

pod := corev1.PodSpec{
Containers: []corev1.Container{
Expand Down Expand Up @@ -575,7 +578,8 @@ func TestAddServerToInstancePod(t *testing.T) {
ctx := context.Background()
cluster := v1beta1.PostgresCluster{}
cluster.Name = "hippo"
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.SetLabels(map[string]string{
naming.LabelVersion: "2.5.0",
})
Expand Down Expand Up @@ -838,7 +842,8 @@ func TestAddServerToRepoPod(t *testing.T) {
ctx := context.Background()
cluster := v1beta1.PostgresCluster{}
cluster.Name = "hippo"
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)
cluster.SetLabels(map[string]string{
naming.LabelVersion: "2.5.0",
})
Expand Down
4 changes: 3 additions & 1 deletion internal/pgbouncer/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package pgbouncer

import (
"context"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -43,7 +44,8 @@ func TestClusterINI(t *testing.T) {
t.Parallel()

cluster := new(v1beta1.PostgresCluster)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

cluster.Name = "foo-baz"
*cluster.Spec.Port = 9999
Expand Down
12 changes: 8 additions & 4 deletions internal/pgbouncer/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func TestConfigMap(t *testing.T) {

cluster.Spec.Proxy = new(v1beta1.PostgresProxySpec)
cluster.Spec.Proxy.PGBouncer = new(v1beta1.PGBouncerPodSpec)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

ConfigMap(cluster, config)

Expand Down Expand Up @@ -71,7 +72,8 @@ func TestSecret(t *testing.T) {

cluster.Spec.Proxy = new(v1beta1.PostgresProxySpec)
cluster.Spec.Proxy.PGBouncer = new(v1beta1.PGBouncerPodSpec)
cluster.Default()
err = cluster.Default(context.Background(), nil)
assert.NilError(t, err)

constant := existing.DeepCopy()
assert.NilError(t, Secret(ctx, cluster, root, existing, service, intent))
Expand Down Expand Up @@ -120,7 +122,8 @@ func TestPod(t *testing.T) {
t.Run("Defaults", func(t *testing.T) {
cluster.Spec.Proxy = new(v1beta1.PostgresProxySpec)
cluster.Spec.Proxy.PGBouncer = new(v1beta1.PGBouncerPodSpec)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

call()

Expand Down Expand Up @@ -487,7 +490,8 @@ func TestPostgreSQL(t *testing.T) {
t.Run("Enabled", func(t *testing.T) {
cluster.Spec.Proxy = new(v1beta1.PostgresProxySpec)
cluster.Spec.Proxy.PGBouncer = new(v1beta1.PGBouncerPodSpec)
cluster.Default()
err := cluster.Default(context.Background(), nil)
assert.NilError(t, err)

PostgreSQL(cluster, hbas)

Expand Down
Loading

0 comments on commit 67d3e15

Please sign in to comment.