Skip to content

Commit 4ffa91a

Browse files
committed
Add context-propagating CreateContext methods to *Review clients
1 parent cc4ca62 commit 4ffa91a

20 files changed

+140
-0
lines changed

staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1/fake/fake_tokenreview_expansion.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ limitations under the License.
1717
package fake
1818

1919
import (
20+
"context"
21+
2022
authenticationapi "k8s.io/api/authentication/v1"
2123
core "k8s.io/client-go/testing"
2224
)
2325

2426
func (c *FakeTokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
27+
return c.CreateContext(context.Background(), tokenReview)
28+
}
29+
30+
func (c *FakeTokenReviews) CreateContext(ctx context.Context, tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
2531
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authenticationapi.SchemeGroupVersion.WithResource("tokenreviews"), tokenReview), &authenticationapi.TokenReview{})
2632
return obj.(*authenticationapi.TokenReview), err
2733
}

staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1/tokenreview_expansion.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,24 @@ limitations under the License.
1717
package v1
1818

1919
import (
20+
"context"
21+
2022
authenticationapi "k8s.io/api/authentication/v1"
2123
)
2224

2325
type TokenReviewExpansion interface {
2426
Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error)
27+
CreateContext(ctx context.Context, tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error)
2528
}
2629

2730
func (c *tokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
31+
return c.CreateContext(context.Background(), tokenReview)
32+
}
33+
34+
func (c *tokenReviews) CreateContext(ctx context.Context, tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
2835
result = &authenticationapi.TokenReview{}
2936
err = c.client.Post().
37+
Context(ctx).
3038
Resource("tokenreviews").
3139
Body(tokenReview).
3240
Do().

staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/fake/fake_tokenreview_expansion.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ limitations under the License.
1717
package fake
1818

1919
import (
20+
"context"
21+
2022
authenticationapi "k8s.io/api/authentication/v1beta1"
2123
core "k8s.io/client-go/testing"
2224
)
2325

2426
func (c *FakeTokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
27+
return c.CreateContext(context.Background(), tokenReview)
28+
}
29+
30+
func (c *FakeTokenReviews) CreateContext(ctx context.Context, tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
2531
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authenticationapi.SchemeGroupVersion.WithResource("tokenreviews"), tokenReview), &authenticationapi.TokenReview{})
2632
return obj.(*authenticationapi.TokenReview), err
2733
}

staging/src/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/tokenreview_expansion.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,24 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20+
"context"
21+
2022
authenticationapi "k8s.io/api/authentication/v1beta1"
2123
)
2224

2325
type TokenReviewExpansion interface {
2426
Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error)
27+
CreateContext(ctx context.Context, tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error)
2528
}
2629

2730
func (c *tokenReviews) Create(tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
31+
return c.CreateContext(context.Background(), tokenReview)
32+
}
33+
34+
func (c *tokenReviews) CreateContext(ctx context.Context, tokenReview *authenticationapi.TokenReview) (result *authenticationapi.TokenReview, err error) {
2835
result = &authenticationapi.TokenReview{}
2936
err = c.client.Post().
37+
Context(ctx).
3038
Resource("tokenreviews").
3139
Body(tokenReview).
3240
Do().

staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_localsubjectaccessreview_expansion.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ limitations under the License.
1717
package fake
1818

1919
import (
20+
"context"
21+
2022
authorizationapi "k8s.io/api/authorization/v1"
2123
core "k8s.io/client-go/testing"
2224
)
2325

2426
func (c *FakeLocalSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
27+
return c.CreateContext(context.Background(), sar)
28+
}
29+
30+
func (c *FakeLocalSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
2531
obj, err := c.Fake.Invokes(core.NewCreateAction(authorizationapi.SchemeGroupVersion.WithResource("localsubjectaccessreviews"), c.ns, sar), &authorizationapi.SubjectAccessReview{})
2632
return obj.(*authorizationapi.LocalSubjectAccessReview), err
2733
}

staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_selfsubjectaccessreview_expansion.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ limitations under the License.
1717
package fake
1818

1919
import (
20+
"context"
21+
2022
authorizationapi "k8s.io/api/authorization/v1"
2123
core "k8s.io/client-go/testing"
2224
)
2325

2426
func (c *FakeSelfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
27+
return c.CreateContext(context.Background(), sar)
28+
}
29+
30+
func (c *FakeSelfSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
2531
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectaccessreviews"), sar), &authorizationapi.SelfSubjectAccessReview{})
2632
return obj.(*authorizationapi.SelfSubjectAccessReview), err
2733
}

staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_selfsubjectrulesreview_expansion.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ limitations under the License.
1717
package fake
1818

1919
import (
20+
"context"
21+
2022
authorizationapi "k8s.io/api/authorization/v1"
2123
core "k8s.io/client-go/testing"
2224
)
2325

2426
func (c *FakeSelfSubjectRulesReviews) Create(srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
27+
return c.CreateContext(context.Background(), srr)
28+
}
29+
30+
func (c *FakeSelfSubjectRulesReviews) CreateContext(ctx context.Context, srr *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
2531
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("selfsubjectrulesreviews"), srr), &authorizationapi.SelfSubjectRulesReview{})
2632
return obj.(*authorizationapi.SelfSubjectRulesReview), err
2733
}

staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1/fake/fake_subjectaccessreview_expansion.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ limitations under the License.
1717
package fake
1818

1919
import (
20+
"context"
21+
2022
authorizationapi "k8s.io/api/authorization/v1"
2123
core "k8s.io/client-go/testing"
2224
)
2325

2426
func (c *FakeSubjectAccessReviews) Create(sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
27+
return c.CreateContext(context.Background(), sar)
28+
}
29+
30+
func (c *FakeSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReview, err error) {
2531
obj, err := c.Fake.Invokes(core.NewRootCreateAction(authorizationapi.SchemeGroupVersion.WithResource("subjectaccessreviews"), sar), &authorizationapi.SubjectAccessReview{})
2632
if obj == nil {
2733
return nil, err

staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1/localsubjectaccessreview_expansion.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,24 @@ limitations under the License.
1717
package v1
1818

1919
import (
20+
"context"
21+
2022
authorizationapi "k8s.io/api/authorization/v1"
2123
)
2224

2325
type LocalSubjectAccessReviewExpansion interface {
2426
Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error)
27+
CreateContext(ctx context.Context, sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error)
2528
}
2629

2730
func (c *localSubjectAccessReviews) Create(sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
31+
return c.CreateContext(context.Background(), sar)
32+
}
33+
34+
func (c *localSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.LocalSubjectAccessReview) (result *authorizationapi.LocalSubjectAccessReview, err error) {
2835
result = &authorizationapi.LocalSubjectAccessReview{}
2936
err = c.client.Post().
37+
Context(ctx).
3038
Namespace(c.ns).
3139
Resource("localsubjectaccessreviews").
3240
Body(sar).

staging/src/k8s.io/client-go/kubernetes/typed/authorization/v1/selfsubjectaccessreview_expansion.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,24 @@ limitations under the License.
1717
package v1
1818

1919
import (
20+
"context"
21+
2022
authorizationapi "k8s.io/api/authorization/v1"
2123
)
2224

2325
type SelfSubjectAccessReviewExpansion interface {
2426
Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error)
27+
CreateContext(ctx context.Context, sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error)
2528
}
2629

2730
func (c *selfSubjectAccessReviews) Create(sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
31+
return c.CreateContext(context.Background(), sar)
32+
}
33+
34+
func (c *selfSubjectAccessReviews) CreateContext(ctx context.Context, sar *authorizationapi.SelfSubjectAccessReview) (result *authorizationapi.SelfSubjectAccessReview, err error) {
2835
result = &authorizationapi.SelfSubjectAccessReview{}
2936
err = c.client.Post().
37+
Context(ctx).
3038
Resource("selfsubjectaccessreviews").
3139
Body(sar).
3240
Do().

0 commit comments

Comments
 (0)