Skip to content

Commit 495cf24

Browse files
committed
go mod: update controller-runtime to v0.16.5
Also bump go version for the Operator Dockerfile due to new deps version incompats to previous go version. Change-Id: I666d149b30485a46982fe5050e1ce4e3d38540ce
1 parent f92e0a5 commit 495cf24

File tree

4 files changed

+83
-107
lines changed

4 files changed

+83
-107
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM quay.io/projectquay/golang:1.19 as builder
2+
FROM quay.io/projectquay/golang:1.20 as builder
33

44
WORKDIR /workspace
55
# Copy the Go Modules manifests

controllers/main.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ import (
1414

1515
"k8s.io/apimachinery/pkg/runtime/schema"
1616
"k8s.io/apimachinery/pkg/runtime/serializer"
17+
"sigs.k8s.io/controller-runtime/pkg/cache"
1718
"sigs.k8s.io/controller-runtime/pkg/client"
1819
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
20+
metrics "sigs.k8s.io/controller-runtime/pkg/metrics/server"
1921

2022
apiroutev1 "github.com/openshift/api/route/v1"
2123
"k8s.io/apimachinery/pkg/runtime"
@@ -78,11 +80,19 @@ func GetConfigContextOrDie(contextName string) *rest.Config {
7880
}
7981

8082
func Main(ns string, metricsAddr string, probeAddr string, enableLeaderElection bool, oneShot bool) {
83+
newCache := func(config *rest.Config, opts cache.Options) (cache.Cache, error) { return cache.New(config, opts) }
84+
if ns != "" {
85+
newCache = func(config *rest.Config, opts cache.Options) (cache.Cache, error) {
86+
opts.DefaultNamespaces = map[string]cache.Config{ns: {}}
87+
return cache.New(config, opts)
88+
}
89+
}
8190
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
82-
Namespace: ns,
83-
Scheme: controllerScheme,
84-
MetricsBindAddress: metricsAddr,
85-
Port: 9443,
91+
NewCache: newCache,
92+
Scheme: controllerScheme,
93+
Metrics: metrics.Options{
94+
BindAddress: metricsAddr,
95+
},
8696
HealthProbeBindAddress: probeAddr,
8797
LeaderElection: enableLeaderElection,
8898
LeaderElectionID: "01752ab0.softwarefactory-project.io",

go.mod

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ require (
1010
github.com/go-sql-driver/mysql v1.7.1
1111
github.com/google/uuid v1.3.0
1212
github.com/onsi/ginkgo v1.16.5
13-
github.com/onsi/gomega v1.27.7
13+
github.com/onsi/gomega v1.27.10
1414
github.com/openshift/api v0.0.0-20230320192226-1fc631efd341
1515
github.com/operator-framework/api v0.17.6
1616
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.67.1
1717
github.com/spf13/cobra v1.7.0
1818
github.com/spf13/viper v1.15.0
19-
golang.org/x/crypto v0.7.0
19+
golang.org/x/crypto v0.14.0
2020
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3
2121
gopkg.in/ini.v1 v1.67.0
2222
gopkg.in/yaml.v2 v2.4.0
2323
gopkg.in/yaml.v3 v3.0.1
24-
k8s.io/api v0.27.2
25-
k8s.io/apimachinery v0.27.2
26-
k8s.io/client-go v0.27.2
24+
k8s.io/api v0.28.3
25+
k8s.io/apimachinery v0.28.3
26+
k8s.io/client-go v0.28.3
2727
k8s.io/kubectl v0.26.0
2828
k8s.io/utils v0.0.0-20230505201702-9f6742963106
29-
sigs.k8s.io/controller-runtime v0.15.0
29+
sigs.k8s.io/controller-runtime v0.16.5
3030
sigs.k8s.io/yaml v1.3.0
3131
)
3232

@@ -37,7 +37,7 @@ require (
3737
github.com/blang/semver/v4 v4.0.0 // indirect
3838
github.com/cespare/xxhash/v2 v2.2.0 // indirect
3939
github.com/davecgh/go-spew v1.1.1 // indirect
40-
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
40+
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
4141
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
4242
github.com/fsnotify/fsnotify v1.6.0 // indirect
4343
github.com/go-logr/zapr v1.2.4 // indirect
@@ -47,7 +47,7 @@ require (
4747
github.com/gogo/protobuf v1.3.2 // indirect
4848
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4949
github.com/golang/protobuf v1.5.3 // indirect
50-
github.com/google/gnostic v0.6.9 // indirect
50+
github.com/google/gnostic-models v0.6.8 // indirect
5151
github.com/google/go-cmp v0.5.9 // indirect
5252
github.com/google/gofuzz v1.2.0 // indirect
5353
github.com/hashicorp/hcl v1.0.0 // indirect
@@ -69,10 +69,10 @@ require (
6969
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
7070
github.com/pkg/errors v0.9.1 // indirect
7171
github.com/pmezard/go-difflib v1.0.0 // indirect
72-
github.com/prometheus/client_golang v1.15.1 // indirect
72+
github.com/prometheus/client_golang v1.16.0 // indirect
7373
github.com/prometheus/client_model v0.4.0 // indirect
74-
github.com/prometheus/common v0.42.0 // indirect
75-
github.com/prometheus/procfs v0.9.0 // indirect
74+
github.com/prometheus/common v0.44.0 // indirect
75+
github.com/prometheus/procfs v0.10.1 // indirect
7676
github.com/sirupsen/logrus v1.9.0 // indirect
7777
github.com/spf13/afero v1.9.3 // indirect
7878
github.com/spf13/cast v1.5.0 // indirect
@@ -81,24 +81,23 @@ require (
8181
github.com/stretchr/objx v0.5.0 // indirect
8282
github.com/stretchr/testify v1.8.2 // indirect
8383
github.com/subosito/gotenv v1.4.2 // indirect
84-
go.uber.org/atomic v1.10.0 // indirect
85-
go.uber.org/multierr v1.10.0 // indirect
86-
go.uber.org/zap v1.24.0 // indirect
87-
golang.org/x/net v0.10.0 // indirect
88-
golang.org/x/oauth2 v0.6.0 // indirect
89-
golang.org/x/sys v0.8.0 // indirect
90-
golang.org/x/term v0.8.0 // indirect
91-
golang.org/x/text v0.10.0 // indirect
84+
go.uber.org/multierr v1.11.0 // indirect
85+
go.uber.org/zap v1.25.0 // indirect
86+
golang.org/x/net v0.17.0 // indirect
87+
golang.org/x/oauth2 v0.8.0 // indirect
88+
golang.org/x/sys v0.13.0 // indirect
89+
golang.org/x/term v0.13.0 // indirect
90+
golang.org/x/text v0.13.0 // indirect
9291
golang.org/x/time v0.3.0 // indirect
93-
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
92+
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
9493
google.golang.org/appengine v1.6.7 // indirect
9594
google.golang.org/protobuf v1.30.0 // indirect
9695
gopkg.in/inf.v0 v0.9.1 // indirect
9796
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
98-
k8s.io/apiextensions-apiserver v0.27.2 // indirect
99-
k8s.io/component-base v0.27.2 // indirect
97+
k8s.io/apiextensions-apiserver v0.28.3 // indirect
98+
k8s.io/component-base v0.28.3 // indirect
10099
k8s.io/klog/v2 v2.100.1 // indirect
101-
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
100+
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
102101
sigs.k8s.io/gateway-api v0.6.2 // indirect
103102
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
104103
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect

0 commit comments

Comments
 (0)