update generated files for cluster override API
Signed-off-by: Kevin Wang <kevinwzf0126@gmail.com>
This commit is contained in:
parent
bc5475c50f
commit
abaf2b2bee
|
@ -0,0 +1,253 @@
|
|||
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.4.1
|
||||
creationTimestamp: null
|
||||
name: clusteroverridepolicies.policy.karmada.io
|
||||
spec:
|
||||
group: policy.karmada.io
|
||||
names:
|
||||
kind: ClusterOverridePolicy
|
||||
listKind: ClusterOverridePolicyList
|
||||
plural: clusteroverridepolicies
|
||||
singular: clusteroverridepolicy
|
||||
scope: Cluster
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: ClusterOverridePolicy represents the cluster-wide policy that
|
||||
overrides a group of resources to one or more clusters.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: 'APIVersion defines the versioned schema of this representation
|
||||
of an object. Servers should convert recognized schemas to the latest
|
||||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
||||
type: string
|
||||
kind:
|
||||
description: 'Kind is a string value representing the REST resource this
|
||||
object represents. Servers may infer this from the endpoint the client
|
||||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
spec:
|
||||
description: Spec represents the desired behavior of ClusterOverridePolicy.
|
||||
properties:
|
||||
overriders:
|
||||
description: Overriders represents the override rules that would apply
|
||||
on resources
|
||||
properties:
|
||||
plaintext:
|
||||
description: Plaintext represents override rules defined with
|
||||
plaintext overriders.
|
||||
items:
|
||||
description: PlaintextOverrider is a simple overrider that overrides
|
||||
target fields according to path, operator and value.
|
||||
properties:
|
||||
operator:
|
||||
description: 'Operator indicates the operation on target
|
||||
field. Available operators are: add, update and remove.'
|
||||
enum:
|
||||
- add
|
||||
- remove
|
||||
- replace
|
||||
type: string
|
||||
path:
|
||||
description: Path indicates the path of target field
|
||||
type: string
|
||||
value:
|
||||
description: Value to be applied to target field. Must be
|
||||
empty when operator is Remove.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- operator
|
||||
- path
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
resourceSelectors:
|
||||
description: ResourceSelectors restricts resource types that this
|
||||
override policy applies to.
|
||||
items:
|
||||
description: ResourceSelector the resources will be selected.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: APIVersion represents the API version of the target
|
||||
resources.
|
||||
type: string
|
||||
kind:
|
||||
description: Kind represents the Kind of the target resources.
|
||||
type: string
|
||||
labelSelector:
|
||||
description: A label query over a set of resources. If name
|
||||
is not empty, labelSelector will be ignored.
|
||||
properties:
|
||||
matchExpressions:
|
||||
description: matchExpressions is a list of label selector
|
||||
requirements. The requirements are ANDed.
|
||||
items:
|
||||
description: A label selector requirement is a selector
|
||||
that contains values, a key, and an operator that relates
|
||||
the key and values.
|
||||
properties:
|
||||
key:
|
||||
description: key is the label key that the selector
|
||||
applies to.
|
||||
type: string
|
||||
operator:
|
||||
description: operator represents a key's relationship
|
||||
to a set of values. Valid operators are In, NotIn,
|
||||
Exists and DoesNotExist.
|
||||
type: string
|
||||
values:
|
||||
description: values is an array of string values.
|
||||
If the operator is In or NotIn, the values array
|
||||
must be non-empty. If the operator is Exists or
|
||||
DoesNotExist, the values array must be empty. This
|
||||
array is replaced during a strategic merge patch.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- key
|
||||
- operator
|
||||
type: object
|
||||
type: array
|
||||
matchLabels:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: matchLabels is a map of {key,value} pairs.
|
||||
A single {key,value} in the matchLabels map is equivalent
|
||||
to an element of matchExpressions, whose key field is
|
||||
"key", the operator is "In", and the values array contains
|
||||
only "value". The requirements are ANDed.
|
||||
type: object
|
||||
type: object
|
||||
name:
|
||||
description: Name of the target resource. Default is empty,
|
||||
which means selecting all resources.
|
||||
type: string
|
||||
namespace:
|
||||
description: Namespace of the target resource. Default is empty,
|
||||
which means inherit from the parent object scope.
|
||||
type: string
|
||||
required:
|
||||
- apiVersion
|
||||
- kind
|
||||
type: object
|
||||
type: array
|
||||
targetCluster:
|
||||
description: TargetCluster defines restrictions on this override policy
|
||||
that only applies to resources propagated to the matching clusters
|
||||
properties:
|
||||
clusterNames:
|
||||
description: ClusterNames is the list of clusters to be selected.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
exclude:
|
||||
description: ExcludedClusters is the list of clusters to be ignored.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
fieldSelector:
|
||||
description: FieldSelector is a filter to select member clusters
|
||||
by fields. If non-nil and non-empty, only the clusters match
|
||||
this filter will be selected.
|
||||
properties:
|
||||
matchExpressions:
|
||||
description: A list of field selector requirements.
|
||||
items:
|
||||
description: A node selector requirement is a selector that
|
||||
contains values, a key, and an operator that relates the
|
||||
key and values.
|
||||
properties:
|
||||
key:
|
||||
description: The label key that the selector applies
|
||||
to.
|
||||
type: string
|
||||
operator:
|
||||
description: Represents a key's relationship to a set
|
||||
of values. Valid operators are In, NotIn, Exists,
|
||||
DoesNotExist. Gt, and Lt.
|
||||
type: string
|
||||
values:
|
||||
description: An array of string values. If the operator
|
||||
is In or NotIn, the values array must be non-empty.
|
||||
If the operator is Exists or DoesNotExist, the values
|
||||
array must be empty. If the operator is Gt or Lt,
|
||||
the values array must have a single element, which
|
||||
will be interpreted as an integer. This array is replaced
|
||||
during a strategic merge patch.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- key
|
||||
- operator
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
labelSelector:
|
||||
description: LabelSelector is a filter to select member clusters
|
||||
by labels. If non-nil and non-empty, only the clusters match
|
||||
this filter will be selected.
|
||||
properties:
|
||||
matchExpressions:
|
||||
description: matchExpressions is a list of label selector
|
||||
requirements. The requirements are ANDed.
|
||||
items:
|
||||
description: A label selector requirement is a selector
|
||||
that contains values, a key, and an operator that relates
|
||||
the key and values.
|
||||
properties:
|
||||
key:
|
||||
description: key is the label key that the selector
|
||||
applies to.
|
||||
type: string
|
||||
operator:
|
||||
description: operator represents a key's relationship
|
||||
to a set of values. Valid operators are In, NotIn,
|
||||
Exists and DoesNotExist.
|
||||
type: string
|
||||
values:
|
||||
description: values is an array of string values. If
|
||||
the operator is In or NotIn, the values array must
|
||||
be non-empty. If the operator is Exists or DoesNotExist,
|
||||
the values array must be empty. This array is replaced
|
||||
during a strategic merge patch.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- key
|
||||
- operator
|
||||
type: object
|
||||
type: array
|
||||
matchLabels:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: matchLabels is a map of {key,value} pairs. A
|
||||
single {key,value} in the matchLabels map is equivalent
|
||||
to an element of matchExpressions, whose key field is "key",
|
||||
the operator is "In", and the values array contains only
|
||||
"value". The requirements are ANDed.
|
||||
type: object
|
||||
type: object
|
||||
type: object
|
||||
type: object
|
||||
required:
|
||||
- spec
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
status:
|
||||
acceptedNames:
|
||||
kind: ""
|
||||
plural: ""
|
||||
conditions: []
|
||||
storedVersions: []
|
|
@ -63,6 +63,66 @@ func (in *ClusterAffinity) DeepCopy() *ClusterAffinity {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterOverridePolicy) DeepCopyInto(out *ClusterOverridePolicy) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOverridePolicy.
|
||||
func (in *ClusterOverridePolicy) DeepCopy() *ClusterOverridePolicy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterOverridePolicy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ClusterOverridePolicy) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterOverridePolicyList) DeepCopyInto(out *ClusterOverridePolicyList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ClusterOverridePolicy, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterOverridePolicyList.
|
||||
func (in *ClusterOverridePolicyList) DeepCopy() *ClusterOverridePolicyList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterOverridePolicyList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ClusterOverridePolicyList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterPropagationPolicy) DeepCopyInto(out *ClusterPropagationPolicy) {
|
||||
*out = *in
|
||||
|
|
|
@ -42,6 +42,8 @@ func init() {
|
|||
// Adds the list of known types to Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&ClusterOverridePolicy{},
|
||||
&ClusterOverridePolicyList{},
|
||||
&ClusterPropagationPolicy{},
|
||||
&ClusterPropagationPolicyList{},
|
||||
&OverridePolicy{},
|
||||
|
|
|
@ -0,0 +1,152 @@
|
|||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
|
||||
scheme "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ClusterOverridePoliciesGetter has a method to return a ClusterOverridePolicyInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ClusterOverridePoliciesGetter interface {
|
||||
ClusterOverridePolicies() ClusterOverridePolicyInterface
|
||||
}
|
||||
|
||||
// ClusterOverridePolicyInterface has methods to work with ClusterOverridePolicy resources.
|
||||
type ClusterOverridePolicyInterface interface {
|
||||
Create(ctx context.Context, clusterOverridePolicy *v1alpha1.ClusterOverridePolicy, opts v1.CreateOptions) (*v1alpha1.ClusterOverridePolicy, error)
|
||||
Update(ctx context.Context, clusterOverridePolicy *v1alpha1.ClusterOverridePolicy, opts v1.UpdateOptions) (*v1alpha1.ClusterOverridePolicy, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ClusterOverridePolicy, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterOverridePolicyList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterOverridePolicy, err error)
|
||||
ClusterOverridePolicyExpansion
|
||||
}
|
||||
|
||||
// clusterOverridePolicies implements ClusterOverridePolicyInterface
|
||||
type clusterOverridePolicies struct {
|
||||
client rest.Interface
|
||||
}
|
||||
|
||||
// newClusterOverridePolicies returns a ClusterOverridePolicies
|
||||
func newClusterOverridePolicies(c *PolicyV1alpha1Client) *clusterOverridePolicies {
|
||||
return &clusterOverridePolicies{
|
||||
client: c.RESTClient(),
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the clusterOverridePolicy, and returns the corresponding clusterOverridePolicy object, and an error if there is any.
|
||||
func (c *clusterOverridePolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterOverridePolicy, err error) {
|
||||
result = &v1alpha1.ClusterOverridePolicy{}
|
||||
err = c.client.Get().
|
||||
Resource("clusteroverridepolicies").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterOverridePolicies that match those selectors.
|
||||
func (c *clusterOverridePolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterOverridePolicyList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.ClusterOverridePolicyList{}
|
||||
err = c.client.Get().
|
||||
Resource("clusteroverridepolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterOverridePolicies.
|
||||
func (c *clusterOverridePolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Resource("clusteroverridepolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterOverridePolicy and creates it. Returns the server's representation of the clusterOverridePolicy, and an error, if there is any.
|
||||
func (c *clusterOverridePolicies) Create(ctx context.Context, clusterOverridePolicy *v1alpha1.ClusterOverridePolicy, opts v1.CreateOptions) (result *v1alpha1.ClusterOverridePolicy, err error) {
|
||||
result = &v1alpha1.ClusterOverridePolicy{}
|
||||
err = c.client.Post().
|
||||
Resource("clusteroverridepolicies").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterOverridePolicy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterOverridePolicy and updates it. Returns the server's representation of the clusterOverridePolicy, and an error, if there is any.
|
||||
func (c *clusterOverridePolicies) Update(ctx context.Context, clusterOverridePolicy *v1alpha1.ClusterOverridePolicy, opts v1.UpdateOptions) (result *v1alpha1.ClusterOverridePolicy, err error) {
|
||||
result = &v1alpha1.ClusterOverridePolicy{}
|
||||
err = c.client.Put().
|
||||
Resource("clusteroverridepolicies").
|
||||
Name(clusterOverridePolicy.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(clusterOverridePolicy).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterOverridePolicy and deletes it. Returns an error if one occurs.
|
||||
func (c *clusterOverridePolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Resource("clusteroverridepolicies").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *clusterOverridePolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Resource("clusteroverridepolicies").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterOverridePolicy.
|
||||
func (c *clusterOverridePolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterOverridePolicy, err error) {
|
||||
result = &v1alpha1.ClusterOverridePolicy{}
|
||||
err = c.client.Patch(pt).
|
||||
Resource("clusteroverridepolicies").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeClusterOverridePolicies implements ClusterOverridePolicyInterface
|
||||
type FakeClusterOverridePolicies struct {
|
||||
Fake *FakePolicyV1alpha1
|
||||
}
|
||||
|
||||
var clusteroverridepoliciesResource = schema.GroupVersionResource{Group: "policy.karmada.io", Version: "v1alpha1", Resource: "clusteroverridepolicies"}
|
||||
|
||||
var clusteroverridepoliciesKind = schema.GroupVersionKind{Group: "policy.karmada.io", Version: "v1alpha1", Kind: "ClusterOverridePolicy"}
|
||||
|
||||
// Get takes name of the clusterOverridePolicy, and returns the corresponding clusterOverridePolicy object, and an error if there is any.
|
||||
func (c *FakeClusterOverridePolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterOverridePolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootGetAction(clusteroverridepoliciesResource, name), &v1alpha1.ClusterOverridePolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterOverridePolicy), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ClusterOverridePolicies that match those selectors.
|
||||
func (c *FakeClusterOverridePolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterOverridePolicyList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootListAction(clusteroverridepoliciesResource, clusteroverridepoliciesKind, opts), &v1alpha1.ClusterOverridePolicyList{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.ClusterOverridePolicyList{ListMeta: obj.(*v1alpha1.ClusterOverridePolicyList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.ClusterOverridePolicyList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested clusterOverridePolicies.
|
||||
func (c *FakeClusterOverridePolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewRootWatchAction(clusteroverridepoliciesResource, opts))
|
||||
}
|
||||
|
||||
// Create takes the representation of a clusterOverridePolicy and creates it. Returns the server's representation of the clusterOverridePolicy, and an error, if there is any.
|
||||
func (c *FakeClusterOverridePolicies) Create(ctx context.Context, clusterOverridePolicy *v1alpha1.ClusterOverridePolicy, opts v1.CreateOptions) (result *v1alpha1.ClusterOverridePolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootCreateAction(clusteroverridepoliciesResource, clusterOverridePolicy), &v1alpha1.ClusterOverridePolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterOverridePolicy), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a clusterOverridePolicy and updates it. Returns the server's representation of the clusterOverridePolicy, and an error, if there is any.
|
||||
func (c *FakeClusterOverridePolicies) Update(ctx context.Context, clusterOverridePolicy *v1alpha1.ClusterOverridePolicy, opts v1.UpdateOptions) (result *v1alpha1.ClusterOverridePolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootUpdateAction(clusteroverridepoliciesResource, clusterOverridePolicy), &v1alpha1.ClusterOverridePolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterOverridePolicy), err
|
||||
}
|
||||
|
||||
// Delete takes name of the clusterOverridePolicy and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeClusterOverridePolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewRootDeleteAction(clusteroverridepoliciesResource, name), &v1alpha1.ClusterOverridePolicy{})
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeClusterOverridePolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewRootDeleteCollectionAction(clusteroverridepoliciesResource, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterOverridePolicyList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched clusterOverridePolicy.
|
||||
func (c *FakeClusterOverridePolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterOverridePolicy, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewRootPatchSubresourceAction(clusteroverridepoliciesResource, name, pt, data, subresources...), &v1alpha1.ClusterOverridePolicy{})
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterOverridePolicy), err
|
||||
}
|
|
@ -12,6 +12,10 @@ type FakePolicyV1alpha1 struct {
|
|||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakePolicyV1alpha1) ClusterOverridePolicies() v1alpha1.ClusterOverridePolicyInterface {
|
||||
return &FakeClusterOverridePolicies{c}
|
||||
}
|
||||
|
||||
func (c *FakePolicyV1alpha1) ClusterPropagationPolicies() v1alpha1.ClusterPropagationPolicyInterface {
|
||||
return &FakeClusterPropagationPolicies{c}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
package v1alpha1
|
||||
|
||||
type ClusterOverridePolicyExpansion interface{}
|
||||
|
||||
type ClusterPropagationPolicyExpansion interface{}
|
||||
|
||||
type OverridePolicyExpansion interface{}
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
|
||||
type PolicyV1alpha1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
ClusterOverridePoliciesGetter
|
||||
ClusterPropagationPoliciesGetter
|
||||
OverridePoliciesGetter
|
||||
PropagationBindingsGetter
|
||||
|
@ -22,6 +23,10 @@ type PolicyV1alpha1Client struct {
|
|||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *PolicyV1alpha1Client) ClusterOverridePolicies() ClusterOverridePolicyInterface {
|
||||
return newClusterOverridePolicies(c)
|
||||
}
|
||||
|
||||
func (c *PolicyV1alpha1Client) ClusterPropagationPolicies() ClusterPropagationPolicyInterface {
|
||||
return newClusterPropagationPolicies(c)
|
||||
}
|
||||
|
|
|
@ -42,6 +42,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
|||
return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1alpha1().Clusters().Informer()}, nil
|
||||
|
||||
// Group=policy.karmada.io, Version=v1alpha1
|
||||
case policyv1alpha1.SchemeGroupVersion.WithResource("clusteroverridepolicies"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1alpha1().ClusterOverridePolicies().Informer()}, nil
|
||||
case policyv1alpha1.SchemeGroupVersion.WithResource("clusterpropagationpolicies"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1alpha1().ClusterPropagationPolicies().Informer()}, nil
|
||||
case policyv1alpha1.SchemeGroupVersion.WithResource("overridepolicies"):
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
|
||||
versioned "github.com/karmada-io/karmada/pkg/generated/clientset/versioned"
|
||||
internalinterfaces "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/internalinterfaces"
|
||||
v1alpha1 "github.com/karmada-io/karmada/pkg/generated/listers/policy/v1alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ClusterOverridePolicyInformer provides access to a shared informer and lister for
|
||||
// ClusterOverridePolicies.
|
||||
type ClusterOverridePolicyInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.ClusterOverridePolicyLister
|
||||
}
|
||||
|
||||
type clusterOverridePolicyInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewClusterOverridePolicyInformer constructs a new informer for ClusterOverridePolicy type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewClusterOverridePolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredClusterOverridePolicyInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredClusterOverridePolicyInformer constructs a new informer for ClusterOverridePolicy type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredClusterOverridePolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.PolicyV1alpha1().ClusterOverridePolicies().List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.PolicyV1alpha1().ClusterOverridePolicies().Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&policyv1alpha1.ClusterOverridePolicy{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *clusterOverridePolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredClusterOverridePolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *clusterOverridePolicyInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&policyv1alpha1.ClusterOverridePolicy{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *clusterOverridePolicyInformer) Lister() v1alpha1.ClusterOverridePolicyLister {
|
||||
return v1alpha1.NewClusterOverridePolicyLister(f.Informer().GetIndexer())
|
||||
}
|
|
@ -8,6 +8,8 @@ import (
|
|||
|
||||
// Interface provides access to all the informers in this group version.
|
||||
type Interface interface {
|
||||
// ClusterOverridePolicies returns a ClusterOverridePolicyInformer.
|
||||
ClusterOverridePolicies() ClusterOverridePolicyInformer
|
||||
// ClusterPropagationPolicies returns a ClusterPropagationPolicyInformer.
|
||||
ClusterPropagationPolicies() ClusterPropagationPolicyInformer
|
||||
// OverridePolicies returns a OverridePolicyInformer.
|
||||
|
@ -31,6 +33,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
|
|||
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
|
||||
}
|
||||
|
||||
// ClusterOverridePolicies returns a ClusterOverridePolicyInformer.
|
||||
func (v *version) ClusterOverridePolicies() ClusterOverridePolicyInformer {
|
||||
return &clusterOverridePolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// ClusterPropagationPolicies returns a ClusterPropagationPolicyInformer.
|
||||
func (v *version) ClusterPropagationPolicies() ClusterPropagationPolicyInformer {
|
||||
return &clusterPropagationPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ClusterOverridePolicyLister helps list ClusterOverridePolicies.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type ClusterOverridePolicyLister interface {
|
||||
// List lists all ClusterOverridePolicies in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.ClusterOverridePolicy, err error)
|
||||
// Get retrieves the ClusterOverridePolicy from the index for a given name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1alpha1.ClusterOverridePolicy, error)
|
||||
ClusterOverridePolicyListerExpansion
|
||||
}
|
||||
|
||||
// clusterOverridePolicyLister implements the ClusterOverridePolicyLister interface.
|
||||
type clusterOverridePolicyLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewClusterOverridePolicyLister returns a new ClusterOverridePolicyLister.
|
||||
func NewClusterOverridePolicyLister(indexer cache.Indexer) ClusterOverridePolicyLister {
|
||||
return &clusterOverridePolicyLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all ClusterOverridePolicies in the indexer.
|
||||
func (s *clusterOverridePolicyLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterOverridePolicy, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.ClusterOverridePolicy))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the ClusterOverridePolicy from the index for a given name.
|
||||
func (s *clusterOverridePolicyLister) Get(name string) (*v1alpha1.ClusterOverridePolicy, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1alpha1.Resource("clusteroverridepolicy"), name)
|
||||
}
|
||||
return obj.(*v1alpha1.ClusterOverridePolicy), nil
|
||||
}
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
package v1alpha1
|
||||
|
||||
// ClusterOverridePolicyListerExpansion allows custom methods to be added to
|
||||
// ClusterOverridePolicyLister.
|
||||
type ClusterOverridePolicyListerExpansion interface{}
|
||||
|
||||
// ClusterPropagationPolicyListerExpansion allows custom methods to be added to
|
||||
// ClusterPropagationPolicyLister.
|
||||
type ClusterPropagationPolicyListerExpansion interface{}
|
||||
|
|
Loading…
Reference in New Issue