mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
chore: update client code generator (#4711)
* chore: update client code generator Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> * fix inconsistency on my mac Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com> Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
This commit is contained in:
parent
ec5c469175
commit
56c74272bb
17 changed files with 139 additions and 43 deletions
6
Makefile
6
Makefile
|
@ -41,7 +41,7 @@ CONTROLLER_GEN_VERSION := v0.9.1-0.20220629131006-1878064c4cdf
|
||||||
CLIENT_GEN := $(TOOLS_DIR)/client-gen
|
CLIENT_GEN := $(TOOLS_DIR)/client-gen
|
||||||
LISTER_GEN := $(TOOLS_DIR)/lister-gen
|
LISTER_GEN := $(TOOLS_DIR)/lister-gen
|
||||||
INFORMER_GEN := $(TOOLS_DIR)/informer-gen
|
INFORMER_GEN := $(TOOLS_DIR)/informer-gen
|
||||||
CODE_GEN_VERSION := v0.19.0
|
CODE_GEN_VERSION := v0.25.2
|
||||||
GEN_CRD_API_REFERENCE_DOCS := $(TOOLS_DIR)/gen-crd-api-reference-docs
|
GEN_CRD_API_REFERENCE_DOCS := $(TOOLS_DIR)/gen-crd-api-reference-docs
|
||||||
GEN_CRD_API_REFERENCE_DOCS_VERSION := latest
|
GEN_CRD_API_REFERENCE_DOCS_VERSION := latest
|
||||||
GO_ACC := $(TOOLS_DIR)/go-acc
|
GO_ACC := $(TOOLS_DIR)/go-acc
|
||||||
|
@ -458,10 +458,10 @@ verify-crds: codegen-crds-all ## Check CRDs are up to date
|
||||||
|
|
||||||
.PHONY: verify-client
|
.PHONY: verify-client
|
||||||
verify-client: codegen-client-all ## Check client is up to date
|
verify-client: codegen-client-all ## Check client is up to date
|
||||||
@git --no-pager diff pkg/client
|
@git --no-pager diff --ignore-space-change pkg/client
|
||||||
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-client-all".'
|
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-client-all".'
|
||||||
@echo 'To correct this, locally run "make codegen-client-all", commit the changes, and re-run tests.'
|
@echo 'To correct this, locally run "make codegen-client-all", commit the changes, and re-run tests.'
|
||||||
@git diff --quiet --exit-code pkg/client
|
@git diff --ignore-space-change --quiet --exit-code pkg/client
|
||||||
|
|
||||||
.PHONY: verify-deepcopy
|
.PHONY: verify-deepcopy
|
||||||
verify-deepcopy: codegen-deepcopy-all ## Check deepcopy functions are up to date
|
verify-deepcopy: codegen-deepcopy-all ## Check deepcopy functions are up to date
|
||||||
|
|
|
@ -20,6 +20,7 @@ package versioned
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
kyvernov1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1"
|
kyvernov1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1"
|
||||||
kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha2"
|
kyvernov1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha2"
|
||||||
|
@ -79,34 +80,57 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface {
|
||||||
// NewForConfig creates a new Clientset for the given config.
|
// NewForConfig creates a new Clientset for the given config.
|
||||||
// If config's RateLimiter is not set and QPS and Burst are acceptable,
|
// If config's RateLimiter is not set and QPS and Burst are acceptable,
|
||||||
// NewForConfig will generate a rate-limiter in configShallowCopy.
|
// NewForConfig will generate a rate-limiter in configShallowCopy.
|
||||||
|
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||||
|
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||||
func NewForConfig(c *rest.Config) (*Clientset, error) {
|
func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||||
configShallowCopy := *c
|
configShallowCopy := *c
|
||||||
|
|
||||||
|
if configShallowCopy.UserAgent == "" {
|
||||||
|
configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent()
|
||||||
|
}
|
||||||
|
|
||||||
|
// share the transport between all clients
|
||||||
|
httpClient, err := rest.HTTPClientFor(&configShallowCopy)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigAndClient creates a new Clientset for the given config and http client.
|
||||||
|
// Note the http client provided takes precedence over the configured transport values.
|
||||||
|
// If config's RateLimiter is not set and QPS and Burst are acceptable,
|
||||||
|
// NewForConfigAndClient will generate a rate-limiter in configShallowCopy.
|
||||||
|
func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) {
|
||||||
|
configShallowCopy := *c
|
||||||
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
|
||||||
if configShallowCopy.Burst <= 0 {
|
if configShallowCopy.Burst <= 0 {
|
||||||
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
|
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
|
||||||
}
|
}
|
||||||
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
|
||||||
}
|
}
|
||||||
|
|
||||||
var cs Clientset
|
var cs Clientset
|
||||||
var err error
|
var err error
|
||||||
cs.kyvernoV1, err = kyvernov1.NewForConfig(&configShallowCopy)
|
cs.kyvernoV1, err = kyvernov1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
cs.kyvernoV1beta1, err = kyvernov1beta1.NewForConfig(&configShallowCopy)
|
cs.kyvernoV1beta1, err = kyvernov1beta1.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
cs.kyvernoV1alpha2, err = kyvernov1alpha2.NewForConfig(&configShallowCopy)
|
cs.kyvernoV1alpha2, err = kyvernov1alpha2.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
cs.wgpolicyk8sV1alpha2, err = wgpolicyk8sv1alpha2.NewForConfig(&configShallowCopy)
|
cs.wgpolicyk8sV1alpha2, err = wgpolicyk8sv1alpha2.NewForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
|
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -116,14 +140,11 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
||||||
// NewForConfigOrDie creates a new Clientset for the given config and
|
// NewForConfigOrDie creates a new Clientset for the given config and
|
||||||
// panics if there is an error in the config.
|
// panics if there is an error in the config.
|
||||||
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||||
var cs Clientset
|
cs, err := NewForConfig(c)
|
||||||
cs.kyvernoV1 = kyvernov1.NewForConfigOrDie(c)
|
if err != nil {
|
||||||
cs.kyvernoV1beta1 = kyvernov1beta1.NewForConfigOrDie(c)
|
panic(err)
|
||||||
cs.kyvernoV1alpha2 = kyvernov1alpha2.NewForConfigOrDie(c)
|
}
|
||||||
cs.wgpolicyk8sV1alpha2 = wgpolicyk8sv1alpha2.NewForConfigOrDie(c)
|
return cs
|
||||||
|
|
||||||
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
|
|
||||||
return &cs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new Clientset for the given RESTClient.
|
// New creates a new Clientset for the given RESTClient.
|
||||||
|
|
|
@ -80,7 +80,10 @@ func (c *Clientset) Tracker() testing.ObjectTracker {
|
||||||
return c.tracker
|
return c.tracker
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ clientset.Interface = &Clientset{}
|
var (
|
||||||
|
_ clientset.Interface = &Clientset{}
|
||||||
|
_ testing.FakeClient = &Clientset{}
|
||||||
|
)
|
||||||
|
|
||||||
// KyvernoV1 retrieves the KyvernoV1Client
|
// KyvernoV1 retrieves the KyvernoV1Client
|
||||||
func (c *Clientset) KyvernoV1() kyvernov1.KyvernoV1Interface {
|
func (c *Clientset) KyvernoV1() kyvernov1.KyvernoV1Interface {
|
||||||
|
|
|
@ -43,14 +43,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
|
||||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||||
// of clientsets, like in:
|
// of clientsets, like in:
|
||||||
//
|
//
|
||||||
// import (
|
// import (
|
||||||
// "k8s.io/client-go/kubernetes"
|
// "k8s.io/client-go/kubernetes"
|
||||||
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
|
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
|
||||||
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
|
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
|
||||||
// )
|
// )
|
||||||
//
|
//
|
||||||
// kclientset, _ := kubernetes.NewForConfig(c)
|
// kclientset, _ := kubernetes.NewForConfig(c)
|
||||||
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
|
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
|
||||||
//
|
//
|
||||||
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
||||||
// correctly.
|
// correctly.
|
||||||
|
|
|
@ -43,14 +43,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
|
||||||
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
|
||||||
// of clientsets, like in:
|
// of clientsets, like in:
|
||||||
//
|
//
|
||||||
// import (
|
// import (
|
||||||
// "k8s.io/client-go/kubernetes"
|
// "k8s.io/client-go/kubernetes"
|
||||||
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
|
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
|
||||||
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
|
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
|
||||||
// )
|
// )
|
||||||
//
|
//
|
||||||
// kclientset, _ := kubernetes.NewForConfig(c)
|
// kclientset, _ := kubernetes.NewForConfig(c)
|
||||||
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
|
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
|
||||||
//
|
//
|
||||||
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
|
||||||
// correctly.
|
// correctly.
|
||||||
|
|
|
@ -110,7 +110,7 @@ func (c *FakeClusterPolicies) UpdateStatus(ctx context.Context, clusterPolicy *k
|
||||||
// Delete takes name of the clusterPolicy and deletes it. Returns an error if one occurs.
|
// Delete takes name of the clusterPolicy and deletes it. Returns an error if one occurs.
|
||||||
func (c *FakeClusterPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
func (c *FakeClusterPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
_, err := c.Fake.
|
_, err := c.Fake.
|
||||||
Invokes(testing.NewRootDeleteAction(clusterpoliciesResource, name), &kyvernov1.ClusterPolicy{})
|
Invokes(testing.NewRootDeleteActionWithOptions(clusterpoliciesResource, name, opts), &kyvernov1.ClusterPolicy{})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ func (c *FakeGenerateRequests) UpdateStatus(ctx context.Context, generateRequest
|
||||||
// Delete takes name of the generateRequest and deletes it. Returns an error if one occurs.
|
// Delete takes name of the generateRequest and deletes it. Returns an error if one occurs.
|
||||||
func (c *FakeGenerateRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
func (c *FakeGenerateRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
_, err := c.Fake.
|
_, err := c.Fake.
|
||||||
Invokes(testing.NewDeleteAction(generaterequestsResource, c.ns, name), &kyvernov1.GenerateRequest{})
|
Invokes(testing.NewDeleteActionWithOptions(generaterequestsResource, c.ns, name, opts), &kyvernov1.GenerateRequest{})
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ func (c *FakePolicies) UpdateStatus(ctx context.Context, policy *kyvernov1.Polic
|
||||||
// Delete takes name of the policy and deletes it. Returns an error if one occurs.
|
// Delete takes name of the policy and deletes it. Returns an error if one occurs.
|
||||||
func (c *FakePolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
func (c *FakePolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
_, err := c.Fake.
|
_, err := c.Fake.
|
||||||
Invokes(testing.NewDeleteAction(policiesResource, c.ns, name), &kyvernov1.Policy{})
|
Invokes(testing.NewDeleteActionWithOptions(policiesResource, c.ns, name, opts), &kyvernov1.Policy{})
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ limitations under the License.
|
||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
v1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
v1 "github.com/kyverno/kyverno/api/kyverno/v1"
|
||||||
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||||
rest "k8s.io/client-go/rest"
|
rest "k8s.io/client-go/rest"
|
||||||
|
@ -49,12 +51,28 @@ func (c *KyvernoV1Client) Policies(namespace string) PolicyInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewForConfig creates a new KyvernoV1Client for the given config.
|
// NewForConfig creates a new KyvernoV1Client for the given config.
|
||||||
|
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||||
|
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||||
func NewForConfig(c *rest.Config) (*KyvernoV1Client, error) {
|
func NewForConfig(c *rest.Config) (*KyvernoV1Client, error) {
|
||||||
config := *c
|
config := *c
|
||||||
if err := setConfigDefaults(&config); err != nil {
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
client, err := rest.RESTClientFor(&config)
|
httpClient, err := rest.HTTPClientFor(&config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return NewForConfigAndClient(&config, httpClient)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigAndClient creates a new KyvernoV1Client for the given config and http client.
|
||||||
|
// Note the http client provided takes precedence over the configured transport values.
|
||||||
|
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KyvernoV1Client, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ func (c *FakeClusterReportChangeRequests) Update(ctx context.Context, clusterRep
|
||||||
// Delete takes name of the clusterReportChangeRequest and deletes it. Returns an error if one occurs.
|
// Delete takes name of the clusterReportChangeRequest and deletes it. Returns an error if one occurs.
|
||||||
func (c *FakeClusterReportChangeRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
func (c *FakeClusterReportChangeRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
_, err := c.Fake.
|
_, err := c.Fake.
|
||||||
Invokes(testing.NewRootDeleteAction(clusterreportchangerequestsResource, name), &v1alpha2.ClusterReportChangeRequest{})
|
Invokes(testing.NewRootDeleteActionWithOptions(clusterreportchangerequestsResource, name, opts), &v1alpha2.ClusterReportChangeRequest{})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ func (c *FakeReportChangeRequests) Update(ctx context.Context, reportChangeReque
|
||||||
// Delete takes name of the reportChangeRequest and deletes it. Returns an error if one occurs.
|
// Delete takes name of the reportChangeRequest and deletes it. Returns an error if one occurs.
|
||||||
func (c *FakeReportChangeRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
func (c *FakeReportChangeRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
_, err := c.Fake.
|
_, err := c.Fake.
|
||||||
Invokes(testing.NewDeleteAction(reportchangerequestsResource, c.ns, name), &v1alpha2.ReportChangeRequest{})
|
Invokes(testing.NewDeleteActionWithOptions(reportchangerequestsResource, c.ns, name, opts), &v1alpha2.ReportChangeRequest{})
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ limitations under the License.
|
||||||
package v1alpha2
|
package v1alpha2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
v1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2"
|
v1alpha2 "github.com/kyverno/kyverno/api/kyverno/v1alpha2"
|
||||||
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||||
rest "k8s.io/client-go/rest"
|
rest "k8s.io/client-go/rest"
|
||||||
|
@ -44,12 +46,28 @@ func (c *KyvernoV1alpha2Client) ReportChangeRequests(namespace string) ReportCha
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewForConfig creates a new KyvernoV1alpha2Client for the given config.
|
// NewForConfig creates a new KyvernoV1alpha2Client for the given config.
|
||||||
|
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||||
|
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||||
func NewForConfig(c *rest.Config) (*KyvernoV1alpha2Client, error) {
|
func NewForConfig(c *rest.Config) (*KyvernoV1alpha2Client, error) {
|
||||||
config := *c
|
config := *c
|
||||||
if err := setConfigDefaults(&config); err != nil {
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
client, err := rest.RESTClientFor(&config)
|
httpClient, err := rest.HTTPClientFor(&config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return NewForConfigAndClient(&config, httpClient)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigAndClient creates a new KyvernoV1alpha2Client for the given config and http client.
|
||||||
|
// Note the http client provided takes precedence over the configured transport values.
|
||||||
|
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KyvernoV1alpha2Client, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ func (c *FakeUpdateRequests) UpdateStatus(ctx context.Context, updateRequest *v1
|
||||||
// Delete takes name of the updateRequest and deletes it. Returns an error if one occurs.
|
// Delete takes name of the updateRequest and deletes it. Returns an error if one occurs.
|
||||||
func (c *FakeUpdateRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
func (c *FakeUpdateRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
_, err := c.Fake.
|
_, err := c.Fake.
|
||||||
Invokes(testing.NewDeleteAction(updaterequestsResource, c.ns, name), &v1beta1.UpdateRequest{})
|
Invokes(testing.NewDeleteActionWithOptions(updaterequestsResource, c.ns, name, opts), &v1beta1.UpdateRequest{})
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ limitations under the License.
|
||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
v1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
|
v1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
|
||||||
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||||
rest "k8s.io/client-go/rest"
|
rest "k8s.io/client-go/rest"
|
||||||
|
@ -39,12 +41,28 @@ func (c *KyvernoV1beta1Client) UpdateRequests(namespace string) UpdateRequestInt
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewForConfig creates a new KyvernoV1beta1Client for the given config.
|
// NewForConfig creates a new KyvernoV1beta1Client for the given config.
|
||||||
|
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||||
|
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||||
func NewForConfig(c *rest.Config) (*KyvernoV1beta1Client, error) {
|
func NewForConfig(c *rest.Config) (*KyvernoV1beta1Client, error) {
|
||||||
config := *c
|
config := *c
|
||||||
if err := setConfigDefaults(&config); err != nil {
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
client, err := rest.RESTClientFor(&config)
|
httpClient, err := rest.HTTPClientFor(&config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return NewForConfigAndClient(&config, httpClient)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigAndClient creates a new KyvernoV1beta1Client for the given config and http client.
|
||||||
|
// Note the http client provided takes precedence over the configured transport values.
|
||||||
|
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*KyvernoV1beta1Client, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ func (c *FakeClusterPolicyReports) Update(ctx context.Context, clusterPolicyRepo
|
||||||
// Delete takes name of the clusterPolicyReport and deletes it. Returns an error if one occurs.
|
// Delete takes name of the clusterPolicyReport and deletes it. Returns an error if one occurs.
|
||||||
func (c *FakeClusterPolicyReports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
func (c *FakeClusterPolicyReports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
_, err := c.Fake.
|
_, err := c.Fake.
|
||||||
Invokes(testing.NewRootDeleteAction(clusterpolicyreportsResource, name), &v1alpha2.ClusterPolicyReport{})
|
Invokes(testing.NewRootDeleteActionWithOptions(clusterpolicyreportsResource, name, opts), &v1alpha2.ClusterPolicyReport{})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ func (c *FakePolicyReports) Update(ctx context.Context, policyReport *v1alpha2.P
|
||||||
// Delete takes name of the policyReport and deletes it. Returns an error if one occurs.
|
// Delete takes name of the policyReport and deletes it. Returns an error if one occurs.
|
||||||
func (c *FakePolicyReports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
func (c *FakePolicyReports) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||||
_, err := c.Fake.
|
_, err := c.Fake.
|
||||||
Invokes(testing.NewDeleteAction(policyreportsResource, c.ns, name), &v1alpha2.PolicyReport{})
|
Invokes(testing.NewDeleteActionWithOptions(policyreportsResource, c.ns, name, opts), &v1alpha2.PolicyReport{})
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ limitations under the License.
|
||||||
package v1alpha2
|
package v1alpha2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
v1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
|
v1alpha2 "github.com/kyverno/kyverno/api/policyreport/v1alpha2"
|
||||||
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
"github.com/kyverno/kyverno/pkg/client/clientset/versioned/scheme"
|
||||||
rest "k8s.io/client-go/rest"
|
rest "k8s.io/client-go/rest"
|
||||||
|
@ -44,12 +46,28 @@ func (c *Wgpolicyk8sV1alpha2Client) PolicyReports(namespace string) PolicyReport
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewForConfig creates a new Wgpolicyk8sV1alpha2Client for the given config.
|
// NewForConfig creates a new Wgpolicyk8sV1alpha2Client for the given config.
|
||||||
|
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
|
||||||
|
// where httpClient was generated with rest.HTTPClientFor(c).
|
||||||
func NewForConfig(c *rest.Config) (*Wgpolicyk8sV1alpha2Client, error) {
|
func NewForConfig(c *rest.Config) (*Wgpolicyk8sV1alpha2Client, error) {
|
||||||
config := *c
|
config := *c
|
||||||
if err := setConfigDefaults(&config); err != nil {
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
client, err := rest.RESTClientFor(&config)
|
httpClient, err := rest.HTTPClientFor(&config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return NewForConfigAndClient(&config, httpClient)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewForConfigAndClient creates a new Wgpolicyk8sV1alpha2Client for the given config and http client.
|
||||||
|
// Note the http client provided takes precedence over the configured transport values.
|
||||||
|
func NewForConfigAndClient(c *rest.Config, h *http.Client) (*Wgpolicyk8sV1alpha2Client, error) {
|
||||||
|
config := *c
|
||||||
|
if err := setConfigDefaults(&config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
client, err := rest.RESTClientForConfigAndClient(&config, h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue