Skip to content

Commit 3829f35

Browse files
Fix compiler and test failures with latest version of sigs.k8s.io/controller-runtime (#7979)
# Description A [recent change](kubernetes-sigs/controller-runtime#2903) to the [`controller-runtime`](https://github.com/kubernetes-sigs/controller-runtime/) package caused Radius compilation errors and test failures, as referenced in #7882. Breaking changes in `controller-runtime` include the removal of a configuration option, and a new validation that prevents duplicate controller names. This PR makes changes to update the packages referenced, fix the compilation errors, and address the test failures. Changes include: - Updates to `go.mod` and `go.sum`. - Fixed compiler errors by moving the warning suppression configuration from the `controller-runtime/pkg/client` options to `client-go/rest/Config`, as required by the changes in `controller-runtime`. - Fixed broken tests by adding the `SkipNameValidation` configuration parameter to unit tests for creating new controllers. - Some refactoring of commonly shared test functions and constants in `cli/controller/reconciler` into `shared-test.go`. > NOTE: The compilation fix in this PR did not change the behavior of the `rad` cli--only the tests were changed. The assumption is that `rad` does not ever create controllers with duplicate names, so suppressing the duplicate controller name validation is not necessary, even though it is necessary in the automated tests. ## Type of change - This pull request fixes a bug in Radius and has an approved issue (issue link required). Fixes: #7882 ## Contributor checklist Please verify that the PR meets the following requirements, where applicable: - [ ] An overview of proposed schema changes is included in a linked GitHub issue. - [ ] A design document PR is created in the [design-notes repository](https://github.com/radius-project/design-notes/), if new APIs are being introduced. - [ ] If applicable, design document has been reviewed and approved by Radius maintainers/approvers. - [ ] A PR for the [samples repository](https://github.com/radius-project/samples) is created, if existing samples are affected by the changes in this PR. - [ ] A PR for the [documentation repository](https://github.com/radius-project/docs) is created, if the changes in this PR affect the documentation or any user facing updates are made. - [ ] A PR for the [recipes repository](https://github.com/radius-project/recipes) is created, if existing recipes are affected by the changes in this PR. --------- Signed-off-by: Brooke Hamilton <[email protected]>
1 parent d2870a7 commit 3829f35

File tree

15 files changed

+246
-224
lines changed

15 files changed

+246
-224
lines changed

.devcontainer/contributor/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
// Prerequisite for Code Generation, see https://github.com/radius-project/radius/tree/main/docs/contributing/contributing-code/contributing-code-prerequisites#code-generation
4545
// Adding workspace as safe directory to avoid permission issues
46-
"postCreateCommand": "git config --global --add safe.directory /workspaces/radius && cd typespec && npm ci && npm install -g autorest && npm install -g oav && go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0 && go install go.uber.org/mock/[email protected]",
46+
"postCreateCommand": "git config --global --add safe.directory /workspaces/radius && cd typespec && npm ci && npm install -g autorest && npm install -g oav && go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.0 && go install go.uber.org/mock/[email protected]",
4747
"hostRequirements": {
4848
"memory": "8gb"
4949
},

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
- name: Install mockgen
6060
run: go install go.uber.org/mock/[email protected]
6161
- name: Install controller-gen
62-
run: go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0
62+
run: go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.0
6363
- name: Install helm
6464
uses: azure/setup-helm@v4
6565
with:

.github/workflows/publish-docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
- name: Install controller-gen
7474
run: |
7575
cd radius
76-
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0
76+
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.0
7777
# Generate Bicep docs
7878
- name: Generate Bicep docs
7979
run: |

build/generate.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ generate: generate-genericcliclient generate-rad-corerp-client generate-rad-data
2929
.PHONY: generate-tsp-installed
3030
generate-tsp-installed:
3131
@echo "$(ARROW) Detecting tsp..."
32-
cd typespec/ && npx$(CMD_EXT) -q tsp --help > /dev/null || { echo "run 'npm ci' in typespec directory."; exit 1; }
32+
cd typespec/ && npx$(CMD_EXT) -q -y tsp --help > /dev/null || { echo "run 'npm ci' in typespec directory."; exit 1; }
3333
@echo "$(ARROW) OK"
3434

3535
.PHONY: generate-openapi-spec
@@ -56,7 +56,7 @@ generate-autorest-installed:
5656
.PHONY: generate-controller-gen-installed
5757
generate-controller-gen-installed:
5858
@echo "$(ARROW) Detecting controller-gen..."
59-
@which controller-gen > /dev/null || { echo "run 'go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0'"; exit 1; }
59+
@which controller-gen > /dev/null || { echo "run 'go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.0'"; exit 1; }
6060
@echo "$(ARROW) OK"
6161

6262
.PHONY: generate-ucp-crd

deploy/Chart/crds/radius/radapp.io_recipes.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.15.0
6+
controller-gen.kubebuilder.io/version: v0.16.0
77
name: recipes.radapp.io
88
spec:
99
group: radapp.io
@@ -72,6 +72,8 @@ spec:
7272
type:
7373
description: 'Type is the type of resource to create. eg: ''Applications.Datastores/redisCaches''.'
7474
type: string
75+
required:
76+
- type
7577
type: object
7678
status:
7779
description: RecipeStatus defines the observed state of Recipe
@@ -126,7 +128,6 @@ spec:
126128
the event) or if no container name is specified "spec.containers[2]" (container with
127129
index 2 in this pod). This syntax is chosen only to have some well-defined way of
128130
referencing a part of an object.
129-
TODO: this design is not final and this field is subject to change in the future.
130131
type: string
131132
kind:
132133
description: |-

deploy/Chart/crds/ucpd/ucp.dev_queuemessages.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.15.0
6+
controller-gen.kubebuilder.io/version: v0.16.0
77
name: queuemessages.ucp.dev
88
spec:
99
group: ucp.dev

deploy/Chart/crds/ucpd/ucp.dev_resources.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.15.0
6+
controller-gen.kubebuilder.io/version: v0.16.0
77
name: resources.ucp.dev
88
spec:
99
group: ucp.dev

docs/contributing/contributing-code/contributing-code-prerequisites/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,6 @@ Enter the following commands to install all of the required tools.
182182
cd typespec && npm ci
183183
npm install -g autorest
184184
npm install -g oav
185-
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0
185+
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.0
186186
go install go.uber.org/mock/[email protected]
187187
```

go.mod

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ require (
5858
github.com/opencontainers/go-digest v1.0.0
5959
github.com/opencontainers/image-spec v1.1.0
6060
github.com/projectcontour/contour v1.29.0
61-
github.com/prometheus/client_golang v1.20.2
61+
github.com/prometheus/client_golang v1.20.4
6262
github.com/spaolacci/murmur3 v1.1.0
6363
github.com/spf13/cobra v1.8.1
6464
github.com/spf13/pflag v1.0.5
@@ -82,17 +82,17 @@ require (
8282
go.uber.org/mock v0.4.0
8383
go.uber.org/zap v1.27.0
8484
golang.org/x/sync v0.8.0
85-
golang.org/x/text v0.18.0
85+
golang.org/x/text v0.19.0
8686
gopkg.in/yaml.v3 v3.0.1
8787
helm.sh/helm/v3 v3.15.4
88-
k8s.io/api v0.30.3
89-
k8s.io/apiextensions-apiserver v0.30.3
90-
k8s.io/apimachinery v0.30.3
91-
k8s.io/cli-runtime v0.30.3
92-
k8s.io/client-go v0.30.3
93-
k8s.io/kubectl v0.30.3
88+
k8s.io/api v0.31.1
89+
k8s.io/apiextensions-apiserver v0.31.1
90+
k8s.io/apimachinery v0.31.1
91+
k8s.io/cli-runtime v0.31.1
92+
k8s.io/client-go v0.31.1
93+
k8s.io/kubectl v0.31.1
9494
oras.land/oras-go/v2 v2.5.0
95-
sigs.k8s.io/controller-runtime v0.18.2
95+
sigs.k8s.io/controller-runtime v0.19.0
9696
sigs.k8s.io/secrets-store-csi-driver v1.4.5
9797
)
9898

@@ -122,6 +122,7 @@ require (
122122
github.com/distribution/reference v0.6.0 // indirect
123123
github.com/emirpasic/gods v1.18.1 // indirect
124124
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
125+
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
125126
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
126127
github.com/go-git/go-billy/v5 v5.5.0 // indirect
127128
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
@@ -150,11 +151,12 @@ require (
150151
github.com/tidwall/pretty v1.2.1 // indirect
151152
github.com/tidwall/sjson v1.2.5 // indirect
152153
github.com/ulikunitz/xz v0.5.12 // indirect
154+
github.com/x448/float16 v0.8.4 // indirect
153155
github.com/xanzy/ssh-agent v0.3.3 // indirect
154156
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
155157
go.mongodb.org/mongo-driver v1.15.1 // indirect
156158
go.opencensus.io v0.24.0 // indirect
157-
golang.org/x/tools v0.22.0 // indirect
159+
golang.org/x/tools v0.25.0 // indirect
158160
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
159161
google.golang.org/api v0.185.0 // indirect
160162
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
@@ -248,7 +250,7 @@ require (
248250
github.com/jonboulle/clockwork v0.4.0 // indirect
249251
github.com/josharian/intern v1.0.0 // indirect
250252
github.com/json-iterator/go v1.1.12 // indirect
251-
github.com/klauspost/compress v1.17.9 // indirect
253+
github.com/klauspost/compress v1.17.10 // indirect
252254
github.com/kylelemons/godebug v1.1.0 // indirect
253255
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
254256
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
@@ -282,7 +284,7 @@ require (
282284
github.com/pkg/errors v0.9.1 // indirect
283285
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
284286
github.com/prometheus/client_model v0.6.1 // indirect
285-
github.com/prometheus/common v0.55.0 // indirect
287+
github.com/prometheus/common v0.60.0 // indirect
286288
github.com/prometheus/procfs v0.15.1 // indirect
287289
github.com/rivo/uniseg v0.4.7 // indirect
288290
github.com/rubenv/sql-migrate v1.6.1 // indirect
@@ -314,13 +316,13 @@ require (
314316
go.starlark.net v0.0.0-20240520160348-046347dcd104 // indirect
315317
go.uber.org/multierr v1.11.0 // indirect
316318
golang.org/x/crypto v0.27.0 // indirect
317-
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8
318-
golang.org/x/mod v0.19.0 // indirect
319-
golang.org/x/net v0.27.0 // indirect
320-
golang.org/x/oauth2 v0.21.0 // indirect
321-
golang.org/x/sys v0.25.0 // indirect
319+
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
320+
golang.org/x/mod v0.21.0 // indirect
321+
golang.org/x/net v0.29.0 // indirect
322+
golang.org/x/oauth2 v0.23.0 // indirect
323+
golang.org/x/sys v0.26.0 // indirect
322324
golang.org/x/term v0.24.0 // indirect
323-
golang.org/x/time v0.5.0 // indirect
325+
golang.org/x/time v0.7.0 // indirect
324326
google.golang.org/genproto v0.0.0-20240624140628-dc46fd24d27d // indirect
325327
google.golang.org/genproto/googleapis/api v0.0.0-20240624140628-dc46fd24d27d // indirect
326328
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
@@ -330,11 +332,11 @@ require (
330332
gopkg.in/ini.v1 v1.67.0 // indirect
331333
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
332334
gopkg.in/yaml.v2 v2.4.0 // indirect
333-
k8s.io/apiserver v0.30.3 // indirect
334-
k8s.io/component-base v0.30.3 // indirect
335+
k8s.io/apiserver v0.31.1 // indirect
336+
k8s.io/component-base v0.31.1 // indirect
335337
k8s.io/klog/v2 v2.130.1 // indirect
336-
k8s.io/kube-openapi v0.0.0-20240620174524-b456828f718b // indirect
337-
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
338+
k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 // indirect
339+
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 // indirect
338340
oras.land/oras-go v1.2.5 // indirect
339341
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
340342
sigs.k8s.io/kustomize/api v0.17.2 // indirect

0 commit comments

Comments
 (0)