add MultiClusterIngress API for MCI feature

Signed-off-by: changzhen <changzhen5@huawei.com>
This commit is contained in:
changzhen 2022-02-21 09:40:55 +08:00
parent 2d48dd495c
commit f0563e517d
26 changed files with 1246 additions and 8 deletions

View File

@ -0,0 +1,367 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: multiclusteringresses.networking.karmada.io
spec:
group: networking.karmada.io
names:
kind: MultiClusterIngress
listKind: MultiClusterIngressList
plural: multiclusteringresses
shortNames:
- mci
singular: multiclusteringress
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: MultiClusterIngress is a collection of rules that allow inbound
connections to reach the endpoints defined by a backend. The structure of
MultiClusterIngress is same as Ingress, indicates the Ingress in multi-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 is the desired state of the MultiClusterIngress.
properties:
defaultBackend:
description: DefaultBackend is the backend that should handle requests
that don't match any rule. If Rules are not specified, DefaultBackend
must be specified. If DefaultBackend is not set, the handling of
requests that do not match any of the rules will be up to the Ingress
controller.
properties:
resource:
description: Resource is an ObjectRef to another Kubernetes resource
in the namespace of the Ingress object. If resource is specified,
a service.Name and service.Port must not be specified. This
is a mutually exclusive setting with "Service".
properties:
apiGroup:
description: APIGroup is the group for the resource being
referenced. If APIGroup is not specified, the specified
Kind must be in the core API group. For any other third-party
types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource being referenced
type: string
name:
description: Name is the name of resource being referenced
type: string
required:
- kind
- name
type: object
service:
description: Service references a Service as a Backend. This is
a mutually exclusive setting with "Resource".
properties:
name:
description: Name is the referenced service. The service must
exist in the same namespace as the Ingress object.
type: string
port:
description: Port of the referenced service. A port name or
port number is required for a IngressServiceBackend.
properties:
name:
description: Name is the name of the port on the Service.
This is a mutually exclusive setting with "Number".
type: string
number:
description: Number is the numerical port number (e.g.
80) on the Service. This is a mutually exclusive setting
with "Name".
format: int32
type: integer
type: object
required:
- name
type: object
type: object
ingressClassName:
description: IngressClassName is the name of the IngressClass cluster
resource. The associated IngressClass defines which controller will
implement the resource. This replaces the deprecated `kubernetes.io/ingress.class`
annotation. For backwards compatibility, when that annotation is
set, it must be given precedence over this field. The controller
may emit a warning if the field and annotation have different values.
Implementations of this API should ignore Ingresses without a class
specified. An IngressClass resource may be marked as default, which
can be used to set a default value for this field. For more information,
refer to the IngressClass documentation.
type: string
rules:
description: A list of host rules used to configure the Ingress. If
unspecified, or no rule matches, all traffic is sent to the default
backend.
items:
description: IngressRule represents the rules mapping the paths
under a specified host to the related backend services. Incoming
requests are first evaluated for a host match, then routed to
the backend associated with the matching IngressRuleValue.
properties:
host:
description: "Host is the fully qualified domain name of a network
host, as defined by RFC 3986. Note the following deviations
from the \"host\" part of the URI as defined in RFC 3986:
1. IPs are not allowed. Currently an IngressRuleValue can
only apply to the IP in the Spec of the parent Ingress.
2. The `:` delimiter is not respected because ports are not
allowed. \t Currently the port of an Ingress is implicitly
:80 for http and \t :443 for https. Both these may change
in the future. Incoming requests are matched against the host
before the IngressRuleValue. If the host is unspecified, the
Ingress routes all traffic based on the specified IngressRuleValue.
\n Host can be \"precise\" which is a domain name without
the terminating dot of a network host (e.g. \"foo.bar.com\")
or \"wildcard\", which is a domain name prefixed with a single
wildcard label (e.g. \"*.foo.com\"). The wildcard character
'*' must appear by itself as the first DNS label and matches
only a single label. You cannot have a wildcard label by itself
(e.g. Host == \"*\"). Requests will be matched against the
Host field in the following way: 1. If Host is precise, the
request matches this rule if the http host header is equal
to Host. 2. If Host is a wildcard, then the request matches
this rule if the http host header is to equal to the suffix
(removing the first label) of the wildcard rule."
type: string
http:
description: 'HTTPIngressRuleValue is a list of http selectors
pointing to backends. In the example: http://<host>/<path>?<searchpart>
-> backend where where parts of the url correspond to RFC
3986, this resource will be used to match against everything
after the last ''/'' and before the first ''?'' or ''#''.'
properties:
paths:
description: A collection of paths that map requests to
backends.
items:
description: HTTPIngressPath associates a path with a
backend. Incoming urls matching the path are forwarded
to the backend.
properties:
backend:
description: Backend defines the referenced service
endpoint to which the traffic will be forwarded
to.
properties:
resource:
description: Resource is an ObjectRef to another
Kubernetes resource in the namespace of the
Ingress object. If resource is specified, a
service.Name and service.Port must not be specified.
This is a mutually exclusive setting with "Service".
properties:
apiGroup:
description: APIGroup is the group for the
resource being referenced. If APIGroup is
not specified, the specified Kind must be
in the core API group. For any other third-party
types, APIGroup is required.
type: string
kind:
description: Kind is the type of resource
being referenced
type: string
name:
description: Name is the name of resource
being referenced
type: string
required:
- kind
- name
type: object
service:
description: Service references a Service as a
Backend. This is a mutually exclusive setting
with "Resource".
properties:
name:
description: Name is the referenced service.
The service must exist in the same namespace
as the Ingress object.
type: string
port:
description: Port of the referenced service.
A port name or port number is required for
a IngressServiceBackend.
properties:
name:
description: Name is the name of the port
on the Service. This is a mutually exclusive
setting with "Number".
type: string
number:
description: Number is the numerical port
number (e.g. 80) on the Service. This
is a mutually exclusive setting with
"Name".
format: int32
type: integer
type: object
required:
- name
type: object
type: object
path:
description: Path is matched against the path of an
incoming request. Currently it can contain characters
disallowed from the conventional "path" part of
a URL as defined by RFC 3986. Paths must begin with
a '/' and must be present when using PathType with
value "Exact" or "Prefix".
type: string
pathType:
description: 'PathType determines the interpretation
of the Path matching. PathType can be one of the
following values: * Exact: Matches the URL path
exactly. * Prefix: Matches based on a URL path prefix
split by ''/''. Matching is done on a path element
by element basis. A path element refers is the list
of labels in the path split by the ''/'' separator.
A request is a match for path p if every p is
an element-wise prefix of p of the request path.
Note that if the last element of the path is a substring of
the last element in request path, it is not a match
(e.g. /foo/bar matches /foo/bar/baz, but does
not match /foo/barbaz). * ImplementationSpecific:
Interpretation of the Path matching is up to the
IngressClass. Implementations can treat this as
a separate PathType or treat it identically to
Prefix or Exact path types. Implementations are
required to support all path types.'
type: string
required:
- backend
- pathType
type: object
type: array
x-kubernetes-list-type: atomic
required:
- paths
type: object
type: object
type: array
x-kubernetes-list-type: atomic
tls:
description: TLS configuration. Currently the Ingress only supports
a single TLS port, 443. If multiple members of this list specify
different hosts, they will be multiplexed on the same port according
to the hostname specified through the SNI TLS extension, if the
ingress controller fulfilling the ingress supports SNI.
items:
description: IngressTLS describes the transport layer security associated
with an Ingress.
properties:
hosts:
description: Hosts are a list of hosts included in the TLS certificate.
The values in this list must match the name/s used in the
tlsSecret. Defaults to the wildcard host setting for the loadbalancer
controller fulfilling this Ingress, if left unspecified.
items:
type: string
type: array
x-kubernetes-list-type: atomic
secretName:
description: SecretName is the name of the secret used to terminate
TLS traffic on port 443. Field is left optional to allow TLS
routing based on SNI hostname alone. If the SNI host in a
listener conflicts with the "Host" header field used by an
IngressRule, the SNI host is used for termination and value
of the Host header is used for routing.
type: string
type: object
type: array
x-kubernetes-list-type: atomic
type: object
status:
description: Status is the current state of the MultiClusterIngress.
properties:
loadBalancer:
description: LoadBalancer contains the current status of the load-balancer.
properties:
ingress:
description: Ingress is a list containing ingress points for the
load-balancer. Traffic intended for the service should be sent
to these ingress points.
items:
description: 'LoadBalancerIngress represents the status of a
load-balancer ingress point: traffic intended for the service
should be sent to an ingress point.'
properties:
hostname:
description: Hostname is set for load-balancer ingress points
that are DNS based (typically AWS load-balancers)
type: string
ip:
description: IP is set for load-balancer ingress points
that are IP based (typically GCE or OpenStack load-balancers)
type: string
ports:
description: Ports is a list of records of service ports
If used, every port defined in the service should have
an entry in it
items:
properties:
error:
description: 'Error is to record the problem with
the service port The format of the error shall comply
with the following rules: - built-in error values
shall be specified in this file and those shall
use CamelCase names - cloud provider specific
error values must have names that comply with the format
foo.example.com/CamelCase. --- The regex it matches
is (dns1123SubdomainFmt/)?(qualifiedNameFmt)'
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
port:
description: Port is the port number of the service
port of which status is recorded here
format: int32
type: integer
protocol:
default: TCP
description: 'Protocol is the protocol of the service
port of which status is recorded here The supported
values are: "TCP", "UDP", "SCTP"'
type: string
required:
- port
- protocol
type: object
type: array
x-kubernetes-list-type: atomic
type: object
type: array
type: object
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -9,6 +9,7 @@ resources:
- bases/work.karmada.io_clusterresourcebindings.yaml
- bases/work.karmada.io_works.yaml
- bases/config.karmada.io_resourceinterpreterwebhookconfigurations.yaml
- bases/networking.karmada.io_multiclusteringresses.yaml
patchesStrategicMerge:
- patches/webhook_in_resourcebindings.yaml

View File

@ -43,6 +43,11 @@ deepcopy-gen \
--input-dirs=github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
--output-package=github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
--output-file-base=zz_generated.deepcopy
deepcopy-gen \
--go-header-file hack/boilerplate/boilerplate.go.txt \
--input-dirs=github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1 \
--output-package=github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1 \
--output-file-base=zz_generated.deepcopy
deepcopy-gen \
--go-header-file hack/boilerplate/boilerplate.go.txt \
--input-dirs=github.com/karmada-io/karmada/examples/customresourceinterpreter/apis/workload/v1alpha1 \
@ -76,6 +81,11 @@ register-gen \
--input-dirs=github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
--output-package=github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
--output-file-base=zz_generated.register
register-gen \
--go-header-file hack/boilerplate/boilerplate.go.txt \
--input-dirs=github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1 \
--output-package=github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1 \
--output-file-base=zz_generated.register
register-gen \
--go-header-file hack/boilerplate/boilerplate.go.txt \
--input-dirs=github.com/karmada-io/karmada/examples/customresourceinterpreter/apis/workload/v1alpha1 \
@ -95,7 +105,7 @@ GO111MODULE=on go install k8s.io/code-generator/cmd/client-gen
client-gen \
--go-header-file hack/boilerplate/boilerplate.go.txt \
--input-base="" \
--input=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1,github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2,github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
--input=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1,github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2,github.com/karmada-io/karmada/pkg/apis/config/v1alpha1,github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1 \
--output-package=github.com/karmada-io/karmada/pkg/generated/clientset \
--clientset-name=versioned
@ -103,14 +113,14 @@ echo "Generating with lister-gen"
GO111MODULE=on go install k8s.io/code-generator/cmd/lister-gen
lister-gen \
--go-header-file hack/boilerplate/boilerplate.go.txt \
--input-dirs=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1,github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2,github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
--input-dirs=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1,github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2,github.com/karmada-io/karmada/pkg/apis/config/v1alpha1,github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1 \
--output-package=github.com/karmada-io/karmada/pkg/generated/listers
echo "Generating with informer-gen"
GO111MODULE=on go install k8s.io/code-generator/cmd/informer-gen
informer-gen \
--go-header-file hack/boilerplate/boilerplate.go.txt \
--input-dirs=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1,github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2,github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
--input-dirs=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1,github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2,github.com/karmada-io/karmada/pkg/apis/config/v1alpha1,github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1 \
--versioned-clientset-package=github.com/karmada-io/karmada/pkg/generated/clientset/versioned \
--listers-package=github.com/karmada-io/karmada/pkg/generated/listers \
--output-package=github.com/karmada-io/karmada/pkg/generated/informers

View File

@ -16,4 +16,5 @@ util::install_tools ${CONTROLLER_GEN_PKG} ${CONTROLLER_GEN_VER} >/dev/null 2>&1
controller-gen crd paths=./pkg/apis/config/... output:crd:dir=./charts/_crds/bases
controller-gen crd paths=./pkg/apis/policy/... output:crd:dir=./charts/_crds/bases
controller-gen crd paths=./pkg/apis/work/... output:crd:dir=./charts/_crds/bases
controller-gen crd paths=./pkg/apis/networking/... output:crd:dir=./charts/_crds/bases
controller-gen crd paths=./examples/customresourceinterpreter/apis/... output:crd:dir=./examples/customresourceinterpreter/apis/

View File

@ -0,0 +1,4 @@
// Package v1alpha1 is the v1alpha1 version of the API.
// +k8s:deepcopy-gen=package,register
// +groupName=networking.karmada.io
package v1alpha1

View File

@ -0,0 +1,38 @@
package v1alpha1
import (
networkingv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=mci
// MultiClusterIngress is a collection of rules that allow inbound connections to reach the
// endpoints defined by a backend. The structure of MultiClusterIngress is same as Ingress,
// indicates the Ingress in multi-clusters.
type MultiClusterIngress struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec is the desired state of the MultiClusterIngress.
// +optional
Spec networkingv1.IngressSpec `json:"spec,omitempty"`
// Status is the current state of the MultiClusterIngress.
// +optional
Status networkingv1.IngressStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// MultiClusterIngressList is a collection of MultiClusterIngress.
type MultiClusterIngressList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// Items is the list of MultiClusterIngress.
Items []MultiClusterIngress `json:"items"`
}

View File

@ -0,0 +1,71 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1alpha1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MultiClusterIngress) DeepCopyInto(out *MultiClusterIngress) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MultiClusterIngress.
func (in *MultiClusterIngress) DeepCopy() *MultiClusterIngress {
if in == nil {
return nil
}
out := new(MultiClusterIngress)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *MultiClusterIngress) 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 *MultiClusterIngressList) DeepCopyInto(out *MultiClusterIngressList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]MultiClusterIngress, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MultiClusterIngressList.
func (in *MultiClusterIngressList) DeepCopy() *MultiClusterIngressList {
if in == nil {
return nil
}
out := new(MultiClusterIngressList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *MultiClusterIngressList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

View File

@ -0,0 +1,51 @@
// Code generated by register-gen. DO NOT EDIT.
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// GroupName specifies the group name used to register the objects.
const GroupName = "networking.karmada.io"
// GroupVersion specifies the group and the version used to register the objects.
var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"}
// SchemeGroupVersion is group version used to register these objects
// Deprecated: use GroupVersion instead.
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
SchemeBuilder runtime.SchemeBuilder
localSchemeBuilder = &SchemeBuilder
// Depreciated: use Install instead
AddToScheme = localSchemeBuilder.AddToScheme
Install = localSchemeBuilder.AddToScheme
)
func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addKnownTypes)
}
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&MultiClusterIngress{},
&MultiClusterIngressList{},
)
// AddToGroupVersion allows the serialization of client types like ListOptions.
v1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

View File

@ -8,6 +8,7 @@ import (
clusterv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/cluster/v1alpha1"
configv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/config/v1alpha1"
networkingv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/networking/v1alpha1"
policyv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/policy/v1alpha1"
workv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/work/v1alpha1"
workv1alpha2 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/work/v1alpha2"
@ -20,6 +21,7 @@ type Interface interface {
Discovery() discovery.DiscoveryInterface
ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface
ConfigV1alpha1() configv1alpha1.ConfigV1alpha1Interface
NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface
PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface
WorkV1alpha1() workv1alpha1.WorkV1alpha1Interface
WorkV1alpha2() workv1alpha2.WorkV1alpha2Interface
@ -29,11 +31,12 @@ type Interface interface {
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
clusterV1alpha1 *clusterv1alpha1.ClusterV1alpha1Client
configV1alpha1 *configv1alpha1.ConfigV1alpha1Client
policyV1alpha1 *policyv1alpha1.PolicyV1alpha1Client
workV1alpha1 *workv1alpha1.WorkV1alpha1Client
workV1alpha2 *workv1alpha2.WorkV1alpha2Client
clusterV1alpha1 *clusterv1alpha1.ClusterV1alpha1Client
configV1alpha1 *configv1alpha1.ConfigV1alpha1Client
networkingV1alpha1 *networkingv1alpha1.NetworkingV1alpha1Client
policyV1alpha1 *policyv1alpha1.PolicyV1alpha1Client
workV1alpha1 *workv1alpha1.WorkV1alpha1Client
workV1alpha2 *workv1alpha2.WorkV1alpha2Client
}
// ClusterV1alpha1 retrieves the ClusterV1alpha1Client
@ -46,6 +49,11 @@ func (c *Clientset) ConfigV1alpha1() configv1alpha1.ConfigV1alpha1Interface {
return c.configV1alpha1
}
// NetworkingV1alpha1 retrieves the NetworkingV1alpha1Client
func (c *Clientset) NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface {
return c.networkingV1alpha1
}
// PolicyV1alpha1 retrieves the PolicyV1alpha1Client
func (c *Clientset) PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface {
return c.policyV1alpha1
@ -109,6 +117,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset,
if err != nil {
return nil, err
}
cs.networkingV1alpha1, err = networkingv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
cs.policyV1alpha1, err = policyv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
@ -144,6 +156,7 @@ func New(c rest.Interface) *Clientset {
var cs Clientset
cs.clusterV1alpha1 = clusterv1alpha1.New(c)
cs.configV1alpha1 = configv1alpha1.New(c)
cs.networkingV1alpha1 = networkingv1alpha1.New(c)
cs.policyV1alpha1 = policyv1alpha1.New(c)
cs.workV1alpha1 = workv1alpha1.New(c)
cs.workV1alpha2 = workv1alpha2.New(c)

View File

@ -8,6 +8,8 @@ import (
fakeclusterv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/cluster/v1alpha1/fake"
configv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/config/v1alpha1"
fakeconfigv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/config/v1alpha1/fake"
networkingv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/networking/v1alpha1"
fakenetworkingv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/networking/v1alpha1/fake"
policyv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/policy/v1alpha1"
fakepolicyv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/policy/v1alpha1/fake"
workv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/work/v1alpha1"
@ -81,6 +83,11 @@ func (c *Clientset) ConfigV1alpha1() configv1alpha1.ConfigV1alpha1Interface {
return &fakeconfigv1alpha1.FakeConfigV1alpha1{Fake: &c.Fake}
}
// NetworkingV1alpha1 retrieves the NetworkingV1alpha1Client
func (c *Clientset) NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface {
return &fakenetworkingv1alpha1.FakeNetworkingV1alpha1{Fake: &c.Fake}
}
// PolicyV1alpha1 retrieves the PolicyV1alpha1Client
func (c *Clientset) PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface {
return &fakepolicyv1alpha1.FakePolicyV1alpha1{Fake: &c.Fake}

View File

@ -5,6 +5,7 @@ package fake
import (
clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1"
configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1"
networkingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1"
policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
workv1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2"
@ -21,6 +22,7 @@ var codecs = serializer.NewCodecFactory(scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
clusterv1alpha1.AddToScheme,
configv1alpha1.AddToScheme,
networkingv1alpha1.AddToScheme,
policyv1alpha1.AddToScheme,
workv1alpha1.AddToScheme,
workv1alpha2.AddToScheme,

View File

@ -5,6 +5,7 @@ package scheme
import (
clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1"
configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1"
networkingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1"
policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
workv1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2"
@ -21,6 +22,7 @@ var ParameterCodec = runtime.NewParameterCodec(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
clusterv1alpha1.AddToScheme,
configv1alpha1.AddToScheme,
networkingv1alpha1.AddToScheme,
policyv1alpha1.AddToScheme,
workv1alpha1.AddToScheme,
workv1alpha2.AddToScheme,

View File

@ -0,0 +1,4 @@
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1alpha1

View File

@ -0,0 +1,4 @@
// Code generated by client-gen. DO NOT EDIT.
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,126 @@
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/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"
)
// FakeMultiClusterIngresses implements MultiClusterIngressInterface
type FakeMultiClusterIngresses struct {
Fake *FakeNetworkingV1alpha1
ns string
}
var multiclusteringressesResource = schema.GroupVersionResource{Group: "networking.karmada.io", Version: "v1alpha1", Resource: "multiclusteringresses"}
var multiclusteringressesKind = schema.GroupVersionKind{Group: "networking.karmada.io", Version: "v1alpha1", Kind: "MultiClusterIngress"}
// Get takes name of the multiClusterIngress, and returns the corresponding multiClusterIngress object, and an error if there is any.
func (c *FakeMultiClusterIngresses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MultiClusterIngress, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(multiclusteringressesResource, c.ns, name), &v1alpha1.MultiClusterIngress{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.MultiClusterIngress), err
}
// List takes label and field selectors, and returns the list of MultiClusterIngresses that match those selectors.
func (c *FakeMultiClusterIngresses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MultiClusterIngressList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(multiclusteringressesResource, multiclusteringressesKind, c.ns, opts), &v1alpha1.MultiClusterIngressList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.MultiClusterIngressList{ListMeta: obj.(*v1alpha1.MultiClusterIngressList).ListMeta}
for _, item := range obj.(*v1alpha1.MultiClusterIngressList).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 multiClusterIngresses.
func (c *FakeMultiClusterIngresses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(multiclusteringressesResource, c.ns, opts))
}
// Create takes the representation of a multiClusterIngress and creates it. Returns the server's representation of the multiClusterIngress, and an error, if there is any.
func (c *FakeMultiClusterIngresses) Create(ctx context.Context, multiClusterIngress *v1alpha1.MultiClusterIngress, opts v1.CreateOptions) (result *v1alpha1.MultiClusterIngress, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(multiclusteringressesResource, c.ns, multiClusterIngress), &v1alpha1.MultiClusterIngress{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.MultiClusterIngress), err
}
// Update takes the representation of a multiClusterIngress and updates it. Returns the server's representation of the multiClusterIngress, and an error, if there is any.
func (c *FakeMultiClusterIngresses) Update(ctx context.Context, multiClusterIngress *v1alpha1.MultiClusterIngress, opts v1.UpdateOptions) (result *v1alpha1.MultiClusterIngress, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(multiclusteringressesResource, c.ns, multiClusterIngress), &v1alpha1.MultiClusterIngress{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.MultiClusterIngress), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeMultiClusterIngresses) UpdateStatus(ctx context.Context, multiClusterIngress *v1alpha1.MultiClusterIngress, opts v1.UpdateOptions) (*v1alpha1.MultiClusterIngress, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(multiclusteringressesResource, "status", c.ns, multiClusterIngress), &v1alpha1.MultiClusterIngress{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.MultiClusterIngress), err
}
// Delete takes name of the multiClusterIngress and deletes it. Returns an error if one occurs.
func (c *FakeMultiClusterIngresses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(multiclusteringressesResource, c.ns, name, opts), &v1alpha1.MultiClusterIngress{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeMultiClusterIngresses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(multiclusteringressesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.MultiClusterIngressList{})
return err
}
// Patch applies the patch and returns the patched multiClusterIngress.
func (c *FakeMultiClusterIngresses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MultiClusterIngress, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(multiclusteringressesResource, c.ns, name, pt, data, subresources...), &v1alpha1.MultiClusterIngress{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.MultiClusterIngress), err
}

View File

@ -0,0 +1,24 @@
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/networking/v1alpha1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeNetworkingV1alpha1 struct {
*testing.Fake
}
func (c *FakeNetworkingV1alpha1) MultiClusterIngresses(namespace string) v1alpha1.MultiClusterIngressInterface {
return &FakeMultiClusterIngresses{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeNetworkingV1alpha1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -0,0 +1,5 @@
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
type MultiClusterIngressExpansion interface{}

View File

@ -0,0 +1,179 @@
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/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"
)
// MultiClusterIngressesGetter has a method to return a MultiClusterIngressInterface.
// A group's client should implement this interface.
type MultiClusterIngressesGetter interface {
MultiClusterIngresses(namespace string) MultiClusterIngressInterface
}
// MultiClusterIngressInterface has methods to work with MultiClusterIngress resources.
type MultiClusterIngressInterface interface {
Create(ctx context.Context, multiClusterIngress *v1alpha1.MultiClusterIngress, opts v1.CreateOptions) (*v1alpha1.MultiClusterIngress, error)
Update(ctx context.Context, multiClusterIngress *v1alpha1.MultiClusterIngress, opts v1.UpdateOptions) (*v1alpha1.MultiClusterIngress, error)
UpdateStatus(ctx context.Context, multiClusterIngress *v1alpha1.MultiClusterIngress, opts v1.UpdateOptions) (*v1alpha1.MultiClusterIngress, 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.MultiClusterIngress, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.MultiClusterIngressList, 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.MultiClusterIngress, err error)
MultiClusterIngressExpansion
}
// multiClusterIngresses implements MultiClusterIngressInterface
type multiClusterIngresses struct {
client rest.Interface
ns string
}
// newMultiClusterIngresses returns a MultiClusterIngresses
func newMultiClusterIngresses(c *NetworkingV1alpha1Client, namespace string) *multiClusterIngresses {
return &multiClusterIngresses{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the multiClusterIngress, and returns the corresponding multiClusterIngress object, and an error if there is any.
func (c *multiClusterIngresses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MultiClusterIngress, err error) {
result = &v1alpha1.MultiClusterIngress{}
err = c.client.Get().
Namespace(c.ns).
Resource("multiclusteringresses").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of MultiClusterIngresses that match those selectors.
func (c *multiClusterIngresses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MultiClusterIngressList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.MultiClusterIngressList{}
err = c.client.Get().
Namespace(c.ns).
Resource("multiclusteringresses").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested multiClusterIngresses.
func (c *multiClusterIngresses) 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().
Namespace(c.ns).
Resource("multiclusteringresses").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a multiClusterIngress and creates it. Returns the server's representation of the multiClusterIngress, and an error, if there is any.
func (c *multiClusterIngresses) Create(ctx context.Context, multiClusterIngress *v1alpha1.MultiClusterIngress, opts v1.CreateOptions) (result *v1alpha1.MultiClusterIngress, err error) {
result = &v1alpha1.MultiClusterIngress{}
err = c.client.Post().
Namespace(c.ns).
Resource("multiclusteringresses").
VersionedParams(&opts, scheme.ParameterCodec).
Body(multiClusterIngress).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a multiClusterIngress and updates it. Returns the server's representation of the multiClusterIngress, and an error, if there is any.
func (c *multiClusterIngresses) Update(ctx context.Context, multiClusterIngress *v1alpha1.MultiClusterIngress, opts v1.UpdateOptions) (result *v1alpha1.MultiClusterIngress, err error) {
result = &v1alpha1.MultiClusterIngress{}
err = c.client.Put().
Namespace(c.ns).
Resource("multiclusteringresses").
Name(multiClusterIngress.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(multiClusterIngress).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *multiClusterIngresses) UpdateStatus(ctx context.Context, multiClusterIngress *v1alpha1.MultiClusterIngress, opts v1.UpdateOptions) (result *v1alpha1.MultiClusterIngress, err error) {
result = &v1alpha1.MultiClusterIngress{}
err = c.client.Put().
Namespace(c.ns).
Resource("multiclusteringresses").
Name(multiClusterIngress.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(multiClusterIngress).
Do(ctx).
Into(result)
return
}
// Delete takes name of the multiClusterIngress and deletes it. Returns an error if one occurs.
func (c *multiClusterIngresses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("multiclusteringresses").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *multiClusterIngresses) 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().
Namespace(c.ns).
Resource("multiclusteringresses").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched multiClusterIngress.
func (c *multiClusterIngresses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MultiClusterIngress, err error) {
result = &v1alpha1.MultiClusterIngress{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("multiclusteringresses").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -0,0 +1,91 @@
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"net/http"
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1"
"github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme"
rest "k8s.io/client-go/rest"
)
type NetworkingV1alpha1Interface interface {
RESTClient() rest.Interface
MultiClusterIngressesGetter
}
// NetworkingV1alpha1Client is used to interact with features provided by the networking.karmada.io group.
type NetworkingV1alpha1Client struct {
restClient rest.Interface
}
func (c *NetworkingV1alpha1Client) MultiClusterIngresses(namespace string) MultiClusterIngressInterface {
return newMultiClusterIngresses(c, namespace)
}
// NewForConfig creates a new NetworkingV1alpha1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*NetworkingV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
httpClient, err := rest.HTTPClientFor(&config)
if err != nil {
return nil, err
}
return NewForConfigAndClient(&config, httpClient)
}
// NewForConfigAndClient creates a new NetworkingV1alpha1Client 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) (*NetworkingV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientForConfigAndClient(&config, h)
if err != nil {
return nil, err
}
return &NetworkingV1alpha1Client{client}, nil
}
// NewForConfigOrDie creates a new NetworkingV1alpha1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *NetworkingV1alpha1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new NetworkingV1alpha1Client for the given RESTClient.
func New(c rest.Interface) *NetworkingV1alpha1Client {
return &NetworkingV1alpha1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *NetworkingV1alpha1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -11,6 +11,7 @@ import (
cluster "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/cluster"
config "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/config"
internalinterfaces "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/internalinterfaces"
networking "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/networking"
policy "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/policy"
work "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/work"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -161,6 +162,7 @@ type SharedInformerFactory interface {
Cluster() cluster.Interface
Config() config.Interface
Networking() networking.Interface
Policy() policy.Interface
Work() work.Interface
}
@ -173,6 +175,10 @@ func (f *sharedInformerFactory) Config() config.Interface {
return config.New(f, f.namespace, f.tweakListOptions)
}
func (f *sharedInformerFactory) Networking() networking.Interface {
return networking.New(f, f.namespace, f.tweakListOptions)
}
func (f *sharedInformerFactory) Policy() policy.Interface {
return policy.New(f, f.namespace, f.tweakListOptions)
}

View File

@ -7,6 +7,7 @@ import (
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1"
configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1"
networkingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1"
policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
v1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2"
@ -48,6 +49,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case configv1alpha1.SchemeGroupVersion.WithResource("resourceinterpreterwebhookconfigurations"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1alpha1().ResourceInterpreterWebhookConfigurations().Informer()}, nil
// Group=networking.karmada.io, Version=v1alpha1
case networkingv1alpha1.SchemeGroupVersion.WithResource("multiclusteringresses"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha1().MultiClusterIngresses().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

View File

@ -0,0 +1,30 @@
// Code generated by informer-gen. DO NOT EDIT.
package networking
import (
internalinterfaces "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/networking/v1alpha1"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1alpha1 provides access to shared informers for resources in V1alpha1.
V1alpha1() v1alpha1.Interface
}
type group struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// V1alpha1 returns a new v1alpha1.Interface.
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
}

View File

@ -0,0 +1,29 @@
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
internalinterfaces "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// MultiClusterIngresses returns a MultiClusterIngressInformer.
MultiClusterIngresses() MultiClusterIngressInformer
}
type version struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// MultiClusterIngresses returns a MultiClusterIngressInformer.
func (v *version) MultiClusterIngresses() MultiClusterIngressInformer {
return &multiClusterIngressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}

View File

@ -0,0 +1,74 @@
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
time "time"
networkingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/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/networking/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"
)
// MultiClusterIngressInformer provides access to a shared informer and lister for
// MultiClusterIngresses.
type MultiClusterIngressInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.MultiClusterIngressLister
}
type multiClusterIngressInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewMultiClusterIngressInformer constructs a new informer for MultiClusterIngress 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 NewMultiClusterIngressInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredMultiClusterIngressInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredMultiClusterIngressInformer constructs a new informer for MultiClusterIngress 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 NewFilteredMultiClusterIngressInformer(client versioned.Interface, namespace string, 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.NetworkingV1alpha1().MultiClusterIngresses(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkingV1alpha1().MultiClusterIngresses(namespace).Watch(context.TODO(), options)
},
},
&networkingv1alpha1.MultiClusterIngress{},
resyncPeriod,
indexers,
)
}
func (f *multiClusterIngressInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredMultiClusterIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *multiClusterIngressInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&networkingv1alpha1.MultiClusterIngress{}, f.defaultInformer)
}
func (f *multiClusterIngressInformer) Lister() v1alpha1.MultiClusterIngressLister {
return v1alpha1.NewMultiClusterIngressLister(f.Informer().GetIndexer())
}

View File

@ -0,0 +1,11 @@
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
// MultiClusterIngressListerExpansion allows custom methods to be added to
// MultiClusterIngressLister.
type MultiClusterIngressListerExpansion interface{}
// MultiClusterIngressNamespaceListerExpansion allows custom methods to be added to
// MultiClusterIngressNamespaceLister.
type MultiClusterIngressNamespaceListerExpansion interface{}

View File

@ -0,0 +1,83 @@
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
import (
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// MultiClusterIngressLister helps list MultiClusterIngresses.
// All objects returned here must be treated as read-only.
type MultiClusterIngressLister interface {
// List lists all MultiClusterIngresses in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.MultiClusterIngress, err error)
// MultiClusterIngresses returns an object that can list and get MultiClusterIngresses.
MultiClusterIngresses(namespace string) MultiClusterIngressNamespaceLister
MultiClusterIngressListerExpansion
}
// multiClusterIngressLister implements the MultiClusterIngressLister interface.
type multiClusterIngressLister struct {
indexer cache.Indexer
}
// NewMultiClusterIngressLister returns a new MultiClusterIngressLister.
func NewMultiClusterIngressLister(indexer cache.Indexer) MultiClusterIngressLister {
return &multiClusterIngressLister{indexer: indexer}
}
// List lists all MultiClusterIngresses in the indexer.
func (s *multiClusterIngressLister) List(selector labels.Selector) (ret []*v1alpha1.MultiClusterIngress, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.MultiClusterIngress))
})
return ret, err
}
// MultiClusterIngresses returns an object that can list and get MultiClusterIngresses.
func (s *multiClusterIngressLister) MultiClusterIngresses(namespace string) MultiClusterIngressNamespaceLister {
return multiClusterIngressNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// MultiClusterIngressNamespaceLister helps list and get MultiClusterIngresses.
// All objects returned here must be treated as read-only.
type MultiClusterIngressNamespaceLister interface {
// List lists all MultiClusterIngresses in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.MultiClusterIngress, err error)
// Get retrieves the MultiClusterIngress from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha1.MultiClusterIngress, error)
MultiClusterIngressNamespaceListerExpansion
}
// multiClusterIngressNamespaceLister implements the MultiClusterIngressNamespaceLister
// interface.
type multiClusterIngressNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all MultiClusterIngresses in the indexer for a given namespace.
func (s multiClusterIngressNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MultiClusterIngress, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.MultiClusterIngress))
})
return ret, err
}
// Get retrieves the MultiClusterIngress from the indexer for a given namespace and name.
func (s multiClusterIngressNamespaceLister) Get(name string) (*v1alpha1.MultiClusterIngress, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("multiclusteringress"), name)
}
return obj.(*v1alpha1.MultiClusterIngress), nil
}