Skip to content

Commit 5fcea52

Browse files
Merge pull request #1852 from swghosh/bump-and-ctx-validate
CFE-910: [o/k-apis] Add context to ObjectValidator; Consume FeatureGate(s) in kube-apiserver
2 parents 5a51bd8 + f733049 commit 5fcea52

File tree

145 files changed

+30316
-17465
lines changed

Some content is hidden

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

145 files changed

+30316
-17465
lines changed

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ require (
5555
github.com/onsi/gomega v1.29.0
5656
github.com/opencontainers/runc v1.1.10
5757
github.com/opencontainers/selinux v1.11.0
58-
github.com/openshift/api v0.0.0-20231218131639-7a5aa77cc72d
58+
github.com/openshift/api v0.0.0-20240207185517-ae973131190e
5959
github.com/openshift/apiserver-library-go v0.0.0-20231218150122-47b436d2f389
6060
github.com/openshift/client-go v0.0.0-20231218155125-ff7d9f9bf415
61-
github.com/openshift/library-go v0.0.0-20231218143352-99cedb2a141c
61+
github.com/openshift/library-go v0.0.0-20240207105404-126b47137408
6262
github.com/pkg/errors v0.9.1
6363
github.com/pmezard/go-difflib v1.0.0
6464
github.com/prometheus/client_golang v1.16.0

go.sum

+4-4
Original file line numberDiff line numberDiff line change
@@ -687,17 +687,17 @@ github.com/opencontainers/runtime-spec v1.0.3-0.20220909204839-494a5a6aca78 h1:R
687687
github.com/opencontainers/runtime-spec v1.0.3-0.20220909204839-494a5a6aca78/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
688688
github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU=
689689
github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec=
690-
github.com/openshift/api v0.0.0-20231218131639-7a5aa77cc72d h1:aVjDasSo08KUIltX++Mcl6ptN0ooxh3dRttHBFGVVI0=
691-
github.com/openshift/api v0.0.0-20231218131639-7a5aa77cc72d/go.mod h1:RLaNkRn87bQeH3MpTWXCxlSb62qVGBxfQY344jBfVsg=
690+
github.com/openshift/api v0.0.0-20240207185517-ae973131190e h1:Iv005XrzYnrIl8ptQFI32t2IBgMOx1kkBrqWO3pCp+E=
691+
github.com/openshift/api v0.0.0-20240207185517-ae973131190e/go.mod h1:CxgbWAlvu2iQB0UmKTtRu1YfepRg1/vJ64n2DlIEVz4=
692692
github.com/openshift/apiserver-library-go v0.0.0-20231218150122-47b436d2f389 h1:EqeY6BMyxhD66eQVj5eLxEqeXeTKW0SGPhvRbmTDuAk=
693693
github.com/openshift/apiserver-library-go v0.0.0-20231218150122-47b436d2f389/go.mod h1:GEjUQF9Z6GqFUKfk+EMN1DVVtTxeUpbcxAv9WwhzE5U=
694694
github.com/openshift/build-machinery-go v0.0.0-20220913142420-e25cf57ea46d/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
695695
github.com/openshift/client-go v0.0.0-20231218155125-ff7d9f9bf415 h1:wfnn3E0Z62bB3wYM5eO1AZ9EYZpFd7M1p4PclcIyVv0=
696696
github.com/openshift/client-go v0.0.0-20231218155125-ff7d9f9bf415/go.mod h1:5W+xoimHjRdZ0dI/yeQR0ANRNLK9mPmXMzUWPAIPADo=
697697
github.com/openshift/ginkgo/v2 v2.6.1-0.20231031162821-c5e24be53ea7 h1:jUM9Fdf+fT0LTccN58jrypOyzcfQUs1v2UH6f8vdBTA=
698698
github.com/openshift/ginkgo/v2 v2.6.1-0.20231031162821-c5e24be53ea7/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o=
699-
github.com/openshift/library-go v0.0.0-20231218143352-99cedb2a141c h1:Onc1C9RWubJj88Jye/giWg2dbbTdMkRGvdekIWBzqTE=
700-
github.com/openshift/library-go v0.0.0-20231218143352-99cedb2a141c/go.mod h1:3taNPDhXab1SAcKteUtv5T7VEYeHJxa5xfHqfnHPEKY=
699+
github.com/openshift/library-go v0.0.0-20240207105404-126b47137408 h1:Evg6GEvEuyj9toFX14YenXI6hGRnhLWqYx/rHO7VnQ4=
700+
github.com/openshift/library-go v0.0.0-20240207105404-126b47137408/go.mod h1:ePlaOqUiPplRc++6aYdMe+2FmXb2xTNS9Nz5laG2YmI=
701701
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
702702
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
703703
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=

openshift-kube-apiserver/admission/customresourcevalidation/apirequestcount/validate_apirequestcount.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package apirequestcount
22

33
import (
4+
"context"
45
"fmt"
56
"io"
67
"strings"
@@ -48,7 +49,7 @@ func toAPIRequestCountV1(uncastObj runtime.Object) (*apiv1.APIRequestCount, fiel
4849
return obj, nil
4950
}
5051

51-
func (a apiRequestCountV1) ValidateCreate(uncastObj runtime.Object) field.ErrorList {
52+
func (a apiRequestCountV1) ValidateCreate(_ context.Context, uncastObj runtime.Object) field.ErrorList {
5253
obj, errs := toAPIRequestCountV1(uncastObj)
5354
if len(errs) > 0 {
5455
return errs
@@ -81,7 +82,7 @@ func NameToResource(name string) (schema.GroupVersionResource, error) {
8182
return result, nil
8283
}
8384

84-
func (a apiRequestCountV1) ValidateUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
85+
func (a apiRequestCountV1) ValidateUpdate(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
8586
obj, errs := toAPIRequestCountV1(uncastObj)
8687
if len(errs) > 0 {
8788
return errs
@@ -94,7 +95,7 @@ func (a apiRequestCountV1) ValidateUpdate(uncastObj runtime.Object, uncastOldObj
9495
return errs
9596
}
9697

97-
func (a apiRequestCountV1) ValidateStatusUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
98+
func (a apiRequestCountV1) ValidateStatusUpdate(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
9899
obj, errs := toAPIRequestCountV1(uncastObj)
99100
if len(errs) > 0 {
100101
return errs

openshift-kube-apiserver/admission/customresourcevalidation/apirequestcount/validate_apirequestcount_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package apirequestcount
22

33
import (
4+
"context"
45
"testing"
56

67
apiv1 "github.com/openshift/api/apiserver/v1"
@@ -20,7 +21,7 @@ func TestApiRequestCountV1_ValidateCreate(t *testing.T) {
2021
}
2122
for _, tc := range testCases {
2223
t.Run(tc.name, func(t *testing.T) {
23-
errs := apiRequestCountV1{}.ValidateCreate(&apiv1.APIRequestCount{ObjectMeta: metav1.ObjectMeta{Name: tc.name}})
24+
errs := apiRequestCountV1{}.ValidateCreate(context.TODO(), &apiv1.APIRequestCount{ObjectMeta: metav1.ObjectMeta{Name: tc.name}})
2425
if tc.errExpected != (len(errs) != 0) {
2526
s := "did not expect "
2627
if tc.errExpected {

openshift-kube-apiserver/admission/customresourcevalidation/apiserver/validate_apiserver.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type apiserverV1 struct {
3838
infrastructureGetter func() configv1client.InfrastructuresGetter
3939
}
4040

41-
func (a apiserverV1) ValidateCreate(uncastObj runtime.Object) field.ErrorList {
41+
func (a apiserverV1) ValidateCreate(_ context.Context, uncastObj runtime.Object) field.ErrorList {
4242
obj, errs := toAPIServerV1(uncastObj)
4343
if len(errs) > 0 {
4444
return errs
@@ -83,7 +83,7 @@ func (a apiserverV1) validateSNINames(obj *configv1.APIServer) field.ErrorList {
8383
return errs
8484
}
8585

86-
func (a apiserverV1) ValidateUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
86+
func (a apiserverV1) ValidateUpdate(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
8787
obj, errs := toAPIServerV1(uncastObj)
8888
if len(errs) > 0 {
8989
return errs
@@ -100,7 +100,7 @@ func (a apiserverV1) ValidateUpdate(uncastObj runtime.Object, uncastOldObj runti
100100
return errs
101101
}
102102

103-
func (apiserverV1) ValidateStatusUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
103+
func (apiserverV1) ValidateStatusUpdate(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
104104
obj, errs := toAPIServerV1(uncastObj)
105105
if len(errs) > 0 {
106106
return errs

openshift-kube-apiserver/admission/customresourcevalidation/authentication/validate_authentication.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package authentication
22

33
import (
4+
"context"
45
"fmt"
56
"io"
67

@@ -47,7 +48,7 @@ func toAuthenticationV1(uncastObj runtime.Object) (*configv1.Authentication, fie
4748

4849
type authenticationV1 struct{}
4950

50-
func (authenticationV1) ValidateCreate(uncastObj runtime.Object) field.ErrorList {
51+
func (authenticationV1) ValidateCreate(_ context.Context, uncastObj runtime.Object) field.ErrorList {
5152
obj, errs := toAuthenticationV1(uncastObj)
5253
if len(errs) > 0 {
5354
return errs
@@ -59,7 +60,7 @@ func (authenticationV1) ValidateCreate(uncastObj runtime.Object) field.ErrorList
5960
return errs
6061
}
6162

62-
func (authenticationV1) ValidateUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
63+
func (authenticationV1) ValidateUpdate(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
6364
obj, errs := toAuthenticationV1(uncastObj)
6465
if len(errs) > 0 {
6566
return errs
@@ -75,7 +76,7 @@ func (authenticationV1) ValidateUpdate(uncastObj runtime.Object, uncastOldObj ru
7576
return errs
7677
}
7778

78-
func (authenticationV1) ValidateStatusUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
79+
func (authenticationV1) ValidateStatusUpdate(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
7980
obj, errs := toAuthenticationV1(uncastObj)
8081
if len(errs) > 0 {
8182
return errs

openshift-kube-apiserver/admission/customresourcevalidation/clusterresourcequota/validate_crq.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package clusterresourcequota
22

33
import (
4+
"context"
45
"fmt"
56
"io"
67

@@ -50,7 +51,7 @@ func toClusterResourceQuota(uncastObj runtime.Object) (*quotav1.ClusterResourceQ
5051
type clusterResourceQuotaV1 struct {
5152
}
5253

53-
func (clusterResourceQuotaV1) ValidateCreate(obj runtime.Object) field.ErrorList {
54+
func (clusterResourceQuotaV1) ValidateCreate(_ context.Context, obj runtime.Object) field.ErrorList {
5455
clusterResourceQuotaObj, errs := toClusterResourceQuota(obj)
5556
if len(errs) > 0 {
5657
return errs
@@ -62,7 +63,7 @@ func (clusterResourceQuotaV1) ValidateCreate(obj runtime.Object) field.ErrorList
6263
return errs
6364
}
6465

65-
func (clusterResourceQuotaV1) ValidateUpdate(obj runtime.Object, oldObj runtime.Object) field.ErrorList {
66+
func (clusterResourceQuotaV1) ValidateUpdate(_ context.Context, obj runtime.Object, oldObj runtime.Object) field.ErrorList {
6667
clusterResourceQuotaObj, errs := toClusterResourceQuota(obj)
6768
if len(errs) > 0 {
6869
return errs
@@ -78,6 +79,6 @@ func (clusterResourceQuotaV1) ValidateUpdate(obj runtime.Object, oldObj runtime.
7879
return errs
7980
}
8081

81-
func (c clusterResourceQuotaV1) ValidateStatusUpdate(obj runtime.Object, oldObj runtime.Object) field.ErrorList {
82-
return c.ValidateUpdate(obj, oldObj)
82+
func (c clusterResourceQuotaV1) ValidateStatusUpdate(ctx context.Context, obj runtime.Object, oldObj runtime.Object) field.ErrorList {
83+
return c.ValidateUpdate(ctx, obj, oldObj)
8384
}

openshift-kube-apiserver/admission/customresourcevalidation/console/validate_console.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package console
22

33
import (
4+
"context"
45
"fmt"
56
"io"
67

@@ -48,7 +49,7 @@ func toConsoleV1(uncastObj runtime.Object) (*configv1.Console, field.ErrorList)
4849

4950
type consoleV1 struct{}
5051

51-
func (consoleV1) ValidateCreate(uncastObj runtime.Object) field.ErrorList {
52+
func (consoleV1) ValidateCreate(_ context.Context, uncastObj runtime.Object) field.ErrorList {
5253
obj, errs := toConsoleV1(uncastObj)
5354
if len(errs) > 0 {
5455
return errs
@@ -60,7 +61,7 @@ func (consoleV1) ValidateCreate(uncastObj runtime.Object) field.ErrorList {
6061
return errs
6162
}
6263

63-
func (consoleV1) ValidateUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
64+
func (consoleV1) ValidateUpdate(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
6465
obj, errs := toConsoleV1(uncastObj)
6566
if len(errs) > 0 {
6667
return errs
@@ -76,7 +77,7 @@ func (consoleV1) ValidateUpdate(uncastObj runtime.Object, uncastOldObj runtime.O
7677
return errs
7778
}
7879

79-
func (consoleV1) ValidateStatusUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
80+
func (consoleV1) ValidateStatusUpdate(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
8081
obj, errs := toConsoleV1(uncastObj)
8182
if len(errs) > 0 {
8283
return errs

openshift-kube-apiserver/admission/customresourcevalidation/customresourcevalidator.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ import (
1111
"k8s.io/apiserver/pkg/admission"
1212
)
1313

14+
// ObjectValidator validates a given resource across create,
15+
// update and status update ops.
1416
type ObjectValidator interface {
15-
ValidateCreate(obj runtime.Object) field.ErrorList
16-
ValidateUpdate(obj runtime.Object, oldObj runtime.Object) field.ErrorList
17-
ValidateStatusUpdate(obj runtime.Object, oldObj runtime.Object) field.ErrorList
17+
// TODO: add router validation logic with ctx, remove this todo once added
18+
ValidateCreate(ctx context.Context, obj runtime.Object) field.ErrorList
19+
ValidateUpdate(ctx context.Context, obj runtime.Object, oldObj runtime.Object) field.ErrorList
20+
ValidateStatusUpdate(ctx context.Context, obj runtime.Object, oldObj runtime.Object) field.ErrorList
1821
}
1922

2023
// ValidateCustomResource is an implementation of admission.Interface.
@@ -54,7 +57,7 @@ func (a *validateCustomResource) Validate(ctx context.Context, uncastAttributes
5457
if len(attributes.GetSubresource()) > 0 {
5558
return nil
5659
}
57-
errors := validator.ValidateCreate(attributes.GetObject())
60+
errors := validator.ValidateCreate(ctx, attributes.GetObject())
5861
if len(errors) == 0 {
5962
return nil
6063
}
@@ -63,14 +66,14 @@ func (a *validateCustomResource) Validate(ctx context.Context, uncastAttributes
6366
case admission.Update:
6467
switch attributes.GetSubresource() {
6568
case "":
66-
errors := validator.ValidateUpdate(attributes.GetObject(), attributes.GetOldObject())
69+
errors := validator.ValidateUpdate(ctx, attributes.GetObject(), attributes.GetOldObject())
6770
if len(errors) == 0 {
6871
return nil
6972
}
7073
return apierrors.NewInvalid(attributes.GetKind().GroupKind(), attributes.GetName(), errors)
7174

7275
case "status":
73-
errors := validator.ValidateStatusUpdate(attributes.GetObject(), attributes.GetOldObject())
76+
errors := validator.ValidateStatusUpdate(ctx, attributes.GetObject(), attributes.GetOldObject())
7477
if len(errors) == 0 {
7578
return nil
7679
}

openshift-kube-apiserver/admission/customresourcevalidation/customresourcevalidator_test.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,15 @@ func TestCustomResourceValidator(t *testing.T) {
157157
},
158158
map[schema.GroupVersionKind]ObjectValidator{
159159
{Group: testGroup, Version: testVersion, Kind: testKind}: testValidator{
160-
validateCreate: func(obj runtime.Object) field.ErrorList {
160+
validateCreate: func(_ context.Context, obj runtime.Object) field.ErrorList {
161161
createFuncCalled = true
162162
if tc.validateFuncErr {
163163
return field.ErrorList{field.InternalError(field.NewPath("test"), errors.New("TEST Error"))}
164164
}
165165
funcArgObject = obj
166166
return nil
167167
},
168-
validateUpdate: func(obj runtime.Object, oldObj runtime.Object) field.ErrorList {
168+
validateUpdate: func(_ context.Context, obj runtime.Object, oldObj runtime.Object) field.ErrorList {
169169
if tc.validateFuncErr {
170170
return field.ErrorList{field.InternalError(field.NewPath("test"), errors.New("TEST Error"))}
171171
}
@@ -174,7 +174,7 @@ func TestCustomResourceValidator(t *testing.T) {
174174
funcArgOldObject = oldObj
175175
return nil
176176
},
177-
validateStatusUpdate: func(obj runtime.Object, oldObj runtime.Object) field.ErrorList {
177+
validateStatusUpdate: func(_ context.Context, obj runtime.Object, oldObj runtime.Object) field.ErrorList {
178178
updateStatusFuncCalled = true
179179
if tc.validateFuncErr {
180180
return field.ErrorList{field.InternalError(field.NewPath("test"), errors.New("TEST Error"))}
@@ -259,20 +259,20 @@ func TestCustomResourceValidator(t *testing.T) {
259259
}
260260

261261
type testValidator struct {
262-
validateCreate func(uncastObj runtime.Object) field.ErrorList
263-
validateUpdate func(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList
264-
validateStatusUpdate func(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList
262+
validateCreate func(_ context.Context, uncastObj runtime.Object) field.ErrorList
263+
validateUpdate func(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList
264+
validateStatusUpdate func(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList
265265
}
266266

267-
func (v testValidator) ValidateCreate(uncastObj runtime.Object) field.ErrorList {
268-
return v.validateCreate(uncastObj)
267+
func (v testValidator) ValidateCreate(ctx context.Context, uncastObj runtime.Object) field.ErrorList {
268+
return v.validateCreate(ctx, uncastObj)
269269
}
270270

271-
func (v testValidator) ValidateUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
272-
return v.validateUpdate(uncastObj, uncastOldObj)
271+
func (v testValidator) ValidateUpdate(ctx context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
272+
return v.validateUpdate(ctx, uncastObj, uncastOldObj)
273273

274274
}
275275

276-
func (v testValidator) ValidateStatusUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
277-
return v.validateStatusUpdate(uncastObj, uncastOldObj)
276+
func (v testValidator) ValidateStatusUpdate(ctx context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
277+
return v.validateStatusUpdate(ctx, uncastObj, uncastOldObj)
278278
}

openshift-kube-apiserver/admission/customresourcevalidation/dns/validate_dns.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package dns
22

33
import (
4+
"context"
45
"fmt"
56
"io"
67
"reflect"
@@ -56,7 +57,7 @@ func toDNSV1(uncastObj runtime.Object) (*operatorv1.DNS, field.ErrorList) {
5657
type dnsV1 struct{}
5758

5859
// ValidateCreate validates a DNS that is being created.
59-
func (dnsV1) ValidateCreate(uncastObj runtime.Object) field.ErrorList {
60+
func (dnsV1) ValidateCreate(_ context.Context, uncastObj runtime.Object) field.ErrorList {
6061
obj, errs := toDNSV1(uncastObj)
6162
if len(errs) > 0 {
6263
return errs
@@ -69,7 +70,7 @@ func (dnsV1) ValidateCreate(uncastObj runtime.Object) field.ErrorList {
6970
}
7071

7172
// ValidateUpdate validates a DNS that is being updated.
72-
func (dnsV1) ValidateUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
73+
func (dnsV1) ValidateUpdate(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
7374
obj, errs := toDNSV1(uncastObj)
7475
if len(errs) > 0 {
7576
return errs
@@ -86,7 +87,7 @@ func (dnsV1) ValidateUpdate(uncastObj runtime.Object, uncastOldObj runtime.Objec
8687
}
8788

8889
// ValidateStatusUpdate validates a DNS status that is being updated.
89-
func (dnsV1) ValidateStatusUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
90+
func (dnsV1) ValidateStatusUpdate(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
9091
obj, errs := toDNSV1(uncastObj)
9192
if len(errs) > 0 {
9293
return errs

openshift-kube-apiserver/admission/customresourcevalidation/features/validate_features.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package features
22

33
import (
4+
"context"
45
"fmt"
56
"io"
67

@@ -89,7 +90,7 @@ func validateFeatureGateSpecUpdate(spec, oldSpec configv1.FeatureGateSpec) field
8990
return allErrs
9091
}
9192

92-
func (featureGateV1) ValidateCreate(uncastObj runtime.Object) field.ErrorList {
93+
func (featureGateV1) ValidateCreate(_ context.Context, uncastObj runtime.Object) field.ErrorList {
9394
obj, allErrs := toFeatureGateV1(uncastObj)
9495
if len(allErrs) > 0 {
9596
return allErrs
@@ -101,7 +102,7 @@ func (featureGateV1) ValidateCreate(uncastObj runtime.Object) field.ErrorList {
101102
return allErrs
102103
}
103104

104-
func (featureGateV1) ValidateUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
105+
func (featureGateV1) ValidateUpdate(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
105106
obj, allErrs := toFeatureGateV1(uncastObj)
106107
if len(allErrs) > 0 {
107108
return allErrs
@@ -117,7 +118,7 @@ func (featureGateV1) ValidateUpdate(uncastObj runtime.Object, uncastOldObj runti
117118
return allErrs
118119
}
119120

120-
func (featureGateV1) ValidateStatusUpdate(uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
121+
func (featureGateV1) ValidateStatusUpdate(_ context.Context, uncastObj runtime.Object, uncastOldObj runtime.Object) field.ErrorList {
121122
obj, errs := toFeatureGateV1(uncastObj)
122123
if len(errs) > 0 {
123124
return errs

0 commit comments

Comments
 (0)