Skip to content

Commit 39a8e1f

Browse files
benjaminjbcbandy
andauthored
Update runtime-controller (#3362)
* Remove unused SSA workarounds for Kubernetes 1.18 We have not supported Kubernetes 1.18 for some time now. OpenShift 4.6 is based on Kubernetes 1.19. * Update runtime-controller * update runtime-controller * adjust logger * adjust envtest * adjust tests Issue [sc-12818] * update crd * remove potentially unnecessary cleanup Co-authored-by: Chris Bandy <chris.bandy@crunchydata.com>
1 parent be28d8c commit 39a8e1f

File tree

28 files changed

+4092
-1483
lines changed

28 files changed

+4092
-1483
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
kubernetes: ["1.19.2"] # TODO(benjaminjb)(issue sc-11672): bump to 1.20.2 or higher after we update controller-runtime
28+
kubernetes: ['1.24']
2929
steps:
3030
- uses: actions/checkout@v3
3131
- uses: actions/setup-go@v3

Makefile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,15 @@ pgo-base-docker: pgo-base-build
195195
check:
196196
PGO_NAMESPACE="postgres-operator" $(GO_TEST) -cover ./...
197197

198+
# Available versions: curl -s 'https://storage.googleapis.com/kubebuilder-tools/' | grep -o '<Key>[^<]*</Key>'
198199
# - KUBEBUILDER_ATTACH_CONTROL_PLANE_OUTPUT=true
199200
.PHONY: check-envtest
200-
check-envtest: hack/tools/envtest
201-
KUBEBUILDER_ASSETS="$(CURDIR)/$^/bin" PGO_NAMESPACE="postgres-operator" $(GO_TEST) -count=1 -cover -tags=envtest ./...
201+
check-envtest: ENVTEST_USE = hack/tools/setup-envtest --bin-dir=$(CURDIR)/hack/tools/envtest use $(ENVTEST_K8S_VERSION)
202+
check-envtest: SHELL = bash
203+
check-envtest:
204+
GOBIN='$(CURDIR)/hack/tools' $(GO) install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
205+
@$(ENVTEST_USE) --print=overview && echo
206+
source <($(ENVTEST_USE) --print=env) && PGO_NAMESPACE="postgres-operator" $(GO_TEST) -count=1 -cover -tags=envtest ./...
202207

203208
# - PGO_TEST_TIMEOUT_SCALE=1
204209
.PHONY: check-envtest-existing
@@ -240,6 +245,8 @@ clean: clean-deprecated
240245
[ ! -d testing/kuttl/e2e-generated ] || rm -r testing/kuttl/e2e-generated
241246
[ ! -d testing/kuttl/e2e-generated-other ] || rm -r testing/kuttl/e2e-generated-other
242247
[ ! -d build/crd/generated ] || rm -r build/crd/generated
248+
[ ! -f hack/tools/setup-envtest ] || hack/tools/setup-envtest --bin-dir=hack/tools/envtest cleanup
249+
[ ! -f hack/tools/setup-envtest ] || rm hack/tools/setup-envtest
243250
[ ! -d hack/tools/envtest ] || rm -r hack/tools/envtest
244251
[ ! -n "$$(ls hack/tools)" ] || rm hack/tools/*
245252
[ ! -d hack/.kube ] || rm -r hack/.kube
@@ -281,7 +288,7 @@ generate-crd:
281288
$(PGO_KUBE_CLIENT) kustomize ./build/crd > ./config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml
282289

283290
generate-crd-docs:
284-
GOBIN='$(CURDIR)/hack/tools' go install fybrik.io/crdoc@v0.5.2
291+
GOBIN='$(CURDIR)/hack/tools' $(GO) install fybrik.io/crdoc@v0.5.2
285292
./hack/tools/crdoc \
286293
--resources ./config/crd/bases \
287294
--template ./hack/api-template.tmpl \
@@ -296,12 +303,6 @@ generate-rbac:
296303
GOBIN='$(CURDIR)/hack/tools' ./hack/generate-rbac.sh \
297304
'./internal/...' 'config/rbac'
298305

299-
# Available versions: curl -s 'https://storage.googleapis.com/kubebuilder-tools/' | grep -o '<Key>[^<]*</Key>'
300-
# - ENVTEST_K8S_VERSION=1.19.2
301-
hack/tools/envtest: SHELL = bash
302-
hack/tools/envtest:
303-
source '$(shell $(GO) list -f '{{ .Dir }}' -m 'sigs.k8s.io/controller-runtime')/hack/setup-envtest.sh' && fetch_envtest_tools $@
304-
305306
.PHONY: license licenses
306307
license: licenses
307308
licenses:

cmd/postgres-operator/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func initLogging() {
4848
if strings.EqualFold(os.Getenv("CRUNCHY_DEBUG"), "true") {
4949
verbosity = 1
5050
}
51-
logging.SetLogFunc(verbosity, logging.Logrus(os.Stdout, versionString, 1))
51+
logging.SetLogSink(logging.Logrus(os.Stdout, versionString, 1, verbosity))
5252
}
5353

5454
func main() {

config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml

Lines changed: 3525 additions & 798 deletions
Large diffs are not rendered by default.

go.mod

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ go 1.17
44

55
require (
66
github.com/evanphx/json-patch/v5 v5.6.0
7-
github.com/go-logr/logr v0.4.0
7+
github.com/go-logr/logr v1.2.2
88
github.com/google/go-cmp v0.5.7
99
github.com/google/uuid v1.3.0
1010
github.com/onsi/ginkgo v1.16.5
11-
github.com/onsi/gomega v1.17.0
11+
github.com/onsi/gomega v1.18.1
1212
github.com/pkg/errors v0.9.1
1313
github.com/sirupsen/logrus v1.8.1
14-
github.com/wojas/genericr v0.2.0
1514
github.com/xdg-go/stringprep v1.0.2
1615
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.27.0
1716
go.opentelemetry.io/otel v1.2.0
@@ -22,36 +21,44 @@ require (
2221
go.opentelemetry.io/otel/trace v1.2.0
2322
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa
2423
gotest.tools/v3 v3.1.0
25-
k8s.io/api v0.20.8
26-
k8s.io/apimachinery v0.20.8
27-
k8s.io/client-go v0.20.8
28-
k8s.io/component-base v0.20.2
29-
sigs.k8s.io/controller-runtime v0.8.3
24+
k8s.io/api v0.24.2
25+
k8s.io/apimachinery v0.24.2
26+
k8s.io/client-go v0.24.2
27+
k8s.io/component-base v0.24.2
28+
sigs.k8s.io/controller-runtime v0.12.3
3029
sigs.k8s.io/yaml v1.3.0
3130
)
3231

3332
require (
34-
cloud.google.com/go v0.65.0 // indirect
33+
cloud.google.com/go v0.81.0 // indirect
34+
github.com/PuerkitoBio/purell v1.1.1 // indirect
35+
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
3536
github.com/beorn7/perks v1.0.1 // indirect
3637
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
3738
github.com/cespare/xxhash/v2 v2.1.2 // indirect
3839
github.com/davecgh/go-spew v1.1.1 // indirect
39-
github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c // indirect
40-
github.com/evanphx/json-patch v4.9.0+incompatible // indirect
40+
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
41+
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
4142
github.com/felixge/httpsnoop v1.0.2 // indirect
4243
github.com/fsnotify/fsnotify v1.5.1 // indirect
44+
github.com/go-openapi/jsonpointer v0.19.5 // indirect
45+
github.com/go-openapi/jsonreference v0.19.5 // indirect
46+
github.com/go-openapi/swag v0.19.14 // indirect
4347
github.com/gogo/protobuf v1.3.2 // indirect
44-
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
48+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4549
github.com/golang/protobuf v1.5.2 // indirect
50+
github.com/google/gnostic v0.5.7-v3refs // indirect
4651
github.com/google/gofuzz v1.1.0 // indirect
47-
github.com/googleapis/gnostic v0.5.1 // indirect
4852
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
49-
github.com/hashicorp/golang-lru v0.5.4 // indirect
50-
github.com/imdario/mergo v0.3.10 // indirect
53+
github.com/imdario/mergo v0.3.12 // indirect
54+
github.com/josharian/intern v1.0.0 // indirect
5155
github.com/json-iterator/go v1.1.12 // indirect
56+
github.com/mailru/easyjson v0.7.6 // indirect
5257
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
58+
github.com/moby/spdystream v0.2.0 // indirect
5359
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5460
github.com/modern-go/reflect2 v1.0.2 // indirect
61+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
5562
github.com/nxadm/tail v1.4.8 // indirect
5663
github.com/prometheus/client_golang v1.12.2 // indirect
5764
github.com/prometheus/client_model v0.2.0 // indirect
@@ -61,25 +68,26 @@ require (
6168
go.opentelemetry.io/otel/internal/metric v0.25.0 // indirect
6269
go.opentelemetry.io/otel/metric v0.25.0 // indirect
6370
go.opentelemetry.io/proto/otlp v0.10.0 // indirect
64-
golang.org/x/net v0.0.0-20220121175114-2ed6ce1e1725 // indirect
65-
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
66-
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
71+
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
72+
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
73+
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
6774
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
6875
golang.org/x/text v0.3.7 // indirect
69-
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
76+
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
7077
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
71-
gomodules.xyz/jsonpatch/v2 v2.1.0 // indirect
72-
google.golang.org/appengine v1.6.6 // indirect
73-
google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a // indirect
78+
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
79+
google.golang.org/appengine v1.6.7 // indirect
80+
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
7481
google.golang.org/grpc v1.42.0 // indirect
7582
google.golang.org/protobuf v1.27.1 // indirect
7683
gopkg.in/inf.v0 v0.9.1 // indirect
7784
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
7885
gopkg.in/yaml.v2 v2.4.0 // indirect
7986
gopkg.in/yaml.v3 v3.0.1 // indirect
80-
k8s.io/apiextensions-apiserver v0.20.1 // indirect
81-
k8s.io/klog/v2 v2.4.0 // indirect
82-
k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd // indirect
83-
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009 // indirect
84-
sigs.k8s.io/structured-merge-diff/v4 v4.0.3 // indirect
87+
k8s.io/apiextensions-apiserver v0.24.2 // indirect
88+
k8s.io/klog/v2 v2.60.1 // indirect
89+
k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect
90+
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
91+
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
92+
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
8593
)

0 commit comments

Comments
 (0)