From b4b2dd11ba39d8c97dd58ce2a8311abeac191e2f Mon Sep 17 00:00:00 2001 From: duanmengkk Date: Mon, 22 Jan 2024 10:27:15 +0800 Subject: [PATCH] add clusterpodconvertpolicy api Signed-off-by: duanmengkk --- .../kosmos.io_clusterpodconvertpolicies.yaml | 1374 +++++++++++++++++ deploy/crds/kosmos.io_podconvertpolicies.yaml | 3 +- .../v1alpha1/clusterpodconvertpolicy_types.go | 46 + .../kosmos/v1alpha1/podconvertpolicy_types.go | 4 +- .../kosmos/v1alpha1/zz_generated.deepcopy.go | 87 ++ .../kosmos/v1alpha1/zz_generated.register.go | 2 + .../v1alpha1/clusterpodconvertpolicy.go | 152 ++ .../fake/fake_clusterpodconvertpolicy.go | 106 ++ .../v1alpha1/fake/fake_kosmos_client.go | 4 + .../kosmos/v1alpha1/generated_expansion.go | 2 + .../typed/kosmos/v1alpha1/kosmos_client.go | 5 + .../informers/externalversions/generic.go | 2 + .../v1alpha1/clusterpodconvertpolicy.go | 73 + .../kosmos/v1alpha1/interface.go | 7 + .../v1alpha1/clusterpodconvertpolicy.go | 52 + .../kosmos/v1alpha1/expansion_generated.go | 4 + pkg/generated/openapi/zz_generated.openapi.go | 129 +- 17 files changed, 2047 insertions(+), 5 deletions(-) create mode 100644 deploy/crds/kosmos.io_clusterpodconvertpolicies.yaml create mode 100644 pkg/apis/kosmos/v1alpha1/clusterpodconvertpolicy_types.go create mode 100644 pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/clusterpodconvertpolicy.go create mode 100644 pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/fake/fake_clusterpodconvertpolicy.go create mode 100644 pkg/generated/informers/externalversions/kosmos/v1alpha1/clusterpodconvertpolicy.go create mode 100644 pkg/generated/listers/kosmos/v1alpha1/clusterpodconvertpolicy.go diff --git a/deploy/crds/kosmos.io_clusterpodconvertpolicies.yaml b/deploy/crds/kosmos.io_clusterpodconvertpolicies.yaml new file mode 100644 index 000000000..16d251a45 --- /dev/null +++ b/deploy/crds/kosmos.io_clusterpodconvertpolicies.yaml @@ -0,0 +1,1374 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.11.0 + creationTimestamp: null + name: clusterpodconvertpolicies.kosmos.io +spec: + group: kosmos.io + names: + kind: ClusterPodConvertPolicy + listKind: ClusterPodConvertPolicyList + plural: clusterpodconvertpolicies + shortNames: + - pc + singular: clusterpodconvertpolicy + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: Spec is the specification for the behaviour of the PodConvertPolicy. + properties: + converters: + description: Converters are some converter for convert pod when pod + synced from root cluster to leaf cluster pod will use these converters + to scheduled in leaf cluster + properties: + affinityConverter: + description: AffinityConverter used to modify the pod's Affinity + when pod synced to leaf cluster + properties: + affinity: + description: Affinity is a group of affinity scheduling rules. + properties: + nodeAffinity: + description: Describes node affinity scheduling rules + for the pod. + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule + pods to nodes that satisfy the affinity expressions + specified by this field, but it may choose a node + that violates one or more of the expressions. The + node that is most preferred is the one with the + greatest sum of weights, i.e. for each node that + meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, + etc.), compute a sum by iterating through the elements + of this field and adding "weight" to the sum if + the node matches the corresponding matchExpressions; + the node(s) with the highest sum are the most preferred. + items: + description: An empty preferred scheduling term + matches all objects with implicit weight 0 (i.e. + it's a no-op). A null preferred scheduling term + matches no objects (i.e. is also a no-op). + properties: + preference: + description: A node selector term, associated + with the corresponding weight. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: A node selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: The label key that the + selector applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators + are In, NotIn, Exists, DoesNotExist. + Gt, and Lt. + type: string + values: + description: An array of string values. + If the operator is In or NotIn, + the values array must be non-empty. + If the operator is Exists or DoesNotExist, + the values array must be empty. + If the operator is Gt or Lt, the + values array must have a single + element, which will be interpreted + as an integer. This array is replaced + during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: A node selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: The label key that the + selector applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators + are In, NotIn, Exists, DoesNotExist. + Gt, and Lt. + type: string + values: + description: An array of string values. + If the operator is In or NotIn, + the values array must be non-empty. + If the operator is Exists or DoesNotExist, + the values array must be empty. + If the operator is Gt or Lt, the + values array must have a single + element, which will be interpreted + as an integer. This array is replaced + during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + weight: + description: Weight associated with matching + the corresponding nodeSelectorTerm, in the + range 1-100. + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the affinity requirements specified + by this field are not met at scheduling time, the + pod will not be scheduled onto the node. If the + affinity requirements specified by this field cease + to be met at some point during pod execution (e.g. + due to an update), the system may or may not try + to eventually evict the pod from its node. + properties: + nodeSelectorTerms: + description: Required. A list of node selector + terms. The terms are ORed. + items: + description: A null or empty node selector term + matches no objects. The requirements of them + are ANDed. The TopologySelectorTerm type implements + a subset of the NodeSelectorTerm. + properties: + matchExpressions: + description: A list of node selector requirements + by node's labels. + items: + description: A node selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: The label key that the + selector applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators + are In, NotIn, Exists, DoesNotExist. + Gt, and Lt. + type: string + values: + description: An array of string values. + If the operator is In or NotIn, + the values array must be non-empty. + If the operator is Exists or DoesNotExist, + the values array must be empty. + If the operator is Gt or Lt, the + values array must have a single + element, which will be interpreted + as an integer. This array is replaced + during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + description: A list of node selector requirements + by node's fields. + items: + description: A node selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: The label key that the + selector applies to. + type: string + operator: + description: Represents a key's relationship + to a set of values. Valid operators + are In, NotIn, Exists, DoesNotExist. + Gt, and Lt. + type: string + values: + description: An array of string values. + If the operator is In or NotIn, + the values array must be non-empty. + If the operator is Exists or DoesNotExist, + the values array must be empty. + If the operator is Gt or Lt, the + values array must have a single + element, which will be interpreted + as an integer. This array is replaced + during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + description: Describes pod affinity scheduling rules (e.g. + co-locate this pod in the same node, zone, etc. as some + other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule + pods to nodes that satisfy the affinity expressions + specified by this field, but it may choose a node + that violates one or more of the expressions. The + node that is most preferred is the one with the + greatest sum of weights, i.e. for each node that + meets all of the scheduling requirements (resource + request, requiredDuringScheduling affinity expressions, + etc.), compute a sum by iterating through the elements + of this field and adding "weight" to the sum if + the node has pods which matches the corresponding + podAffinityTerm; the node(s) with the highest sum + are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred + node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, + associated with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of + resources, in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The + requirements are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label + key that the selector applies + to. + type: string + operator: + description: operator represents + a key's relationship to a set + of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array + of string values. If the operator + is In or NotIn, the values array + must be non-empty. If the operator + is Exists or DoesNotExist, the + values array must be empty. + This array is replaced during + a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of + {key,value} pairs. A single {key,value} + in the matchLabels map is equivalent + to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are + ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: A label query over the set + of namespaces that the term applies to. + The term is applied to the union of the + namespaces selected by this field and + the ones listed in the namespaces field. + null selector and null or empty namespaces + list means "this pod's namespace". An + empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The + requirements are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label + key that the selector applies + to. + type: string + operator: + description: operator represents + a key's relationship to a set + of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array + of string values. If the operator + is In or NotIn, the values array + must be non-empty. If the operator + is Exists or DoesNotExist, the + values array must be empty. + This array is replaced during + a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of + {key,value} pairs. A single {key,value} + in the matchLabels map is equivalent + to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are + ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: namespaces specifies a static + list of namespace names that the term + applies to. The term is applied to the + union of the namespaces listed in this + field and the ones selected by namespaceSelector. + null or empty namespaces list and null + namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: This pod should be co-located + (affinity) or not co-located (anti-affinity) + with the pods matching the labelSelector + in the specified namespaces, where co-located + is defined as running on a node whose + value of the label with key topologyKey + matches that of any node on which any + of the selected pods is running. Empty + topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: weight associated with matching + the corresponding podAffinityTerm, in the + range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the affinity requirements specified + by this field are not met at scheduling time, the + pod will not be scheduled onto the node. If the + affinity requirements specified by this field cease + to be met at some point during pod execution (e.g. + due to a pod label update), the system may or may + not try to eventually evict the pod from its node. + When there are multiple elements, the lists of nodes + corresponding to each podAffinityTerm are intersected, + i.e. all terms must be satisfied. + items: + description: Defines a set of pods (namely those + matching the labelSelector relative to the given + namespace(s)) that this pod should be co-located + (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node + whose value of the label with key + matches that of any node on which a pod of the + set of pods is running + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: operator represents a + key's relationship to a set of values. + Valid operators are In, NotIn, Exists + and DoesNotExist. + type: string + values: + description: values is an array of + string values. If the operator is + In or NotIn, the values array must + be non-empty. If the operator is + Exists or DoesNotExist, the values + array must be empty. This array + is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: A label query over the set of namespaces + that the term applies to. The term is applied + to the union of the namespaces selected by + this field and the ones listed in the namespaces + field. null selector and null or empty namespaces + list means "this pod's namespace". An empty + selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: operator represents a + key's relationship to a set of values. + Valid operators are In, NotIn, Exists + and DoesNotExist. + type: string + values: + description: values is an array of + string values. If the operator is + In or NotIn, the values array must + be non-empty. If the operator is + Exists or DoesNotExist, the values + array must be empty. This array + is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: namespaces specifies a static list + of namespace names that the term applies to. + The term is applied to the union of the namespaces + listed in this field and the ones selected + by namespaceSelector. null or empty namespaces + list and null namespaceSelector means "this + pod's namespace". + items: + type: string + type: array + topologyKey: + description: This pod should be co-located (affinity) + or not co-located (anti-affinity) with the + pods matching the labelSelector in the specified + namespaces, where co-located is defined as + running on a node whose value of the label + with key topologyKey matches that of any node + on which any of the selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + podAntiAffinity: + description: Describes pod anti-affinity scheduling rules + (e.g. avoid putting this pod in the same node, zone, + etc. as some other pod(s)). + properties: + preferredDuringSchedulingIgnoredDuringExecution: + description: The scheduler will prefer to schedule + pods to nodes that satisfy the anti-affinity expressions + specified by this field, but it may choose a node + that violates one or more of the expressions. The + node that is most preferred is the one with the + greatest sum of weights, i.e. for each node that + meets all of the scheduling requirements (resource + request, requiredDuringScheduling anti-affinity + expressions, etc.), compute a sum by iterating through + the elements of this field and adding "weight" to + the sum if the node has pods which matches the corresponding + podAffinityTerm; the node(s) with the highest sum + are the most preferred. + items: + description: The weights of all of the matched WeightedPodAffinityTerm + fields are added per-node to find the most preferred + node(s) + properties: + podAffinityTerm: + description: Required. A pod affinity term, + associated with the corresponding weight. + properties: + labelSelector: + description: A label query over a set of + resources, in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The + requirements are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label + key that the selector applies + to. + type: string + operator: + description: operator represents + a key's relationship to a set + of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array + of string values. If the operator + is In or NotIn, the values array + must be non-empty. If the operator + is Exists or DoesNotExist, the + values array must be empty. + This array is replaced during + a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of + {key,value} pairs. A single {key,value} + in the matchLabels map is equivalent + to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are + ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: A label query over the set + of namespaces that the term applies to. + The term is applied to the union of the + namespaces selected by this field and + the ones listed in the namespaces field. + null selector and null or empty namespaces + list means "this pod's namespace". An + empty selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The + requirements are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label + key that the selector applies + to. + type: string + operator: + description: operator represents + a key's relationship to a set + of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array + of string values. If the operator + is In or NotIn, the values array + must be non-empty. If the operator + is Exists or DoesNotExist, the + values array must be empty. + This array is replaced during + a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of + {key,value} pairs. A single {key,value} + in the matchLabels map is equivalent + to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are + ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: namespaces specifies a static + list of namespace names that the term + applies to. The term is applied to the + union of the namespaces listed in this + field and the ones selected by namespaceSelector. + null or empty namespaces list and null + namespaceSelector means "this pod's namespace". + items: + type: string + type: array + topologyKey: + description: This pod should be co-located + (affinity) or not co-located (anti-affinity) + with the pods matching the labelSelector + in the specified namespaces, where co-located + is defined as running on a node whose + value of the label with key topologyKey + matches that of any node on which any + of the selected pods is running. Empty + topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + weight: + description: weight associated with matching + the corresponding podAffinityTerm, in the + range 1-100. + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + description: If the anti-affinity requirements specified + by this field are not met at scheduling time, the + pod will not be scheduled onto the node. If the + anti-affinity requirements specified by this field + cease to be met at some point during pod execution + (e.g. due to a pod label update), the system may + or may not try to eventually evict the pod from + its node. When there are multiple elements, the + lists of nodes corresponding to each podAffinityTerm + are intersected, i.e. all terms must be satisfied. + items: + description: Defines a set of pods (namely those + matching the labelSelector relative to the given + namespace(s)) that this pod should be co-located + (affinity) or not co-located (anti-affinity) with, + where co-located is defined as running on a node + whose value of the label with key + matches that of any node on which a pod of the + set of pods is running + properties: + labelSelector: + description: A label query over a set of resources, + in this case pods. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: operator represents a + key's relationship to a set of values. + Valid operators are In, NotIn, Exists + and DoesNotExist. + type: string + values: + description: values is an array of + string values. If the operator is + In or NotIn, the values array must + be non-empty. If the operator is + Exists or DoesNotExist, the values + array must be empty. This array + is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaceSelector: + description: A label query over the set of namespaces + that the term applies to. The term is applied + to the union of the namespaces selected by + this field and the ones listed in the namespaces + field. null selector and null or empty namespaces + list means "this pod's namespace". An empty + selector ({}) matches all namespaces. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: A label selector requirement + is a selector that contains values, + a key, and an operator that relates + the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: operator represents a + key's relationship to a set of values. + Valid operators are In, NotIn, Exists + and DoesNotExist. + type: string + values: + description: values is an array of + string values. If the operator is + In or NotIn, the values array must + be non-empty. If the operator is + Exists or DoesNotExist, the values + array must be empty. This array + is replaced during a strategic merge + patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator + is "In", and the values array contains + only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + description: namespaces specifies a static list + of namespace names that the term applies to. + The term is applied to the union of the namespaces + listed in this field and the ones selected + by namespaceSelector. null or empty namespaces + list and null namespaceSelector means "this + pod's namespace". + items: + type: string + type: array + topologyKey: + description: This pod should be co-located (affinity) + or not co-located (anti-affinity) with the + pods matching the labelSelector in the specified + namespaces, where co-located is defined as + running on a node whose value of the label + with key topologyKey matches that of any node + on which any of the selected pods is running. + Empty topologyKey is not allowed. + type: string + required: + - topologyKey + type: object + type: array + type: object + type: object + convertType: + description: ConvertType if the operation type when convert + pod from root cluster to leaf cluster. + enum: + - add + - remove + - replace + type: string + required: + - convertType + type: object + nodeNameConverter: + description: NodeNameConverter used to modify the pod's nodeName + when pod synced to leaf cluster + properties: + convertType: + description: ConvertType if the operation type when convert + pod from root cluster to leaf cluster. + enum: + - add + - remove + - replace + type: string + nodeName: + type: string + required: + - convertType + type: object + nodeSelectorConverter: + description: NodeSelectorConverter used to modify the pod's NodeSelector + when pod synced to leaf cluster + properties: + convertType: + description: ConvertType if the operation type when convert + pod from root cluster to leaf cluster. + enum: + - add + - remove + - replace + type: string + nodeSelector: + additionalProperties: + type: string + type: object + required: + - convertType + type: object + schedulerNameConverter: + description: SchedulerNameConverter used to modify the pod's nodeName + when pod synced to leaf cluster + properties: + convertType: + description: ConvertType if the operation type when convert + pod from root cluster to leaf cluster. + enum: + - add + - remove + - replace + type: string + schedulerName: + type: string + required: + - convertType + type: object + tolerationConverter: + description: TolerationConverter used to modify the pod's Tolerations + when pod synced to leaf cluster + properties: + convertType: + description: ConvertType if the operation type when convert + pod from root cluster to leaf cluster. + enum: + - add + - remove + - replace + type: string + tolerations: + items: + description: The pod this Toleration is attached to tolerates + any taint that matches the triple using + the matching operator . + properties: + effect: + description: Effect indicates the taint effect to match. + Empty means match all taint effects. When specified, + allowed values are NoSchedule, PreferNoSchedule and + NoExecute. + type: string + key: + description: Key is the taint key that the toleration + applies to. Empty means match all taint keys. If the + key is empty, operator must be Exists; this combination + means to match all values and all keys. + type: string + operator: + description: Operator represents a key's relationship + to the value. Valid operators are Exists and Equal. + Defaults to Equal. Exists is equivalent to wildcard + for value, so that a pod can tolerate all taints of + a particular category. + type: string + tolerationSeconds: + description: TolerationSeconds represents the period + of time the toleration (which must be of effect NoExecute, + otherwise this field is ignored) tolerates the taint. + By default, it is not set, which means tolerate the + taint forever (do not evict). Zero and negative values + will be treated as 0 (evict immediately) by the system. + format: int64 + type: integer + value: + description: Value is the taint value the toleration + matches to. If the operator is Exists, the value should + be empty, otherwise just a regular string. + type: string + type: object + type: array + required: + - convertType + type: object + topologySpreadConstraintsConverter: + description: TopologySpreadConstraintsConverter used to modify + the pod's TopologySpreadConstraints when pod synced to leaf + cluster + properties: + convertType: + description: ConvertType if the operation type when convert + pod from root cluster to leaf cluster. + enum: + - add + - remove + - replace + type: string + topologySpreadConstraints: + description: TopologySpreadConstraints describes how a group + of pods ought to spread across topology domains. Scheduler + will schedule pods in a way which abides by the constraints. + All topologySpreadConstraints are ANDed. + items: + description: TopologySpreadConstraint specifies how to spread + matching pods among the given topology. + properties: + labelSelector: + description: LabelSelector is used to find matching + pods. Pods that match this label selector are counted + to determine the number of pods in their corresponding + topology domain. + properties: + matchExpressions: + description: matchExpressions is a list of label + selector requirements. The requirements are ANDed. + items: + description: A label selector requirement is a + selector that contains values, a key, and an + operator that relates the key and values. + properties: + key: + description: key is the label key that the + selector applies to. + type: string + operator: + description: operator represents a key's relationship + to a set of values. Valid operators are + In, NotIn, Exists and DoesNotExist. + type: string + values: + description: values is an array of string + values. If the operator is In or NotIn, + the values array must be non-empty. If the + operator is Exists or DoesNotExist, the + values array must be empty. This array is + replaced during a strategic merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} + pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, + whose key field is "key", the operator is "In", + and the values array contains only "value". The + requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + description: MatchLabelKeys is a set of pod label keys + to select the pods over which spreading will be calculated. + The keys are used to lookup values from the incoming + pod labels, those key-value labels are ANDed with + labelSelector to select the group of existing pods + over which spreading will be calculated for the incoming + pod. Keys that don't exist in the incoming pod labels + will be ignored. A null or empty list means only match + against labelSelector. + items: + type: string + type: array + x-kubernetes-list-type: atomic + maxSkew: + description: 'MaxSkew describes the degree to which + pods may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, + it is the maximum permitted difference between the + number of matching pods in the target topology and + the global minimum. The global minimum is the minimum + number of matching pods in an eligible domain or zero + if the number of eligible domains is less than MinDomains. + For example, in a 3-zone cluster, MaxSkew is set to + 1, and pods with the same labelSelector spread as + 2/2/1: In this case, the global minimum is 1. | zone1 + | zone2 | zone3 | | P P | P P | P | - if MaxSkew + is 1, incoming pod can only be scheduled to zone3 + to become 2/2/2; scheduling it onto zone1(zone2) would + make the ActualSkew(3-1) on zone1(zone2) violate MaxSkew(1). + - if MaxSkew is 2, incoming pod can be scheduled onto + any zone. When `whenUnsatisfiable=ScheduleAnyway`, + it is used to give higher precedence to topologies + that satisfy it. It''s a required field. Default value + is 1 and 0 is not allowed.' + format: int32 + type: integer + minDomains: + description: "MinDomains indicates a minimum number + of eligible domains. When the number of eligible domains + with matching topology keys is less than minDomains, + Pod Topology Spread treats \"global minimum\" as 0, + and then the calculation of Skew is performed. And + when the number of eligible domains with matching + topology keys equals or greater than minDomains, this + value has no effect on scheduling. As a result, when + the number of eligible domains is less than minDomains, + scheduler won't schedule more than maxSkew Pods to + those domains. If value is nil, the constraint behaves + as if MinDomains is equal to 1. Valid values are integers + greater than 0. When value is not nil, WhenUnsatisfiable + must be DoNotSchedule. \n For example, in a 3-zone + cluster, MaxSkew is set to 2, MinDomains is set to + 5 and pods with the same labelSelector spread as 2/2/2: + | zone1 | zone2 | zone3 | | P P | P P | P P | + The number of domains is less than 5(MinDomains), + so \"global minimum\" is treated as 0. In this situation, + new pod with the same labelSelector cannot be scheduled, + because computed skew will be 3(3 - 0) if new Pod + is scheduled to any of the three zones, it will violate + MaxSkew. \n This is a beta field and requires the + MinDomainsInPodTopologySpread feature gate to be enabled + (enabled by default)." + format: int32 + type: integer + nodeAffinityPolicy: + description: "NodeAffinityPolicy indicates how we will + treat Pod's nodeAffinity/nodeSelector when calculating + pod topology spread skew. Options are: - Honor: only + nodes matching nodeAffinity/nodeSelector are included + in the calculations. - Ignore: nodeAffinity/nodeSelector + are ignored. All nodes are included in the calculations. + \n If this value is nil, the behavior is equivalent + to the Honor policy. This is a beta-level feature + default enabled by the NodeInclusionPolicyInPodTopologySpread + feature flag." + type: string + nodeTaintsPolicy: + description: "NodeTaintsPolicy indicates how we will + treat node taints when calculating pod topology spread + skew. Options are: - Honor: nodes without taints, + along with tainted nodes for which the incoming pod + has a toleration, are included. - Ignore: node taints + are ignored. All nodes are included. \n If this value + is nil, the behavior is equivalent to the Ignore policy. + This is a beta-level feature default enabled by the + NodeInclusionPolicyInPodTopologySpread feature flag." + type: string + topologyKey: + description: TopologyKey is the key of node labels. + Nodes that have a label with this key and identical + values are considered to be in the same topology. + We consider each as a "bucket", and try + to put balanced number of pods into each bucket. We + define a domain as a particular instance of a topology. + Also, we define an eligible domain as a domain whose + nodes meet the requirements of nodeAffinityPolicy + and nodeTaintsPolicy. e.g. If TopologyKey is "kubernetes.io/hostname", + each Node is a domain of that topology. And, if TopologyKey + is "topology.kubernetes.io/zone", each zone is a domain + of that topology. It's a required field. + type: string + whenUnsatisfiable: + description: 'WhenUnsatisfiable indicates how to deal + with a pod if it doesn''t satisfy the spread constraint. + - DoNotSchedule (default) tells the scheduler not + to schedule it. - ScheduleAnyway tells the scheduler + to schedule the pod in any location, but giving higher + precedence to topologies that would help reduce the + skew. A constraint is considered "Unsatisfiable" for + an incoming pod if and only if every possible node + assignment for that pod would violate "MaxSkew" on + some topology. For example, in a 3-zone cluster, MaxSkew + is set to 1, and pods with the same labelSelector + spread as 3/1/1: | zone1 | zone2 | zone3 | | P P P + | P | P | If WhenUnsatisfiable is set to DoNotSchedule, + incoming pod can only be scheduled to zone2(zone3) + to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) + satisfies MaxSkew(1). In other words, the cluster + can still be imbalanced, but scheduler won''t make + it *more* imbalanced. It''s a required field.' + type: string + required: + - maxSkew + - topologyKey + - whenUnsatisfiable + type: object + type: array + required: + - convertType + type: object + type: object + labelSelector: + description: A label query over a set of resources. If name is not + empty, labelSelector will be ignored. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: A label selector requirement is a selector that + contains values, a key, and an operator that relates the key + and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: operator represents a key's relationship to + a set of values. Valid operators are In, NotIn, Exists + and DoesNotExist. + type: string + values: + description: values is an array of string values. If the + operator is In or NotIn, the values array must be non-empty. + If the operator is Exists or DoesNotExist, the values + array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single + {key,value} in the matchLabels map is equivalent to an element + of matchExpressions, whose key field is "key", the operator + is "In", and the values array contains only "value". The requirements + are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + leafNodeSelector: + description: A label query over a set of resources. If name is not + empty, LeafNodeSelector will be ignored. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: A label selector requirement is a selector that + contains values, a key, and an operator that relates the key + and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: operator represents a key's relationship to + a set of values. Valid operators are In, NotIn, Exists + and DoesNotExist. + type: string + values: + description: values is an array of string values. If the + operator is In or NotIn, the values array must be non-empty. + If the operator is Exists or DoesNotExist, the values + array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + description: matchLabels is a map of {key,value} pairs. A single + {key,value} in the matchLabels map is equivalent to an element + of matchExpressions, whose key field is "key", the operator + is "In", and the values array contains only "value". The requirements + are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + required: + - labelSelector + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/deploy/crds/kosmos.io_podconvertpolicies.yaml b/deploy/crds/kosmos.io_podconvertpolicies.yaml index 108b6a149..7f459dbfc 100644 --- a/deploy/crds/kosmos.io_podconvertpolicies.yaml +++ b/deploy/crds/kosmos.io_podconvertpolicies.yaml @@ -14,7 +14,6 @@ spec: plural: podconvertpolicies shortNames: - pc - - pcs singular: podconvertpolicy scope: Namespaced versions: @@ -35,7 +34,7 @@ spec: metadata: type: object spec: - description: Spec is the specification for the behaviour of the podConversion. + description: Spec is the specification for the behaviour of the PodConvertPolicy. properties: converters: description: Converters are some converter for convert pod when pod diff --git a/pkg/apis/kosmos/v1alpha1/clusterpodconvertpolicy_types.go b/pkg/apis/kosmos/v1alpha1/clusterpodconvertpolicy_types.go new file mode 100644 index 000000000..ed936d6a7 --- /dev/null +++ b/pkg/apis/kosmos/v1alpha1/clusterpodconvertpolicy_types.go @@ -0,0 +1,46 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +genclient:nonNamespaced +// +kubebuilder:resource:scope="Cluster" +// +kubebuilder:subresource:status +// +kubebuilder:resource:shortName=pc +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type ClusterPodConvertPolicy struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec is the specification for the behaviour of the PodConvertPolicy. + // +required + Spec ClusterPodConvertPolicySpec `json:"spec"` +} + +type ClusterPodConvertPolicySpec struct { + // A label query over a set of resources. + // If name is not empty, labelSelector will be ignored. + // +required + LabelSelector metav1.LabelSelector `json:"labelSelector"` + + // A label query over a set of resources. + // If name is not empty, LeafNodeSelector will be ignored. + // +option + LeafNodeSelector *metav1.LabelSelector `json:"leafNodeSelector,omitempty"` + + // Converters are some converter for convert pod when pod synced from root cluster to leaf cluster + // pod will use these converters to scheduled in leaf cluster + // +optional + Converters *Converters `json:"converters,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type ClusterPodConvertPolicyList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []ClusterPodConvertPolicy `json:"items"` +} diff --git a/pkg/apis/kosmos/v1alpha1/podconvertpolicy_types.go b/pkg/apis/kosmos/v1alpha1/podconvertpolicy_types.go index d597f4f06..1a90fd1d7 100644 --- a/pkg/apis/kosmos/v1alpha1/podconvertpolicy_types.go +++ b/pkg/apis/kosmos/v1alpha1/podconvertpolicy_types.go @@ -7,14 +7,14 @@ import ( // +genclient // +kubebuilder:subresource:status -// +kubebuilder:resource:shortName=pc;pcs +// +kubebuilder:resource:shortName=pc // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type PodConvertPolicy struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - // Spec is the specification for the behaviour of the podConversion. + // Spec is the specification for the behaviour of the PodConvertPolicy. // +required Spec PodConvertPolicySpec `json:"spec"` } diff --git a/pkg/apis/kosmos/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/kosmos/v1alpha1/zz_generated.deepcopy.go index 6ba746a20..2419c61f0 100644 --- a/pkg/apis/kosmos/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/kosmos/v1alpha1/zz_generated.deepcopy.go @@ -271,6 +271,93 @@ func (in *ClusterNodeStatus) DeepCopy() *ClusterNodeStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterPodConvertPolicy) DeepCopyInto(out *ClusterPodConvertPolicy) { + *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 ClusterPodConvertPolicy. +func (in *ClusterPodConvertPolicy) DeepCopy() *ClusterPodConvertPolicy { + if in == nil { + return nil + } + out := new(ClusterPodConvertPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterPodConvertPolicy) 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 *ClusterPodConvertPolicyList) DeepCopyInto(out *ClusterPodConvertPolicyList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterPodConvertPolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterPodConvertPolicyList. +func (in *ClusterPodConvertPolicyList) DeepCopy() *ClusterPodConvertPolicyList { + if in == nil { + return nil + } + out := new(ClusterPodConvertPolicyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClusterPodConvertPolicyList) 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 *ClusterPodConvertPolicySpec) DeepCopyInto(out *ClusterPodConvertPolicySpec) { + *out = *in + in.LabelSelector.DeepCopyInto(&out.LabelSelector) + if in.LeafNodeSelector != nil { + in, out := &in.LeafNodeSelector, &out.LeafNodeSelector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.Converters != nil { + in, out := &in.Converters, &out.Converters + *out = new(Converters) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterPodConvertPolicySpec. +func (in *ClusterPodConvertPolicySpec) DeepCopy() *ClusterPodConvertPolicySpec { + if in == nil { + return nil + } + out := new(ClusterPodConvertPolicySpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { *out = *in diff --git a/pkg/apis/kosmos/v1alpha1/zz_generated.register.go b/pkg/apis/kosmos/v1alpha1/zz_generated.register.go index 42af84880..d8a8d9128 100644 --- a/pkg/apis/kosmos/v1alpha1/zz_generated.register.go +++ b/pkg/apis/kosmos/v1alpha1/zz_generated.register.go @@ -46,6 +46,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &ClusterList{}, &ClusterNode{}, &ClusterNodeList{}, + &ClusterPodConvertPolicy{}, + &ClusterPodConvertPolicyList{}, &DaemonSet{}, &DaemonSetList{}, &Knode{}, diff --git a/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/clusterpodconvertpolicy.go b/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/clusterpodconvertpolicy.go new file mode 100644 index 000000000..3e5a99058 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/clusterpodconvertpolicy.go @@ -0,0 +1,152 @@ +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1" + scheme "github.com/kosmos.io/kosmos/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" +) + +// ClusterPodConvertPoliciesGetter has a method to return a ClusterPodConvertPolicyInterface. +// A group's client should implement this interface. +type ClusterPodConvertPoliciesGetter interface { + ClusterPodConvertPolicies() ClusterPodConvertPolicyInterface +} + +// ClusterPodConvertPolicyInterface has methods to work with ClusterPodConvertPolicy resources. +type ClusterPodConvertPolicyInterface interface { + Create(ctx context.Context, clusterPodConvertPolicy *v1alpha1.ClusterPodConvertPolicy, opts v1.CreateOptions) (*v1alpha1.ClusterPodConvertPolicy, error) + Update(ctx context.Context, clusterPodConvertPolicy *v1alpha1.ClusterPodConvertPolicy, opts v1.UpdateOptions) (*v1alpha1.ClusterPodConvertPolicy, 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.ClusterPodConvertPolicy, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterPodConvertPolicyList, 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.ClusterPodConvertPolicy, err error) + ClusterPodConvertPolicyExpansion +} + +// clusterPodConvertPolicies implements ClusterPodConvertPolicyInterface +type clusterPodConvertPolicies struct { + client rest.Interface +} + +// newClusterPodConvertPolicies returns a ClusterPodConvertPolicies +func newClusterPodConvertPolicies(c *KosmosV1alpha1Client) *clusterPodConvertPolicies { + return &clusterPodConvertPolicies{ + client: c.RESTClient(), + } +} + +// Get takes name of the clusterPodConvertPolicy, and returns the corresponding clusterPodConvertPolicy object, and an error if there is any. +func (c *clusterPodConvertPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterPodConvertPolicy, err error) { + result = &v1alpha1.ClusterPodConvertPolicy{} + err = c.client.Get(). + Resource("clusterpodconvertpolicies"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of ClusterPodConvertPolicies that match those selectors. +func (c *clusterPodConvertPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterPodConvertPolicyList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.ClusterPodConvertPolicyList{} + err = c.client.Get(). + Resource("clusterpodconvertpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusterPodConvertPolicies. +func (c *clusterPodConvertPolicies) 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("clusterpodconvertpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a clusterPodConvertPolicy and creates it. Returns the server's representation of the clusterPodConvertPolicy, and an error, if there is any. +func (c *clusterPodConvertPolicies) Create(ctx context.Context, clusterPodConvertPolicy *v1alpha1.ClusterPodConvertPolicy, opts v1.CreateOptions) (result *v1alpha1.ClusterPodConvertPolicy, err error) { + result = &v1alpha1.ClusterPodConvertPolicy{} + err = c.client.Post(). + Resource("clusterpodconvertpolicies"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterPodConvertPolicy). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a clusterPodConvertPolicy and updates it. Returns the server's representation of the clusterPodConvertPolicy, and an error, if there is any. +func (c *clusterPodConvertPolicies) Update(ctx context.Context, clusterPodConvertPolicy *v1alpha1.ClusterPodConvertPolicy, opts v1.UpdateOptions) (result *v1alpha1.ClusterPodConvertPolicy, err error) { + result = &v1alpha1.ClusterPodConvertPolicy{} + err = c.client.Put(). + Resource("clusterpodconvertpolicies"). + Name(clusterPodConvertPolicy.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(clusterPodConvertPolicy). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the clusterPodConvertPolicy and deletes it. Returns an error if one occurs. +func (c *clusterPodConvertPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("clusterpodconvertpolicies"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusterPodConvertPolicies) 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("clusterpodconvertpolicies"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched clusterPodConvertPolicy. +func (c *clusterPodConvertPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterPodConvertPolicy, err error) { + result = &v1alpha1.ClusterPodConvertPolicy{} + err = c.client.Patch(pt). + Resource("clusterpodconvertpolicies"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/fake/fake_clusterpodconvertpolicy.go b/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/fake/fake_clusterpodconvertpolicy.go new file mode 100644 index 000000000..0862c106f --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/fake/fake_clusterpodconvertpolicy.go @@ -0,0 +1,106 @@ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/kosmos.io/kosmos/pkg/apis/kosmos/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" +) + +// FakeClusterPodConvertPolicies implements ClusterPodConvertPolicyInterface +type FakeClusterPodConvertPolicies struct { + Fake *FakeKosmosV1alpha1 +} + +var clusterpodconvertpoliciesResource = schema.GroupVersionResource{Group: "kosmos.io", Version: "v1alpha1", Resource: "clusterpodconvertpolicies"} + +var clusterpodconvertpoliciesKind = schema.GroupVersionKind{Group: "kosmos.io", Version: "v1alpha1", Kind: "ClusterPodConvertPolicy"} + +// Get takes name of the clusterPodConvertPolicy, and returns the corresponding clusterPodConvertPolicy object, and an error if there is any. +func (c *FakeClusterPodConvertPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterPodConvertPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(clusterpodconvertpoliciesResource, name), &v1alpha1.ClusterPodConvertPolicy{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterPodConvertPolicy), err +} + +// List takes label and field selectors, and returns the list of ClusterPodConvertPolicies that match those selectors. +func (c *FakeClusterPodConvertPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterPodConvertPolicyList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(clusterpodconvertpoliciesResource, clusterpodconvertpoliciesKind, opts), &v1alpha1.ClusterPodConvertPolicyList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.ClusterPodConvertPolicyList{ListMeta: obj.(*v1alpha1.ClusterPodConvertPolicyList).ListMeta} + for _, item := range obj.(*v1alpha1.ClusterPodConvertPolicyList).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 clusterPodConvertPolicies. +func (c *FakeClusterPodConvertPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(clusterpodconvertpoliciesResource, opts)) +} + +// Create takes the representation of a clusterPodConvertPolicy and creates it. Returns the server's representation of the clusterPodConvertPolicy, and an error, if there is any. +func (c *FakeClusterPodConvertPolicies) Create(ctx context.Context, clusterPodConvertPolicy *v1alpha1.ClusterPodConvertPolicy, opts v1.CreateOptions) (result *v1alpha1.ClusterPodConvertPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(clusterpodconvertpoliciesResource, clusterPodConvertPolicy), &v1alpha1.ClusterPodConvertPolicy{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterPodConvertPolicy), err +} + +// Update takes the representation of a clusterPodConvertPolicy and updates it. Returns the server's representation of the clusterPodConvertPolicy, and an error, if there is any. +func (c *FakeClusterPodConvertPolicies) Update(ctx context.Context, clusterPodConvertPolicy *v1alpha1.ClusterPodConvertPolicy, opts v1.UpdateOptions) (result *v1alpha1.ClusterPodConvertPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(clusterpodconvertpoliciesResource, clusterPodConvertPolicy), &v1alpha1.ClusterPodConvertPolicy{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterPodConvertPolicy), err +} + +// Delete takes name of the clusterPodConvertPolicy and deletes it. Returns an error if one occurs. +func (c *FakeClusterPodConvertPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(clusterpodconvertpoliciesResource, name, opts), &v1alpha1.ClusterPodConvertPolicy{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeClusterPodConvertPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(clusterpodconvertpoliciesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.ClusterPodConvertPolicyList{}) + return err +} + +// Patch applies the patch and returns the patched clusterPodConvertPolicy. +func (c *FakeClusterPodConvertPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterPodConvertPolicy, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(clusterpodconvertpoliciesResource, name, pt, data, subresources...), &v1alpha1.ClusterPodConvertPolicy{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.ClusterPodConvertPolicy), err +} diff --git a/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/fake/fake_kosmos_client.go b/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/fake/fake_kosmos_client.go index c74de6468..c01d7fdce 100644 --- a/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/fake/fake_kosmos_client.go +++ b/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/fake/fake_kosmos_client.go @@ -20,6 +20,10 @@ func (c *FakeKosmosV1alpha1) ClusterNodes() v1alpha1.ClusterNodeInterface { return &FakeClusterNodes{c} } +func (c *FakeKosmosV1alpha1) ClusterPodConvertPolicies() v1alpha1.ClusterPodConvertPolicyInterface { + return &FakeClusterPodConvertPolicies{c} +} + func (c *FakeKosmosV1alpha1) DaemonSets(namespace string) v1alpha1.DaemonSetInterface { return &FakeDaemonSets{c, namespace} } diff --git a/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/generated_expansion.go index 49973005a..ed90e7f97 100644 --- a/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/generated_expansion.go +++ b/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/generated_expansion.go @@ -6,6 +6,8 @@ type ClusterExpansion interface{} type ClusterNodeExpansion interface{} +type ClusterPodConvertPolicyExpansion interface{} + type DaemonSetExpansion interface{} type KnodeExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/kosmos_client.go b/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/kosmos_client.go index 6340661cb..250b16f43 100644 --- a/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/kosmos_client.go +++ b/pkg/generated/clientset/versioned/typed/kosmos/v1alpha1/kosmos_client.go @@ -14,6 +14,7 @@ type KosmosV1alpha1Interface interface { RESTClient() rest.Interface ClustersGetter ClusterNodesGetter + ClusterPodConvertPoliciesGetter DaemonSetsGetter KnodesGetter NodeConfigsGetter @@ -34,6 +35,10 @@ func (c *KosmosV1alpha1Client) ClusterNodes() ClusterNodeInterface { return newClusterNodes(c) } +func (c *KosmosV1alpha1Client) ClusterPodConvertPolicies() ClusterPodConvertPolicyInterface { + return newClusterPodConvertPolicies(c) +} + func (c *KosmosV1alpha1Client) DaemonSets(namespace string) DaemonSetInterface { return newDaemonSets(c, namespace) } diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index b24e17f81..8b822beb5 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -42,6 +42,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Kosmos().V1alpha1().Clusters().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("clusternodes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Kosmos().V1alpha1().ClusterNodes().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("clusterpodconvertpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Kosmos().V1alpha1().ClusterPodConvertPolicies().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("daemonsets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Kosmos().V1alpha1().DaemonSets().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("knodes"): diff --git a/pkg/generated/informers/externalversions/kosmos/v1alpha1/clusterpodconvertpolicy.go b/pkg/generated/informers/externalversions/kosmos/v1alpha1/clusterpodconvertpolicy.go new file mode 100644 index 000000000..3ace843dd --- /dev/null +++ b/pkg/generated/informers/externalversions/kosmos/v1alpha1/clusterpodconvertpolicy.go @@ -0,0 +1,73 @@ +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + kosmosv1alpha1 "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1" + versioned "github.com/kosmos.io/kosmos/pkg/generated/clientset/versioned" + internalinterfaces "github.com/kosmos.io/kosmos/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/kosmos.io/kosmos/pkg/generated/listers/kosmos/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" +) + +// ClusterPodConvertPolicyInformer provides access to a shared informer and lister for +// ClusterPodConvertPolicies. +type ClusterPodConvertPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.ClusterPodConvertPolicyLister +} + +type clusterPodConvertPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewClusterPodConvertPolicyInformer constructs a new informer for ClusterPodConvertPolicy 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 NewClusterPodConvertPolicyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredClusterPodConvertPolicyInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredClusterPodConvertPolicyInformer constructs a new informer for ClusterPodConvertPolicy 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 NewFilteredClusterPodConvertPolicyInformer(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.KosmosV1alpha1().ClusterPodConvertPolicies().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KosmosV1alpha1().ClusterPodConvertPolicies().Watch(context.TODO(), options) + }, + }, + &kosmosv1alpha1.ClusterPodConvertPolicy{}, + resyncPeriod, + indexers, + ) +} + +func (f *clusterPodConvertPolicyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredClusterPodConvertPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *clusterPodConvertPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&kosmosv1alpha1.ClusterPodConvertPolicy{}, f.defaultInformer) +} + +func (f *clusterPodConvertPolicyInformer) Lister() v1alpha1.ClusterPodConvertPolicyLister { + return v1alpha1.NewClusterPodConvertPolicyLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/kosmos/v1alpha1/interface.go b/pkg/generated/informers/externalversions/kosmos/v1alpha1/interface.go index 4768655ab..cf716ae3e 100644 --- a/pkg/generated/informers/externalversions/kosmos/v1alpha1/interface.go +++ b/pkg/generated/informers/externalversions/kosmos/v1alpha1/interface.go @@ -12,6 +12,8 @@ type Interface interface { Clusters() ClusterInformer // ClusterNodes returns a ClusterNodeInformer. ClusterNodes() ClusterNodeInformer + // ClusterPodConvertPolicies returns a ClusterPodConvertPolicyInformer. + ClusterPodConvertPolicies() ClusterPodConvertPolicyInformer // DaemonSets returns a DaemonSetInformer. DaemonSets() DaemonSetInformer // Knodes returns a KnodeInformer. @@ -45,6 +47,11 @@ func (v *version) ClusterNodes() ClusterNodeInformer { return &clusterNodeInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } +// ClusterPodConvertPolicies returns a ClusterPodConvertPolicyInformer. +func (v *version) ClusterPodConvertPolicies() ClusterPodConvertPolicyInformer { + return &clusterPodConvertPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // DaemonSets returns a DaemonSetInformer. func (v *version) DaemonSets() DaemonSetInformer { return &daemonSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/generated/listers/kosmos/v1alpha1/clusterpodconvertpolicy.go b/pkg/generated/listers/kosmos/v1alpha1/clusterpodconvertpolicy.go new file mode 100644 index 000000000..29a3b8e22 --- /dev/null +++ b/pkg/generated/listers/kosmos/v1alpha1/clusterpodconvertpolicy.go @@ -0,0 +1,52 @@ +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// ClusterPodConvertPolicyLister helps list ClusterPodConvertPolicies. +// All objects returned here must be treated as read-only. +type ClusterPodConvertPolicyLister interface { + // List lists all ClusterPodConvertPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.ClusterPodConvertPolicy, err error) + // Get retrieves the ClusterPodConvertPolicy from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.ClusterPodConvertPolicy, error) + ClusterPodConvertPolicyListerExpansion +} + +// clusterPodConvertPolicyLister implements the ClusterPodConvertPolicyLister interface. +type clusterPodConvertPolicyLister struct { + indexer cache.Indexer +} + +// NewClusterPodConvertPolicyLister returns a new ClusterPodConvertPolicyLister. +func NewClusterPodConvertPolicyLister(indexer cache.Indexer) ClusterPodConvertPolicyLister { + return &clusterPodConvertPolicyLister{indexer: indexer} +} + +// List lists all ClusterPodConvertPolicies in the indexer. +func (s *clusterPodConvertPolicyLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterPodConvertPolicy, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.ClusterPodConvertPolicy)) + }) + return ret, err +} + +// Get retrieves the ClusterPodConvertPolicy from the index for a given name. +func (s *clusterPodConvertPolicyLister) Get(name string) (*v1alpha1.ClusterPodConvertPolicy, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("clusterpodconvertpolicy"), name) + } + return obj.(*v1alpha1.ClusterPodConvertPolicy), nil +} diff --git a/pkg/generated/listers/kosmos/v1alpha1/expansion_generated.go b/pkg/generated/listers/kosmos/v1alpha1/expansion_generated.go index e588209cc..c565580ce 100644 --- a/pkg/generated/listers/kosmos/v1alpha1/expansion_generated.go +++ b/pkg/generated/listers/kosmos/v1alpha1/expansion_generated.go @@ -10,6 +10,10 @@ type ClusterListerExpansion interface{} // ClusterNodeLister. type ClusterNodeListerExpansion interface{} +// ClusterPodConvertPolicyListerExpansion allows custom methods to be added to +// ClusterPodConvertPolicyLister. +type ClusterPodConvertPolicyListerExpansion interface{} + // DaemonSetListerExpansion allows custom methods to be added to // DaemonSetLister. type DaemonSetListerExpansion interface{} diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 8872dc8ca..e1a676118 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -25,6 +25,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterNodeList": schema_pkg_apis_kosmos_v1alpha1_ClusterNodeList(ref), "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterNodeSpec": schema_pkg_apis_kosmos_v1alpha1_ClusterNodeSpec(ref), "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterNodeStatus": schema_pkg_apis_kosmos_v1alpha1_ClusterNodeStatus(ref), + "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterPodConvertPolicy": schema_pkg_apis_kosmos_v1alpha1_ClusterPodConvertPolicy(ref), + "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterPodConvertPolicyList": schema_pkg_apis_kosmos_v1alpha1_ClusterPodConvertPolicyList(ref), + "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterPodConvertPolicySpec": schema_pkg_apis_kosmos_v1alpha1_ClusterPodConvertPolicySpec(ref), "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterSpec": schema_pkg_apis_kosmos_v1alpha1_ClusterSpec(ref), "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterStatus": schema_pkg_apis_kosmos_v1alpha1_ClusterStatus(ref), "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterTreeOptions": schema_pkg_apis_kosmos_v1alpha1_ClusterTreeOptions(ref), @@ -592,6 +595,130 @@ func schema_pkg_apis_kosmos_v1alpha1_ClusterNodeStatus(ref common.ReferenceCallb } } +func schema_pkg_apis_kosmos_v1alpha1_ClusterPodConvertPolicy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec is the specification for the behaviour of the PodConvertPolicy.", + Default: map[string]interface{}{}, + Ref: ref("github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterPodConvertPolicySpec"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterPodConvertPolicySpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_kosmos_v1alpha1_ClusterPodConvertPolicyList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterPodConvertPolicy"), + }, + }, + }, + }, + }, + }, + Required: []string{"metadata", "items"}, + }, + }, + Dependencies: []string{ + "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.ClusterPodConvertPolicy", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_kosmos_v1alpha1_ClusterPodConvertPolicySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "labelSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A label query over a set of resources. If name is not empty, labelSelector will be ignored.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + "leafNodeSelector": { + SchemaProps: spec.SchemaProps{ + Description: "A label query over a set of resources. If name is not empty, LeafNodeSelector will be ignored.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"), + }, + }, + "converters": { + SchemaProps: spec.SchemaProps{ + Description: "Converters are some converter for convert pod when pod synced from root cluster to leaf cluster pod will use these converters to scheduled in leaf cluster", + Ref: ref("github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.Converters"), + }, + }, + }, + Required: []string{"labelSelector"}, + }, + }, + Dependencies: []string{ + "github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.Converters", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"}, + } +} + func schema_pkg_apis_kosmos_v1alpha1_ClusterSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1761,7 +1888,7 @@ func schema_pkg_apis_kosmos_v1alpha1_PodConvertPolicy(ref common.ReferenceCallba }, "spec": { SchemaProps: spec.SchemaProps{ - Description: "Spec is the specification for the behaviour of the podConversion.", + Description: "Spec is the specification for the behaviour of the PodConvertPolicy.", Default: map[string]interface{}{}, Ref: ref("github.com/kosmos.io/kosmos/pkg/apis/kosmos/v1alpha1.PodConvertPolicySpec"), },