Skip to content

Commit 08fb8fd

Browse files
Merge pull request #16541 from deads2k/api-09-field-selector3.6
Automatic merge from submit-queue hack in field selectors for 3.6 This doesn't make any of the structural fixes to make field selectors more consistent and reliable across APIs, but it should enable compatible field selection in the 3.6 groupified APIs. @bparees @gabemontero per request
2 parents 1f2181c + ea49279 commit 08fb8fd

File tree

10 files changed

+121
-6
lines changed

10 files changed

+121
-6
lines changed

pkg/authorization/apis/authorization/v1/conversion.go

+30
Original file line numberDiff line numberDiff line change
@@ -399,36 +399,66 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
399399
); err != nil {
400400
return err
401401
}
402+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "ClusterPolicy",
403+
oapi.GetFieldLabelConversionFunc(newer.ClusterPolicyToSelectableFields(&newer.ClusterPolicy{}), nil),
404+
); err != nil {
405+
return err
406+
}
402407

403408
if err := scheme.AddFieldLabelConversionFunc("v1", "ClusterPolicyBinding",
404409
oapi.GetFieldLabelConversionFunc(newer.ClusterPolicyBindingToSelectableFields(&newer.ClusterPolicyBinding{}), nil),
405410
); err != nil {
406411
return err
407412
}
413+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "ClusterPolicyBinding",
414+
oapi.GetFieldLabelConversionFunc(newer.ClusterPolicyBindingToSelectableFields(&newer.ClusterPolicyBinding{}), nil),
415+
); err != nil {
416+
return err
417+
}
408418

409419
if err := scheme.AddFieldLabelConversionFunc("v1", "Policy",
410420
oapi.GetFieldLabelConversionFunc(newer.PolicyToSelectableFields(&newer.Policy{}), nil),
411421
); err != nil {
412422
return err
413423
}
424+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "Policy",
425+
oapi.GetFieldLabelConversionFunc(newer.PolicyToSelectableFields(&newer.Policy{}), nil),
426+
); err != nil {
427+
return err
428+
}
414429

415430
if err := scheme.AddFieldLabelConversionFunc("v1", "PolicyBinding",
416431
oapi.GetFieldLabelConversionFunc(newer.PolicyBindingToSelectableFields(&newer.PolicyBinding{}), nil),
417432
); err != nil {
418433
return err
419434
}
435+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "PolicyBinding",
436+
oapi.GetFieldLabelConversionFunc(newer.PolicyBindingToSelectableFields(&newer.PolicyBinding{}), nil),
437+
); err != nil {
438+
return err
439+
}
420440

421441
if err := scheme.AddFieldLabelConversionFunc("v1", "Role",
422442
oapi.GetFieldLabelConversionFunc(newer.RoleToSelectableFields(&newer.Role{}), nil),
423443
); err != nil {
424444
return err
425445
}
446+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "Role",
447+
oapi.GetFieldLabelConversionFunc(newer.RoleToSelectableFields(&newer.Role{}), nil),
448+
); err != nil {
449+
return err
450+
}
426451

427452
if err := scheme.AddFieldLabelConversionFunc("v1", "RoleBinding",
428453
oapi.GetFieldLabelConversionFunc(newer.RoleBindingToSelectableFields(&newer.RoleBinding{}), nil),
429454
); err != nil {
430455
return err
431456
}
457+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "RoleBinding",
458+
oapi.GetFieldLabelConversionFunc(newer.RoleBindingToSelectableFields(&newer.RoleBinding{}), nil),
459+
); err != nil {
460+
return err
461+
}
432462
return nil
433463
}
434464

pkg/build/apis/build/v1/conversion.go

+10
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,21 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
179179
); err != nil {
180180
return err
181181
}
182+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "Build",
183+
oapi.GetFieldLabelConversionFunc(newer.BuildToSelectableFields(&newer.Build{}), nil),
184+
); err != nil {
185+
return err
186+
}
182187

183188
if err := scheme.AddFieldLabelConversionFunc("v1", "BuildConfig",
184189
oapi.GetFieldLabelConversionFunc(newer.BuildConfigToSelectableFields(&newer.BuildConfig{}), map[string]string{"name": "metadata.name"}),
185190
); err != nil {
186191
return err
187192
}
193+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "BuildConfig",
194+
oapi.GetFieldLabelConversionFunc(newer.BuildConfigToSelectableFields(&newer.BuildConfig{}), nil),
195+
); err != nil {
196+
return err
197+
}
188198
return nil
189199
}

pkg/deploy/apis/apps/v1/conversion.go

+5
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,10 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
130130
); err != nil {
131131
return err
132132
}
133+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "DeploymentConfig",
134+
oapi.GetFieldLabelConversionFunc(newer.DeploymentConfigToSelectableFields(&newer.DeploymentConfig{}), nil),
135+
); err != nil {
136+
return err
137+
}
133138
return nil
134139
}

pkg/image/apis/image/v1/conversion.go

+10
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,21 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
283283
); err != nil {
284284
return err
285285
}
286+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "Image",
287+
oapi.GetFieldLabelConversionFunc(newer.ImageToSelectableFields(&newer.Image{}), nil),
288+
); err != nil {
289+
return err
290+
}
286291

287292
if err := scheme.AddFieldLabelConversionFunc("v1", "ImageStream",
288293
oapi.GetFieldLabelConversionFunc(newer.ImageStreamToSelectableFields(&newer.ImageStream{}), map[string]string{"name": "metadata.name"}),
289294
); err != nil {
290295
return err
291296
}
297+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "ImageStream",
298+
oapi.GetFieldLabelConversionFunc(newer.ImageStreamToSelectableFields(&newer.ImageStream{}), nil),
299+
); err != nil {
300+
return err
301+
}
292302
return nil
293303
}

pkg/oauth/apis/oauth/v1/conversion.go

+20
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,43 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
1313
); err != nil {
1414
return err
1515
}
16+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "OAuthAccessToken",
17+
oapi.GetFieldLabelConversionFunc(oauthapi.OAuthAccessTokenToSelectableFields(&oauthapi.OAuthAccessToken{}), nil),
18+
); err != nil {
19+
return err
20+
}
1621

1722
if err := scheme.AddFieldLabelConversionFunc("v1", "OAuthAuthorizeToken",
1823
oapi.GetFieldLabelConversionFunc(oauthapi.OAuthAuthorizeTokenToSelectableFields(&oauthapi.OAuthAuthorizeToken{}), nil),
1924
); err != nil {
2025
return err
2126
}
27+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "OAuthAuthorizeToken",
28+
oapi.GetFieldLabelConversionFunc(oauthapi.OAuthAuthorizeTokenToSelectableFields(&oauthapi.OAuthAuthorizeToken{}), nil),
29+
); err != nil {
30+
return err
31+
}
2232

2333
if err := scheme.AddFieldLabelConversionFunc("v1", "OAuthClient",
2434
oapi.GetFieldLabelConversionFunc(oauthapi.OAuthClientToSelectableFields(&oauthapi.OAuthClient{}), nil),
2535
); err != nil {
2636
return err
2737
}
38+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "OAuthClient",
39+
oapi.GetFieldLabelConversionFunc(oauthapi.OAuthClientToSelectableFields(&oauthapi.OAuthClient{}), nil),
40+
); err != nil {
41+
return err
42+
}
2843

2944
if err := scheme.AddFieldLabelConversionFunc("v1", "OAuthClientAuthorization",
3045
oapi.GetFieldLabelConversionFunc(oauthapi.OAuthClientAuthorizationToSelectableFields(&oauthapi.OAuthClientAuthorization{}), nil),
3146
); err != nil {
3247
return err
3348
}
49+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "OAuthClientAuthorization",
50+
oapi.GetFieldLabelConversionFunc(oauthapi.OAuthClientAuthorizationToSelectableFields(&oauthapi.OAuthClientAuthorization{}), nil),
51+
); err != nil {
52+
return err
53+
}
3454
return nil
3555
}

pkg/project/apis/project/v1/conversion.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ import (
99
)
1010

1111
func addConversionFuncs(scheme *runtime.Scheme) error {
12-
return scheme.AddFieldLabelConversionFunc("v1", "Project",
12+
if err := scheme.AddFieldLabelConversionFunc("v1", "Project",
13+
oapi.GetFieldLabelConversionFunc(namespace.NamespaceToSelectableFields(&kapi.Namespace{}), nil),
14+
); err != nil {
15+
return err
16+
}
17+
return scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "Project",
1318
oapi.GetFieldLabelConversionFunc(namespace.NamespaceToSelectableFields(&kapi.Namespace{}), nil),
1419
)
1520
}

pkg/route/apis/route/v1/conversion.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ import (
88
)
99

1010
func addConversionFuncs(scheme *runtime.Scheme) error {
11-
return scheme.AddFieldLabelConversionFunc("v1", "Route",
11+
if err := scheme.AddFieldLabelConversionFunc("v1", "Route",
12+
oapi.GetFieldLabelConversionFunc(routeapi.RouteToSelectableFields(&routeapi.Route{}), nil),
13+
); err != nil {
14+
return err
15+
}
16+
return scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "Route",
1217
oapi.GetFieldLabelConversionFunc(routeapi.RouteToSelectableFields(&routeapi.Route{}), nil),
1318
)
1419
}

pkg/template/apis/template/v1/conversion.go

+15
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,33 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
1515
); err != nil {
1616
return err
1717
}
18+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "Template",
19+
oapi.GetFieldLabelConversionFunc(templateapi.TemplateToSelectableFields(&templateapi.Template{}), nil),
20+
); err != nil {
21+
return err
22+
}
1823

1924
if err := scheme.AddFieldLabelConversionFunc("v1", "TemplateInstance",
2025
oapi.GetFieldLabelConversionFunc(templateapi.TemplateInstanceToSelectableFields(&templateapi.TemplateInstance{}), nil),
2126
); err != nil {
2227
return err
2328
}
29+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "TemplateInstance",
30+
oapi.GetFieldLabelConversionFunc(templateapi.TemplateInstanceToSelectableFields(&templateapi.TemplateInstance{}), nil),
31+
); err != nil {
32+
return err
33+
}
2434

2535
if err := scheme.AddFieldLabelConversionFunc("v1", "BrokerTemplateInstance",
2636
oapi.GetFieldLabelConversionFunc(templateapi.BrokerTemplateInstanceToSelectableFields(&templateapi.BrokerTemplateInstance{}), nil),
2737
); err != nil {
2838
return err
2939
}
40+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "BrokerTemplateInstance",
41+
oapi.GetFieldLabelConversionFunc(templateapi.BrokerTemplateInstanceToSelectableFields(&templateapi.BrokerTemplateInstance{}), nil),
42+
); err != nil {
43+
return err
44+
}
3045

3146
return nil
3247

pkg/user/apis/user/v1/conversion.go

+15
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,32 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
1313
); err != nil {
1414
return err
1515
}
16+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "Group",
17+
oapi.GetFieldLabelConversionFunc(userapi.GroupToSelectableFields(&userapi.Group{}), nil),
18+
); err != nil {
19+
return err
20+
}
1621

1722
if err := scheme.AddFieldLabelConversionFunc("v1", "Identity",
1823
oapi.GetFieldLabelConversionFunc(userapi.IdentityToSelectableFields(&userapi.Identity{}), nil),
1924
); err != nil {
2025
return err
2126
}
27+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "Identity",
28+
oapi.GetFieldLabelConversionFunc(userapi.IdentityToSelectableFields(&userapi.Identity{}), nil),
29+
); err != nil {
30+
return err
31+
}
2232

2333
if err := scheme.AddFieldLabelConversionFunc("v1", "User",
2434
oapi.GetFieldLabelConversionFunc(userapi.UserToSelectableFields(&userapi.User{}), nil),
2535
); err != nil {
2636
return err
2737
}
38+
if err := scheme.AddFieldLabelConversionFunc(SchemeGroupVersion.String(), "User",
39+
oapi.GetFieldLabelConversionFunc(userapi.UserToSelectableFields(&userapi.User{}), nil),
40+
); err != nil {
41+
return err
42+
}
2843
return nil
2944
}

test/extended/builds/start.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,14 @@ var _ = g.Describe("[builds][Slow] starting a build using CLI", func() {
308308
g.By("verifying the build output contains the changes.")
309309
o.Expect(buildLog).To(o.ContainSubstring("bar"))
310310
})
311-
g.It("Should fail on non-existent build-arg", func() {
311+
g.It("Should complete with a warning on non-existent build-arg", func() {
312312
g.By("starting the build with --build-arg flag")
313313
br, _ := exutil.StartBuildAndWait(oc, "sample-build-docker-args", "--build-arg=bar=foo")
314-
br.AssertFailure()
314+
br.AssertSuccess()
315315
buildLog, err := br.Logs()
316316
o.Expect(err).NotTo(o.HaveOccurred())
317-
g.By("verifying the build failed due to Docker.")
318-
o.Expect(buildLog).To(o.ContainSubstring("One or more build-args [bar] were not consumed, failing build"))
317+
g.By("verifying the build completed with a warning.")
318+
o.Expect(buildLog).To(o.ContainSubstring("One or more build-args [bar] were not consumed"))
319319
})
320320
})
321321

0 commit comments

Comments
 (0)