Skip to content

Commit 3828395

Browse files
Merge pull request openshift#856 from perdasilva/perdasilva/manual-sync-0906
NO-ISSUE: Manually Synchronize From Upstream Repositories (Sept. 6)
2 parents 4dee899 + f572743 commit 3828395

File tree

4 files changed

+30
-27
lines changed

4 files changed

+30
-27
lines changed

staging/operator-lifecycle-manager/go.mod

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,6 @@ require (
178178
sigs.k8s.io/yaml v1.4.0 // indirect
179179
)
180180

181-
// pin to v1.18.0 until k8s.io/component-base updates its prometheus dependency
182-
// issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/3283
183-
//replace (
184-
// github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.18.0
185-
// github.com/prometheus/common => github.com/prometheus/common v0.47.0
186-
//)
187-
188181
// v1.64.0 breaks our e2e tests as it affects the grpc connection state transition
189182
// issue: https://github.com/operator-framework/operator-lifecycle-manager/issues/3284
190183
replace google.golang.org/grpc => google.golang.org/grpc v1.63.2

staging/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import (
4545
"k8s.io/client-go/metadata/metadatalister"
4646
"k8s.io/client-go/tools/cache"
4747
"k8s.io/client-go/tools/clientcmd"
48+
"k8s.io/client-go/tools/pager"
4849
"k8s.io/client-go/tools/record"
4950
"k8s.io/client-go/util/retry"
5051
"k8s.io/client-go/util/workqueue"
@@ -2230,15 +2231,15 @@ func validateExistingCRs(dynamicClient dynamic.Interface, gr schema.GroupResourc
22302231
return fmt.Errorf("error creating validator for schema version %s: %s", version, err)
22312232
}
22322233
gvr := schema.GroupVersionResource{Group: gr.Group, Version: version, Resource: gr.Resource}
2233-
crList, err := dynamicClient.Resource(gvr).List(context.TODO(), metav1.ListOptions{})
2234-
if err != nil {
2235-
return fmt.Errorf("error listing resources in GroupVersionResource %#v: %s", gvr, err)
2236-
}
2237-
2238-
// validate each CR against this version schema
2239-
for _, cr := range crList.Items {
2240-
err = validation.ValidateCustomResource(field.NewPath(""), cr.UnstructuredContent(), validator).ToAggregate()
2234+
pager := pager.New(pager.SimplePageFunc(func(opts metav1.ListOptions) (runtime.Object, error) {
2235+
return dynamicClient.Resource(gvr).List(context.TODO(), opts)
2236+
}))
2237+
validationFn := func(obj runtime.Object) error {
2238+
err = validation.ValidateCustomResource(field.NewPath(""), obj, validator).ToAggregate()
22412239
if err != nil {
2240+
// lister will only provide unstructured objects as runtime.Object, so this should never fail to convert
2241+
// if it does, it's a programming error
2242+
cr := obj.(*unstructured.Unstructured)
22422243
var namespacedName string
22432244
if cr.GetNamespace() == "" {
22442245
namespacedName = cr.GetName()
@@ -2247,6 +2248,11 @@ func validateExistingCRs(dynamicClient dynamic.Interface, gr schema.GroupResourc
22472248
}
22482249
return validationError{fmt.Errorf("error validating %s %q: updated validation is too restrictive: %v", cr.GroupVersionKind(), namespacedName, err)}
22492250
}
2251+
return nil
2252+
}
2253+
err = pager.EachListItem(context.Background(), metav1.ListOptions{}, validationFn)
2254+
if err != nil {
2255+
return err
22502256
}
22512257
}
22522258
return nil

staging/operator-lifecycle-manager/test/e2e/installplan_e2e_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ var _ = Describe("Install Plan", func() {
14351435
// excluded: new CRD, same version, same schema - won't trigger a CRD update
14361436

14371437
tableEntries := []TableEntry{
1438-
Entry("[FLAKE] upgrade CRD with deprecated version", schemaPayload{
1438+
Entry("upgrade CRD with deprecated version", schemaPayload{
14391439
name: "upgrade CRD with deprecated version",
14401440
expectedPhase: operatorsv1alpha1.InstallPlanPhaseComplete,
14411441
oldCRD: func() *apiextensionsv1.CustomResourceDefinition {
@@ -1471,7 +1471,7 @@ var _ = Describe("Install Plan", func() {
14711471
},
14721472
{
14731473
Name: "v1alpha1",
1474-
Served: false,
1474+
Served: true,
14751475
Storage: false,
14761476
Schema: &apiextensionsv1.CustomResourceValidation{
14771477
OpenAPIV3Schema: &apiextensionsv1.JSONSchemaProps{
@@ -1631,7 +1631,6 @@ var _ = Describe("Install Plan", func() {
16311631
fetchedInstallPlan, err = fetchInstallPlan(GinkgoT(), crc, installPlanName, generatedNamespace.GetName(), buildInstallPlanPhaseCheckFunc(operatorsv1alpha1.InstallPlanPhaseComplete, operatorsv1alpha1.InstallPlanPhaseFailed))
16321632
require.NoError(GinkgoT(), err)
16331633
GinkgoT().Logf("Install plan %s fetched with status %s", fetchedInstallPlan.GetName(), fetchedInstallPlan.Status.Phase)
1634-
16351634
require.Equal(GinkgoT(), tt.expectedPhase, fetchedInstallPlan.Status.Phase)
16361635

16371636
By(`Ensure correct in-cluster resource(s)`)
@@ -1688,7 +1687,6 @@ var _ = Describe("Install Plan", func() {
16881687
validateCRDVersions(GinkgoT(), c, tt.oldCRD.GetName(), expectedVersions)
16891688
GinkgoT().Logf("All expected resources resolved %s", fetchedCSV.Status.Phase)
16901689
}, tableEntries)
1691-
16921690
})
16931691

16941692
Describe("update catalog for subscription", func() {

vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go

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

0 commit comments

Comments
 (0)