Merge pull request #4635 from XiShanYongYe-Chang/add-remedy-api

Adding remedy APIs to ClusterState-based policy orchestration solutions
This commit is contained in:
karmada-bot 2024-02-27 22:21:31 +08:00 committed by GitHub
commit bc9316705c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 1676 additions and 47 deletions

View File

@ -15547,6 +15547,14 @@
"description": "NodeSummary represents the summary of nodes status in the member cluster.",
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.cluster.v1alpha1.NodeSummary"
},
"remedyActions": {
"description": "RemedyActions represents the remedy actions that needs to be performed on the cluster.",
"type": "array",
"items": {
"type": "string",
"default": ""
}
},
"resourceSummary": {
"description": "ResourceSummary represents the summary of resources in the member cluster.",
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.cluster.v1alpha1.ResourceSummary"
@ -16142,7 +16150,7 @@
"status": {
"description": "Status is the current state of the MultiClusterIngress.",
"default": {},
"$ref": "#/definitions/io.k8s.api.networking.v1.IngressStatus"
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.networking.v1alpha1.MultiClusterIngressStatus"
}
},
"x-kubernetes-group-version-kind": [
@ -16189,6 +16197,33 @@
}
]
},
"com.github.karmada-io.karmada.pkg.apis.networking.v1alpha1.MultiClusterIngressStatus": {
"description": "MultiClusterIngressStatus is the current state of the MultiClusterIngress.",
"type": "object",
"properties": {
"loadBalancer": {
"description": "loadBalancer contains the current status of the load-balancer.",
"default": {},
"$ref": "#/definitions/io.k8s.api.networking.v1.IngressLoadBalancerStatus"
},
"serviceLocations": {
"description": "ServiceLocations records the locations of MulticlusterIngress's backend Service resources. It will be set by the system controller.",
"type": "array",
"items": {
"default": {},
"$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.networking.v1alpha1.ServiceLocation"
}
},
"trafficBlockClusters": {
"description": "TrafficBlockClusters records the cluster name list that needs to perform traffic block. When the cloud provider implements its multicluster-cloud-provider and refreshes the service backend address to the LoadBalancer Service, it needs to filter out the backend addresses in these clusters.",
"type": "array",
"items": {
"type": "string",
"default": ""
}
}
}
},
"com.github.karmada-io.karmada.pkg.apis.networking.v1alpha1.MultiClusterService": {
"description": "MultiClusterService is a named abstraction of multi-cluster software service. The name field of MultiClusterService is the same as that of Service name. Services with the same name in different clusters are regarded as the same service and are associated with the same MultiClusterService. MultiClusterService can control the exposure of services to outside multiple clusters, and also enable service discovery between clusters.",
"type": "object",
@ -16325,6 +16360,28 @@
}
}
},
"com.github.karmada-io.karmada.pkg.apis.networking.v1alpha1.ServiceLocation": {
"description": "ServiceLocation records the locations of MulticlusterIngress's backend Service resources.",
"type": "object",
"required": [
"name"
],
"properties": {
"clusters": {
"description": "Clusters records the cluster list where the Service is located.",
"type": "array",
"items": {
"type": "string",
"default": ""
}
},
"name": {
"description": "name is the referenced service. The service must exist in the same namespace as the MultiClusterService object.",
"type": "string",
"default": ""
}
}
},
"com.github.karmada-io.karmada.pkg.apis.policy.v1alpha1.ApplicationFailoverBehavior": {
"description": "ApplicationFailoverBehavior indicates application failover behaviors.",
"type": "object",
@ -19197,17 +19254,6 @@
}
}
},
"io.k8s.api.networking.v1.IngressStatus": {
"description": "IngressStatus describe the current state of the Ingress.",
"type": "object",
"properties": {
"loadBalancer": {
"description": "loadBalancer contains the current status of the load-balancer.",
"default": {},
"$ref": "#/definitions/io.k8s.api.networking.v1.IngressLoadBalancerStatus"
}
}
},
"io.k8s.api.networking.v1.IngressTLS": {
"description": "IngressTLS describes the transport layer security associated with an ingress.",
"type": "object",

View File

@ -353,6 +353,36 @@ spec:
type: object
type: array
type: object
serviceLocations:
description: ServiceLocations records the locations of MulticlusterIngress's
backend Service resources. It will be set by the system controller.
items:
description: ServiceLocation records the locations of MulticlusterIngress's
backend Service resources.
properties:
clusters:
description: Clusters records the cluster list where the Service
is located.
items:
type: string
type: array
name:
description: name is the referenced service. The service must
exist in the same namespace as the MultiClusterService object.
type: string
required:
- name
type: object
type: array
trafficBlockClusters:
description: TrafficBlockClusters records the cluster name list that
needs to perform traffic block. When the cloud provider implements
its multicluster-cloud-provider and refreshes the service backend
address to the LoadBalancer Service, it needs to filter out the
backend addresses in these clusters.
items:
type: string
type: array
type: object
type: object
served: true

View File

@ -0,0 +1,101 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
name: remedies.remedy.karmada.io
spec:
group: remedy.karmada.io
names:
kind: Remedy
listKind: RemedyList
plural: remedies
singular: remedy
scope: Cluster
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Remedy represents the cluster-level management strategies based
on cluster conditions.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec represents the desired behavior of Remedy.
properties:
actions:
description: Actions specifies the actions that remedy system needs
to perform. If empty, no action will be performed.
items:
description: RemedyAction represents the action type the remedy
system needs to preform.
type: string
type: array
clusterAffinity:
description: ClusterAffinity specifies the clusters that Remedy needs
to pay attention to. For clusters that meet the DecisionConditions,
Actions will be preformed. If empty, all clusters will be selected.
properties:
clusterNames:
description: ClusterNames is the list of clusters to be selected.
items:
type: string
type: array
type: object
decisionMatches:
description: DecisionMatches indicates the decision matches of triggering
the remedy system to perform the actions. As long as any one DecisionMatch
matches, the Actions will be preformed. If empty, the Actions will
be performed immediately.
items:
description: DecisionMatch represents the decision match detail
of activating the remedy system.
properties:
clusterConditionMatch:
description: ClusterConditionMatch describes the cluster condition
requirement.
properties:
conditionStatus:
description: ConditionStatus specifies the ClusterStatue
condition status.
type: string
conditionType:
description: ConditionType specifies the ClusterStatus condition
type.
type: string
operator:
description: Operator represents a conditionType's relationship
to a conditionStatus. Valid operators are Equal, NotEqual.
type: string
required:
- conditionStatus
- conditionType
- operator
type: object
type: object
type: array
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -15,6 +15,7 @@ resources:
- bases/networking/networking.karmada.io_multiclusterservices.yaml
- bases/autoscaling/autoscaling.karmada.io_federatedhpas.yaml
- bases/autoscaling/autoscaling.karmada.io_cronfederatedhpas.yaml
- bases/remedy/remedy.karmada.io_remedies.yaml
patchesStrategicMerge:
- patches/webhook_in_resourcebindings.yaml

View File

@ -64,6 +64,8 @@ spec:
mountPath: /opt/crds/base/networking
- name: crds-policy-base
mountPath: /opt/crds/base/policy
- name: crds-remedy-base
mountPath: /opt/crds/base/remedy
- name: crds-work-base
mountPath: /opt/crds/base/work
volumes:
@ -88,6 +90,9 @@ spec:
- name: crds-policy-base
configMap:
name: {{ $name }}-crds-policy-bases-config
- name: crds-remedy-base
configMap:
name: {{ $name }}-crds-remedy-bases-config
- name: crds-work-base
configMap:
name: {{ $name }}-crds-work-bases-config

View File

@ -66,6 +66,8 @@ spec:
mountPath: /crds/bases/networking
- name: {{ $name }}-crds-policy-bases
mountPath: /crds/bases/policy
- name: {{ $name }}-crds-remedy-bases
mountPath: /crds/bases/remedy
- name: {{ $name }}-crds-work-bases
mountPath: /crds/bases/work
- name: {{ $name }}-static-resources
@ -93,6 +95,9 @@ spec:
- name: {{ $name }}-crds-policy-bases
configMap:
name: {{ $name }}-crds-policy-bases
- name: {{ $name }}-crds-remedy-bases
configMap:
name: {{ $name }}-crds-remedy-bases
- name: {{ $name }}-crds-work-bases
configMap:
name: {{ $name }}-crds-work-bases

View File

@ -122,6 +122,26 @@ data:
{{- $.Files.Get $path | nindent 8 }}
{{ end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $name }}-crds-remedy-bases
namespace: {{ $namespace }}
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "2"
{{- if "karmada.preInstallJob.labels" }}
labels:
{{- include "karmada.preInstallJob.labels" . | nindent 4 }}
{{- end }}
data:
{{ range $path, $bytes := .Files.Glob (printf "_crds/bases/remedy/**")}}
{{ $name := base $path }}
{{- (printf "%s: " $name) | nindent 6 }} |-
{{- $.Files.Get $path | nindent 8 }}
{{ end }}
---
apiVersion: v1
kind: ConfigMap

View File

@ -55,6 +55,7 @@
"github.com/karmada-io/karmada/pkg/apis/config/v1alpha1": "configv1alpha1",
"github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1": "networkingv1alpha1",
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1": "policyv1alpha1",
"github.com/karmada-io/karmada/pkg/apis/remediation/v1alpha1": "remediationv1alpha1",
"github.com/karmada-io/karmada/pkg/apis/search/v1alpha1": "searchv1alpha1",
"github.com/karmada-io/karmada/pkg/apis/work/v1alpha1": "workv1alpha1",
"github.com/karmada-io/karmada/pkg/apis/work/v1alpha2": "workv1alpha2",

View File

@ -105,6 +105,11 @@ deepcopy-gen \
--input-dirs=github.com/karmada-io/karmada/operator/pkg/apis/operator/v1alpha1 \
--output-package=github.com/karmada-io/karmada/operator/pkg/apis/operator/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/remedy/v1alpha1 \
--output-package=github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1 \
--output-file-base=zz_generated.deepcopy
echo "Generating with register-gen"
register-gen \
@ -157,6 +162,11 @@ register-gen \
--input-dirs=github.com/karmada-io/karmada/operator/pkg/apis/operator/v1alpha1 \
--output-package=github.com/karmada-io/karmada/operator/pkg/apis/operator/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/remedy/v1alpha1 \
--output-package=github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1 \
--output-file-base=zz_generated.register
echo "Generating with conversion-gen"
conversion-gen \
@ -174,7 +184,7 @@ echo "Generating with 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,github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1,github.com/karmada-io/karmada/pkg/apis/search/v1alpha1,github.com/karmada-io/karmada/pkg/apis/autoscaling/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,github.com/karmada-io/karmada/pkg/apis/search/v1alpha1,github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1,github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1 \
--output-package=github.com/karmada-io/karmada/pkg/generated/clientset \
--clientset-name=versioned
client-gen \
@ -187,7 +197,7 @@ client-gen \
echo "Generating with 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,github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1,github.com/karmada-io/karmada/pkg/apis/search/v1alpha1,github.com/karmada-io/karmada/pkg/apis/autoscaling/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,github.com/karmada-io/karmada/pkg/apis/search/v1alpha1,github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1,github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1 \
--output-package=github.com/karmada-io/karmada/pkg/generated/listers
lister-gen \
--go-header-file hack/boilerplate/boilerplate.go.txt \
@ -197,7 +207,7 @@ lister-gen \
echo "Generating with 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,github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1,github.com/karmada-io/karmada/pkg/apis/search/v1alpha1,github.com/karmada-io/karmada/pkg/apis/autoscaling/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,github.com/karmada-io/karmada/pkg/apis/search/v1alpha1,github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1,github.com/karmada-io/karmada/pkg/apis/remedy/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

@ -27,11 +27,12 @@ echo "Generating with controller-gen"
util::install_tools ${CONTROLLER_GEN_PKG} ${CONTROLLER_GEN_VER} >/dev/null 2>&1
# Unify the crds used by helm chart and the installation scripts
controller-gen crd paths=./pkg/apis/config/... output:crd:dir=./charts/karmada/_crds/bases/config
controller-gen crd paths=./pkg/apis/policy/... output:crd:dir=./charts/karmada/_crds/bases/policy
controller-gen crd paths=./pkg/apis/work/... output:crd:dir=./charts/karmada/_crds/bases/work
controller-gen crd paths=./pkg/apis/autoscaling/... output:crd:dir=./charts/karmada/_crds/bases/autoscaling
controller-gen crd paths=./pkg/apis/config/... output:crd:dir=./charts/karmada/_crds/bases/config
controller-gen crd paths=./pkg/apis/networking/... output:crd:dir=./charts/karmada/_crds/bases/networking
controller-gen crd paths=./pkg/apis/policy/... output:crd:dir=./charts/karmada/_crds/bases/policy
controller-gen crd paths=./pkg/apis/remedy/... output:crd:dir=./charts/karmada/_crds/bases/remedy
controller-gen crd paths=./pkg/apis/work/... output:crd:dir=./charts/karmada/_crds/bases/work
controller-gen crd:generateEmbeddedObjectMeta=true paths=./examples/customresourceinterpreter/apis/... output:crd:dir=./examples/customresourceinterpreter/apis/
controller-gen crd:generateEmbeddedObjectMeta=true paths=./operator/pkg/apis/operator/... output:crd:dir=./charts/karmada-operator/crds
controller-gen crd:generateEmbeddedObjectMeta=true paths=./operator/pkg/apis/operator/... output:crd:dir=./operator/config/crds

View File

@ -290,6 +290,11 @@ type ClusterStatus struct {
// ResourceSummary represents the summary of resources in the member cluster.
// +optional
ResourceSummary *ResourceSummary
// RemedyActions represents the remedy actions that needs to be performed
// on the cluster.
// +optional
RemedyActions []string
}
// APIEnablement is a list of API resource, it is used to expose the name of the

View File

@ -302,6 +302,11 @@ type ClusterStatus struct {
// ResourceSummary represents the summary of resources in the member cluster.
// +optional
ResourceSummary *ResourceSummary `json:"resourceSummary,omitempty"`
// RemedyActions represents the remedy actions that needs to be performed
// on the cluster.
// +optional
RemedyActions []string `json:"remedyActions,omitempty"`
}
// APIEnablement is a list of API resource, it is used to expose the name of the

View File

@ -387,6 +387,7 @@ func autoConvert_v1alpha1_ClusterStatus_To_cluster_ClusterStatus(in *ClusterStat
out.Conditions = *(*[]metav1.Condition)(unsafe.Pointer(&in.Conditions))
out.NodeSummary = (*cluster.NodeSummary)(unsafe.Pointer(in.NodeSummary))
out.ResourceSummary = (*cluster.ResourceSummary)(unsafe.Pointer(in.ResourceSummary))
out.RemedyActions = *(*[]string)(unsafe.Pointer(&in.RemedyActions))
return nil
}
@ -401,6 +402,7 @@ func autoConvert_cluster_ClusterStatus_To_v1alpha1_ClusterStatus(in *cluster.Clu
out.Conditions = *(*[]metav1.Condition)(unsafe.Pointer(&in.Conditions))
out.NodeSummary = (*NodeSummary)(unsafe.Pointer(in.NodeSummary))
out.ResourceSummary = (*ResourceSummary)(unsafe.Pointer(in.ResourceSummary))
out.RemedyActions = *(*[]string)(unsafe.Pointer(&in.RemedyActions))
return nil
}

View File

@ -245,6 +245,11 @@ func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) {
*out = new(ResourceSummary)
(*in).DeepCopyInto(*out)
}
if in.RemedyActions != nil {
in, out := &in.RemedyActions, &out.RemedyActions
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}

View File

@ -245,6 +245,11 @@ func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) {
*out = new(ResourceSummary)
(*in).DeepCopyInto(*out)
}
if in.RemedyActions != nil {
in, out := &in.RemedyActions, &out.RemedyActions
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}

View File

@ -50,7 +50,35 @@ type MultiClusterIngress struct {
// Status is the current state of the MultiClusterIngress.
// +optional
Status networkingv1.IngressStatus `json:"status,omitempty"`
Status MultiClusterIngressStatus `json:"status,omitempty"`
}
// MultiClusterIngressStatus is the current state of the MultiClusterIngress.
type MultiClusterIngressStatus struct {
networkingv1.IngressStatus `json:",inline"`
// TrafficBlockClusters records the cluster name list that needs to perform traffic block.
// When the cloud provider implements its multicluster-cloud-provider and refreshes
// the service backend address to the LoadBalancer Service, it needs to filter out
// the backend addresses in these clusters.
// +optional
TrafficBlockClusters []string `json:"trafficBlockClusters,omitempty"`
// ServiceLocations records the locations of MulticlusterIngress's backend
// Service resources. It will be set by the system controller.
// +optional
ServiceLocations []ServiceLocation `json:"serviceLocations,omitempty"`
}
// ServiceLocation records the locations of MulticlusterIngress's backend Service resources.
type ServiceLocation struct {
// name is the referenced service. The service must exist in
// the same namespace as the MultiClusterService object.
Name string `json:"name"`
// Clusters records the cluster list where the Service is located.
// +optional
Clusters []string `json:"clusters,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

View File

@ -139,6 +139,35 @@ func (in *MultiClusterIngressList) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MultiClusterIngressStatus) DeepCopyInto(out *MultiClusterIngressStatus) {
*out = *in
in.IngressStatus.DeepCopyInto(&out.IngressStatus)
if in.TrafficBlockClusters != nil {
in, out := &in.TrafficBlockClusters, &out.TrafficBlockClusters
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.ServiceLocations != nil {
in, out := &in.ServiceLocations, &out.ServiceLocations
*out = make([]ServiceLocation, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MultiClusterIngressStatus.
func (in *MultiClusterIngressStatus) DeepCopy() *MultiClusterIngressStatus {
if in == nil {
return nil
}
out := new(MultiClusterIngressStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MultiClusterService) DeepCopyInto(out *MultiClusterService) {
*out = *in
@ -246,3 +275,24 @@ func (in *MultiClusterServiceSpec) DeepCopy() *MultiClusterServiceSpec {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServiceLocation) DeepCopyInto(out *ServiceLocation) {
*out = *in
if in.Clusters != nil {
in, out := &in.Clusters, &out.Clusters
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceLocation.
func (in *ServiceLocation) DeepCopy() *ServiceLocation {
if in == nil {
return nil
}
out := new(ServiceLocation)
in.DeepCopyInto(out)
return out
}

View File

@ -0,0 +1,21 @@
/*
Copyright 2024 The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package v1alpha1 is the v1alpha1 version of the API.
// +k8s:deepcopy-gen=package,register
// +k8s:openapi-gen=true
// +groupName=remedy.karmada.io
package v1alpha1

View File

@ -0,0 +1,121 @@
/*
Copyright 2024 The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:scope="Cluster"
// Remedy represents the cluster-level management strategies based on cluster conditions.
type Remedy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec represents the desired behavior of Remedy.
// +required
Spec RemedySpec `json:"spec"`
}
// RemedySpec represents the desired behavior of Remedy.
type RemedySpec struct {
// ClusterAffinity specifies the clusters that Remedy needs to pay attention to.
// For clusters that meet the DecisionConditions, Actions will be preformed.
// If empty, all clusters will be selected.
// +optional
ClusterAffinity *ClusterAffinity `json:"clusterAffinity,omitempty"`
// DecisionMatches indicates the decision matches of triggering the remedy
// system to perform the actions. As long as any one DecisionMatch matches,
// the Actions will be preformed.
// If empty, the Actions will be performed immediately.
// +optional
DecisionMatches []DecisionMatch `json:"decisionMatches,omitempty"`
// Actions specifies the actions that remedy system needs to perform.
// If empty, no action will be performed.
// +optional
Actions []RemedyAction `json:"actions,omitempty"`
}
// DecisionMatch represents the decision match detail of activating the remedy system.
type DecisionMatch struct {
// ClusterConditionMatch describes the cluster condition requirement.
// +optional
ClusterConditionMatch *ClusterConditionRequirement `json:"clusterConditionMatch,omitempty"`
}
// ClusterConditionRequirement describes the Cluster condition requirement details.
type ClusterConditionRequirement struct {
// ConditionType specifies the ClusterStatus condition type.
// +required
ConditionType ConditionType `json:"conditionType"`
// Operator represents a conditionType's relationship to a conditionStatus.
// Valid operators are Equal, NotEqual.
// +required
Operator ClusterConditionOperator `json:"operator"`
// ConditionStatus specifies the ClusterStatue condition status.
// +required
ConditionStatus string `json:"conditionStatus"`
}
// ConditionType represents the detection ClusterStatus condition type.
type ConditionType string
const (
// ServiceDomainNameResolutionReady expresses the detection of the domain name resolution
// function of Service in the Kubernetes cluster.
ServiceDomainNameResolutionReady ConditionType = "ServiceDomainNameResolutionReady"
)
// ClusterConditionOperator is the set of operators that can be used in the cluster condition requirement.
type ClusterConditionOperator string
const (
// ClusterConditionEqual means equal match.
ClusterConditionEqual ClusterConditionOperator = "Equal"
// ClusterConditionNotEqual means not equal match.
ClusterConditionNotEqual ClusterConditionOperator = "NotEqual"
)
// ClusterAffinity represents the filter to select clusters.
type ClusterAffinity struct {
// ClusterNames is the list of clusters to be selected.
// +optional
ClusterNames []string `json:"clusterNames,omitempty"`
}
// RemedyAction represents the action type the remedy system needs to preform.
type RemedyAction string
const (
// TrafficControl indicates that the cluster requires traffic control.
TrafficControl RemedyAction = "TrafficControl"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// RemedyList contains a list of Remedy.
type RemedyList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Remedy `json:"items"`
}

View File

@ -0,0 +1,177 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// 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 *ClusterAffinity) DeepCopyInto(out *ClusterAffinity) {
*out = *in
if in.ClusterNames != nil {
in, out := &in.ClusterNames, &out.ClusterNames
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterAffinity.
func (in *ClusterAffinity) DeepCopy() *ClusterAffinity {
if in == nil {
return nil
}
out := new(ClusterAffinity)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterConditionRequirement) DeepCopyInto(out *ClusterConditionRequirement) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterConditionRequirement.
func (in *ClusterConditionRequirement) DeepCopy() *ClusterConditionRequirement {
if in == nil {
return nil
}
out := new(ClusterConditionRequirement)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DecisionMatch) DeepCopyInto(out *DecisionMatch) {
*out = *in
if in.ClusterConditionMatch != nil {
in, out := &in.ClusterConditionMatch, &out.ClusterConditionMatch
*out = new(ClusterConditionRequirement)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DecisionMatch.
func (in *DecisionMatch) DeepCopy() *DecisionMatch {
if in == nil {
return nil
}
out := new(DecisionMatch)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Remedy) DeepCopyInto(out *Remedy) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Remedy.
func (in *Remedy) DeepCopy() *Remedy {
if in == nil {
return nil
}
out := new(Remedy)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Remedy) 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 *RemedyList) DeepCopyInto(out *RemedyList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Remedy, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemedyList.
func (in *RemedyList) DeepCopy() *RemedyList {
if in == nil {
return nil
}
out := new(RemedyList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RemedyList) 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 *RemedySpec) DeepCopyInto(out *RemedySpec) {
*out = *in
if in.ClusterAffinity != nil {
in, out := &in.ClusterAffinity, &out.ClusterAffinity
*out = new(ClusterAffinity)
(*in).DeepCopyInto(*out)
}
if in.DecisionMatches != nil {
in, out := &in.DecisionMatches, &out.DecisionMatches
*out = make([]DecisionMatch, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Actions != nil {
in, out := &in.Actions, &out.Actions
*out = make([]RemedyAction, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RemedySpec.
func (in *RemedySpec) DeepCopy() *RemedySpec {
if in == nil {
return nil
}
out := new(RemedySpec)
in.DeepCopyInto(out)
return out
}

View File

@ -0,0 +1,67 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// 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 = "remedy.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,
&Remedy{},
&RemedyList{},
)
// AddToGroupVersion allows the serialization of client types like ListOptions.
v1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

View File

@ -27,6 +27,7 @@ import (
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"
remedyv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/remedy/v1alpha1"
searchv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/search/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"
@ -42,6 +43,7 @@ type Interface interface {
ConfigV1alpha1() configv1alpha1.ConfigV1alpha1Interface
NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface
PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface
RemedyV1alpha1() remedyv1alpha1.RemedyV1alpha1Interface
SearchV1alpha1() searchv1alpha1.SearchV1alpha1Interface
WorkV1alpha1() workv1alpha1.WorkV1alpha1Interface
WorkV1alpha2() workv1alpha2.WorkV1alpha2Interface
@ -55,6 +57,7 @@ type Clientset struct {
configV1alpha1 *configv1alpha1.ConfigV1alpha1Client
networkingV1alpha1 *networkingv1alpha1.NetworkingV1alpha1Client
policyV1alpha1 *policyv1alpha1.PolicyV1alpha1Client
remedyV1alpha1 *remedyv1alpha1.RemedyV1alpha1Client
searchV1alpha1 *searchv1alpha1.SearchV1alpha1Client
workV1alpha1 *workv1alpha1.WorkV1alpha1Client
workV1alpha2 *workv1alpha2.WorkV1alpha2Client
@ -85,6 +88,11 @@ func (c *Clientset) PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface {
return c.policyV1alpha1
}
// RemedyV1alpha1 retrieves the RemedyV1alpha1Client
func (c *Clientset) RemedyV1alpha1() remedyv1alpha1.RemedyV1alpha1Interface {
return c.remedyV1alpha1
}
// SearchV1alpha1 retrieves the SearchV1alpha1Client
func (c *Clientset) SearchV1alpha1() searchv1alpha1.SearchV1alpha1Interface {
return c.searchV1alpha1
@ -164,6 +172,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset,
if err != nil {
return nil, err
}
cs.remedyV1alpha1, err = remedyv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
}
cs.searchV1alpha1, err = searchv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
@ -202,6 +214,7 @@ func New(c rest.Interface) *Clientset {
cs.configV1alpha1 = configv1alpha1.New(c)
cs.networkingV1alpha1 = networkingv1alpha1.New(c)
cs.policyV1alpha1 = policyv1alpha1.New(c)
cs.remedyV1alpha1 = remedyv1alpha1.New(c)
cs.searchV1alpha1 = searchv1alpha1.New(c)
cs.workV1alpha1 = workv1alpha1.New(c)
cs.workV1alpha2 = workv1alpha2.New(c)

View File

@ -30,6 +30,8 @@ import (
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"
remedyv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/remedy/v1alpha1"
fakeremedyv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/remedy/v1alpha1/fake"
searchv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/search/v1alpha1"
fakesearchv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/search/v1alpha1/fake"
workv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/work/v1alpha1"
@ -118,6 +120,11 @@ func (c *Clientset) PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface {
return &fakepolicyv1alpha1.FakePolicyV1alpha1{Fake: &c.Fake}
}
// RemedyV1alpha1 retrieves the RemedyV1alpha1Client
func (c *Clientset) RemedyV1alpha1() remedyv1alpha1.RemedyV1alpha1Interface {
return &fakeremedyv1alpha1.FakeRemedyV1alpha1{Fake: &c.Fake}
}
// SearchV1alpha1 retrieves the SearchV1alpha1Client
func (c *Clientset) SearchV1alpha1() searchv1alpha1.SearchV1alpha1Interface {
return &fakesearchv1alpha1.FakeSearchV1alpha1{Fake: &c.Fake}

View File

@ -24,6 +24,7 @@ import (
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"
remedyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1"
searchv1alpha1 "github.com/karmada-io/karmada/pkg/apis/search/v1alpha1"
workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
workv1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2"
@ -43,6 +44,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
configv1alpha1.AddToScheme,
networkingv1alpha1.AddToScheme,
policyv1alpha1.AddToScheme,
remedyv1alpha1.AddToScheme,
searchv1alpha1.AddToScheme,
workv1alpha1.AddToScheme,
workv1alpha2.AddToScheme,

View File

@ -24,6 +24,7 @@ import (
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"
remedyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1"
searchv1alpha1 "github.com/karmada-io/karmada/pkg/apis/search/v1alpha1"
workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
workv1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2"
@ -43,6 +44,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
configv1alpha1.AddToScheme,
networkingv1alpha1.AddToScheme,
policyv1alpha1.AddToScheme,
remedyv1alpha1.AddToScheme,
searchv1alpha1.AddToScheme,
workv1alpha1.AddToScheme,
workv1alpha2.AddToScheme,

View File

@ -0,0 +1,20 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1alpha1

View File

@ -0,0 +1,20 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,121 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeRemedies implements RemedyInterface
type FakeRemedies struct {
Fake *FakeRemedyV1alpha1
}
var remediesResource = v1alpha1.SchemeGroupVersion.WithResource("remedies")
var remediesKind = v1alpha1.SchemeGroupVersion.WithKind("Remedy")
// Get takes name of the remedy, and returns the corresponding remedy object, and an error if there is any.
func (c *FakeRemedies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Remedy, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(remediesResource, name), &v1alpha1.Remedy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Remedy), err
}
// List takes label and field selectors, and returns the list of Remedies that match those selectors.
func (c *FakeRemedies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RemedyList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(remediesResource, remediesKind, opts), &v1alpha1.RemedyList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.RemedyList{ListMeta: obj.(*v1alpha1.RemedyList).ListMeta}
for _, item := range obj.(*v1alpha1.RemedyList).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 remedies.
func (c *FakeRemedies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(remediesResource, opts))
}
// Create takes the representation of a remedy and creates it. Returns the server's representation of the remedy, and an error, if there is any.
func (c *FakeRemedies) Create(ctx context.Context, remedy *v1alpha1.Remedy, opts v1.CreateOptions) (result *v1alpha1.Remedy, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(remediesResource, remedy), &v1alpha1.Remedy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Remedy), err
}
// Update takes the representation of a remedy and updates it. Returns the server's representation of the remedy, and an error, if there is any.
func (c *FakeRemedies) Update(ctx context.Context, remedy *v1alpha1.Remedy, opts v1.UpdateOptions) (result *v1alpha1.Remedy, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(remediesResource, remedy), &v1alpha1.Remedy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Remedy), err
}
// Delete takes name of the remedy and deletes it. Returns an error if one occurs.
func (c *FakeRemedies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(remediesResource, name, opts), &v1alpha1.Remedy{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeRemedies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(remediesResource, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.RemedyList{})
return err
}
// Patch applies the patch and returns the patched remedy.
func (c *FakeRemedies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Remedy, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(remediesResource, name, pt, data, subresources...), &v1alpha1.Remedy{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Remedy), err
}

View File

@ -0,0 +1,40 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/remedy/v1alpha1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeRemedyV1alpha1 struct {
*testing.Fake
}
func (c *FakeRemedyV1alpha1) Remedies() v1alpha1.RemedyInterface {
return &FakeRemedies{c}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeRemedyV1alpha1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -0,0 +1,21 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
type RemedyExpansion interface{}

View File

@ -0,0 +1,168 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/remedy/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"
)
// RemediesGetter has a method to return a RemedyInterface.
// A group's client should implement this interface.
type RemediesGetter interface {
Remedies() RemedyInterface
}
// RemedyInterface has methods to work with Remedy resources.
type RemedyInterface interface {
Create(ctx context.Context, remedy *v1alpha1.Remedy, opts v1.CreateOptions) (*v1alpha1.Remedy, error)
Update(ctx context.Context, remedy *v1alpha1.Remedy, opts v1.UpdateOptions) (*v1alpha1.Remedy, 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.Remedy, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RemedyList, 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.Remedy, err error)
RemedyExpansion
}
// remedies implements RemedyInterface
type remedies struct {
client rest.Interface
}
// newRemedies returns a Remedies
func newRemedies(c *RemedyV1alpha1Client) *remedies {
return &remedies{
client: c.RESTClient(),
}
}
// Get takes name of the remedy, and returns the corresponding remedy object, and an error if there is any.
func (c *remedies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Remedy, err error) {
result = &v1alpha1.Remedy{}
err = c.client.Get().
Resource("remedies").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Remedies that match those selectors.
func (c *remedies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RemedyList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.RemedyList{}
err = c.client.Get().
Resource("remedies").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested remedies.
func (c *remedies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Resource("remedies").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a remedy and creates it. Returns the server's representation of the remedy, and an error, if there is any.
func (c *remedies) Create(ctx context.Context, remedy *v1alpha1.Remedy, opts v1.CreateOptions) (result *v1alpha1.Remedy, err error) {
result = &v1alpha1.Remedy{}
err = c.client.Post().
Resource("remedies").
VersionedParams(&opts, scheme.ParameterCodec).
Body(remedy).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a remedy and updates it. Returns the server's representation of the remedy, and an error, if there is any.
func (c *remedies) Update(ctx context.Context, remedy *v1alpha1.Remedy, opts v1.UpdateOptions) (result *v1alpha1.Remedy, err error) {
result = &v1alpha1.Remedy{}
err = c.client.Put().
Resource("remedies").
Name(remedy.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(remedy).
Do(ctx).
Into(result)
return
}
// Delete takes name of the remedy and deletes it. Returns an error if one occurs.
func (c *remedies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("remedies").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *remedies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Resource("remedies").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched remedy.
func (c *remedies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Remedy, err error) {
result = &v1alpha1.Remedy{}
err = c.client.Patch(pt).
Resource("remedies").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -0,0 +1,107 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"net/http"
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1"
"github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme"
rest "k8s.io/client-go/rest"
)
type RemedyV1alpha1Interface interface {
RESTClient() rest.Interface
RemediesGetter
}
// RemedyV1alpha1Client is used to interact with features provided by the remedy.karmada.io group.
type RemedyV1alpha1Client struct {
restClient rest.Interface
}
func (c *RemedyV1alpha1Client) Remedies() RemedyInterface {
return newRemedies(c)
}
// NewForConfig creates a new RemedyV1alpha1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).
func NewForConfig(c *rest.Config) (*RemedyV1alpha1Client, 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 RemedyV1alpha1Client 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) (*RemedyV1alpha1Client, 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 &RemedyV1alpha1Client{client}, nil
}
// NewForConfigOrDie creates a new RemedyV1alpha1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *RemedyV1alpha1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new RemedyV1alpha1Client for the given RESTClient.
func New(c rest.Interface) *RemedyV1alpha1Client {
return &RemedyV1alpha1Client{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 *RemedyV1alpha1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -30,6 +30,7 @@ import (
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"
remedy "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/remedy"
search "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/search"
work "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/work"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -254,6 +255,7 @@ type SharedInformerFactory interface {
Config() config.Interface
Networking() networking.Interface
Policy() policy.Interface
Remedy() remedy.Interface
Search() search.Interface
Work() work.Interface
}
@ -278,6 +280,10 @@ func (f *sharedInformerFactory) Policy() policy.Interface {
return policy.New(f, f.namespace, f.tweakListOptions)
}
func (f *sharedInformerFactory) Remedy() remedy.Interface {
return remedy.New(f, f.namespace, f.tweakListOptions)
}
func (f *sharedInformerFactory) Search() search.Interface {
return search.New(f, f.namespace, f.tweakListOptions)
}

View File

@ -26,6 +26,7 @@ import (
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"
remedyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1"
searchv1alpha1 "github.com/karmada-io/karmada/pkg/apis/search/v1alpha1"
workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1"
v1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2"
@ -93,6 +94,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case policyv1alpha1.SchemeGroupVersion.WithResource("propagationpolicies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Policy().V1alpha1().PropagationPolicies().Informer()}, nil
// Group=remedy.karmada.io, Version=v1alpha1
case remedyv1alpha1.SchemeGroupVersion.WithResource("remedies"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Remedy().V1alpha1().Remedies().Informer()}, nil
// Group=search.karmada.io, Version=v1alpha1
case searchv1alpha1.SchemeGroupVersion.WithResource("resourceregistries"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Search().V1alpha1().ResourceRegistries().Informer()}, nil

View File

@ -0,0 +1,46 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package remedy
import (
internalinterfaces "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/remedy/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,45 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// 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 {
// Remedies returns a RemedyInformer.
Remedies() RemedyInformer
}
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}
}
// Remedies returns a RemedyInformer.
func (v *version) Remedies() RemedyInformer {
return &remedyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}

View File

@ -0,0 +1,89 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
time "time"
remedyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/remedy/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/remedy/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"
)
// RemedyInformer provides access to a shared informer and lister for
// Remedies.
type RemedyInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.RemedyLister
}
type remedyInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewRemedyInformer constructs a new informer for Remedy 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 NewRemedyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredRemedyInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredRemedyInformer constructs a new informer for Remedy 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 NewFilteredRemedyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.RemedyV1alpha1().Remedies().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.RemedyV1alpha1().Remedies().Watch(context.TODO(), options)
},
},
&remedyv1alpha1.Remedy{},
resyncPeriod,
indexers,
)
}
func (f *remedyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredRemedyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *remedyInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&remedyv1alpha1.Remedy{}, f.defaultInformer)
}
func (f *remedyInformer) Lister() v1alpha1.RemedyLister {
return v1alpha1.NewRemedyLister(f.Informer().GetIndexer())
}

View File

@ -0,0 +1,23 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
// RemedyListerExpansion allows custom methods to be added to
// RemedyLister.
type RemedyListerExpansion interface{}

View File

@ -0,0 +1,68 @@
/*
Copyright The Karmada Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1alpha1
import (
v1alpha1 "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// RemedyLister helps list Remedies.
// All objects returned here must be treated as read-only.
type RemedyLister interface {
// List lists all Remedies in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.Remedy, err error)
// Get retrieves the Remedy from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha1.Remedy, error)
RemedyListerExpansion
}
// remedyLister implements the RemedyLister interface.
type remedyLister struct {
indexer cache.Indexer
}
// NewRemedyLister returns a new RemedyLister.
func NewRemedyLister(indexer cache.Indexer) RemedyLister {
return &remedyLister{indexer: indexer}
}
// List lists all Remedies in the indexer.
func (s *remedyLister) List(selector labels.Selector) (ret []*v1alpha1.Remedy, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Remedy))
})
return ret, err
}
// Get retrieves the Remedy from the index for a given name.
func (s *remedyLister) Get(name string) (*v1alpha1.Remedy, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("remedy"), name)
}
return obj.(*v1alpha1.Remedy), nil
}

View File

@ -84,9 +84,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
"github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1.ExposureRange": schema_pkg_apis_networking_v1alpha1_ExposureRange(ref),
"github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1.MultiClusterIngress": schema_pkg_apis_networking_v1alpha1_MultiClusterIngress(ref),
"github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1.MultiClusterIngressList": schema_pkg_apis_networking_v1alpha1_MultiClusterIngressList(ref),
"github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1.MultiClusterIngressStatus": schema_pkg_apis_networking_v1alpha1_MultiClusterIngressStatus(ref),
"github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1.MultiClusterService": schema_pkg_apis_networking_v1alpha1_MultiClusterService(ref),
"github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1.MultiClusterServiceList": schema_pkg_apis_networking_v1alpha1_MultiClusterServiceList(ref),
"github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1.MultiClusterServiceSpec": schema_pkg_apis_networking_v1alpha1_MultiClusterServiceSpec(ref),
"github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1.ServiceLocation": schema_pkg_apis_networking_v1alpha1_ServiceLocation(ref),
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.ApplicationFailoverBehavior": schema_pkg_apis_policy_v1alpha1_ApplicationFailoverBehavior(ref),
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.ClusterAffinity": schema_pkg_apis_policy_v1alpha1_ClusterAffinity(ref),
"github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.ClusterAffinityTerm": schema_pkg_apis_policy_v1alpha1_ClusterAffinityTerm(ref),
@ -1512,6 +1514,21 @@ func schema_pkg_apis_cluster_v1alpha1_ClusterStatus(ref common.ReferenceCallback
Ref: ref("github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1.ResourceSummary"),
},
},
"remedyActions": {
SchemaProps: spec.SchemaProps{
Description: "RemedyActions represents the remedy actions that needs to be performed on the cluster.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
},
},
},
@ -2805,14 +2822,14 @@ func schema_pkg_apis_networking_v1alpha1_MultiClusterIngress(ref common.Referenc
SchemaProps: spec.SchemaProps{
Description: "Status is the current state of the MultiClusterIngress.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/networking/v1.IngressStatus"),
Ref: ref("github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1.MultiClusterIngressStatus"),
},
},
},
},
},
Dependencies: []string{
"k8s.io/api/networking/v1.IngressSpec", "k8s.io/api/networking/v1.IngressStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
"github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1.MultiClusterIngressStatus", "k8s.io/api/networking/v1.IngressSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
@ -2866,6 +2883,57 @@ func schema_pkg_apis_networking_v1alpha1_MultiClusterIngressList(ref common.Refe
}
}
func schema_pkg_apis_networking_v1alpha1_MultiClusterIngressStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "MultiClusterIngressStatus is the current state of the MultiClusterIngress.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"loadBalancer": {
SchemaProps: spec.SchemaProps{
Description: "loadBalancer contains the current status of the load-balancer.",
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/networking/v1.IngressLoadBalancerStatus"),
},
},
"trafficBlockClusters": {
SchemaProps: spec.SchemaProps{
Description: "TrafficBlockClusters records the cluster name list that needs to perform traffic block. When the cloud provider implements its multicluster-cloud-provider and refreshes the service backend address to the LoadBalancer Service, it needs to filter out the backend addresses in these clusters.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
"serviceLocations": {
SchemaProps: spec.SchemaProps{
Description: "ServiceLocations records the locations of MulticlusterIngress's backend Service resources. It will be set by the system controller.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1.ServiceLocation"),
},
},
},
},
},
},
},
},
Dependencies: []string{
"github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1.ServiceLocation", "k8s.io/api/networking/v1.IngressLoadBalancerStatus"},
}
}
func schema_pkg_apis_networking_v1alpha1_MultiClusterService(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@ -3076,6 +3144,43 @@ func schema_pkg_apis_networking_v1alpha1_MultiClusterServiceSpec(ref common.Refe
}
}
func schema_pkg_apis_networking_v1alpha1_ServiceLocation(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ServiceLocation records the locations of MulticlusterIngress's backend Service resources.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"name": {
SchemaProps: spec.SchemaProps{
Description: "name is the referenced service. The service must exist in the same namespace as the MultiClusterService object.",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"clusters": {
SchemaProps: spec.SchemaProps{
Description: "Clusters records the cluster list where the Service is located.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
},
Required: []string{"name"},
},
},
}
}
func schema_pkg_apis_policy_v1alpha1_ApplicationFailoverBehavior(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{

View File

@ -23,11 +23,12 @@ import (
"k8s.io/apimachinery/pkg/util/duration"
"github.com/karmada-io/karmada/pkg/printers"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"github.com/karmada-io/karmada/pkg/printers"
)
const (

View File

@ -21,10 +21,11 @@ import (
"reflect"
"testing"
"github.com/karmada-io/karmada/pkg/printers"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/diff"
"github.com/karmada-io/karmada/pkg/printers"
)
func TestPrintCoreV1(t *testing.T) {

View File

@ -68,10 +68,12 @@ func TestValidateIngress(t *testing.T) {
},
}},
},
Status: networkingv1.IngressStatus{
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{
{IP: "127.0.0.1"},
Status: networkingv1alpha1.MultiClusterIngressStatus{
IngressStatus: networkingv1.IngressStatus{
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{
{IP: "127.0.0.1"},
},
},
},
},
@ -294,10 +296,12 @@ func TestValidateIngressTLS(t *testing.T) {
},
}},
},
Status: networkingv1.IngressStatus{
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{
{IP: "127.0.0.1"},
Status: networkingv1alpha1.MultiClusterIngressStatus{
IngressStatus: networkingv1.IngressStatus{
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{
{IP: "127.0.0.1"},
},
},
},
},
@ -437,36 +441,45 @@ func TestValidateIngressStatusUpdate(t *testing.T) {
},
}},
},
Status: networkingv1.IngressStatus{
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{
{IP: "127.0.0.1", Hostname: "foo.bar.com"},
Status: networkingv1alpha1.MultiClusterIngressStatus{
IngressStatus: networkingv1.IngressStatus{
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{
{IP: "127.0.0.1", Hostname: "foo.bar.com"},
},
},
},
},
}
}
newValue := newValid()
newValue.Status = networkingv1.IngressStatus{
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{
{IP: "127.0.0.2", Hostname: "foo.com"},
newValue.Status = networkingv1alpha1.MultiClusterIngressStatus{
IngressStatus: networkingv1.IngressStatus{
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{
{IP: "127.0.0.2", Hostname: "foo.com"},
},
},
},
}
invalidIP := newValid()
invalidIP.Status = networkingv1.IngressStatus{
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{
{IP: "abcd", Hostname: "foo.com"},
invalidIP.Status = networkingv1alpha1.MultiClusterIngressStatus{
IngressStatus: networkingv1.IngressStatus{
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{
{IP: "abcd", Hostname: "foo.com"},
},
},
},
}
invalidHostname := newValid()
invalidHostname.Status = networkingv1.IngressStatus{
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{
{IP: "127.0.0.1", Hostname: "127.0.0.1"},
invalidHostname.Status = networkingv1alpha1.MultiClusterIngressStatus{
IngressStatus: networkingv1.IngressStatus{
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{
{IP: "127.0.0.1", Hostname: "127.0.0.1"},
},
},
},
}