Skip to content

Commit 127549a

Browse files
Upgrade dependencies; ocp/api*, kube-openapi and indirects (#3707)
* Upgrade dependencies; ocp/api*, kube-openapi and indirects * fix tests to work with latest ocp/api versions Generated-by: Cursor
1 parent 6838e5e commit 127549a

File tree

540 files changed

+40533
-11930
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

540 files changed

+40533
-11930
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,16 @@ e2e-local-deploy: $(KIND) $(HELM) #HELP Deploy OLM for e2e testing (without cert
319319
#SECTION Code Generation
320320

321321
.PHONY: gen-all #HELP Update OLM API, generate code and mocks
322-
gen-all: manifests codegen mockgen
322+
gen-all: manifests openshift-test-crds codegen mockgen
323323

324324
.PHONY: manifests
325325
manifests: vendor #HELP Copy OLM API CRD manifests to deploy/chart/crds
326326
./scripts/copy_crds.sh
327327

328+
.PHONY: openshift-test-crds
329+
openshift-test-crds: #HELP Generate OpenShift CRDs for openshift controller unit tests (ClusterOperator, ClusterVersion)
330+
./scripts/generate_openshift_crds.sh
331+
328332
.PHONY: codegen
329333
codegen: #HELP Generate clients, deepcopy, listers, and informers
330334
./scripts/update_codegen.sh

go.mod

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ require (
1919
github.com/mitchellh/mapstructure v1.5.0
2020
github.com/onsi/ginkgo/v2 v2.27.2
2121
github.com/onsi/gomega v1.38.2
22-
github.com/openshift/api v0.0.0-20221021112143-4226c2167e40
23-
github.com/openshift/client-go v0.0.0-20220525160904-9e1acff93e4a
22+
github.com/openshift/api v0.0.0-20251111193948-50e2ece149d7
23+
github.com/openshift/client-go v0.0.0-20251015124057-db0dee36e235
2424
github.com/operator-framework/api v0.36.0
2525
github.com/operator-framework/operator-registry v1.61.0
2626
github.com/otiai10/copy v1.14.1
@@ -33,7 +33,7 @@ require (
3333
github.com/spf13/pflag v1.0.10
3434
github.com/stretchr/testify v1.11.1
3535
go.podman.io/image/v5 v5.38.0
36-
golang.org/x/net v0.46.0
36+
golang.org/x/net v0.47.0
3737
golang.org/x/sync v0.18.0
3838
golang.org/x/time v0.14.0
3939
google.golang.org/grpc v1.76.0
@@ -47,8 +47,8 @@ require (
4747
k8s.io/component-base v0.34.1
4848
k8s.io/klog v1.0.0
4949
k8s.io/kube-aggregator v0.34.1
50-
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b
51-
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
50+
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912
51+
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4
5252
sigs.k8s.io/controller-runtime v0.22.4
5353
sigs.k8s.io/controller-tools v0.19.0
5454
)
@@ -90,7 +90,6 @@ require (
9090
github.com/fatih/color v1.18.0 // indirect
9191
github.com/felixge/httpsnoop v1.0.4 // indirect
9292
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
93-
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
9493
github.com/go-logr/stdr v1.2.2 // indirect
9594
github.com/go-logr/zapr v1.3.0 // indirect
9695
github.com/go-openapi/jsonpointer v0.21.1 // indirect
@@ -105,7 +104,7 @@ require (
105104
github.com/google/btree v1.1.3 // indirect
106105
github.com/google/cel-go v0.26.1 // indirect
107106
github.com/google/gnostic-models v0.7.0 // indirect
108-
github.com/google/pprof v0.0.0-20251007162407-5df77e3f7d1d // indirect
107+
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect
109108
github.com/google/uuid v1.6.0 // indirect
110109
github.com/gorilla/mux v1.8.1 // indirect
111110
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
@@ -160,18 +159,18 @@ require (
160159
go.uber.org/zap v1.27.0 // indirect
161160
go.yaml.in/yaml/v2 v2.4.3 // indirect
162161
go.yaml.in/yaml/v3 v3.0.4 // indirect
163-
golang.org/x/crypto v0.43.0 // indirect
162+
golang.org/x/crypto v0.44.0 // indirect
164163
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect
165164
golang.org/x/mod v0.29.0 // indirect
166165
golang.org/x/oauth2 v0.32.0 // indirect
167166
golang.org/x/sys v0.38.0 // indirect
168-
golang.org/x/term v0.36.0 // indirect
169-
golang.org/x/text v0.30.0 // indirect
167+
golang.org/x/term v0.37.0 // indirect
168+
golang.org/x/text v0.31.0 // indirect
170169
golang.org/x/tools v0.38.0 // indirect
171170
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
172171
google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect
173172
google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b // indirect
174-
google.golang.org/genproto/googleapis/rpc v0.0.0-20251110190251-83f479183930 // indirect
173+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect
175174
google.golang.org/protobuf v1.36.10 // indirect
176175
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
177176
gopkg.in/inf.v0 v0.9.1 // indirect

go.sum

Lines changed: 22 additions & 502 deletions
Large diffs are not rendered by default.

pkg/controller/operators/openshift/suite_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ const (
4646
var _ = BeforeSuite(func() {
4747
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
4848

49-
base := filepath.Join("..", "..", "..", "..", "vendor", "github.com", "openshift", "api", "config", "v1")
49+
// Note: OpenShift CRDs are loaded from testdata instead of vendor.
50+
// Breaking change: The github.com/openshift/api package (v0.0.0-20251111193948+)
51+
// no longer ships individual CRD YAML files in vendor (they were removed in favor
52+
// of a consolidated manifest). We generate minimal CRDs via scripts/generate_openshift_crds.sh
53+
// and load them from testdata to keep tests self-contained and work in envtest/kind environments.
5054
testEnv = &envtest.Environment{
51-
ErrorIfCRDPathMissing: true,
5255
CRDs: []*apiextensionsv1.CustomResourceDefinition{
5356
crds.ClusterServiceVersion(),
5457
},
5558
CRDDirectoryPaths: []string{
56-
filepath.Join(base, "0000_00_cluster-version-operator_01_clusteroperator.crd.yaml"),
57-
filepath.Join(base, "0000_00_cluster-version-operator_01_clusterversion.crd.yaml"),
59+
filepath.Join("testdata", "crds"),
5860
},
5961
}
6062

@@ -73,6 +75,9 @@ var _ = BeforeSuite(func() {
7375
})
7476
Expect(err).ToNot(HaveOccurred())
7577

78+
// Register OpenShift types with the scheme
79+
Expect(configv1.AddToScheme(mgr.GetScheme())).To(Succeed())
80+
7681
k8sClient = mgr.GetClient()
7782

7883
syncCh = make(chan error)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# OpenShift Test CRDs
2+
3+
## Purpose
4+
5+
These CRD YAML files are used **only for unit testing** the OpenShift controller (`pkg/controller/operators/openshift/`).
6+
7+
## Why These Files Exist
8+
9+
The OpenShift controller reports OLM status by managing `ClusterOperator` and `ClusterVersion` resources on OpenShift clusters. To test this controller in envtest environments (like CI or local development), we need the CRD definitions.
10+
11+
**Problem**: The `github.com/openshift/api` package (v0.0.0-20251111193948+) no longer ships individual CRD YAML files in vendor. They were removed in favor of a consolidated metadata-only manifest (`zz_generated.featuregated-crd-manifests.yaml`).
12+
13+
**Solution**: Generate minimal CRDs with the schema our tests need. These CRDs are NOT used in production - OpenShift clusters have the actual CRDs installed by the platform.
14+
15+
## How They're Generated
16+
17+
Run: `make openshift-test-crds` or `make gen-all`
18+
19+
This executes `scripts/generate_openshift_crds.sh` which creates:
20+
- `clusteroperators.config.openshift.io.yaml` - Minimal ClusterOperator CRD
21+
- `clusterversions.config.openshift.io.yaml` - Minimal ClusterVersion CRD
22+
23+
## How They're Used
24+
25+
In `suite_test.go`:
26+
27+
```go
28+
testEnv = &envtest.Environment{
29+
CRDs: []*apiextensionsv1.CustomResourceDefinition{
30+
crds.ClusterServiceVersion(),
31+
},
32+
CRDDirectoryPaths: []string{
33+
filepath.Join("testdata", "crds"), // <- Loads these files
34+
},
35+
}
36+
```
37+
38+
## DO NOT Edit Manually
39+
40+
These files are generated. Changes should be made in `scripts/generate_openshift_crds.sh`.
41+
42+
Run `make verify-manifests` to check if these files are up-to-date.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: clusteroperators.config.openshift.io
5+
spec:
6+
group: config.openshift.io
7+
names:
8+
kind: ClusterOperator
9+
listKind: ClusterOperatorList
10+
plural: clusteroperators
11+
shortNames:
12+
- co
13+
singular: clusteroperator
14+
scope: Cluster
15+
versions:
16+
- name: v1
17+
schema:
18+
openAPIV3Schema:
19+
description: ClusterOperator is the Custom Resource object which holds the current state of an operator
20+
properties:
21+
spec:
22+
description: spec holds configuration that could apply to any operator
23+
type: object
24+
x-kubernetes-preserve-unknown-fields: true
25+
status:
26+
description: status holds the information about the state of an operator
27+
properties:
28+
conditions:
29+
items:
30+
properties:
31+
lastTransitionTime:
32+
format: date-time
33+
type: string
34+
message:
35+
type: string
36+
reason:
37+
type: string
38+
status:
39+
type: string
40+
type:
41+
type: string
42+
required:
43+
- status
44+
- type
45+
type: object
46+
type: array
47+
relatedObjects:
48+
items:
49+
properties:
50+
group:
51+
type: string
52+
name:
53+
type: string
54+
namespace:
55+
type: string
56+
resource:
57+
type: string
58+
required:
59+
- group
60+
- name
61+
- resource
62+
type: object
63+
type: array
64+
versions:
65+
items:
66+
properties:
67+
name:
68+
type: string
69+
version:
70+
type: string
71+
required:
72+
- name
73+
- version
74+
type: object
75+
type: array
76+
type: object
77+
type: object
78+
served: true
79+
storage: true
80+
subresources:
81+
status: {}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: clusterversions.config.openshift.io
5+
spec:
6+
group: config.openshift.io
7+
names:
8+
kind: ClusterVersion
9+
listKind: ClusterVersionList
10+
plural: clusterversions
11+
singular: clusterversion
12+
scope: Cluster
13+
versions:
14+
- name: v1
15+
schema:
16+
openAPIV3Schema:
17+
description: ClusterVersion is the configuration for the ClusterVersionOperator
18+
properties:
19+
spec:
20+
description: spec is the desired state
21+
type: object
22+
x-kubernetes-preserve-unknown-fields: true
23+
status:
24+
description: status contains information about the available updates
25+
type: object
26+
x-kubernetes-preserve-unknown-fields: true
27+
type: object
28+
served: true
29+
storage: true
30+
subresources:
31+
status: {}

pkg/package-server/client/openapi/zz_generated.openapi.go

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)