Merge pull request #899 from RainbowMango/pr_config_api
Add custom resource webhook API
This commit is contained in:
commit
36d6174b5f
|
@ -0,0 +1,203 @@
|
|||
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.6.2
|
||||
creationTimestamp: null
|
||||
name: resourceexploringwebhookconfigurations.config.karmada.io
|
||||
spec:
|
||||
group: config.karmada.io
|
||||
names:
|
||||
kind: ResourceExploringWebhookConfiguration
|
||||
listKind: ResourceExploringWebhookConfigurationList
|
||||
plural: resourceexploringwebhookconfigurations
|
||||
singular: resourceexploringwebhookconfiguration
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: ResourceExploringWebhookConfiguration describes the configuration
|
||||
of webhooks which take the responsibility to tell karmada the details of
|
||||
the resource object, especially for custom resources.
|
||||
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
|
||||
webhooks:
|
||||
description: Webhooks is a list of webhooks and the affected resources
|
||||
and operations.
|
||||
items:
|
||||
description: ResourceExploringWebhook describes the webhook as well
|
||||
as the resources and operations it applies to.
|
||||
properties:
|
||||
clientConfig:
|
||||
description: ClientConfig defines how to communicate with the hook.
|
||||
properties:
|
||||
caBundle:
|
||||
description: '`caBundle` is a PEM encoded CA bundle which will
|
||||
be used to validate the webhook''s server certificate. If
|
||||
unspecified, system trust roots on the apiserver are used.'
|
||||
format: byte
|
||||
type: string
|
||||
service:
|
||||
description: "`service` is a reference to the service for this
|
||||
webhook. Either `service` or `url` must be specified. \n If
|
||||
the webhook is running within the cluster, then you should
|
||||
use `service`."
|
||||
properties:
|
||||
name:
|
||||
description: '`name` is the name of the service. Required'
|
||||
type: string
|
||||
namespace:
|
||||
description: '`namespace` is the namespace of the service.
|
||||
Required'
|
||||
type: string
|
||||
path:
|
||||
description: '`path` is an optional URL path which will
|
||||
be sent in any request to this service.'
|
||||
type: string
|
||||
port:
|
||||
description: If specified, the port on the service that
|
||||
hosting webhook. Default to 443 for backward compatibility.
|
||||
`port` should be a valid port number (1-65535, inclusive).
|
||||
format: int32
|
||||
type: integer
|
||||
required:
|
||||
- name
|
||||
- namespace
|
||||
type: object
|
||||
url:
|
||||
description: "`url` gives the location of the webhook, in standard
|
||||
URL form (`scheme://host:port/path`). Exactly one of `url`
|
||||
or `service` must be specified. \n The `host` should not refer
|
||||
to a service running in the cluster; use the `service` field
|
||||
instead. The host might be resolved via external DNS in some
|
||||
apiservers (e.g., `kube-apiserver` cannot resolve in-cluster
|
||||
DNS as that would be a layering violation). `host` may also
|
||||
be an IP address. \n Please note that using `localhost` or
|
||||
`127.0.0.1` as a `host` is risky unless you take great care
|
||||
to run this webhook on all hosts which run an apiserver which
|
||||
might need to make calls to this webhook. Such installs are
|
||||
likely to be non-portable, i.e., not easy to turn up in a
|
||||
new cluster. \n The scheme must be \"https\"; the URL must
|
||||
begin with \"https://\". \n A path is optional, and if present
|
||||
may be any string permissible in a URL. You may use the path
|
||||
to pass an arbitrary string to the webhook, for example, a
|
||||
cluster identifier. \n Attempting to use a user or basic auth
|
||||
e.g. \"user:password@\" is not allowed. Fragments (\"#...\")
|
||||
and query parameters (\"?...\") are not allowed, either."
|
||||
type: string
|
||||
type: object
|
||||
exploreReviewVersions:
|
||||
description: ExploreReviewVersions is an ordered list of preferred
|
||||
`ExploreReview` versions the Webhook expects. Karmada will try
|
||||
to use first version in the list which it supports. If none of
|
||||
the versions specified in this list supported by Karmada, validation
|
||||
will fail for this object. If a persisted webhook configuration
|
||||
specifies allowed versions and does not include any versions known
|
||||
to the Karmada, calls to the webhook will fail and be subject
|
||||
to the failure policy.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
failurePolicy:
|
||||
description: FailurePolicy defines how unrecognized errors from
|
||||
the webhook are handled, allowed values are Ignore or Fail. Defaults
|
||||
to Fail.
|
||||
type: string
|
||||
name:
|
||||
description: Name is the full-qualified name of the webhook.
|
||||
type: string
|
||||
rules:
|
||||
description: Rules describes what operations on what resources the
|
||||
webhook cares about. The webhook cares about an operation if it
|
||||
matches any Rule.
|
||||
items:
|
||||
description: RuleWithOperations is a tuple of Operations and Resources.
|
||||
It is recommended to make sure that all the tuple expansions
|
||||
are valid.
|
||||
properties:
|
||||
apiGroups:
|
||||
description: APIGroups is the API groups the resources belong
|
||||
to. '*' is all groups. If '*' is present, the length of
|
||||
the slice must be one. Required.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
apiVersions:
|
||||
description: APIVersions is the API versions the resources
|
||||
belong to. '*' is all versions. If '*' is present, the length
|
||||
of the slice must be one. Required.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
operations:
|
||||
description: Operations is the operations the hook cares about.
|
||||
If '*' is present, the length of the slice must be one.
|
||||
items:
|
||||
description: OperationType specifies an operation for a
|
||||
request.
|
||||
type: string
|
||||
type: array
|
||||
resources:
|
||||
description: "Resources is a list of resources this rule applies
|
||||
to. \n For example: 'pods' means pods. 'pods/log' means
|
||||
the log subresource of pods. '*' means all resources, but
|
||||
not subresources. 'pods/*' means all subresources of pods.
|
||||
'*/scale' means all scale subresources. '*/*' means all
|
||||
resources and their subresources. \n If wildcard is present,
|
||||
the validation rule will ensure resources do not overlap
|
||||
with each other. \n Depending on the enclosing object, subresources
|
||||
might not be allowed. Required."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
scope:
|
||||
description: scope specifies the scope of this rule. Valid
|
||||
values are "Cluster", "Namespaced", and "*" "Cluster" means
|
||||
that only cluster-scoped resources will match this rule.
|
||||
Namespace API objects are cluster-scoped. "Namespaced" means
|
||||
that only namespaced resources will match this rule. "*"
|
||||
means that there are no scope restrictions. Subresources
|
||||
match the scope of their parent resource. Default is "*".
|
||||
type: string
|
||||
required:
|
||||
- operations
|
||||
type: object
|
||||
type: array
|
||||
timeoutSeconds:
|
||||
description: TimeoutSeconds specifies the timeout for this webhook.
|
||||
After the timeout passes, the webhook call will be ignored or
|
||||
the API call will fail based on the failure policy. The timeout
|
||||
value must be between 1 and 30 seconds. Default to 10 seconds.
|
||||
format: int32
|
||||
type: integer
|
||||
required:
|
||||
- clientConfig
|
||||
- exploreReviewVersions
|
||||
- name
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- webhooks
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
status:
|
||||
acceptedNames:
|
||||
kind: ""
|
||||
plural: ""
|
||||
conditions: []
|
||||
storedVersions: []
|
|
@ -10,6 +10,7 @@ resources:
|
|||
- bases/work.karmada.io_resourcebindings.yaml
|
||||
- bases/work.karmada.io_clusterresourcebindings.yaml
|
||||
- bases/work.karmada.io_works.yaml
|
||||
- bases/config.karmada.io_resourceexploringwebhookconfigurations.yaml
|
||||
|
||||
patchesStrategicMerge:
|
||||
- patches/webhook_in_resourcebindings.yaml
|
||||
|
|
|
@ -33,6 +33,11 @@ deepcopy-gen \
|
|||
--input-dirs=github.com/karmada-io/karmada/pkg/apis/work/v1alpha2 \
|
||||
--output-package=github.com/karmada-io/karmada/pkg/apis/work/v1alpha2 \
|
||||
--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/config/v1alpha1 \
|
||||
--output-package=github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
|
||||
--output-file-base=zz_generated.deepcopy
|
||||
|
||||
echo "Generating with register-gen"
|
||||
GO111MODULE=on go install k8s.io/code-generator/cmd/register-gen
|
||||
|
@ -56,13 +61,18 @@ register-gen \
|
|||
--input-dirs=github.com/karmada-io/karmada/pkg/apis/work/v1alpha2 \
|
||||
--output-package=github.com/karmada-io/karmada/pkg/apis/work/v1alpha2 \
|
||||
--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/config/v1alpha1 \
|
||||
--output-package=github.com/karmada-io/karmada/pkg/apis/config/v1alpha1 \
|
||||
--output-file-base=zz_generated.register
|
||||
|
||||
echo "Generating with client-gen"
|
||||
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 \
|
||||
--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 \
|
||||
--output-package=github.com/karmada-io/karmada/pkg/generated/clientset \
|
||||
--clientset-name=versioned
|
||||
|
||||
|
@ -70,14 +80,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 \
|
||||
--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 \
|
||||
--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 \
|
||||
--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 \
|
||||
--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
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
// Package v1alpha1 is the v1alpha1 version of the API.
|
||||
// +k8s:deepcopy-gen=package,register
|
||||
// +groupName=config.karmada.io
|
||||
package v1alpha1
|
|
@ -0,0 +1,133 @@
|
|||
package v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
|
||||
workv1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ExploreReview describes an explore review request and response.
|
||||
type ExploreReview struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
// Request describes the attributes for the explore request.
|
||||
// +optional
|
||||
Request *ExploreRequest `json:"request,omitempty"`
|
||||
|
||||
// Response describes the attributes for the explore response.
|
||||
// +optional
|
||||
Response *ExploreResponse `json:"response,omitempty"`
|
||||
}
|
||||
|
||||
// ExploreRequest describes the explore.Attributes for the explore request.
|
||||
type ExploreRequest struct {
|
||||
// UID is an identifier for the individual request/response.
|
||||
// The UID is meant to track the round trip (request/response) between the karmada and the WebHook, not the user request.
|
||||
// It is suitable for correlating log entries between the webhook and karmada, for either auditing or debugging.
|
||||
// +required
|
||||
UID types.UID `json:"uid"`
|
||||
|
||||
// Kind is the fully-qualified type of object being submitted (for example, v1.Pod or autoscaling.v1.Scale)
|
||||
// +required
|
||||
Kind metav1.GroupVersionKind `json:"kind"`
|
||||
|
||||
// Name is the name of the object as presented in the request.
|
||||
// +required
|
||||
Name string `json:"name"`
|
||||
|
||||
// Namespace is the namespace associated with the request (if any).
|
||||
// +optional
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
|
||||
// Operation is the operation being performed.
|
||||
// +required
|
||||
Operation OperationType `json:"operation"`
|
||||
|
||||
// Object is the object from the incoming request.
|
||||
// +optional
|
||||
Object runtime.RawExtension `json:"object,omitempty"`
|
||||
|
||||
// DesiredReplicas represents the desired pods number which webhook should revise with.
|
||||
// It'll be set only if OperationType is ExploreReplicaRevising.
|
||||
// +optional
|
||||
DesiredReplicas *int32 `json:"replicas,omitempty"`
|
||||
|
||||
// AggregatedStatus represents status list of the resource running in each member cluster.
|
||||
// +optional
|
||||
AggregatedStatus []workv1alpha1.AggregatedStatusItem `json:"aggregatedStatus,omitempty"`
|
||||
}
|
||||
|
||||
// ExploreResponse describes an explore response.
|
||||
type ExploreResponse struct {
|
||||
// UID is an identifier for the individual request/response.
|
||||
// This must be copied over from the corresponding ExploreRequest.
|
||||
// +required
|
||||
UID types.UID `json:"uid"`
|
||||
|
||||
// The patch body. We only support "JSONPatch" currently which implements RFC 6902.
|
||||
// +optional
|
||||
Patch []byte `json:"patch,omitempty"`
|
||||
|
||||
// The type of Patch. We only allow "JSONPatch" currently.
|
||||
// +optional
|
||||
PatchType *PatchType `json:"patchType,omitempty" protobuf:"bytes,5,opt,name=patchType"`
|
||||
|
||||
// ReplicaRequirements represents the requirements required by each replica.
|
||||
// Required if OperationType is ExploreReplica.
|
||||
// +optional
|
||||
ReplicaRequirements *workv1alpha2.ReplicaRequirements `json:"replicaRequirements,omitempty"`
|
||||
|
||||
// Replicas represents the number of desired pods. This is a pointer to distinguish between explicit
|
||||
// zero and not specified.
|
||||
// Required if OperationType is ExploreReplica.
|
||||
// +optional
|
||||
Replicas *int32 `json:"replicas,omitempty"`
|
||||
|
||||
// Dependencies represents the reference of dependencies object.
|
||||
// Required if OperationType is ExploreDependencies.
|
||||
// +optional
|
||||
Dependencies []DependentObjectReference `json:"dependencies,omitempty"`
|
||||
|
||||
// Status represents the referencing object's status.
|
||||
// +optional
|
||||
Status *runtime.RawExtension `json:"status,omitempty"`
|
||||
|
||||
// Healthy represents the referencing object's healthy status.
|
||||
// +optional
|
||||
Healthy *bool `json:"healthy,omitempty"`
|
||||
}
|
||||
|
||||
// PatchType is the type of patch being used to represent the mutated object
|
||||
type PatchType string
|
||||
|
||||
const (
|
||||
// PatchTypeJSONPatch represents the JSONType.
|
||||
PatchTypeJSONPatch PatchType = "JSONPatch"
|
||||
)
|
||||
|
||||
// DependentObjectReference contains enough information to locate the referenced object inside current cluster.
|
||||
type DependentObjectReference struct {
|
||||
// APIVersion represents the API version of the referent.
|
||||
// +required
|
||||
APIVersion string `json:"apiVersion"`
|
||||
|
||||
// Kind represents the Kind of the referent.
|
||||
// +required
|
||||
Kind string `json:"kind"`
|
||||
|
||||
// Namespace represents the namespace for the referent.
|
||||
// For non-namespace scoped resources(e.g. 'ClusterRole'),do not need specify Namespace,
|
||||
// and for namespace scoped resources, Namespace is required.
|
||||
// If Namespace is not specified, means the resource is non-namespace scoped.
|
||||
// +optional
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
|
||||
// Name represents the name of the referent.
|
||||
// +required
|
||||
Name string `json:"name"`
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package v1alpha1
|
||||
|
||||
import (
|
||||
admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +kubebuilder:storageversion
|
||||
|
||||
// ResourceExploringWebhookConfiguration describes the configuration of webhooks which take the responsibility to
|
||||
// tell karmada the details of the resource object, especially for custom resources.
|
||||
type ResourceExploringWebhookConfiguration struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Webhooks is a list of webhooks and the affected resources and operations.
|
||||
// +required
|
||||
Webhooks []ResourceExploringWebhook `json:"webhooks"`
|
||||
}
|
||||
|
||||
// ResourceExploringWebhook describes the webhook as well as the resources and operations it applies to.
|
||||
type ResourceExploringWebhook struct {
|
||||
// Name is the full-qualified name of the webhook.
|
||||
// +required
|
||||
Name string `json:"name"`
|
||||
|
||||
// ClientConfig defines how to communicate with the hook.
|
||||
// +required
|
||||
ClientConfig admissionregistrationv1.WebhookClientConfig `json:"clientConfig"`
|
||||
|
||||
// Rules describes what operations on what resources the webhook cares about.
|
||||
// The webhook cares about an operation if it matches any Rule.
|
||||
// +optional
|
||||
Rules []RuleWithOperations `json:"rules,omitempty"`
|
||||
|
||||
// FailurePolicy defines how unrecognized errors from the webhook are handled,
|
||||
// allowed values are Ignore or Fail. Defaults to Fail.
|
||||
// +optional
|
||||
FailurePolicy *admissionregistrationv1.FailurePolicyType `json:"failurePolicy,omitempty"`
|
||||
|
||||
// TimeoutSeconds specifies the timeout for this webhook. After the timeout passes,
|
||||
// the webhook call will be ignored or the API call will fail based on the
|
||||
// failure policy.
|
||||
// The timeout value must be between 1 and 30 seconds.
|
||||
// Default to 10 seconds.
|
||||
// +optional
|
||||
TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"`
|
||||
|
||||
// ExploreReviewVersions is an ordered list of preferred `ExploreReview`
|
||||
// versions the Webhook expects. Karmada will try to use first version in
|
||||
// the list which it supports. If none of the versions specified in this list
|
||||
// supported by Karmada, validation will fail for this object.
|
||||
// If a persisted webhook configuration specifies allowed versions and does not
|
||||
// include any versions known to the Karmada, calls to the webhook will fail
|
||||
// and be subject to the failure policy.
|
||||
ExploreReviewVersions []string `json:"exploreReviewVersions"`
|
||||
}
|
||||
|
||||
// RuleWithOperations is a tuple of Operations and Resources. It is recommended to make
|
||||
// sure that all the tuple expansions are valid.
|
||||
type RuleWithOperations struct {
|
||||
// Operations is the operations the hook cares about.
|
||||
// If '*' is present, the length of the slice must be one.
|
||||
// +required
|
||||
Operations []OperationType `json:"operations"`
|
||||
|
||||
// Rule is embedded, it describes other criteria of the rule, like
|
||||
// APIGroups, APIVersions, Resources, etc.
|
||||
admissionregistrationv1.Rule `json:",inline"`
|
||||
}
|
||||
|
||||
// OperationType specifies an operation for a request.
|
||||
type OperationType string
|
||||
|
||||
const (
|
||||
// ExploreReplica indicates that karmada want to figure out the replica declaration of a specific object.
|
||||
// Only necessary for those resource types that have replica declaration, like Deployment or similar custom resources.
|
||||
ExploreReplica OperationType = "ExploreReplica"
|
||||
|
||||
// ExploreStatus indicates that karmada want to figure out how to get the status.
|
||||
// Only necessary for those resource types that define their status in a special path(not '.status').
|
||||
ExploreStatus OperationType = "ExploreStatus"
|
||||
|
||||
// ExplorePacking indicates that karmada want to figure out how to package resource template to Work.
|
||||
ExplorePacking OperationType = "ExplorePacking"
|
||||
|
||||
// ExploreReplicaRevising indicates that karmada request webhook to modify the replica.
|
||||
ExploreReplicaRevising OperationType = "ExploreReplicaRevising"
|
||||
|
||||
// ExploreRetaining indicates that karmada request webhook to retain the desired resource template.
|
||||
// Only necessary for those resources which specification will be updated by their controllers running in member cluster.
|
||||
ExploreRetaining OperationType = "ExploreRetaining"
|
||||
|
||||
// ExploreStatusAggregating indicates that karmada want to figure out how to aggregate status to resource template.
|
||||
// Only necessary for those resource types that want to aggregate status to resource template.
|
||||
ExploreStatusAggregating OperationType = "ExploreStatusAggregating"
|
||||
|
||||
// ExploreHealthy indicates that karmada want to figure out the healthy status of a specific object.
|
||||
// Only necessary for those resource types that have and want to reflect their healthy status.
|
||||
ExploreHealthy OperationType = "ExploreHealthy"
|
||||
|
||||
// ExploreDependencies indicates that karmada want to figure out the dependencies of a specific object.
|
||||
// Only necessary for those resource types that have dependencies resources and expect the dependencies be propagated
|
||||
// together, like Deployment depends on ConfigMap/Secret.
|
||||
ExploreDependencies OperationType = "ExploreDependencies"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ResourceExploringWebhookConfigurationList contains a list of ResourceExploringWebhookConfiguration.
|
||||
type ResourceExploringWebhookConfigurationList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
|
||||
// Items holds a list of ResourceExploringWebhookConfiguration.
|
||||
Items []ResourceExploringWebhookConfiguration `json:"items"`
|
||||
}
|
|
@ -0,0 +1,271 @@
|
|||
// +build !ignore_autogenerated
|
||||
|
||||
// Code generated by deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
|
||||
v1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2"
|
||||
v1 "k8s.io/api/admissionregistration/v1"
|
||||
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 *DependentObjectReference) DeepCopyInto(out *DependentObjectReference) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DependentObjectReference.
|
||||
func (in *DependentObjectReference) DeepCopy() *DependentObjectReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DependentObjectReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ExploreRequest) DeepCopyInto(out *ExploreRequest) {
|
||||
*out = *in
|
||||
out.Kind = in.Kind
|
||||
in.Object.DeepCopyInto(&out.Object)
|
||||
if in.DesiredReplicas != nil {
|
||||
in, out := &in.DesiredReplicas, &out.DesiredReplicas
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.AggregatedStatus != nil {
|
||||
in, out := &in.AggregatedStatus, &out.AggregatedStatus
|
||||
*out = make([]workv1alpha1.AggregatedStatusItem, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExploreRequest.
|
||||
func (in *ExploreRequest) DeepCopy() *ExploreRequest {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ExploreRequest)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ExploreResponse) DeepCopyInto(out *ExploreResponse) {
|
||||
*out = *in
|
||||
if in.Patch != nil {
|
||||
in, out := &in.Patch, &out.Patch
|
||||
*out = make([]byte, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.PatchType != nil {
|
||||
in, out := &in.PatchType, &out.PatchType
|
||||
*out = new(PatchType)
|
||||
**out = **in
|
||||
}
|
||||
if in.ReplicaRequirements != nil {
|
||||
in, out := &in.ReplicaRequirements, &out.ReplicaRequirements
|
||||
*out = new(v1alpha2.ReplicaRequirements)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Replicas != nil {
|
||||
in, out := &in.Replicas, &out.Replicas
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.Dependencies != nil {
|
||||
in, out := &in.Dependencies, &out.Dependencies
|
||||
*out = make([]DependentObjectReference, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Status != nil {
|
||||
in, out := &in.Status, &out.Status
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Healthy != nil {
|
||||
in, out := &in.Healthy, &out.Healthy
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExploreResponse.
|
||||
func (in *ExploreResponse) DeepCopy() *ExploreResponse {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ExploreResponse)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ExploreReview) DeepCopyInto(out *ExploreReview) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
if in.Request != nil {
|
||||
in, out := &in.Request, &out.Request
|
||||
*out = new(ExploreRequest)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Response != nil {
|
||||
in, out := &in.Response, &out.Response
|
||||
*out = new(ExploreResponse)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExploreReview.
|
||||
func (in *ExploreReview) DeepCopy() *ExploreReview {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ExploreReview)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ExploreReview) 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 *ResourceExploringWebhook) DeepCopyInto(out *ResourceExploringWebhook) {
|
||||
*out = *in
|
||||
in.ClientConfig.DeepCopyInto(&out.ClientConfig)
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]RuleWithOperations, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.FailurePolicy != nil {
|
||||
in, out := &in.FailurePolicy, &out.FailurePolicy
|
||||
*out = new(v1.FailurePolicyType)
|
||||
**out = **in
|
||||
}
|
||||
if in.TimeoutSeconds != nil {
|
||||
in, out := &in.TimeoutSeconds, &out.TimeoutSeconds
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.ExploreReviewVersions != nil {
|
||||
in, out := &in.ExploreReviewVersions, &out.ExploreReviewVersions
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceExploringWebhook.
|
||||
func (in *ResourceExploringWebhook) DeepCopy() *ResourceExploringWebhook {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourceExploringWebhook)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceExploringWebhookConfiguration) DeepCopyInto(out *ResourceExploringWebhookConfiguration) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Webhooks != nil {
|
||||
in, out := &in.Webhooks, &out.Webhooks
|
||||
*out = make([]ResourceExploringWebhook, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceExploringWebhookConfiguration.
|
||||
func (in *ResourceExploringWebhookConfiguration) DeepCopy() *ResourceExploringWebhookConfiguration {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourceExploringWebhookConfiguration)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ResourceExploringWebhookConfiguration) 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 *ResourceExploringWebhookConfigurationList) DeepCopyInto(out *ResourceExploringWebhookConfigurationList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ResourceExploringWebhookConfiguration, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceExploringWebhookConfigurationList.
|
||||
func (in *ResourceExploringWebhookConfigurationList) DeepCopy() *ResourceExploringWebhookConfigurationList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourceExploringWebhookConfigurationList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ResourceExploringWebhookConfigurationList) 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 *RuleWithOperations) DeepCopyInto(out *RuleWithOperations) {
|
||||
*out = *in
|
||||
if in.Operations != nil {
|
||||
in, out := &in.Operations, &out.Operations
|
||||
*out = make([]OperationType, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
in.Rule.DeepCopyInto(&out.Rule)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleWithOperations.
|
||||
func (in *RuleWithOperations) DeepCopy() *RuleWithOperations {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RuleWithOperations)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
// 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 = "config.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,
|
||||
&ExploreReview{},
|
||||
&ResourceExploringWebhookConfiguration{},
|
||||
&ResourceExploringWebhookConfigurationList{},
|
||||
)
|
||||
// AddToGroupVersion allows the serialization of client types like ListOptions.
|
||||
v1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
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"
|
||||
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"
|
||||
|
@ -17,6 +18,7 @@ import (
|
|||
type Interface interface {
|
||||
Discovery() discovery.DiscoveryInterface
|
||||
ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface
|
||||
ConfigV1alpha1() configv1alpha1.ConfigV1alpha1Interface
|
||||
PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface
|
||||
WorkV1alpha1() workv1alpha1.WorkV1alpha1Interface
|
||||
WorkV1alpha2() workv1alpha2.WorkV1alpha2Interface
|
||||
|
@ -27,6 +29,7 @@ type Interface interface {
|
|||
type Clientset struct {
|
||||
*discovery.DiscoveryClient
|
||||
clusterV1alpha1 *clusterv1alpha1.ClusterV1alpha1Client
|
||||
configV1alpha1 *configv1alpha1.ConfigV1alpha1Client
|
||||
policyV1alpha1 *policyv1alpha1.PolicyV1alpha1Client
|
||||
workV1alpha1 *workv1alpha1.WorkV1alpha1Client
|
||||
workV1alpha2 *workv1alpha2.WorkV1alpha2Client
|
||||
|
@ -37,6 +40,11 @@ func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface {
|
|||
return c.clusterV1alpha1
|
||||
}
|
||||
|
||||
// ConfigV1alpha1 retrieves the ConfigV1alpha1Client
|
||||
func (c *Clientset) ConfigV1alpha1() configv1alpha1.ConfigV1alpha1Interface {
|
||||
return c.configV1alpha1
|
||||
}
|
||||
|
||||
// PolicyV1alpha1 retrieves the PolicyV1alpha1Client
|
||||
func (c *Clientset) PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface {
|
||||
return c.policyV1alpha1
|
||||
|
@ -77,6 +85,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.configV1alpha1, err = configv1alpha1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cs.policyV1alpha1, err = policyv1alpha1.NewForConfig(&configShallowCopy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -102,6 +114,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
|
|||
func NewForConfigOrDie(c *rest.Config) *Clientset {
|
||||
var cs Clientset
|
||||
cs.clusterV1alpha1 = clusterv1alpha1.NewForConfigOrDie(c)
|
||||
cs.configV1alpha1 = configv1alpha1.NewForConfigOrDie(c)
|
||||
cs.policyV1alpha1 = policyv1alpha1.NewForConfigOrDie(c)
|
||||
cs.workV1alpha1 = workv1alpha1.NewForConfigOrDie(c)
|
||||
cs.workV1alpha2 = workv1alpha2.NewForConfigOrDie(c)
|
||||
|
@ -114,6 +127,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
|
|||
func New(c rest.Interface) *Clientset {
|
||||
var cs Clientset
|
||||
cs.clusterV1alpha1 = clusterv1alpha1.New(c)
|
||||
cs.configV1alpha1 = configv1alpha1.New(c)
|
||||
cs.policyV1alpha1 = policyv1alpha1.New(c)
|
||||
cs.workV1alpha1 = workv1alpha1.New(c)
|
||||
cs.workV1alpha2 = workv1alpha2.New(c)
|
||||
|
|
|
@ -6,6 +6,8 @@ import (
|
|||
clientset "github.com/karmada-io/karmada/pkg/generated/clientset/versioned"
|
||||
clusterv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/cluster/v1alpha1"
|
||||
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"
|
||||
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"
|
||||
|
@ -74,6 +76,11 @@ func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface {
|
|||
return &fakeclusterv1alpha1.FakeClusterV1alpha1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// ConfigV1alpha1 retrieves the ConfigV1alpha1Client
|
||||
func (c *Clientset) ConfigV1alpha1() configv1alpha1.ConfigV1alpha1Interface {
|
||||
return &fakeconfigv1alpha1.FakeConfigV1alpha1{Fake: &c.Fake}
|
||||
}
|
||||
|
||||
// PolicyV1alpha1 retrieves the PolicyV1alpha1Client
|
||||
func (c *Clientset) PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface {
|
||||
return &fakepolicyv1alpha1.FakePolicyV1alpha1{Fake: &c.Fake}
|
||||
|
|
|
@ -4,6 +4,7 @@ package fake
|
|||
|
||||
import (
|
||||
clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1"
|
||||
configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/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"
|
||||
|
@ -19,6 +20,7 @@ var codecs = serializer.NewCodecFactory(scheme)
|
|||
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
clusterv1alpha1.AddToScheme,
|
||||
configv1alpha1.AddToScheme,
|
||||
policyv1alpha1.AddToScheme,
|
||||
workv1alpha1.AddToScheme,
|
||||
workv1alpha2.AddToScheme,
|
||||
|
|
|
@ -4,6 +4,7 @@ package scheme
|
|||
|
||||
import (
|
||||
clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1"
|
||||
configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/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"
|
||||
|
@ -19,6 +20,7 @@ var Codecs = serializer.NewCodecFactory(Scheme)
|
|||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||
var localSchemeBuilder = runtime.SchemeBuilder{
|
||||
clusterv1alpha1.AddToScheme,
|
||||
configv1alpha1.AddToScheme,
|
||||
policyv1alpha1.AddToScheme,
|
||||
workv1alpha1.AddToScheme,
|
||||
workv1alpha2.AddToScheme,
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1"
|
||||
"github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type ConfigV1alpha1Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
ResourceExploringWebhookConfigurationsGetter
|
||||
}
|
||||
|
||||
// ConfigV1alpha1Client is used to interact with features provided by the config.karmada.io group.
|
||||
type ConfigV1alpha1Client struct {
|
||||
restClient rest.Interface
|
||||
}
|
||||
|
||||
func (c *ConfigV1alpha1Client) ResourceExploringWebhookConfigurations(namespace string) ResourceExploringWebhookConfigurationInterface {
|
||||
return newResourceExploringWebhookConfigurations(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new ConfigV1alpha1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*ConfigV1alpha1Client, error) {
|
||||
config := *c
|
||||
if err := setConfigDefaults(&config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
client, err := rest.RESTClientFor(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ConfigV1alpha1Client{client}, nil
|
||||
}
|
||||
|
||||
// NewForConfigOrDie creates a new ConfigV1alpha1Client for the given config and
|
||||
// panics if there is an error in the config.
|
||||
func NewForConfigOrDie(c *rest.Config) *ConfigV1alpha1Client {
|
||||
client, err := NewForConfig(c)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
// New creates a new ConfigV1alpha1Client for the given RESTClient.
|
||||
func New(c rest.Interface) *ConfigV1alpha1Client {
|
||||
return &ConfigV1alpha1Client{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 *ConfigV1alpha1Client) RESTClient() rest.Interface {
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
return c.restClient
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// This package has the automatically generated typed clients.
|
||||
package v1alpha1
|
|
@ -0,0 +1,4 @@
|
|||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
// Package fake has the automatically generated clients.
|
||||
package fake
|
|
@ -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/config/v1alpha1"
|
||||
rest "k8s.io/client-go/rest"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
type FakeConfigV1alpha1 struct {
|
||||
*testing.Fake
|
||||
}
|
||||
|
||||
func (c *FakeConfigV1alpha1) ResourceExploringWebhookConfigurations(namespace string) v1alpha1.ResourceExploringWebhookConfigurationInterface {
|
||||
return &FakeResourceExploringWebhookConfigurations{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeConfigV1alpha1) RESTClient() rest.Interface {
|
||||
var ret *rest.RESTClient
|
||||
return ret
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/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"
|
||||
)
|
||||
|
||||
// FakeResourceExploringWebhookConfigurations implements ResourceExploringWebhookConfigurationInterface
|
||||
type FakeResourceExploringWebhookConfigurations struct {
|
||||
Fake *FakeConfigV1alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var resourceexploringwebhookconfigurationsResource = schema.GroupVersionResource{Group: "config.karmada.io", Version: "v1alpha1", Resource: "resourceexploringwebhookconfigurations"}
|
||||
|
||||
var resourceexploringwebhookconfigurationsKind = schema.GroupVersionKind{Group: "config.karmada.io", Version: "v1alpha1", Kind: "ResourceExploringWebhookConfiguration"}
|
||||
|
||||
// Get takes name of the resourceExploringWebhookConfiguration, and returns the corresponding resourceExploringWebhookConfiguration object, and an error if there is any.
|
||||
func (c *FakeResourceExploringWebhookConfigurations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceExploringWebhookConfiguration, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(resourceexploringwebhookconfigurationsResource, c.ns, name), &v1alpha1.ResourceExploringWebhookConfiguration{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ResourceExploringWebhookConfiguration), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ResourceExploringWebhookConfigurations that match those selectors.
|
||||
func (c *FakeResourceExploringWebhookConfigurations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceExploringWebhookConfigurationList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(resourceexploringwebhookconfigurationsResource, resourceexploringwebhookconfigurationsKind, c.ns, opts), &v1alpha1.ResourceExploringWebhookConfigurationList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v1alpha1.ResourceExploringWebhookConfigurationList{ListMeta: obj.(*v1alpha1.ResourceExploringWebhookConfigurationList).ListMeta}
|
||||
for _, item := range obj.(*v1alpha1.ResourceExploringWebhookConfigurationList).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 resourceExploringWebhookConfigurations.
|
||||
func (c *FakeResourceExploringWebhookConfigurations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(resourceexploringwebhookconfigurationsResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a resourceExploringWebhookConfiguration and creates it. Returns the server's representation of the resourceExploringWebhookConfiguration, and an error, if there is any.
|
||||
func (c *FakeResourceExploringWebhookConfigurations) Create(ctx context.Context, resourceExploringWebhookConfiguration *v1alpha1.ResourceExploringWebhookConfiguration, opts v1.CreateOptions) (result *v1alpha1.ResourceExploringWebhookConfiguration, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(resourceexploringwebhookconfigurationsResource, c.ns, resourceExploringWebhookConfiguration), &v1alpha1.ResourceExploringWebhookConfiguration{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ResourceExploringWebhookConfiguration), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a resourceExploringWebhookConfiguration and updates it. Returns the server's representation of the resourceExploringWebhookConfiguration, and an error, if there is any.
|
||||
func (c *FakeResourceExploringWebhookConfigurations) Update(ctx context.Context, resourceExploringWebhookConfiguration *v1alpha1.ResourceExploringWebhookConfiguration, opts v1.UpdateOptions) (result *v1alpha1.ResourceExploringWebhookConfiguration, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(resourceexploringwebhookconfigurationsResource, c.ns, resourceExploringWebhookConfiguration), &v1alpha1.ResourceExploringWebhookConfiguration{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ResourceExploringWebhookConfiguration), err
|
||||
}
|
||||
|
||||
// Delete takes name of the resourceExploringWebhookConfiguration and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeResourceExploringWebhookConfigurations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(resourceexploringwebhookconfigurationsResource, c.ns, name), &v1alpha1.ResourceExploringWebhookConfiguration{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeResourceExploringWebhookConfigurations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(resourceexploringwebhookconfigurationsResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v1alpha1.ResourceExploringWebhookConfigurationList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched resourceExploringWebhookConfiguration.
|
||||
func (c *FakeResourceExploringWebhookConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceExploringWebhookConfiguration, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(resourceexploringwebhookconfigurationsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ResourceExploringWebhookConfiguration{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v1alpha1.ResourceExploringWebhookConfiguration), err
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
type ResourceExploringWebhookConfigurationExpansion interface{}
|
|
@ -0,0 +1,162 @@
|
|||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/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"
|
||||
)
|
||||
|
||||
// ResourceExploringWebhookConfigurationsGetter has a method to return a ResourceExploringWebhookConfigurationInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ResourceExploringWebhookConfigurationsGetter interface {
|
||||
ResourceExploringWebhookConfigurations(namespace string) ResourceExploringWebhookConfigurationInterface
|
||||
}
|
||||
|
||||
// ResourceExploringWebhookConfigurationInterface has methods to work with ResourceExploringWebhookConfiguration resources.
|
||||
type ResourceExploringWebhookConfigurationInterface interface {
|
||||
Create(ctx context.Context, resourceExploringWebhookConfiguration *v1alpha1.ResourceExploringWebhookConfiguration, opts v1.CreateOptions) (*v1alpha1.ResourceExploringWebhookConfiguration, error)
|
||||
Update(ctx context.Context, resourceExploringWebhookConfiguration *v1alpha1.ResourceExploringWebhookConfiguration, opts v1.UpdateOptions) (*v1alpha1.ResourceExploringWebhookConfiguration, 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.ResourceExploringWebhookConfiguration, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ResourceExploringWebhookConfigurationList, 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.ResourceExploringWebhookConfiguration, err error)
|
||||
ResourceExploringWebhookConfigurationExpansion
|
||||
}
|
||||
|
||||
// resourceExploringWebhookConfigurations implements ResourceExploringWebhookConfigurationInterface
|
||||
type resourceExploringWebhookConfigurations struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newResourceExploringWebhookConfigurations returns a ResourceExploringWebhookConfigurations
|
||||
func newResourceExploringWebhookConfigurations(c *ConfigV1alpha1Client, namespace string) *resourceExploringWebhookConfigurations {
|
||||
return &resourceExploringWebhookConfigurations{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the resourceExploringWebhookConfiguration, and returns the corresponding resourceExploringWebhookConfiguration object, and an error if there is any.
|
||||
func (c *resourceExploringWebhookConfigurations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ResourceExploringWebhookConfiguration, err error) {
|
||||
result = &v1alpha1.ResourceExploringWebhookConfiguration{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("resourceexploringwebhookconfigurations").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ResourceExploringWebhookConfigurations that match those selectors.
|
||||
func (c *resourceExploringWebhookConfigurations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ResourceExploringWebhookConfigurationList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1alpha1.ResourceExploringWebhookConfigurationList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("resourceexploringwebhookconfigurations").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested resourceExploringWebhookConfigurations.
|
||||
func (c *resourceExploringWebhookConfigurations) 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("resourceexploringwebhookconfigurations").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a resourceExploringWebhookConfiguration and creates it. Returns the server's representation of the resourceExploringWebhookConfiguration, and an error, if there is any.
|
||||
func (c *resourceExploringWebhookConfigurations) Create(ctx context.Context, resourceExploringWebhookConfiguration *v1alpha1.ResourceExploringWebhookConfiguration, opts v1.CreateOptions) (result *v1alpha1.ResourceExploringWebhookConfiguration, err error) {
|
||||
result = &v1alpha1.ResourceExploringWebhookConfiguration{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("resourceexploringwebhookconfigurations").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(resourceExploringWebhookConfiguration).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a resourceExploringWebhookConfiguration and updates it. Returns the server's representation of the resourceExploringWebhookConfiguration, and an error, if there is any.
|
||||
func (c *resourceExploringWebhookConfigurations) Update(ctx context.Context, resourceExploringWebhookConfiguration *v1alpha1.ResourceExploringWebhookConfiguration, opts v1.UpdateOptions) (result *v1alpha1.ResourceExploringWebhookConfiguration, err error) {
|
||||
result = &v1alpha1.ResourceExploringWebhookConfiguration{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("resourceexploringwebhookconfigurations").
|
||||
Name(resourceExploringWebhookConfiguration.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(resourceExploringWebhookConfiguration).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the resourceExploringWebhookConfiguration and deletes it. Returns an error if one occurs.
|
||||
func (c *resourceExploringWebhookConfigurations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("resourceexploringwebhookconfigurations").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *resourceExploringWebhookConfigurations) 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("resourceexploringwebhookconfigurations").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched resourceExploringWebhookConfiguration.
|
||||
func (c *resourceExploringWebhookConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ResourceExploringWebhookConfiguration, err error) {
|
||||
result = &v1alpha1.ResourceExploringWebhookConfiguration{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("resourceexploringwebhookconfigurations").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/config/v1alpha1"
|
||||
internalinterfaces "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/internalinterfaces"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
|
@ -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 {
|
||||
// ResourceExploringWebhookConfigurations returns a ResourceExploringWebhookConfigurationInformer.
|
||||
ResourceExploringWebhookConfigurations() ResourceExploringWebhookConfigurationInformer
|
||||
}
|
||||
|
||||
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}
|
||||
}
|
||||
|
||||
// ResourceExploringWebhookConfigurations returns a ResourceExploringWebhookConfigurationInformer.
|
||||
func (v *version) ResourceExploringWebhookConfigurations() ResourceExploringWebhookConfigurationInformer {
|
||||
return &resourceExploringWebhookConfigurationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/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/config/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"
|
||||
)
|
||||
|
||||
// ResourceExploringWebhookConfigurationInformer provides access to a shared informer and lister for
|
||||
// ResourceExploringWebhookConfigurations.
|
||||
type ResourceExploringWebhookConfigurationInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1alpha1.ResourceExploringWebhookConfigurationLister
|
||||
}
|
||||
|
||||
type resourceExploringWebhookConfigurationInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewResourceExploringWebhookConfigurationInformer constructs a new informer for ResourceExploringWebhookConfiguration 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 NewResourceExploringWebhookConfigurationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredResourceExploringWebhookConfigurationInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredResourceExploringWebhookConfigurationInformer constructs a new informer for ResourceExploringWebhookConfiguration 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 NewFilteredResourceExploringWebhookConfigurationInformer(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.ConfigV1alpha1().ResourceExploringWebhookConfigurations(namespace).List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.ConfigV1alpha1().ResourceExploringWebhookConfigurations(namespace).Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&configv1alpha1.ResourceExploringWebhookConfiguration{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *resourceExploringWebhookConfigurationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredResourceExploringWebhookConfigurationInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *resourceExploringWebhookConfigurationInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&configv1alpha1.ResourceExploringWebhookConfiguration{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *resourceExploringWebhookConfigurationInformer) Lister() v1alpha1.ResourceExploringWebhookConfigurationLister {
|
||||
return v1alpha1.NewResourceExploringWebhookConfigurationLister(f.Informer().GetIndexer())
|
||||
}
|
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
versioned "github.com/karmada-io/karmada/pkg/generated/clientset/versioned"
|
||||
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"
|
||||
policy "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/policy"
|
||||
work "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/work"
|
||||
|
@ -159,6 +160,7 @@ type SharedInformerFactory interface {
|
|||
WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool
|
||||
|
||||
Cluster() cluster.Interface
|
||||
Config() config.Interface
|
||||
Policy() policy.Interface
|
||||
Work() work.Interface
|
||||
}
|
||||
|
@ -167,6 +169,10 @@ func (f *sharedInformerFactory) Cluster() cluster.Interface {
|
|||
return cluster.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Config() config.Interface {
|
||||
return config.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *sharedInformerFactory) Policy() policy.Interface {
|
||||
return policy.New(f, f.namespace, f.tweakListOptions)
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1"
|
||||
configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/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"
|
||||
|
@ -43,6 +44,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
|||
case v1alpha1.SchemeGroupVersion.WithResource("clusters"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1alpha1().Clusters().Informer()}, nil
|
||||
|
||||
// Group=config.karmada.io, Version=v1alpha1
|
||||
case configv1alpha1.SchemeGroupVersion.WithResource("resourceexploringwebhookconfigurations"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1alpha1().ResourceExploringWebhookConfigurations().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
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
// ResourceExploringWebhookConfigurationListerExpansion allows custom methods to be added to
|
||||
// ResourceExploringWebhookConfigurationLister.
|
||||
type ResourceExploringWebhookConfigurationListerExpansion interface{}
|
||||
|
||||
// ResourceExploringWebhookConfigurationNamespaceListerExpansion allows custom methods to be added to
|
||||
// ResourceExploringWebhookConfigurationNamespaceLister.
|
||||
type ResourceExploringWebhookConfigurationNamespaceListerExpansion interface{}
|
|
@ -0,0 +1,83 @@
|
|||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ResourceExploringWebhookConfigurationLister helps list ResourceExploringWebhookConfigurations.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type ResourceExploringWebhookConfigurationLister interface {
|
||||
// List lists all ResourceExploringWebhookConfigurations in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.ResourceExploringWebhookConfiguration, err error)
|
||||
// ResourceExploringWebhookConfigurations returns an object that can list and get ResourceExploringWebhookConfigurations.
|
||||
ResourceExploringWebhookConfigurations(namespace string) ResourceExploringWebhookConfigurationNamespaceLister
|
||||
ResourceExploringWebhookConfigurationListerExpansion
|
||||
}
|
||||
|
||||
// resourceExploringWebhookConfigurationLister implements the ResourceExploringWebhookConfigurationLister interface.
|
||||
type resourceExploringWebhookConfigurationLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewResourceExploringWebhookConfigurationLister returns a new ResourceExploringWebhookConfigurationLister.
|
||||
func NewResourceExploringWebhookConfigurationLister(indexer cache.Indexer) ResourceExploringWebhookConfigurationLister {
|
||||
return &resourceExploringWebhookConfigurationLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all ResourceExploringWebhookConfigurations in the indexer.
|
||||
func (s *resourceExploringWebhookConfigurationLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceExploringWebhookConfiguration, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.ResourceExploringWebhookConfiguration))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// ResourceExploringWebhookConfigurations returns an object that can list and get ResourceExploringWebhookConfigurations.
|
||||
func (s *resourceExploringWebhookConfigurationLister) ResourceExploringWebhookConfigurations(namespace string) ResourceExploringWebhookConfigurationNamespaceLister {
|
||||
return resourceExploringWebhookConfigurationNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// ResourceExploringWebhookConfigurationNamespaceLister helps list and get ResourceExploringWebhookConfigurations.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type ResourceExploringWebhookConfigurationNamespaceLister interface {
|
||||
// List lists all ResourceExploringWebhookConfigurations in the indexer for a given namespace.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1alpha1.ResourceExploringWebhookConfiguration, err error)
|
||||
// Get retrieves the ResourceExploringWebhookConfiguration from the indexer for a given namespace and name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1alpha1.ResourceExploringWebhookConfiguration, error)
|
||||
ResourceExploringWebhookConfigurationNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// resourceExploringWebhookConfigurationNamespaceLister implements the ResourceExploringWebhookConfigurationNamespaceLister
|
||||
// interface.
|
||||
type resourceExploringWebhookConfigurationNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all ResourceExploringWebhookConfigurations in the indexer for a given namespace.
|
||||
func (s resourceExploringWebhookConfigurationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ResourceExploringWebhookConfiguration, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1alpha1.ResourceExploringWebhookConfiguration))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the ResourceExploringWebhookConfiguration from the indexer for a given namespace and name.
|
||||
func (s resourceExploringWebhookConfigurationNamespaceLister) Get(name string) (*v1alpha1.ResourceExploringWebhookConfiguration, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1alpha1.Resource("resourceexploringwebhookconfiguration"), name)
|
||||
}
|
||||
return obj.(*v1alpha1.ResourceExploringWebhookConfiguration), nil
|
||||
}
|
Loading…
Reference in New Issue