Skip to content

Commit 1f2472f

Browse files
authored
go.*,pkg,vendor: Bump controller-runtime to v0.10.1 (#2368)
* go.*,vendor: Bump controller-runtime to v0.10.1 Signed-off-by: timflannagan <[email protected]> * pkg/controller: Update the CRD testEnv field to use the CRD type Update the CRD field to use the apiextensionsv1.CustomResourceDefinition type instead of the client.Object interface. It looks like this change was introduced during the sweep to k8s 1.22 bump: kubernetes-sigs/controller-runtime@b5eeb71 Signed-off-by: timflannagan <[email protected]> * go.*,vendor: Bump the o/api dependency for v1 CRDs Update the o/api dependency and pull in a new version that contains v1 CRDs. Newer controller-runtime versions don't support v1beta1 CRDs Signed-off-by: timflannagan <[email protected]> * pkg/controller: Update openshift-related tests after bumping o/api dependency Signed-off-by: timflannagan <[email protected]> * pkg,test: Update test fixtures that are instantiated with status fields Update the adoption controller test subscription fixture and remove the status sub-resource block that's shared between tests. When an object is created, it's status sub-resource is now removed, so changes are centered around setting this resource before firing off any Update calls used throughout this test package. Update any test/e2e APIs that also follow a similiar pattern. Signed-off-by: timflannagan <[email protected]>
1 parent 4f5c16c commit 1f2472f

File tree

190 files changed

+11426
-7533
lines changed

Some content is hidden

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

190 files changed

+11426
-7533
lines changed

go.mod

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
github.com/mitchellh/hashstructure v1.0.0
2323
github.com/mitchellh/mapstructure v1.1.2
2424
github.com/onsi/ginkgo v1.16.4
25-
github.com/onsi/gomega v1.13.0
25+
github.com/onsi/gomega v1.15.0
2626
github.com/openshift/api v0.0.0-20200331152225-585af27e34fd
2727
github.com/openshift/client-go v0.0.0-20200326155132-2a6cd50aedd0
2828
github.com/operator-framework/api v0.10.3
@@ -41,28 +41,29 @@ require (
4141
google.golang.org/grpc v1.38.0
4242
gopkg.in/yaml.v2 v2.4.0
4343
helm.sh/helm/v3 v3.6.1
44-
k8s.io/api v0.22.0
45-
k8s.io/apiextensions-apiserver v0.22.0
46-
k8s.io/apimachinery v0.22.0
47-
k8s.io/apiserver v0.22.0
48-
k8s.io/client-go v0.22.0
49-
k8s.io/code-generator v0.22.0
50-
k8s.io/component-base v0.22.0
44+
k8s.io/api v0.22.2
45+
k8s.io/apiextensions-apiserver v0.22.2
46+
k8s.io/apimachinery v0.22.2
47+
k8s.io/apiserver v0.22.2
48+
k8s.io/client-go v0.22.2
49+
k8s.io/code-generator v0.22.2
50+
k8s.io/component-base v0.22.2
5151
k8s.io/klog v1.0.0
5252
k8s.io/kube-aggregator v0.22.0
5353
k8s.io/kube-openapi v0.0.0-20210527164424-3c818078ee3d
54-
k8s.io/utils v0.0.0-20210707171843-4b05e18ac7d9
54+
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a
5555
rsc.io/letsencrypt v0.0.3 // indirect
56-
sigs.k8s.io/controller-runtime v0.9.2
56+
sigs.k8s.io/controller-runtime v0.10.0
5757
sigs.k8s.io/controller-tools v0.6.1
5858
sigs.k8s.io/kind v0.11.1
5959
)
6060

6161
replace (
6262
// controller runtime
63-
github.com/openshift/api => github.com/openshift/api v0.0.0-20200331152225-585af27e34fd // release-4.5
63+
github.com/openshift/api => github.com/openshift/api v0.0.0-20211014063134-be2a7fb8aa44
6464
github.com/openshift/client-go => github.com/openshift/client-go v0.0.0-20200326155132-2a6cd50aedd0 // release-4.5
65+
6566
// Patch for a race condition involving metadata-only
6667
// informers until it can be resolved upstream:
67-
sigs.k8s.io/controller-runtime v0.9.2 => github.com/benluddy/controller-runtime v0.9.3-0.20210720171926-9bcb99bd9bd3
68+
sigs.k8s.io/controller-runtime v0.10.0 => github.com/timflannagan/controller-runtime v0.10.1-0.20211210161403-6756a4203e70
6869
)

go.sum

Lines changed: 47 additions & 20 deletions
Large diffs are not rendered by default.

pkg/controller/operators/adoption_controller_test.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ var _ = Describe("Adoption Controller", func() {
8080
Spec: &operatorsv1alpha1.SubscriptionSpec{
8181
Package: "poultry",
8282
},
83-
Status: operatorsv1alpha1.SubscriptionStatus{
84-
InstalledCSV: "turkey",
85-
LastUpdated: metav1.Now(),
86-
},
8783
}
8884
sub.SetNamespace(ns.GetName())
8985
sub.SetName(sub.Spec.Package)
@@ -94,13 +90,14 @@ var _ = Describe("Adoption Controller", func() {
9490
created = append(created, sub)
9591

9692
// Set the Subscription's status separately
97-
status := sub.DeepCopy().Status
9893
Eventually(func() error {
9994
if err := k8sClient.Get(ctx, testobj.NamespacedName(sub), sub); err != nil {
10095
return err
10196
}
102-
sub.Status = status
103-
97+
sub.Status = operatorsv1alpha1.SubscriptionStatus{
98+
InstalledCSV: "turkey",
99+
LastUpdated: metav1.Now(),
100+
}
104101
return k8sClient.Status().Update(ctx, sub)
105102
}, timeout, interval).Should(Succeed())
106103

pkg/controller/operators/openshift/clusteroperator_controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ var _ = Describe("ClusterOperator controller", func() {
6464
}).Should(Succeed())
6565

6666
cv.Status = configv1.ClusterVersionStatus{
67-
Desired: configv1.Update{
67+
Desired: configv1.Release{
6868
Version: clusterVersion,
6969
},
7070
}
@@ -161,7 +161,7 @@ var _ = Describe("ClusterOperator controller", func() {
161161
}))
162162

163163
cv.Status = configv1.ClusterVersionStatus{
164-
Desired: configv1.Update{
164+
Desired: configv1.Release{
165165
Version: clusterVersion,
166166
},
167167
}

pkg/controller/operators/openshift/helpers_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func TestIncompatibleOperators(t *testing.T) {
232232
Name: "version",
233233
},
234234
Status: configv1.ClusterVersionStatus{
235-
Desired: configv1.Update{
235+
Desired: configv1.Release{
236236
Version: "1.0.0",
237237
},
238238
},
@@ -266,7 +266,7 @@ func TestIncompatibleOperators(t *testing.T) {
266266
Name: "version",
267267
},
268268
Status: configv1.ClusterVersionStatus{
269-
Desired: configv1.Update{
269+
Desired: configv1.Release{
270270
Version: "1.0.0",
271271
},
272272
},
@@ -336,7 +336,7 @@ func TestIncompatibleOperators(t *testing.T) {
336336
Name: "version",
337337
},
338338
Status: configv1.ClusterVersionStatus{
339-
Desired: configv1.Update{
339+
Desired: configv1.Release{
340340
Version: "1.0.0",
341341
},
342342
},
@@ -381,7 +381,7 @@ func TestIncompatibleOperators(t *testing.T) {
381381
Name: "version",
382382
},
383383
Status: configv1.ClusterVersionStatus{
384-
Desired: configv1.Update{
384+
Desired: configv1.Release{
385385
Version: "1.0.0",
386386
},
387387
},
@@ -429,7 +429,7 @@ func TestIncompatibleOperators(t *testing.T) {
429429
Name: "version",
430430
},
431431
Status: configv1.ClusterVersionStatus{
432-
Desired: configv1.Update{
432+
Desired: configv1.Release{
433433
Version: "", // This should result in an transient error
434434
},
435435
},
@@ -458,7 +458,7 @@ func TestIncompatibleOperators(t *testing.T) {
458458
Name: "version",
459459
},
460460
Status: configv1.ClusterVersionStatus{
461-
Desired: configv1.Update{
461+
Desired: configv1.Release{
462462
Version: "1.0.1", // Next Y-stream is 1.1.0, NOT 1.1.1
463463
},
464464
},
@@ -482,7 +482,7 @@ func TestIncompatibleOperators(t *testing.T) {
482482
Name: "version",
483483
},
484484
Status: configv1.ClusterVersionStatus{
485-
Desired: configv1.Update{
485+
Desired: configv1.Release{
486486
Version: "1.1.0-pre", // Next Y-stream is 1.1.0, NOT 1.2.0
487487
},
488488
},

pkg/controller/operators/openshift/suite_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
. "github.com/onsi/gomega"
1111
configv1 "github.com/openshift/api/config/v1"
1212
"github.com/operator-framework/api/crds"
13+
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
1314
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1415
"k8s.io/client-go/rest"
1516
ctrl "sigs.k8s.io/controller-runtime"
@@ -54,8 +55,8 @@ var _ = BeforeSuite(func() {
5455
base := filepath.Join("..", "..", "..", "..", "vendor", "github.com", "openshift", "api", "config", "v1")
5556
testEnv = &envtest.Environment{
5657
ErrorIfCRDPathMissing: true,
57-
CRDs: []client.Object{
58-
crds.ClusterServiceVersion(),
58+
CRDs: []apiextensionsv1.CustomResourceDefinition{
59+
*crds.ClusterServiceVersion(),
5960
},
6061
CRDDirectoryPaths: []string{
6162
filepath.Join(base, "0000_00_cluster-version-operator_01_clusteroperator.crd.yaml"),

pkg/controller/operators/suite_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ var _ = BeforeSuite(func() {
8888
useExisting := false
8989
testEnv = &envtest.Environment{
9090
UseExistingCluster: &useExisting,
91-
CRDs: []client.Object{
92-
crds.CatalogSource(),
93-
crds.ClusterServiceVersion(),
94-
crds.InstallPlan(),
95-
crds.Subscription(),
96-
crds.OperatorGroup(),
97-
crds.Operator(),
98-
crds.OperatorCondition(),
91+
CRDs: []apiextensionsv1.CustomResourceDefinition{
92+
*crds.CatalogSource(),
93+
*crds.ClusterServiceVersion(),
94+
*crds.InstallPlan(),
95+
*crds.Subscription(),
96+
*crds.OperatorGroup(),
97+
*crds.Operator(),
98+
*crds.OperatorCondition(),
9999
},
100100
}
101101

test/e2e/deprecated_e2e_test.go

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ var _ = Describe("Not found APIs", func() {
3030
// each entry is an installplan with a deprecated resource
3131
type payload struct {
3232
name string
33-
ip *operatorsv1alpha1.InstallPlan
33+
IP *operatorsv1alpha1.InstallPlan
3434
errMessage string
3535
}
3636

3737
var tableEntries []table.TableEntry
3838
tableEntries = []table.TableEntry{
3939
table.Entry("contains an entry with a missing API not found on cluster ", payload{
4040
name: "installplan contains a missing API",
41-
ip: &operatorsv1alpha1.InstallPlan{
41+
IP: &operatorsv1alpha1.InstallPlan{
4242
ObjectMeta: metav1.ObjectMeta{
4343
Namespace: *namespace, // this is necessary due to ginkgo table semantics, see https://github.com/onsi/ginkgo/issues/378
4444
Name: "test-plan-api",
@@ -48,41 +48,43 @@ var _ = Describe("Not found APIs", func() {
4848
Approved: true,
4949
ClusterServiceVersionNames: []string{},
5050
},
51-
Status: operatorsv1alpha1.InstallPlanStatus{
52-
Phase: operatorsv1alpha1.InstallPlanPhaseInstalling,
53-
CatalogSources: []string{},
54-
Plan: []*operatorsv1alpha1.Step{
55-
{
56-
Resolving: "test-csv",
57-
Status: operatorsv1alpha1.StepStatusUnknown,
58-
Resource: operatorsv1alpha1.StepResource{
59-
Name: "my.thing",
60-
Group: "verticalpodautoscalers.autoscaling.k8s.io",
61-
Version: "v1",
62-
Kind: "VerticalPodAutoscaler",
63-
Manifest: missingAPI,
64-
},
65-
},
66-
},
67-
},
6851
},
6952
errMessage: "api-server resource not found installing VerticalPodAutoscaler my.thing: GroupVersionKind " +
7053
"verticalpodautoscalers.autoscaling.k8s.io/v1, Kind=VerticalPodAutoscaler not found on the cluster",
7154
}),
7255
}
7356

7457
table.DescribeTable("the ip enters a failed state with a helpful error message", func(tt payload) {
75-
Expect(ctx.Ctx().Client().Create(context.Background(), tt.ip)).To(Succeed())
76-
Expect(ctx.Ctx().Client().Status().Update(context.Background(), tt.ip)).To(Succeed())
58+
Expect(ctx.Ctx().Client().Create(context.Background(), tt.IP)).To(Succeed())
59+
60+
tt.IP.Status = operatorsv1alpha1.InstallPlanStatus{
61+
Phase: operatorsv1alpha1.InstallPlanPhaseInstalling,
62+
CatalogSources: []string{},
63+
Plan: []*operatorsv1alpha1.Step{
64+
{
65+
Resolving: "test-csv",
66+
Status: operatorsv1alpha1.StepStatusUnknown,
67+
Resource: operatorsv1alpha1.StepResource{
68+
Name: "my.thing",
69+
Group: "verticalpodautoscalers.autoscaling.k8s.io",
70+
Version: "v1",
71+
Kind: "VerticalPodAutoscaler",
72+
Manifest: missingAPI,
73+
},
74+
},
75+
},
76+
}
77+
78+
Expect(ctx.Ctx().Client().Status().Update(context.Background(), tt.IP)).To(Succeed(), "failed to update the resource")
7779

7880
// The IP sits in the Installing phase with the GVK missing error
7981
Eventually(func() (*operatorsv1alpha1.InstallPlan, error) {
80-
return tt.ip, ctx.Ctx().Client().Get(context.Background(), client.ObjectKeyFromObject(tt.ip), tt.ip)
82+
return tt.IP, ctx.Ctx().Client().Get(context.Background(), client.ObjectKeyFromObject(tt.IP), tt.IP)
8183
}).Should(And(HavePhase(operatorsv1alpha1.InstallPlanPhaseInstalling)), HaveMessage(tt.errMessage))
8284

8385
// Eventually the IP fails with the GVK missing error, after installplan retries, which is by default 1 minute.
8486
Eventually(func() (*operatorsv1alpha1.InstallPlan, error) {
85-
return tt.ip, ctx.Ctx().Client().Get(context.Background(), client.ObjectKeyFromObject(tt.ip), tt.ip)
87+
return tt.IP, ctx.Ctx().Client().Get(context.Background(), client.ObjectKeyFromObject(tt.IP), tt.IP)
8688
}, 2*time.Minute).Should(And(HavePhase(operatorsv1alpha1.InstallPlanPhaseFailed)), HaveMessage(tt.errMessage))
8789
}, tableEntries...)
8890
})

0 commit comments

Comments
 (0)