diff --git a/charts/spiderpool/crds/spiderpool.spidernet.io_spidercoordinators.yaml b/charts/spiderpool/crds/spiderpool.spidernet.io_spidercoordinators.yaml index 00dc8d9239..99f33b2376 100644 --- a/charts/spiderpool/crds/spiderpool.spidernet.io_spidercoordinators.yaml +++ b/charts/spiderpool/crds/spiderpool.spidernet.io_spidercoordinators.yaml @@ -146,6 +146,137 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - name: v2beta2 + schema: + openAPIV3Schema: + description: SpiderCoordinator is the Schema for the spidercoordinators API. + 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: CoordinationSpec defines the desired state of SpiderCoordinator. + properties: + detectGateway: + default: false + description: DetectGateway to detect the gateway for the pod + type: boolean + detectIPConflict: + default: false + description: DetectIPConflict to detect the ip conflict for the pod + type: boolean + hijackCIDR: + description: HijackCIDR configure static routing tables in the pod + that target these subnets to ensure that when the pod accesses these + subnets, packets are forwarded through the host network stack, such + as nodelocaldns(169.254.0.0/16) + items: + type: string + type: array + hostRPFilter: + default: 0 + description: 'HostRPFilter is used for coordiantor to help set the + rp_filter parameters of the node. NOTE: This field is considered + deprecated in the future. the rp_filter of the node should be configured + by spiderpool-agent rather than coordinator plugin. Configurable + values: /0/1/2, -1 means leave it as it is. the + default value is 0.' + type: integer + hostRuleTable: + default: 500 + description: HostRuleTable specifies the table number of the routing + table used to configure the communication between the pod and the + local node. + type: integer + mode: + default: auto + description: Mode mode specifies the mode in which the coordinator + runs, and the configurable values include auto (default), underlay, + overlay, disabled. + enum: + - auto + - underlay + - overlay + - disabled + type: string + podCIDRType: + description: CoordinatorSpec is used by SpiderCoordinator and SpiderMultusConfig + in spidermultusconfig CRD , podCIDRType should not be required, + which could be merged from SpiderCoordinator CR but in SpiderCoordinator + CRD, podCIDRType should be required + enum: + - auto + - cluster + - calico + - cilium + - none + type: string + podDefaultRouteNIC: + description: PodDefaultRouteNIC PodDefaultRouteNIC is used to configure + the NIC where the pod's default route resides. the default value + is empty, which means the default route will remain at eth0. + type: string + podMACPrefix: + description: 'PodMACPrefix the fixed MAC address prefix, the length + is two bytes. the lowest bit of the first byte must be 0, which + indicates the unicast MAC address. example: 0a:1b' + type: string + podRPFilter: + default: 0 + description: 'PodRPFilter is used for coordiantor to help set the + rp_filter parameters of the pod. Configurable values: /0/1/2. negative number means leave it as it is. the default + value is 0.' + type: integer + tunePodRoutes: + default: true + description: TunePodRoutes specifies whether to tune pod routes of + multiple NICs on pods. + type: boolean + txQueueLen: + default: 0 + description: TxQueueLen to set the tx_queue_len of the pod. requirement + is a positive integer the default value is 0, which means leaving + it as it is. + type: integer + vethLinkAddress: + description: VethLinkAddress configure a ipv4 link-local address for + veth0 device. empty means disable. default is empty. Format is like + 169.254.100.1 + type: string + type: object + status: + description: CoordinationStatus defines the observed state of SpiderCoordinator. + properties: + overlayPodCIDR: + items: + type: string + type: array + phase: + type: string + reason: + type: string + serviceCIDR: + items: + type: string + type: array + required: + - phase + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/charts/spiderpool/crds/spiderpool.spidernet.io_spiderendpoints.yaml b/charts/spiderpool/crds/spiderpool.spidernet.io_spiderendpoints.yaml index 28ba9b1a33..dab4d0f599 100644 --- a/charts/spiderpool/crds/spiderpool.spidernet.io_spiderendpoints.yaml +++ b/charts/spiderpool/crds/spiderpool.spidernet.io_spiderendpoints.yaml @@ -127,5 +127,116 @@ spec: type: object type: object served: true + storage: false + subresources: {} + - additionalPrinterColumns: + - description: interface + jsonPath: .status.current.ips[0].interface + name: INTERFACE + type: string + - description: ipv4Pool + jsonPath: .status.current.ips[0].ipv4Pool + name: IPV4POOL + type: string + - description: ipv4 + jsonPath: .status.current.ips[0].ipv4 + name: IPV4 + type: string + - description: ipv6Pool + jsonPath: .status.current.ips[0].ipv6Pool + name: IPV6POOL + type: string + - description: ipv6 + jsonPath: .status.current.ips[0].ipv6 + name: IPV6 + type: string + - description: node + jsonPath: .status.current.node + name: NODE + type: string + name: v2beta2 + schema: + openAPIV3Schema: + description: Spiderndpoint is the Schema for the spiderendpoints API. + 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 + status: + description: WorkloadEndpointStatus defines the observed state of SpiderEndpoint. + properties: + current: + properties: + ips: + items: + properties: + cleanGateway: + type: boolean + interface: + type: string + ipv4: + type: string + ipv4Gateway: + type: string + ipv4Pool: + type: string + ipv6: + type: string + ipv6Gateway: + type: string + ipv6Pool: + type: string + routes: + items: + properties: + dst: + type: string + gw: + type: string + required: + - dst + - gw + type: object + type: array + vlan: + default: 0 + description: 'DEPRECATED: Vlan is deprecated.' + format: int64 + maximum: 4094 + minimum: 0 + type: integer + required: + - interface + type: object + type: array + node: + type: string + uid: + type: string + required: + - ips + - node + - uid + type: object + ownerControllerName: + type: string + ownerControllerType: + type: string + required: + - current + - ownerControllerName + - ownerControllerType + type: object + type: object + served: true storage: true subresources: {} diff --git a/charts/spiderpool/crds/spiderpool.spidernet.io_spiderippools.yaml b/charts/spiderpool/crds/spiderpool.spidernet.io_spiderippools.yaml index 4753a3b4df..dee421012a 100644 --- a/charts/spiderpool/crds/spiderpool.spidernet.io_spiderippools.yaml +++ b/charts/spiderpool/crds/spiderpool.spidernet.io_spiderippools.yaml @@ -302,6 +302,249 @@ spec: type: object type: object served: true - storage: true + storage: false subresources: status: {} + - name: v2beta2 + 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: IPPoolSpec defines the desired state of SpiderIPPool. + properties: + default: + default: false + type: boolean + disable: + default: false + type: boolean + excludeIPs: + items: + type: string + type: array + gateway: + type: string + ipVersion: + enum: + - 4 + - 6 + format: int64 + type: integer + ips: + items: + type: string + type: array + multusName: + items: + type: string + type: array + namespaceAffinity: + description: A label selector is a label query over a set of resources. + The result of matchLabels and matchExpressions are ANDed. An empty + label selector matches all objects. A null label selector matches + no objects. + 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 + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + 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 + namespaceName: + items: + type: string + type: array + nodeAffinity: + description: A label selector is a label query over a set of resources. + The result of matchLabels and matchExpressions are ANDed. An empty + label selector matches all objects. A null label selector matches + no objects. + 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 + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + 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 + nodeName: + items: + type: string + type: array + podAffinity: + description: A label selector is a label query over a set of resources. + The result of matchLabels and matchExpressions are ANDed. An empty + label selector matches all objects. A null label selector matches + no objects. + 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 + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + 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 + routes: + items: + properties: + dst: + type: string + gw: + type: string + required: + - dst + - gw + type: object + type: array + subnet: + type: string + vlan: + description: 'DEPRECATED: Vlan is deprecated.' + format: int64 + maximum: 4094 + minimum: 0 + type: integer + required: + - subnet + type: object + status: + description: IPPoolStatus defines the observed state of SpiderIPPool. + properties: + allocatedIPCount: + format: int64 + minimum: 0 + type: integer + allocatedIPs: + type: string + totalIPCount: + format: int64 + minimum: 0 + type: integer + type: object + type: object + served: true + storage: true diff --git a/charts/spiderpool/crds/spiderpool.spidernet.io_spidermultusconfigs.yaml b/charts/spiderpool/crds/spiderpool.spidernet.io_spidermultusconfigs.yaml index 461d27a569..c7bfc55cef 100644 --- a/charts/spiderpool/crds/spiderpool.spidernet.io_spidermultusconfigs.yaml +++ b/charts/spiderpool/crds/spiderpool.spidernet.io_spidermultusconfigs.yaml @@ -394,4 +394,423 @@ spec: type: object type: object served: true + storage: false + - name: v2beta2 + 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 of the MultusCNIConfig + properties: + chainCNIJsonData: + description: ChainCNIJsonData is used to configure the configuration + of chain CNI. format in json. + items: + type: string + type: array + cniType: + default: custom + enum: + - macvlan + - ipvlan + - sriov + - ovs + - ib-sriov + - ipoib + - custom + type: string + coordinator: + description: CoordinationSpec defines the desired state of SpiderCoordinator. + properties: + detectGateway: + default: false + description: DetectGateway to detect the gateway for the pod + type: boolean + detectIPConflict: + default: false + description: DetectIPConflict to detect the ip conflict for the + pod + type: boolean + hijackCIDR: + description: HijackCIDR configure static routing tables in the + pod that target these subnets to ensure that when the pod accesses + these subnets, packets are forwarded through the host network + stack, such as nodelocaldns(169.254.0.0/16) + items: + type: string + type: array + hostRPFilter: + default: 0 + description: 'HostRPFilter is used for coordiantor to help set + the rp_filter parameters of the node. NOTE: This field is considered + deprecated in the future. the rp_filter of the node should be + configured by spiderpool-agent rather than coordinator plugin. + Configurable values: /0/1/2, -1 means leave + it as it is. the default value is 0.' + type: integer + hostRuleTable: + default: 500 + description: HostRuleTable specifies the table number of the routing + table used to configure the communication between the pod and + the local node. + type: integer + mode: + default: auto + description: Mode mode specifies the mode in which the coordinator + runs, and the configurable values include auto (default), underlay, + overlay, disabled. + enum: + - auto + - underlay + - overlay + - disabled + type: string + podCIDRType: + description: CoordinatorSpec is used by SpiderCoordinator and + SpiderMultusConfig in spidermultusconfig CRD , podCIDRType should + not be required, which could be merged from SpiderCoordinator + CR but in SpiderCoordinator CRD, podCIDRType should be required + enum: + - auto + - cluster + - calico + - cilium + - none + type: string + podDefaultRouteNIC: + description: PodDefaultRouteNIC PodDefaultRouteNIC is used to + configure the NIC where the pod's default route resides. the + default value is empty, which means the default route will remain + at eth0. + type: string + podMACPrefix: + description: 'PodMACPrefix the fixed MAC address prefix, the length + is two bytes. the lowest bit of the first byte must be 0, which + indicates the unicast MAC address. example: 0a:1b' + type: string + podRPFilter: + default: 0 + description: 'PodRPFilter is used for coordiantor to help set + the rp_filter parameters of the pod. Configurable values: /0/1/2. negative number means leave it as it is. the + default value is 0.' + type: integer + tunePodRoutes: + default: true + description: TunePodRoutes specifies whether to tune pod routes + of multiple NICs on pods. + type: boolean + txQueueLen: + default: 0 + description: TxQueueLen to set the tx_queue_len of the pod. requirement + is a positive integer the default value is 0, which means leaving + it as it is. + type: integer + vethLinkAddress: + description: VethLinkAddress configure a ipv4 link-local address + for veth0 device. empty means disable. default is empty. Format + is like 169.254.100.1 + type: string + type: object + customCNI: + description: OtherCniTypeConfig only used for CniType custom, valid + json format, can be empty + type: string + disableIPAM: + default: false + type: boolean + enableCoordinator: + default: true + description: if CniType was set to custom, we'll mutate this field + to be false + type: boolean + ibsriov: + properties: + ibKubernetesEnabled: + default: false + description: Enforces ib-sriov-cni to work with ib-kubernetes. + type: boolean + ippools: + description: SpiderpoolPools could specify the IPAM spiderpool + CNI configuration default IPv4&IPv6 pools. + properties: + ipv4: + items: + type: string + type: array + ipv6: + items: + type: string + type: array + type: object + linkState: + default: enable + description: 'Enforces link state for the VF. Allowed values: + auto, enable, disable.' + enum: + - auto + - enable + - disable + type: string + pkey: + description: infiniBand pkey for VF, this field is used by ib-kubernetes + to add pkey with guid to InfiniBand subnet manager client e.g. + Mellanox UFM, OpenSM + type: string + rdmaIsolation: + default: true + description: rdmaIsolation enablw RDMA CNI plugin is intended + to be run as a chained CNI plugin. it ensures isolation of RDMA + traffic from other workloads in the system by moving the associated + RDMA interfaces of the provided network interface to the container's + network namespace path. + type: boolean + resourceName: + description: The SR-IOV RDMA resource name of the SpiderMultusConfig. + the SR-IOV RDMA resource is often reported to kubelet by the + sriov-device-plugin. + type: string + required: + - resourceName + type: object + ipoib: + properties: + ippools: + description: SpiderpoolPools could specify the IPAM spiderpool + CNI configuration default IPv4&IPv6 pools. + properties: + ipv4: + items: + type: string + type: array + ipv6: + items: + type: string + type: array + type: object + master: + description: name of the host interface to create the link from. + type: string + type: object + ipvlan: + properties: + bond: + description: Optional bond configuration for the CNI. It must + not be nil if the multiple master interfaces are specified. + properties: + mode: + format: int32 + maximum: 6 + minimum: 0 + type: integer + name: + type: string + options: + type: string + required: + - mode + - name + type: object + ippools: + description: SpiderpoolPools could specify the IPAM spiderpool + CNI configuration default IPv4&IPv6 pools. + properties: + ipv4: + items: + type: string + type: array + ipv6: + items: + type: string + type: array + type: object + master: + description: The master interface(s) for the CNI configuration. + At least one master interface must be specified. If multiple + master interfaces are specified, the spiderpool will create + a bond device with the bondConfig by the ifacer plugin. + items: + type: string + type: array + rdmaResourceName: + description: The RDMA resource name of the nic. the RDMA resource + is often reported to kubelet by the k8s-rdma-shared-dev-plugin. + when it is not empty and spiderpool podResourceInject feature + is enabled, spiderpool can automatically inject it into the + container's resources via webhook. + type: string + vlanID: + description: 'The VLAN ID for the CNI configuration, optional + and must be within the specified range: [0.4096).' + format: int32 + maximum: 4094 + minimum: 0 + type: integer + required: + - master + type: object + macvlan: + properties: + bond: + description: Optional bond configuration for the CNI. It must + not be nil if the multiple master interfaces are specified. + properties: + mode: + format: int32 + maximum: 6 + minimum: 0 + type: integer + name: + type: string + options: + type: string + required: + - mode + - name + type: object + ippools: + description: SpiderpoolPools could specify the IPAM spiderpool + CNI configuration default IPv4&IPv6 pools. + properties: + ipv4: + items: + type: string + type: array + ipv6: + items: + type: string + type: array + type: object + master: + description: The master interface(s) for the CNI configuration. + At least one master interface must be specified. If multiple + master interfaces are specified, the spiderpool will create + a bond device with the bondConfig by the ifacer plugin. + items: + type: string + type: array + rdmaResourceName: + description: The RDMA resource name of the nic. the RDMA resource + is often reported to kubelet by the k8s-rdma-shared-dev-plugin. + when it is not empty and spiderpool podResourceInject feature + is enabled, spiderpool can automatically inject it into the + container's resources via webhook. + type: string + vlanID: + description: 'The VLAN ID for the CNI configuration, optional + and must be within the specified range: [0.4096).' + format: int32 + maximum: 4094 + minimum: 0 + type: integer + required: + - master + type: object + ovs: + properties: + bridge: + type: string + deviceID: + description: PCI address of a VF in valid sysfs format + type: string + ippools: + description: SpiderpoolPools could specify the IPAM spiderpool + CNI configuration default IPv4&IPv6 pools. + properties: + ipv4: + items: + type: string + type: array + ipv6: + items: + type: string + type: array + type: object + trunk: + items: + properties: + id: + maximum: 4094 + minimum: 0 + type: integer + maxID: + maximum: 4094 + minimum: 0 + type: integer + minID: + maximum: 4094 + minimum: 0 + type: integer + type: object + type: array + vlan: + format: int32 + type: integer + required: + - bridge + type: object + sriov: + properties: + enableRdma: + default: false + description: DEPRECATED, use RdmaIsolation flled instead. + type: boolean + ippools: + description: SpiderpoolPools could specify the IPAM spiderpool + CNI configuration default IPv4&IPv6 pools. + properties: + ipv4: + items: + type: string + type: array + ipv6: + items: + type: string + type: array + type: object + maxTxRateMbps: + description: Mbps, 0 = disable rate limiting + minimum: 0 + type: integer + minTxRateMbps: + minimum: 0 + type: integer + rdmaIsolation: + default: false + description: rdmaIsolation enable RDMA CNI plugin is intended + to be run as a chained CNI plugin. it ensures isolation of RDMA + traffic from other workloads in the system by moving the associated + RDMA interfaces of the provided network interface to the container's + network namespace path. + type: boolean + resourceName: + description: The SR-IOV RDMA resource name of the SpiderMultusConfig. + the SR-IOV RDMA resource is often reported to kubelet by the + sriov-device-plugin. + type: string + vlanID: + description: 'The VLAN ID for the CNI configuration, optional + and must be within the specified range: [0.4096).' + format: int32 + maximum: 4094 + minimum: 0 + type: integer + required: + - resourceName + type: object + type: object + type: object + served: true storage: true diff --git a/charts/spiderpool/crds/spiderpool.spidernet.io_spiderreservedips.yaml b/charts/spiderpool/crds/spiderpool.spidernet.io_spiderreservedips.yaml index 01ef3d08ec..7de5e85a6e 100644 --- a/charts/spiderpool/crds/spiderpool.spidernet.io_spiderreservedips.yaml +++ b/charts/spiderpool/crds/spiderpool.spidernet.io_spiderreservedips.yaml @@ -56,5 +56,45 @@ spec: type: object type: object served: true + storage: false + subresources: {} + - additionalPrinterColumns: + - description: ipVersion + jsonPath: .spec.ipVersion + name: VERSION + type: string + name: v2beta2 + schema: + openAPIV3Schema: + description: SpiderReservedIP is the Schema for the spiderreservedips API. + 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: ReservedIPSpec defines the desired state of SpiderReservedIP. + properties: + ipVersion: + enum: + - 4 + - 6 + format: int64 + type: integer + ips: + items: + type: string + type: array + type: object + type: object + served: true storage: true subresources: {} diff --git a/charts/spiderpool/crds/spiderpool.spidernet.io_spidersubnets.yaml b/charts/spiderpool/crds/spiderpool.spidernet.io_spidersubnets.yaml index 3a367467b3..f33d0722b8 100644 --- a/charts/spiderpool/crds/spiderpool.spidernet.io_spidersubnets.yaml +++ b/charts/spiderpool/crds/spiderpool.spidernet.io_spidersubnets.yaml @@ -110,6 +110,101 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - description: ipVersion + jsonPath: .spec.ipVersion + name: VERSION + type: string + - description: subnet + jsonPath: .spec.subnet + name: SUBNET + type: string + - description: allocatedIPCount + jsonPath: .status.allocatedIPCount + name: ALLOCATED-IP-COUNT + type: integer + - description: totalIPCount + jsonPath: .status.totalIPCount + name: TOTAL-IP-COUNT + type: integer + name: v2beta2 + schema: + openAPIV3Schema: + description: SpiderSubnet is the Schema for the spidersubnets API. + 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: SubnetSpec defines the desired state of SpiderSubnet. + properties: + excludeIPs: + items: + type: string + type: array + gateway: + type: string + ipVersion: + enum: + - 4 + - 6 + format: int64 + type: integer + ips: + items: + type: string + type: array + routes: + items: + properties: + dst: + type: string + gw: + type: string + required: + - dst + - gw + type: object + type: array + subnet: + type: string + vlan: + description: 'DEPRECATED: Vlan is deprecated.' + format: int64 + maximum: 4094 + minimum: 0 + type: integer + required: + - subnet + type: object + status: + description: SubnetStatus defines the observed state of SpiderSubnet. + properties: + allocatedIPCount: + format: int64 + minimum: 0 + type: integer + controlledIPPools: + type: string + totalIPCount: + format: int64 + minimum: 0 + type: integer + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/pkg/constant/k8s.go b/pkg/constant/k8s.go index 9b88acde5e..c26c1be83b 100644 --- a/pkg/constant/k8s.go +++ b/pkg/constant/k8s.go @@ -118,16 +118,17 @@ const ( ) const ( - SpiderFinalizer = SpiderpoolAPIGroup - SpiderpoolAPIGroup = "spiderpool.spidernet.io" - SpiderpoolAPIVersion = "v2beta1" - KindSpiderSubnet = "SpiderSubnet" - KindSpiderIPPool = "SpiderIPPool" - KindSpiderEndpoint = "SpiderEndpoint" - KindSpiderReservedIP = "SpiderReservedIP" - KindSpiderCoordinator = "SpiderCoordinator" - KindSpiderMultusConfig = "SpiderMultusConfig" - KindSpiderClaimParameter = "SpiderClaimParameter" + SpiderFinalizer = SpiderpoolAPIGroup + SpiderpoolAPIGroup = "spiderpool.spidernet.io" + SpiderpoolAPIVersion = "v2beta1" + SpiderpoolAPIVersionV2beta2 = "v2beta2" + KindSpiderSubnet = "SpiderSubnet" + KindSpiderIPPool = "SpiderIPPool" + KindSpiderEndpoint = "SpiderEndpoint" + KindSpiderReservedIP = "SpiderReservedIP" + KindSpiderCoordinator = "SpiderCoordinator" + KindSpiderMultusConfig = "SpiderMultusConfig" + KindSpiderClaimParameter = "SpiderClaimParameter" ) const ( diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/doc.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/doc.go new file mode 100644 index 0000000000..ccb4c79af0 --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/doc.go @@ -0,0 +1,6 @@ +// Copyright 2025 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Package v2beta2 is the v2beta2 version of the API. +// +groupName=spiderpool.spidernet.io +package v2beta2 diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/groupversion_info.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/groupversion_info.go new file mode 100644 index 0000000000..721cd5b06a --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/groupversion_info.go @@ -0,0 +1,26 @@ +// Copyright 2025 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// +kubebuilder:object:generate=true +// +groupName=spiderpool.spidernet.io + +// Package v2beta2 contains API Schema definitions for the spiderpool v2 API group +package v2beta2 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" + + "github.com/spidernet-io/spiderpool/pkg/constant" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: constant.SpiderpoolAPIGroup, Version: constant.SpiderpoolAPIVersionV2beta2} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/rbac.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/rbac.go new file mode 100644 index 0000000000..5724c60d08 --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/rbac.go @@ -0,0 +1,24 @@ +// Copyright 2025 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// +kubebuilder:rbac:groups=spiderpool.spidernet.io,resources=spiderippools,verbs=get;list;watch;create;update;patch;delete;deletecollection +// +kubebuilder:rbac:groups=spiderpool.spidernet.io,resources=spidersubnets;spiderendpoints;spiderreservedips;spidermultusconfigs;spiderclaimparameters,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=spiderpool.spidernet.io,resources=spidercoordinators,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=spiderpool.spidernet.io,resources=spidersubnets/status;spiderippools/status;spidercoordinators/status,verbs=get;update;patch +// +kubebuilder:rbac:groups="",resources=events,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups="coordination.k8s.io",resources=leases,verbs=create;get;update +// +kubebuilder:rbac:groups="apps",resources=statefulsets;deployments;replicasets;daemonsets,verbs=get;list;watch;update +// +kubebuilder:rbac:groups="resource.k8s.io",resources=resourceclaims;resourceclaims/status;podschedulingcontexts/status;resourceclaimtemplates;resourceclasses;podschedulingcontexts,verbs=get;list;patch;watch;update +// +kubebuilder:rbac:groups="networking.k8s.io",resources=servicecidrs,verbs=get;list;watch +// +kubebuilder:rbac:groups="batch",resources=jobs;cronjobs,verbs=get;list;watch;update;delete +// +kubebuilder:rbac:groups="",resources=nodes,verbs=get;list;watch +// +kubebuilder:rbac:groups="",resources=namespaces;endpoints;pods;pods/status;configmaps,verbs=get;list;watch;update;patch;delete;deletecollection +// +kubebuilder:rbac:groups=k8s.cni.cncf.io,resources=network-attachment-definitions,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=kubevirt.io,resources=virtualmachines;virtualmachineinstances,verbs=get;list +// +kubebuilder:rbac:groups=admissionregistration.k8s.io,resources=mutatingwebhookconfigurations;validatingwebhookconfigurations,verbs=get;list;watch;delete;update +// +kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=apps.kruise.io,resources=clonesets;statefulsets,verbs=get;list;watch +// +kubebuilder:rbac:groups=crd.projectcalico.org,resources=ippools,verbs=get;list;watch +// +kubebuilder:rbac:groups=cilium.io,resources=ciliumpodippools,verbs=get;list;watch + +package v2beta2 diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/register.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/register.go new file mode 100644 index 0000000000..8b140866f7 --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/register.go @@ -0,0 +1,16 @@ +// Copyright 2025 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta2 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// SchemeGroupVersion is group version used to register these objects. +var SchemeGroupVersion = GroupVersion + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidercoordinator_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidercoordinator_types.go new file mode 100644 index 0000000000..25dc693b7a --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidercoordinator_types.go @@ -0,0 +1,141 @@ +// Copyright 2025 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// CoordinationSpec defines the desired state of SpiderCoordinator. +type CoordinatorSpec struct { + + // Mode mode specifies the mode in which the coordinator runs, + // and the configurable values include auto (default), underlay, + // overlay, disabled. + // +kubebuilder:validation:Enum=auto;underlay;overlay;disabled + // +kubebuilder:validation:Optional + // +kubebuilder:default=auto + Mode *string `json:"mode,omitempty"` + + // CoordinatorSpec is used by SpiderCoordinator and SpiderMultusConfig + // in spidermultusconfig CRD , podCIDRType should not be required, which + // could be merged from SpiderCoordinator CR + // but in SpiderCoordinator CRD, podCIDRType should be required + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Enum=auto;cluster;calico;cilium;none + PodCIDRType *string `json:"podCIDRType,omitempty"` + + // HijackCIDR configure static routing tables in the pod that target these + // subnets to ensure that when the pod accesses these subnets, packets + // are forwarded through the host network stack, such as nodelocaldns(169.254.0.0/16) + // +kubebuilder:validation:Optional + HijackCIDR []string `json:"hijackCIDR,omitempty"` + + // PodMACPrefix the fixed MAC address prefix, the length is two bytes. + // the lowest bit of the first byte must be 0, which indicates the + // unicast MAC address. example: 0a:1b + // +kubebuilder:validation:Optional + PodMACPrefix *string `json:"podMACPrefix,omitempty"` + + // TunePodRoutes specifies whether to tune pod routes of multiple NICs on pods. + // +kubebuilder:validation:Optional + // +kubebuilder:default=true + TunePodRoutes *bool `json:"tunePodRoutes,omitempty"` + + // PodDefaultRouteNIC PodDefaultRouteNIC is used to configure the NIC where + // the pod's default route resides. the default value is empty, which means + // the default route will remain at eth0. + // +kubebuilder:validation:Optional + PodDefaultRouteNIC *string `json:"podDefaultRouteNIC,omitempty"` + + // HostRuleTable specifies the table number of the routing table used + // to configure the communication between the pod and the local node. + // +kubebuilder:validation:Optional + // +kubebuilder:default=500 + HostRuleTable *int `json:"hostRuleTable,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=0 + // HostRPFilter is used for coordiantor to help set the rp_filter parameters + // of the node. NOTE: This field is considered deprecated in the future. + // the rp_filter of the node should be configured by spiderpool-agent + // rather than coordinator plugin. + // Configurable values: /0/1/2, -1 means leave it as it is. the default value is 0. + // +kubebuilder:validation:Optional + // +kubebuilder:default=0 + HostRPFilter *int `json:"hostRPFilter,omitempty"` + + // PodRPFilter is used for coordiantor to help set the rp_filter parameters of the pod. + // Configurable values: /0/1/2. negative number means leave it as it is. + // the default value is 0. + // +kubebuilder:validation:Optional + // +kubebuilder:default=0 + PodRPFilter *int `json:"podRPFilter,omitempty"` + + // TxQueueLen to set the tx_queue_len of the pod. requirement is a positive integer + // the default value is 0, which means leaving it as it is. + // +kubebuilder:validation:Optional + // +kubebuilder:default=0 + TxQueueLen *int `json:"txQueueLen,omitempty"` + + // DetectIPConflict to detect the ip conflict for the pod + // +kubebuilder:validation:Optional + // +kubebuilder:default=false + DetectIPConflict *bool `json:"detectIPConflict,omitempty"` + + // DetectGateway to detect the gateway for the pod + // +kubebuilder:validation:Optional + // +kubebuilder:default=false + DetectGateway *bool `json:"detectGateway,omitempty"` + + // VethLinkAddress configure a ipv4 link-local address + // for veth0 device. empty means disable. default is empty. + // Format is like 169.254.100.1 + VethLinkAddress *string `json:"vethLinkAddress,omitempty"` +} + +// CoordinationStatus defines the observed state of SpiderCoordinator. +type CoordinatorStatus struct { + // +kubebuilder:validation:Requred + Phase string `json:"phase"` + + // +kubebuilder: validation:Optional + Reason string `json:"reason,omitempty"` + + // +kubebuilder:validation:Optional + OverlayPodCIDR []string `json:"overlayPodCIDR"` + + // +kubebuilder:validation:Optional + ServiceCIDR []string `json:"serviceCIDR"` +} + +// +kubebuilder:resource:categories={spiderpool},path="spidercoordinators",scope="Cluster",shortName={scc},singular="spidercoordinator" +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +genclient +// +genclient:nonNamespaced + +// SpiderCoordinator is the Schema for the spidercoordinators API. +type SpiderCoordinator struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec CoordinatorSpec `json:"spec,omitempty"` + Status CoordinatorStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// SpiderCoordinatorList contains a list of SpiderCoordinator. +type SpiderCoordinatorList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderCoordinator `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SpiderCoordinator{}, &SpiderCoordinatorList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderendpoint_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderendpoint_types.go new file mode 100644 index 0000000000..3f67a4c539 --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderendpoint_types.go @@ -0,0 +1,100 @@ +// Copyright 2025 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +kubebuilder:storageversion +// WorkloadEndpointStatus defines the observed state of SpiderEndpoint. +type WorkloadEndpointStatus struct { + // +kubebuilder:validation:Required + Current PodIPAllocation `json:"current"` + + // +kubebuilder:validation:Required + OwnerControllerType string `json:"ownerControllerType"` + + // +kubebuilder:validation:Required + OwnerControllerName string `json:"ownerControllerName"` +} + +type PodIPAllocation struct { + // +kubebuilder:validation:Required + UID string `json:"uid"` + + // +kubebuilder:validation:Required + Node string `json:"node"` + + // +kubebuilder:validation:Required + IPs []IPAllocationDetail `json:"ips"` +} + +type IPAllocationDetail struct { + // +kubebuilder:validation:Required + NIC string `json:"interface"` + + // +kubebuilder:validation:Optional + IPv4 *string `json:"ipv4,omitempty"` + + // +kubebuilder:validation:Optional + IPv6 *string `json:"ipv6,omitempty"` + + // +kubebuilder:validation:Optional + IPv4Pool *string `json:"ipv4Pool,omitempty"` + + // +kubebuilder:validation:Optional + IPv6Pool *string `json:"ipv6Pool,omitempty"` + + // DEPRECATED: Vlan is deprecated. + // +kubebuilder:default=0 + // +kubebuilder:validation:Maximum=4094 + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + Vlan *int64 `json:"vlan,omitempty"` + + // +kubebuilder:validation:Optional + IPv4Gateway *string `json:"ipv4Gateway,omitempty"` + + // +kubebuilder:validation:Optional + IPv6Gateway *string `json:"ipv6Gateway,omitempty"` + + // +kubebuilder:validation:Optional + CleanGateway *bool `json:"cleanGateway,omitempty"` + + // +kubebuilder:validation:Optional + Routes []Route `json:"routes,omitempty"` +} + +// +kubebuilder:resource:categories={spiderpool},path="spiderendpoints",scope="Namespaced",shortName={se},singular="spiderendpoint" +// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].interface",description="interface",name="INTERFACE",type=string +// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].ipv4Pool",description="ipv4Pool",name="IPV4POOL",type=string +// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].ipv4",description="ipv4",name="IPV4",type=string +// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].ipv6Pool",description="ipv6Pool",name="IPV6POOL",type=string +// +kubebuilder:printcolumn:JSONPath=".status.current.ips[0].ipv6",description="ipv6",name="IPV6",type=string +// +kubebuilder:printcolumn:JSONPath=".status.current.node",description="node",name="NODE",type=string +// +kubebuilder:storageversion +// +kubebuilder:object:root=true + +// Spiderndpoint is the Schema for the spiderendpoints API. +type SpiderEndpoint struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Status WorkloadEndpointStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// SpiderEndpointList contains a list of SpiderEndpoint. +type SpiderEndpointList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderEndpoint `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SpiderEndpoint{}, &SpiderEndpointList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderippool_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderippool_types.go new file mode 100644 index 0000000000..bc994c957f --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderippool_types.go @@ -0,0 +1,132 @@ +// Copyright 2025 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// IPPoolSpec defines the desired state of SpiderIPPool. +type IPPoolSpec struct { + // +kubebuilder:validation:Enum=4;6 + // +kubebuilder:validation:Optional + IPVersion *int64 `json:"ipVersion,omitempty"` + + // +kubebuilder:validation:Required + Subnet string `json:"subnet"` + + // +kubebuilder:validation:Optional + IPs []string `json:"ips,omitempty"` + + // +kubebuilder:validation:Optional + ExcludeIPs []string `json:"excludeIPs,omitempty"` + + // +kubebuilder:validation:Optional + Gateway *string `json:"gateway,omitempty"` + + // DEPRECATED: Vlan is deprecated. + // +kubebuilder:validation:Maximum=4094 + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + Vlan *int64 `json:"vlan,omitempty"` + + // +kubebuilder:validation:Optional + Routes []Route `json:"routes,omitempty"` + + // +kubebuilder:validation:Optional + PodAffinity *metav1.LabelSelector `json:"podAffinity,omitempty"` + + // +kubebuilder:validation:Optional + NamespaceAffinity *metav1.LabelSelector `json:"namespaceAffinity,omitempty"` + + // +kubebuilder:validation:Optional + NamespaceName []string `json:"namespaceName,omitempty"` + + // +kubebuilder:validation:Optional + NodeAffinity *metav1.LabelSelector `json:"nodeAffinity,omitempty"` + + // +kubebuilder:validation:Optional + NodeName []string `json:"nodeName,omitempty"` + + // +kubebuilder:validation:Optional + MultusName []string `json:"multusName,omitempty"` + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + Default *bool `json:"default,omitempty"` + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + Disable *bool `json:"disable,omitempty"` +} + +type Route struct { + // +kubebuilder:validation:Required + Dst string `json:"dst"` + + // +kubebuilder:validation:Required + Gw string `json:"gw"` +} + +// IPPoolStatus defines the observed state of SpiderIPPool. +type IPPoolStatus struct { + // +kubebuilder:validation:Optional + AllocatedIPs *string `json:"allocatedIPs,omitempty"` + + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + TotalIPCount *int64 `json:"totalIPCount,omitempty"` + + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + AllocatedIPCount *int64 `json:"allocatedIPCount,omitempty"` +} + +// PoolIPAllocations is a map of IP allocation details indexed by IP address. +type PoolIPAllocations map[string]PoolIPAllocation + +type PoolIPAllocation struct { + NamespacedName string `json:"pod"` + PodUID string `json:"podUid"` +} + +// +kubebuilder:resource:categories={spiderpool},path="spiderippools",scope="Cluster",shortName={sp},singular="spiderippool" +// +kubebuilder:printcolumn:JSONPath=".spec.ipVersion",description="ipVersion",name="VERSION",type=string +// +kubebuilder:printcolumn:JSONPath=".spec.subnet",description="subnet",name="SUBNET",type=string +// +kubebuilder:printcolumn:JSONPath=".status.allocatedIPCount",description="allocatedIPCount",name="ALLOCATED-IP-COUNT",type=integer +// +kubebuilder:printcolumn:JSONPath=".status.totalIPCount",description="totalIPCount",name="TOTAL-IP-COUNT",type=integer +// +kubebuilder:printcolumn:JSONPath=".spec.default",description="default",name="DEFAULT",type=boolean +// +kubebuilder:printcolumn:JSONPath=".spec.disable",description="disable",name="DISABLE",type=boolean,priority=10 +// +kubebuilder:printcolumn:JSONPath=".spec.nodeName",description="nodeName",name="NodeName",type=string,priority=10 +// +kubebuilder:printcolumn:JSONPath=".spec.multusName",description="multusName",name="MultusName",type=string,priority=10 +// +kubebuilder:printcolumn:JSONPath=`.spec.podAffinity.matchLabels['ipam\.spidernet\.io/app\-namespace']`,description="AppNamespace",name="APP-NAMESPACE",type=string,priority=10 +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +genclient +// +genclient:nonNamespaced + +// SpiderIPPool is the Schema for the spiderippools API. +// +kubebuilder:storageversion + +type SpiderIPPool struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec IPPoolSpec `json:"spec,omitempty"` + Status IPPoolStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// SpiderIPPoolList contains a list of SpiderIPPool. +type SpiderIPPoolList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderIPPool `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SpiderIPPool{}, &SpiderIPPoolList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidermultus_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidermultus_types.go new file mode 100644 index 0000000000..47dd77f72d --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidermultus_types.go @@ -0,0 +1,268 @@ +// Copyright 2025 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta2 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// +kubebuilder:resource:categories={spiderpool},path="spidermultusconfigs",scope="Namespaced",shortName={smc},singular="spidermultusconfig" +// +kubebuilder:object:root=true +// +kubebuilder:storageversion + +// +genclient +// +genclient:noStatus +type SpiderMultusConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec is the specification of the MultusCNIConfig + Spec MultusCNIConfigSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true +type SpiderMultusConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderMultusConfig `json:"items"` +} + +// MultusCNIConfigSpec defines the desired state of SpiderMultusConfig. +type MultusCNIConfigSpec struct { + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Enum=macvlan;ipvlan;sriov;ovs;ib-sriov;ipoib;custom + // +kubebuilder:default=custom + CniType *string `json:"cniType,omitempty"` + + // +kubebuilder:validation:Optional + MacvlanConfig *SpiderMacvlanCniConfig `json:"macvlan,omitempty"` + + // +kubebuilder:validation:Optional + IPVlanConfig *SpiderIPvlanCniConfig `json:"ipvlan,omitempty"` + + // +kubebuilder:validation:Optional + SriovConfig *SpiderSRIOVCniConfig `json:"sriov,omitempty"` + + // +kubebuilder:validation:Optional + OvsConfig *SpiderOvsCniConfig `json:"ovs,omitempty"` + + // +kubebuilder:validation:Optional + IbSriovConfig *SpiderIBSriovCniConfig `json:"ibsriov,omitempty"` + + // +kubebuilder:validation:Optional + IpoibConfig *SpiderIpoibCniConfig `json:"ipoib,omitempty"` + + // if CniType was set to custom, we'll mutate this field to be false + // +kubebuilder:default=true + // +kubebuilder:validation:Optional + EnableCoordinator *bool `json:"enableCoordinator,omitempty"` + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + DisableIPAM *bool `json:"disableIPAM,omitempty"` + + // +kubebuilder:validation:Optional + CoordinatorConfig *CoordinatorSpec `json:"coordinator,omitempty"` + + // ChainCNIJsonData is used to configure the configuration of chain CNI. + // format in json. + // +kubebuilder:validation:Optional + ChainCNIJsonData []string `json:"chainCNIJsonData"` + + // OtherCniTypeConfig only used for CniType custom, valid json format, can be empty + // +kubebuilder:validation:Optional + CustomCNIConfig *string `json:"customCNI,omitempty"` +} + +type SpiderMacvlanCniConfig struct { + // +kubebuilder:validation:Required + // The master interface(s) for the CNI configuration. At least one master interface must be specified. + // If multiple master interfaces are specified, the spiderpool will create a bond device with the bondConfig + // by the ifacer plugin. + Master []string `json:"master"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=4094 + // The VLAN ID for the CNI configuration, optional and must be within the specified range: [0.4096). + VlanID *int32 `json:"vlanID,omitempty"` + + // +kubebuilder:validation:Optional + // Optional bond configuration for the CNI. It must not be nil if the multiple master interfaces are specified. + Bond *BondConfig `json:"bond,omitempty"` + + // +kubebuilder:validation:Optional + // The RDMA resource name of the nic. the RDMA resource is often reported to kubelet by the + // k8s-rdma-shared-dev-plugin. when it is not empty and spiderpool podResourceInject feature + // is enabled, spiderpool can automatically inject it into the container's resources via webhook. + RdmaResourceName string `json:"rdmaResourceName"` + + // +kubebuilder:validation:Optional + SpiderpoolConfigPools *SpiderpoolPools `json:"ippools,omitempty"` +} + +type SpiderIPvlanCniConfig struct { + // +kubebuilder:validation:Required + // The master interface(s) for the CNI configuration. At least one master interface must be specified. + // If multiple master interfaces are specified, the spiderpool will create a bond device with the bondConfig + // by the ifacer plugin. + Master []string `json:"master"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=4094 + // The VLAN ID for the CNI configuration, optional and must be within the specified range: [0.4096). + VlanID *int32 `json:"vlanID,omitempty"` + + // +kubebuilder:validation:Optional + // Optional bond configuration for the CNI. It must not be nil if the multiple master interfaces are specified. + Bond *BondConfig `json:"bond,omitempty"` + + // +kubebuilder:validation:Optional + // The RDMA resource name of the nic. the RDMA resource is often reported to kubelet by the + // k8s-rdma-shared-dev-plugin. when it is not empty and spiderpool podResourceInject feature + // is enabled, spiderpool can automatically inject it into the container's resources via webhook. + RdmaResourceName string `json:"rdmaResourceName"` + + // +kubebuilder:validation:Optional + SpiderpoolConfigPools *SpiderpoolPools `json:"ippools,omitempty"` +} + +type SpiderSRIOVCniConfig struct { + // +kubebuilder:validation:Required + // The SR-IOV RDMA resource name of the SpiderMultusConfig. the SR-IOV RDMA resource is often + // reported to kubelet by the sriov-device-plugin. + ResourceName string `json:"resourceName"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=4094 + // The VLAN ID for the CNI configuration, optional and must be within the specified range: [0.4096). + VlanID *int32 `json:"vlanID,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + MinTxRateMbps *int `json:"minTxRateMbps,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // Mbps, 0 = disable rate limiting + MaxTxRateMbps *int `json:"maxTxRateMbps,omitempty"` // Mbps, 0 = disable rate limiting + + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + // +kubebuilder:deprecated:reason="This field is deprecated and will be removed in future versions." + // DEPRECATED, use RdmaIsolation flled instead. + EnableRdma bool `json:"enableRdma"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=false + // +kubebuilder:validation:Optional + // rdmaIsolation enable RDMA CNI plugin is intended to be run as a chained CNI plugin. + // it ensures isolation of RDMA traffic from other workloads in the system by moving + // the associated RDMA interfaces of the provided network interface to the container's + // network namespace path. + RdmaIsolation bool `json:"rdmaIsolation"` + + // +kubebuilder:validation:Optional + SpiderpoolConfigPools *SpiderpoolPools `json:"ippools,omitempty"` +} + +type SpiderIBSriovCniConfig struct { + // +kubebuilder:validation:Required + // The SR-IOV RDMA resource name of the SpiderMultusConfig. the SR-IOV RDMA resource is often + // reported to kubelet by the sriov-device-plugin. + ResourceName string `json:"resourceName"` + + // +kubebuilder:validation:Optional + // infiniBand pkey for VF, this field is used by ib-kubernetes to add pkey with + // guid to InfiniBand subnet manager client e.g. Mellanox UFM, OpenSM + Pkey *string `json:"pkey,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=enable + // +kubebuilder:validation:Enum=auto;enable;disable + // Enforces link state for the VF. Allowed values: auto, enable, disable. + LinkState *string `json:"linkState,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=true + // +kubebuilder:validation:Optional + // rdmaIsolation enablw RDMA CNI plugin is intended to be run as a chained CNI plugin. + // it ensures isolation of RDMA traffic from other workloads in the system by moving + // the associated RDMA interfaces of the provided network interface to the container's + // network namespace path. + RdmaIsolation *bool `json:"rdmaIsolation,omitempty"` + + // +kubebuilder:validation:Optional + // +kubebuilder:default=false + // Enforces ib-sriov-cni to work with ib-kubernetes. + IbKubernetesEnabled *bool `json:"ibKubernetesEnabled,omitempty"` + + // +kubebuilder:validation:Optional + SpiderpoolConfigPools *SpiderpoolPools `json:"ippools,omitempty"` +} + +type SpiderIpoibCniConfig struct { + // +kubebuilder:validation:Required + // name of the host interface to create the link from. + Master string `json:"master,omitempty"` + + // +kubebuilder:validation:Optional + SpiderpoolConfigPools *SpiderpoolPools `json:"ippools,omitempty"` +} + +type SpiderOvsCniConfig struct { + // +kubebuilder:validation:Required + BrName string `json:"bridge"` + // +kubebuilder:validation:Optional + VlanTag *int32 `json:"vlan,omitempty"` + // +kubebuilder:validation:Optional + Trunk []*Trunk `json:"trunk,omitempty"` + // +kubebuilder:validation:Optional + // PCI address of a VF in valid sysfs format + DeviceID string `json:"deviceID"` + // +kubebuilder:validation:Optional + SpiderpoolConfigPools *SpiderpoolPools `json:"ippools,omitempty"` +} + +type Trunk struct { + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=4094 + MinID *uint `json:"minID,omitempty"` + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=4094 + MaxID *uint `json:"maxID,omitempty"` + // +kubebuilder:validation:Optional + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=4094 + ID *uint `json:"id,omitempty"` +} + +type BondConfig struct { + // +kubebuilder:validation:Required + Name string `json:"name"` + + // +kubebuilder:validation:Required + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Maximum=6 + Mode int32 `json:"mode"` + + // +kubebuilder:validation:Optional + Options *string `json:"options,omitempty"` +} + +// SpiderpoolPools could specify the IPAM spiderpool CNI configuration default IPv4&IPv6 pools. +type SpiderpoolPools struct { + // +kubebuilder:validation:Optional + IPv4IPPool []string `json:"ipv4,omitempty"` + + // +kubebuilder:validation:Optional + IPv6IPPool []string `json:"ipv6,omitempty"` +} + +func init() { + SchemeBuilder.Register(&SpiderMultusConfig{}, &SpiderMultusConfigList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderreservedip_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderreservedip_types.go new file mode 100644 index 0000000000..454004c05a --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spiderreservedip_types.go @@ -0,0 +1,45 @@ +// Copyright 2025 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ReservedIPSpec defines the desired state of SpiderReservedIP. +type ReservedIPSpec struct { + // +kubebuilder:validation:Enum=4;6 + // +kubebuilder:validation:Optional + IPVersion *int64 `json:"ipVersion,omitempty"` + + // +kubebuilder:validation:Optional + IPs []string `json:"ips,omitempty"` +} + +// +kubebuilder:resource:categories={spiderpool},path="spiderreservedips",scope="Cluster",shortName={sr},singular="spiderreservedip" +// +kubebuilder:printcolumn:JSONPath=".spec.ipVersion",description="ipVersion",name="VERSION",type=string +// +kubebuilder:object:root=true +// +kubebuilder:storageversion + +// SpiderReservedIP is the Schema for the spiderreservedips API. +type SpiderReservedIP struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec ReservedIPSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true + +// SpiderReservedIPList contains a list of SpiderReservedIP. +type SpiderReservedIPList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderReservedIP `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SpiderReservedIP{}, &SpiderReservedIPList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidersubnet_types.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidersubnet_types.go new file mode 100644 index 0000000000..460d118f5b --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/spidersubnet_types.go @@ -0,0 +1,92 @@ +// Copyright 2025 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +package v2beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// SubnetSpec defines the desired state of SpiderSubnet. +type SubnetSpec struct { + // +kubebuilder:validation:Enum=4;6 + // +kubebuilder:validation:Optional + IPVersion *int64 `json:"ipVersion,omitempty"` + + // +kubebuilder:validation:Required + Subnet string `json:"subnet"` + + // +kubebuilder:validation:Optional + IPs []string `json:"ips,omitempty"` + + // +kubebuilder:validation:Optional + ExcludeIPs []string `json:"excludeIPs,omitempty"` + + // +kubebuilder:validation:Optional + Gateway *string `json:"gateway,omitempty"` + + // DEPRECATED: Vlan is deprecated. + // +kubebuilder:validation:Maximum=4094 + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + Vlan *int64 `json:"vlan,omitempty"` + + // +kubebuilder:validation:Optional + Routes []Route `json:"routes,omitempty"` +} + +// SubnetStatus defines the observed state of SpiderSubnet. +type SubnetStatus struct { + // +kubebuilder:validation:Optional + ControlledIPPools *string `json:"controlledIPPools,omitempty"` + + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + TotalIPCount *int64 `json:"totalIPCount,omitempty"` + + // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Optional + AllocatedIPCount *int64 `json:"allocatedIPCount,omitempty"` +} + +// PoolIPPreAllocations is a map of pool IP pre-allocation details indexed by pool name. +type PoolIPPreAllocations map[string]PoolIPPreAllocation + +type PoolIPPreAllocation struct { + IPs []string `json:"ips"` + Application *string `json:"application,omitempty"` +} + +// +kubebuilder:resource:categories={spiderpool},path="spidersubnets",scope="Cluster",shortName={ss},singular="spidersubnet" +// +kubebuilder:printcolumn:JSONPath=".spec.ipVersion",description="ipVersion",name="VERSION",type=string +// +kubebuilder:printcolumn:JSONPath=".spec.subnet",description="subnet",name="SUBNET",type=string +// +kubebuilder:printcolumn:JSONPath=".status.allocatedIPCount",description="allocatedIPCount",name="ALLOCATED-IP-COUNT",type=integer +// +kubebuilder:printcolumn:JSONPath=".status.totalIPCount",description="totalIPCount",name="TOTAL-IP-COUNT",type=integer +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +genclient +// +genclient:nonNamespaced + +// SpiderSubnet is the Schema for the spidersubnets API. +type SpiderSubnet struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec SubnetSpec `json:"spec,omitempty"` + Status SubnetStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// SpiderSubnetList contains a list of SpiderSubnet. +type SpiderSubnetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []SpiderSubnet `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SpiderSubnet{}, &SpiderSubnetList{}) +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/types_string.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/types_string.go new file mode 100644 index 0000000000..1c76c0ada0 --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/types_string.go @@ -0,0 +1,217 @@ +// Copyright 2019 The Kubernetes Authors +// SPDX-License-Identifier: Apache-2.0 + +package v2beta2 + +import ( + "fmt" + "strings" + + stringutil "github.com/spidernet-io/spiderpool/pkg/utils/string" +) + +// String serves for SpiderIPPool +func (in *SpiderIPPool) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&SpiderIPPool{`, + `ObjectMeta:` + strings.Replace(fmt.Sprintf("%v", in.ObjectMeta), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(in.Spec.String(), "IPPoolSpec", "IPPoolSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(in.Status.String(), "IPPoolStatus", "IPPoolStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderIPPool Spec IPPoolSpec +func (in *IPPoolSpec) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&IPPoolSpec{`, + `IPVersion:` + stringutil.ValueToStringGenerated(in.IPVersion) + `,`, + `Subnet:` + fmt.Sprintf("%v", in.Subnet) + `,`, + `IPs:` + fmt.Sprintf("%v", in.IPs) + `,`, + `ExcludeIPs:` + fmt.Sprintf("%v", in.ExcludeIPs) + `,`, + `Gateway:` + stringutil.ValueToStringGenerated(in.Gateway) + `,`, + `Vlan:` + stringutil.ValueToStringGenerated(in.Vlan) + `,`, + `Routes:` + fmt.Sprintf("%+v", in.Routes) + `,`, + `PodAffinity:` + fmt.Sprintf("%v", in.PodAffinity.String()) + `,`, + `NamespaceAffinity:` + fmt.Sprintf("%v", in.NamespaceAffinity.String()) + `,`, + `NamespaceName:` + fmt.Sprintf("%v", in.NamespaceName) + `,`, + `NodeAffinity:` + fmt.Sprintf("%v", in.NodeAffinity.String()) + `,`, + `NodeName:` + fmt.Sprintf("%v", in.NodeName) + `,`, + `MultusName:` + fmt.Sprintf("%v", in.MultusName) + `,`, + `Default:` + stringutil.ValueToStringGenerated(in.Default) + `,`, + `Disable:` + stringutil.ValueToStringGenerated(in.Disable) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderIPPool Status IPPoolStatus +func (in *IPPoolStatus) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&IPPoolStatus{`, + `AllocatedIPs:` + stringutil.ValueToStringGenerated(in.AllocatedIPs) + `,`, + `TotalIPCount:` + stringutil.ValueToStringGenerated(in.TotalIPCount) + `,`, + `AllocatedIPCount:` + stringutil.ValueToStringGenerated(in.AllocatedIPCount) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderEndpoint +func (in *SpiderEndpoint) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&SpiderEndpoint{`, + `ObjectMeta:` + strings.Replace(fmt.Sprintf("%v", in.ObjectMeta), `&`, ``, 1) + `,`, + `Status:` + in.Status.String() + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderEndpoint Status WorkloadEndpointStatus +func (in *WorkloadEndpointStatus) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&WorkloadEndpointStatus{`, + `Current:` + fmt.Sprintf("%v", in.Current.String()) + `,`, + `OwnerControllerType:` + fmt.Sprintf("%v", in.OwnerControllerType) + `,`, + `OwnerControllerName:` + fmt.Sprintf("%v", in.OwnerControllerName) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderEndpoint Status PodIPAllocation +func (in *PodIPAllocation) String() string { + if in == nil { + return "nil" + } + + repeatedStringForIPs := "[]IPs{" + for _, f := range in.IPs { + repeatedStringForIPs += strings.Replace(strings.Replace(f.String(), "IPs", "IPs", 1), `&`, ``, 1) + "," + } + repeatedStringForIPs += "}" + + s := strings.Join([]string{`&PodIPAllocation{`, + `UID:` + fmt.Sprintf("%+v", in.UID) + `,`, + `Node:` + fmt.Sprintf("%+v", in.Node) + `,`, + `IPs:` + repeatedStringForIPs + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderEndpoint Status +func (in *IPAllocationDetail) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&IPAllocationDetail{`, + `NIC:` + fmt.Sprintf("%v", in.NIC) + `,`, + `IPv4:` + stringutil.ValueToStringGenerated(in.IPv4) + `,`, + `IPv6:` + stringutil.ValueToStringGenerated(in.IPv6) + `,`, + `IPv4Pool:` + stringutil.ValueToStringGenerated(in.IPv4Pool) + `,`, + `IPv6Pool:` + stringutil.ValueToStringGenerated(in.IPv6Pool) + `,`, + `Vlan:` + stringutil.ValueToStringGenerated(in.Vlan) + `,`, + `IPv4Gateway:` + stringutil.ValueToStringGenerated(in.IPv4Gateway) + `,`, + `IPv6Gateway:` + stringutil.ValueToStringGenerated(in.IPv6Gateway) + `,`, + `CleanGateway:` + stringutil.ValueToStringGenerated(in.CleanGateway) + `,`, + `Routes:` + fmt.Sprintf("%+v", in.Routes) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderReservedIP +func (in *SpiderReservedIP) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&SpiderReservedIP{`, + `ObjectMeta:` + strings.Replace(fmt.Sprintf("%v", in.ObjectMeta), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(in.Spec.String(), "ReservedIPSpec", "ReservedIPSpec", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderReservedIP Spec +func (in *ReservedIPSpec) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&ReservedIPSpec{`, + `IPVersion:` + stringutil.ValueToStringGenerated(in.IPVersion) + `,`, + `IPs:` + fmt.Sprintf("%v", in.IPs) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderSubnet +func (in *SpiderSubnet) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&SpiderSubnet{`, + `ObjectMeta:` + strings.Replace(fmt.Sprintf("%v", in.ObjectMeta), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(in.Spec.String(), "SubnetSpec", "SubnetSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(in.Status.String(), "SubnetStatus", "SubnetStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderSubnet Spec +func (in *SubnetSpec) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`&SubnetSpec{`, + `IPVersion:` + stringutil.ValueToStringGenerated(in.IPVersion) + `,`, + `Subnet:` + fmt.Sprintf("%v", in.Subnet) + `,`, + `IPs:` + fmt.Sprintf("%v", in.IPs) + `,`, + `ExcludeIPs:` + fmt.Sprintf("%v", in.ExcludeIPs) + `,`, + `Gateway:` + stringutil.ValueToStringGenerated(in.Gateway) + `,`, + `Vlan:` + stringutil.ValueToStringGenerated(in.Vlan) + `,`, + `Routes:` + fmt.Sprintf("%+v", in.Routes) + `,`, + `}`, + }, "") + return s +} + +// String serves for SpiderSubnet Status +func (in *SubnetStatus) String() string { + if in == nil { + return "nil" + } + + s := strings.Join([]string{`SubnetStatus{`, + `ControlledIPPools:` + stringutil.ValueToStringGenerated(in.ControlledIPPools) + `,`, + `TotalIPCount:` + stringutil.ValueToStringGenerated(in.TotalIPCount) + `,`, + `AllocatedIPCount:` + stringutil.ValueToStringGenerated(in.AllocatedIPCount) + `,`, + `}`, + }, "") + return s +} diff --git a/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/zz_generated.deepcopy.go b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/zz_generated.deepcopy.go new file mode 100644 index 0000000000..24df270ec4 --- /dev/null +++ b/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2/zz_generated.deepcopy.go @@ -0,0 +1,1223 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by controller-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BondConfig) DeepCopyInto(out *BondConfig) { + *out = *in + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BondConfig. +func (in *BondConfig) DeepCopy() *BondConfig { + if in == nil { + return nil + } + out := new(BondConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CoordinatorSpec) DeepCopyInto(out *CoordinatorSpec) { + *out = *in + if in.Mode != nil { + in, out := &in.Mode, &out.Mode + *out = new(string) + **out = **in + } + if in.PodCIDRType != nil { + in, out := &in.PodCIDRType, &out.PodCIDRType + *out = new(string) + **out = **in + } + if in.HijackCIDR != nil { + in, out := &in.HijackCIDR, &out.HijackCIDR + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PodMACPrefix != nil { + in, out := &in.PodMACPrefix, &out.PodMACPrefix + *out = new(string) + **out = **in + } + if in.TunePodRoutes != nil { + in, out := &in.TunePodRoutes, &out.TunePodRoutes + *out = new(bool) + **out = **in + } + if in.PodDefaultRouteNIC != nil { + in, out := &in.PodDefaultRouteNIC, &out.PodDefaultRouteNIC + *out = new(string) + **out = **in + } + if in.HostRuleTable != nil { + in, out := &in.HostRuleTable, &out.HostRuleTable + *out = new(int) + **out = **in + } + if in.HostRPFilter != nil { + in, out := &in.HostRPFilter, &out.HostRPFilter + *out = new(int) + **out = **in + } + if in.PodRPFilter != nil { + in, out := &in.PodRPFilter, &out.PodRPFilter + *out = new(int) + **out = **in + } + if in.TxQueueLen != nil { + in, out := &in.TxQueueLen, &out.TxQueueLen + *out = new(int) + **out = **in + } + if in.DetectIPConflict != nil { + in, out := &in.DetectIPConflict, &out.DetectIPConflict + *out = new(bool) + **out = **in + } + if in.DetectGateway != nil { + in, out := &in.DetectGateway, &out.DetectGateway + *out = new(bool) + **out = **in + } + if in.VethLinkAddress != nil { + in, out := &in.VethLinkAddress, &out.VethLinkAddress + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CoordinatorSpec. +func (in *CoordinatorSpec) DeepCopy() *CoordinatorSpec { + if in == nil { + return nil + } + out := new(CoordinatorSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CoordinatorStatus) DeepCopyInto(out *CoordinatorStatus) { + *out = *in + if in.OverlayPodCIDR != nil { + in, out := &in.OverlayPodCIDR, &out.OverlayPodCIDR + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ServiceCIDR != nil { + in, out := &in.ServiceCIDR, &out.ServiceCIDR + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CoordinatorStatus. +func (in *CoordinatorStatus) DeepCopy() *CoordinatorStatus { + if in == nil { + return nil + } + out := new(CoordinatorStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPAllocationDetail) DeepCopyInto(out *IPAllocationDetail) { + *out = *in + if in.IPv4 != nil { + in, out := &in.IPv4, &out.IPv4 + *out = new(string) + **out = **in + } + if in.IPv6 != nil { + in, out := &in.IPv6, &out.IPv6 + *out = new(string) + **out = **in + } + if in.IPv4Pool != nil { + in, out := &in.IPv4Pool, &out.IPv4Pool + *out = new(string) + **out = **in + } + if in.IPv6Pool != nil { + in, out := &in.IPv6Pool, &out.IPv6Pool + *out = new(string) + **out = **in + } + if in.Vlan != nil { + in, out := &in.Vlan, &out.Vlan + *out = new(int64) + **out = **in + } + if in.IPv4Gateway != nil { + in, out := &in.IPv4Gateway, &out.IPv4Gateway + *out = new(string) + **out = **in + } + if in.IPv6Gateway != nil { + in, out := &in.IPv6Gateway, &out.IPv6Gateway + *out = new(string) + **out = **in + } + if in.CleanGateway != nil { + in, out := &in.CleanGateway, &out.CleanGateway + *out = new(bool) + **out = **in + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAllocationDetail. +func (in *IPAllocationDetail) DeepCopy() *IPAllocationDetail { + if in == nil { + return nil + } + out := new(IPAllocationDetail) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPPoolSpec) DeepCopyInto(out *IPPoolSpec) { + *out = *in + if in.IPVersion != nil { + in, out := &in.IPVersion, &out.IPVersion + *out = new(int64) + **out = **in + } + if in.IPs != nil { + in, out := &in.IPs, &out.IPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludeIPs != nil { + in, out := &in.ExcludeIPs, &out.ExcludeIPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Gateway != nil { + in, out := &in.Gateway, &out.Gateway + *out = new(string) + **out = **in + } + if in.Vlan != nil { + in, out := &in.Vlan, &out.Vlan + *out = new(int64) + **out = **in + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route, len(*in)) + copy(*out, *in) + } + if in.PodAffinity != nil { + in, out := &in.PodAffinity, &out.PodAffinity + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.NamespaceAffinity != nil { + in, out := &in.NamespaceAffinity, &out.NamespaceAffinity + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.NamespaceName != nil { + in, out := &in.NamespaceName, &out.NamespaceName + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.NodeAffinity != nil { + in, out := &in.NodeAffinity, &out.NodeAffinity + *out = new(v1.LabelSelector) + (*in).DeepCopyInto(*out) + } + if in.NodeName != nil { + in, out := &in.NodeName, &out.NodeName + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.MultusName != nil { + in, out := &in.MultusName, &out.MultusName + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Default != nil { + in, out := &in.Default, &out.Default + *out = new(bool) + **out = **in + } + if in.Disable != nil { + in, out := &in.Disable, &out.Disable + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPoolSpec. +func (in *IPPoolSpec) DeepCopy() *IPPoolSpec { + if in == nil { + return nil + } + out := new(IPPoolSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IPPoolStatus) DeepCopyInto(out *IPPoolStatus) { + *out = *in + if in.AllocatedIPs != nil { + in, out := &in.AllocatedIPs, &out.AllocatedIPs + *out = new(string) + **out = **in + } + if in.TotalIPCount != nil { + in, out := &in.TotalIPCount, &out.TotalIPCount + *out = new(int64) + **out = **in + } + if in.AllocatedIPCount != nil { + in, out := &in.AllocatedIPCount, &out.AllocatedIPCount + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPPoolStatus. +func (in *IPPoolStatus) DeepCopy() *IPPoolStatus { + if in == nil { + return nil + } + out := new(IPPoolStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MultusCNIConfigSpec) DeepCopyInto(out *MultusCNIConfigSpec) { + *out = *in + if in.CniType != nil { + in, out := &in.CniType, &out.CniType + *out = new(string) + **out = **in + } + if in.MacvlanConfig != nil { + in, out := &in.MacvlanConfig, &out.MacvlanConfig + *out = new(SpiderMacvlanCniConfig) + (*in).DeepCopyInto(*out) + } + if in.IPVlanConfig != nil { + in, out := &in.IPVlanConfig, &out.IPVlanConfig + *out = new(SpiderIPvlanCniConfig) + (*in).DeepCopyInto(*out) + } + if in.SriovConfig != nil { + in, out := &in.SriovConfig, &out.SriovConfig + *out = new(SpiderSRIOVCniConfig) + (*in).DeepCopyInto(*out) + } + if in.OvsConfig != nil { + in, out := &in.OvsConfig, &out.OvsConfig + *out = new(SpiderOvsCniConfig) + (*in).DeepCopyInto(*out) + } + if in.IbSriovConfig != nil { + in, out := &in.IbSriovConfig, &out.IbSriovConfig + *out = new(SpiderIBSriovCniConfig) + (*in).DeepCopyInto(*out) + } + if in.IpoibConfig != nil { + in, out := &in.IpoibConfig, &out.IpoibConfig + *out = new(SpiderIpoibCniConfig) + (*in).DeepCopyInto(*out) + } + if in.EnableCoordinator != nil { + in, out := &in.EnableCoordinator, &out.EnableCoordinator + *out = new(bool) + **out = **in + } + if in.DisableIPAM != nil { + in, out := &in.DisableIPAM, &out.DisableIPAM + *out = new(bool) + **out = **in + } + if in.CoordinatorConfig != nil { + in, out := &in.CoordinatorConfig, &out.CoordinatorConfig + *out = new(CoordinatorSpec) + (*in).DeepCopyInto(*out) + } + if in.ChainCNIJsonData != nil { + in, out := &in.ChainCNIJsonData, &out.ChainCNIJsonData + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.CustomCNIConfig != nil { + in, out := &in.CustomCNIConfig, &out.CustomCNIConfig + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MultusCNIConfigSpec. +func (in *MultusCNIConfigSpec) DeepCopy() *MultusCNIConfigSpec { + if in == nil { + return nil + } + out := new(MultusCNIConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodIPAllocation) DeepCopyInto(out *PodIPAllocation) { + *out = *in + if in.IPs != nil { + in, out := &in.IPs, &out.IPs + *out = make([]IPAllocationDetail, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodIPAllocation. +func (in *PodIPAllocation) DeepCopy() *PodIPAllocation { + if in == nil { + return nil + } + out := new(PodIPAllocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PoolIPAllocation) DeepCopyInto(out *PoolIPAllocation) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PoolIPAllocation. +func (in *PoolIPAllocation) DeepCopy() *PoolIPAllocation { + if in == nil { + return nil + } + out := new(PoolIPAllocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in PoolIPAllocations) DeepCopyInto(out *PoolIPAllocations) { + { + in := &in + *out = make(PoolIPAllocations, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PoolIPAllocations. +func (in PoolIPAllocations) DeepCopy() PoolIPAllocations { + if in == nil { + return nil + } + out := new(PoolIPAllocations) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PoolIPPreAllocation) DeepCopyInto(out *PoolIPPreAllocation) { + *out = *in + if in.IPs != nil { + in, out := &in.IPs, &out.IPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Application != nil { + in, out := &in.Application, &out.Application + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PoolIPPreAllocation. +func (in *PoolIPPreAllocation) DeepCopy() *PoolIPPreAllocation { + if in == nil { + return nil + } + out := new(PoolIPPreAllocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in PoolIPPreAllocations) DeepCopyInto(out *PoolIPPreAllocations) { + { + in := &in + *out = make(PoolIPPreAllocations, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PoolIPPreAllocations. +func (in PoolIPPreAllocations) DeepCopy() PoolIPPreAllocations { + if in == nil { + return nil + } + out := new(PoolIPPreAllocations) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReservedIPSpec) DeepCopyInto(out *ReservedIPSpec) { + *out = *in + if in.IPVersion != nil { + in, out := &in.IPVersion, &out.IPVersion + *out = new(int64) + **out = **in + } + if in.IPs != nil { + in, out := &in.IPs, &out.IPs + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReservedIPSpec. +func (in *ReservedIPSpec) DeepCopy() *ReservedIPSpec { + if in == nil { + return nil + } + out := new(ReservedIPSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Route) DeepCopyInto(out *Route) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route. +func (in *Route) DeepCopy() *Route { + if in == nil { + return nil + } + out := new(Route) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderCoordinator) DeepCopyInto(out *SpiderCoordinator) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderCoordinator. +func (in *SpiderCoordinator) DeepCopy() *SpiderCoordinator { + if in == nil { + return nil + } + out := new(SpiderCoordinator) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderCoordinator) 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 *SpiderCoordinatorList) DeepCopyInto(out *SpiderCoordinatorList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderCoordinator, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderCoordinatorList. +func (in *SpiderCoordinatorList) DeepCopy() *SpiderCoordinatorList { + if in == nil { + return nil + } + out := new(SpiderCoordinatorList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderCoordinatorList) 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 *SpiderEndpoint) DeepCopyInto(out *SpiderEndpoint) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderEndpoint. +func (in *SpiderEndpoint) DeepCopy() *SpiderEndpoint { + if in == nil { + return nil + } + out := new(SpiderEndpoint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderEndpoint) 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 *SpiderEndpointList) DeepCopyInto(out *SpiderEndpointList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderEndpoint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderEndpointList. +func (in *SpiderEndpointList) DeepCopy() *SpiderEndpointList { + if in == nil { + return nil + } + out := new(SpiderEndpointList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderEndpointList) 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 *SpiderIBSriovCniConfig) DeepCopyInto(out *SpiderIBSriovCniConfig) { + *out = *in + if in.Pkey != nil { + in, out := &in.Pkey, &out.Pkey + *out = new(string) + **out = **in + } + if in.LinkState != nil { + in, out := &in.LinkState, &out.LinkState + *out = new(string) + **out = **in + } + if in.RdmaIsolation != nil { + in, out := &in.RdmaIsolation, &out.RdmaIsolation + *out = new(bool) + **out = **in + } + if in.IbKubernetesEnabled != nil { + in, out := &in.IbKubernetesEnabled, &out.IbKubernetesEnabled + *out = new(bool) + **out = **in + } + if in.SpiderpoolConfigPools != nil { + in, out := &in.SpiderpoolConfigPools, &out.SpiderpoolConfigPools + *out = new(SpiderpoolPools) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderIBSriovCniConfig. +func (in *SpiderIBSriovCniConfig) DeepCopy() *SpiderIBSriovCniConfig { + if in == nil { + return nil + } + out := new(SpiderIBSriovCniConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderIPPool) DeepCopyInto(out *SpiderIPPool) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderIPPool. +func (in *SpiderIPPool) DeepCopy() *SpiderIPPool { + if in == nil { + return nil + } + out := new(SpiderIPPool) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderIPPoolList) DeepCopyInto(out *SpiderIPPoolList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderIPPool, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderIPPoolList. +func (in *SpiderIPPoolList) DeepCopy() *SpiderIPPoolList { + if in == nil { + return nil + } + out := new(SpiderIPPoolList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderIPPoolList) 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 *SpiderIPvlanCniConfig) DeepCopyInto(out *SpiderIPvlanCniConfig) { + *out = *in + if in.Master != nil { + in, out := &in.Master, &out.Master + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.VlanID != nil { + in, out := &in.VlanID, &out.VlanID + *out = new(int32) + **out = **in + } + if in.Bond != nil { + in, out := &in.Bond, &out.Bond + *out = new(BondConfig) + (*in).DeepCopyInto(*out) + } + if in.SpiderpoolConfigPools != nil { + in, out := &in.SpiderpoolConfigPools, &out.SpiderpoolConfigPools + *out = new(SpiderpoolPools) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderIPvlanCniConfig. +func (in *SpiderIPvlanCniConfig) DeepCopy() *SpiderIPvlanCniConfig { + if in == nil { + return nil + } + out := new(SpiderIPvlanCniConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderIpoibCniConfig) DeepCopyInto(out *SpiderIpoibCniConfig) { + *out = *in + if in.SpiderpoolConfigPools != nil { + in, out := &in.SpiderpoolConfigPools, &out.SpiderpoolConfigPools + *out = new(SpiderpoolPools) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderIpoibCniConfig. +func (in *SpiderIpoibCniConfig) DeepCopy() *SpiderIpoibCniConfig { + if in == nil { + return nil + } + out := new(SpiderIpoibCniConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderMacvlanCniConfig) DeepCopyInto(out *SpiderMacvlanCniConfig) { + *out = *in + if in.Master != nil { + in, out := &in.Master, &out.Master + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.VlanID != nil { + in, out := &in.VlanID, &out.VlanID + *out = new(int32) + **out = **in + } + if in.Bond != nil { + in, out := &in.Bond, &out.Bond + *out = new(BondConfig) + (*in).DeepCopyInto(*out) + } + if in.SpiderpoolConfigPools != nil { + in, out := &in.SpiderpoolConfigPools, &out.SpiderpoolConfigPools + *out = new(SpiderpoolPools) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderMacvlanCniConfig. +func (in *SpiderMacvlanCniConfig) DeepCopy() *SpiderMacvlanCniConfig { + if in == nil { + return nil + } + out := new(SpiderMacvlanCniConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderMultusConfig) DeepCopyInto(out *SpiderMultusConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderMultusConfig. +func (in *SpiderMultusConfig) DeepCopy() *SpiderMultusConfig { + if in == nil { + return nil + } + out := new(SpiderMultusConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderMultusConfig) 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 *SpiderMultusConfigList) DeepCopyInto(out *SpiderMultusConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderMultusConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderMultusConfigList. +func (in *SpiderMultusConfigList) DeepCopy() *SpiderMultusConfigList { + if in == nil { + return nil + } + out := new(SpiderMultusConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderMultusConfigList) 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 *SpiderOvsCniConfig) DeepCopyInto(out *SpiderOvsCniConfig) { + *out = *in + if in.VlanTag != nil { + in, out := &in.VlanTag, &out.VlanTag + *out = new(int32) + **out = **in + } + if in.Trunk != nil { + in, out := &in.Trunk, &out.Trunk + *out = make([]*Trunk, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Trunk) + (*in).DeepCopyInto(*out) + } + } + } + if in.SpiderpoolConfigPools != nil { + in, out := &in.SpiderpoolConfigPools, &out.SpiderpoolConfigPools + *out = new(SpiderpoolPools) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderOvsCniConfig. +func (in *SpiderOvsCniConfig) DeepCopy() *SpiderOvsCniConfig { + if in == nil { + return nil + } + out := new(SpiderOvsCniConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderReservedIP) DeepCopyInto(out *SpiderReservedIP) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderReservedIP. +func (in *SpiderReservedIP) DeepCopy() *SpiderReservedIP { + if in == nil { + return nil + } + out := new(SpiderReservedIP) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderReservedIP) 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 *SpiderReservedIPList) DeepCopyInto(out *SpiderReservedIPList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderReservedIP, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderReservedIPList. +func (in *SpiderReservedIPList) DeepCopy() *SpiderReservedIPList { + if in == nil { + return nil + } + out := new(SpiderReservedIPList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderReservedIPList) 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 *SpiderSRIOVCniConfig) DeepCopyInto(out *SpiderSRIOVCniConfig) { + *out = *in + if in.VlanID != nil { + in, out := &in.VlanID, &out.VlanID + *out = new(int32) + **out = **in + } + if in.MinTxRateMbps != nil { + in, out := &in.MinTxRateMbps, &out.MinTxRateMbps + *out = new(int) + **out = **in + } + if in.MaxTxRateMbps != nil { + in, out := &in.MaxTxRateMbps, &out.MaxTxRateMbps + *out = new(int) + **out = **in + } + if in.SpiderpoolConfigPools != nil { + in, out := &in.SpiderpoolConfigPools, &out.SpiderpoolConfigPools + *out = new(SpiderpoolPools) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderSRIOVCniConfig. +func (in *SpiderSRIOVCniConfig) DeepCopy() *SpiderSRIOVCniConfig { + if in == nil { + return nil + } + out := new(SpiderSRIOVCniConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SpiderSubnet) DeepCopyInto(out *SpiderSubnet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderSubnet. +func (in *SpiderSubnet) DeepCopy() *SpiderSubnet { + if in == nil { + return nil + } + out := new(SpiderSubnet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderSubnet) 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 *SpiderSubnetList) DeepCopyInto(out *SpiderSubnetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]SpiderSubnet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderSubnetList. +func (in *SpiderSubnetList) DeepCopy() *SpiderSubnetList { + if in == nil { + return nil + } + out := new(SpiderSubnetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SpiderSubnetList) 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 *SpiderpoolPools) DeepCopyInto(out *SpiderpoolPools) { + *out = *in + if in.IPv4IPPool != nil { + in, out := &in.IPv4IPPool, &out.IPv4IPPool + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.IPv6IPPool != nil { + in, out := &in.IPv6IPPool, &out.IPv6IPPool + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SpiderpoolPools. +func (in *SpiderpoolPools) DeepCopy() *SpiderpoolPools { + if in == nil { + return nil + } + out := new(SpiderpoolPools) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubnetSpec) DeepCopyInto(out *SubnetSpec) { + *out = *in + if in.IPVersion != nil { + in, out := &in.IPVersion, &out.IPVersion + *out = new(int64) + **out = **in + } + if in.IPs != nil { + in, out := &in.IPs, &out.IPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ExcludeIPs != nil { + in, out := &in.ExcludeIPs, &out.ExcludeIPs + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Gateway != nil { + in, out := &in.Gateway, &out.Gateway + *out = new(string) + **out = **in + } + if in.Vlan != nil { + in, out := &in.Vlan, &out.Vlan + *out = new(int64) + **out = **in + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]Route, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetSpec. +func (in *SubnetSpec) DeepCopy() *SubnetSpec { + if in == nil { + return nil + } + out := new(SubnetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubnetStatus) DeepCopyInto(out *SubnetStatus) { + *out = *in + if in.ControlledIPPools != nil { + in, out := &in.ControlledIPPools, &out.ControlledIPPools + *out = new(string) + **out = **in + } + if in.TotalIPCount != nil { + in, out := &in.TotalIPCount, &out.TotalIPCount + *out = new(int64) + **out = **in + } + if in.AllocatedIPCount != nil { + in, out := &in.AllocatedIPCount, &out.AllocatedIPCount + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetStatus. +func (in *SubnetStatus) DeepCopy() *SubnetStatus { + if in == nil { + return nil + } + out := new(SubnetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Trunk) DeepCopyInto(out *Trunk) { + *out = *in + if in.MinID != nil { + in, out := &in.MinID, &out.MinID + *out = new(uint) + **out = **in + } + if in.MaxID != nil { + in, out := &in.MaxID, &out.MaxID + *out = new(uint) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(uint) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Trunk. +func (in *Trunk) DeepCopy() *Trunk { + if in == nil { + return nil + } + out := new(Trunk) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadEndpointStatus) DeepCopyInto(out *WorkloadEndpointStatus) { + *out = *in + in.Current.DeepCopyInto(&out.Current) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadEndpointStatus. +func (in *WorkloadEndpointStatus) DeepCopy() *WorkloadEndpointStatus { + if in == nil { + return nil + } + out := new(WorkloadEndpointStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/k8s/client/clientset/versioned/clientset.go b/pkg/k8s/client/clientset/versioned/clientset.go index 06a71c391f..193717b391 100644 --- a/pkg/k8s/client/clientset/versioned/clientset.go +++ b/pkg/k8s/client/clientset/versioned/clientset.go @@ -10,6 +10,7 @@ import ( "net/http" spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -18,12 +19,14 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface SpiderpoolV2beta1() spiderpoolv2beta1.SpiderpoolV2beta1Interface + SpiderpoolV2beta2() spiderpoolv2beta2.SpiderpoolV2beta2Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient spiderpoolV2beta1 *spiderpoolv2beta1.SpiderpoolV2beta1Client + spiderpoolV2beta2 *spiderpoolv2beta2.SpiderpoolV2beta2Client } // SpiderpoolV2beta1 retrieves the SpiderpoolV2beta1Client @@ -31,6 +34,11 @@ func (c *Clientset) SpiderpoolV2beta1() spiderpoolv2beta1.SpiderpoolV2beta1Inter return c.spiderpoolV2beta1 } +// SpiderpoolV2beta2 retrieves the SpiderpoolV2beta2Client +func (c *Clientset) SpiderpoolV2beta2() spiderpoolv2beta2.SpiderpoolV2beta2Interface { + return c.spiderpoolV2beta2 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -79,6 +87,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.spiderpoolV2beta2, err = spiderpoolv2beta2.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { @@ -101,6 +113,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.spiderpoolV2beta1 = spiderpoolv2beta1.New(c) + cs.spiderpoolV2beta2 = spiderpoolv2beta2.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go b/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go index d04ca1d2ce..5b0a04bc44 100644 --- a/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/k8s/client/clientset/versioned/fake/clientset_generated.go @@ -9,6 +9,8 @@ import ( clientset "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1" fakespiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta1/fake" + spiderpoolv2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2" + fakespiderpoolv2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -70,3 +72,8 @@ var ( func (c *Clientset) SpiderpoolV2beta1() spiderpoolv2beta1.SpiderpoolV2beta1Interface { return &fakespiderpoolv2beta1.FakeSpiderpoolV2beta1{Fake: &c.Fake} } + +// SpiderpoolV2beta2 retrieves the SpiderpoolV2beta2Client +func (c *Clientset) SpiderpoolV2beta2() spiderpoolv2beta2.SpiderpoolV2beta2Interface { + return &fakespiderpoolv2beta2.FakeSpiderpoolV2beta2{Fake: &c.Fake} +} diff --git a/pkg/k8s/client/clientset/versioned/fake/register.go b/pkg/k8s/client/clientset/versioned/fake/register.go index 8fee34d5bd..e7897318bd 100644 --- a/pkg/k8s/client/clientset/versioned/fake/register.go +++ b/pkg/k8s/client/clientset/versioned/fake/register.go @@ -7,6 +7,7 @@ package fake import ( spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -19,6 +20,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ spiderpoolv2beta1.AddToScheme, + spiderpoolv2beta2.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/k8s/client/clientset/versioned/scheme/register.go b/pkg/k8s/client/clientset/versioned/scheme/register.go index 03fa279097..7a430775ab 100644 --- a/pkg/k8s/client/clientset/versioned/scheme/register.go +++ b/pkg/k8s/client/clientset/versioned/scheme/register.go @@ -7,6 +7,7 @@ package scheme import ( spiderpoolv2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + spiderpoolv2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -19,6 +20,7 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ spiderpoolv2beta1.AddToScheme, + spiderpoolv2beta2.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/doc.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/doc.go new file mode 100644 index 0000000000..45c9fc1d01 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/doc.go @@ -0,0 +1,7 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v2beta2 diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/doc.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/doc.go new file mode 100644 index 0000000000..c962f5b29f --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/doc.go @@ -0,0 +1,7 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidercoordinator.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidercoordinator.go new file mode 100644 index 0000000000..1d25da2223 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidercoordinator.go @@ -0,0 +1,119 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + 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" +) + +// FakeSpiderCoordinators implements SpiderCoordinatorInterface +type FakeSpiderCoordinators struct { + Fake *FakeSpiderpoolV2beta2 +} + +var spidercoordinatorsResource = v2beta2.SchemeGroupVersion.WithResource("spidercoordinators") + +var spidercoordinatorsKind = v2beta2.SchemeGroupVersion.WithKind("SpiderCoordinator") + +// Get takes name of the spiderCoordinator, and returns the corresponding spiderCoordinator object, and an error if there is any. +func (c *FakeSpiderCoordinators) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderCoordinator, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(spidercoordinatorsResource, name), &v2beta2.SpiderCoordinator{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderCoordinator), err +} + +// List takes label and field selectors, and returns the list of SpiderCoordinators that match those selectors. +func (c *FakeSpiderCoordinators) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderCoordinatorList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(spidercoordinatorsResource, spidercoordinatorsKind, opts), &v2beta2.SpiderCoordinatorList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2beta2.SpiderCoordinatorList{ListMeta: obj.(*v2beta2.SpiderCoordinatorList).ListMeta} + for _, item := range obj.(*v2beta2.SpiderCoordinatorList).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 spiderCoordinators. +func (c *FakeSpiderCoordinators) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(spidercoordinatorsResource, opts)) +} + +// Create takes the representation of a spiderCoordinator and creates it. Returns the server's representation of the spiderCoordinator, and an error, if there is any. +func (c *FakeSpiderCoordinators) Create(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.CreateOptions) (result *v2beta2.SpiderCoordinator, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(spidercoordinatorsResource, spiderCoordinator), &v2beta2.SpiderCoordinator{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderCoordinator), err +} + +// Update takes the representation of a spiderCoordinator and updates it. Returns the server's representation of the spiderCoordinator, and an error, if there is any. +func (c *FakeSpiderCoordinators) Update(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.UpdateOptions) (result *v2beta2.SpiderCoordinator, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(spidercoordinatorsResource, spiderCoordinator), &v2beta2.SpiderCoordinator{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderCoordinator), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeSpiderCoordinators) UpdateStatus(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.UpdateOptions) (*v2beta2.SpiderCoordinator, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(spidercoordinatorsResource, "status", spiderCoordinator), &v2beta2.SpiderCoordinator{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderCoordinator), err +} + +// Delete takes name of the spiderCoordinator and deletes it. Returns an error if one occurs. +func (c *FakeSpiderCoordinators) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(spidercoordinatorsResource, name, opts), &v2beta2.SpiderCoordinator{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSpiderCoordinators) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(spidercoordinatorsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2beta2.SpiderCoordinatorList{}) + return err +} + +// Patch applies the patch and returns the patched spiderCoordinator. +func (c *FakeSpiderCoordinators) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderCoordinator, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(spidercoordinatorsResource, name, pt, data, subresources...), &v2beta2.SpiderCoordinator{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderCoordinator), err +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidermultusconfig.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidermultusconfig.go new file mode 100644 index 0000000000..c7c1ae8abe --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidermultusconfig.go @@ -0,0 +1,116 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + 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" +) + +// FakeSpiderMultusConfigs implements SpiderMultusConfigInterface +type FakeSpiderMultusConfigs struct { + Fake *FakeSpiderpoolV2beta2 + ns string +} + +var spidermultusconfigsResource = v2beta2.SchemeGroupVersion.WithResource("spidermultusconfigs") + +var spidermultusconfigsKind = v2beta2.SchemeGroupVersion.WithKind("SpiderMultusConfig") + +// Get takes name of the spiderMultusConfig, and returns the corresponding spiderMultusConfig object, and an error if there is any. +func (c *FakeSpiderMultusConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderMultusConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(spidermultusconfigsResource, c.ns, name), &v2beta2.SpiderMultusConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderMultusConfig), err +} + +// List takes label and field selectors, and returns the list of SpiderMultusConfigs that match those selectors. +func (c *FakeSpiderMultusConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderMultusConfigList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(spidermultusconfigsResource, spidermultusconfigsKind, c.ns, opts), &v2beta2.SpiderMultusConfigList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2beta2.SpiderMultusConfigList{ListMeta: obj.(*v2beta2.SpiderMultusConfigList).ListMeta} + for _, item := range obj.(*v2beta2.SpiderMultusConfigList).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 spiderMultusConfigs. +func (c *FakeSpiderMultusConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(spidermultusconfigsResource, c.ns, opts)) + +} + +// Create takes the representation of a spiderMultusConfig and creates it. Returns the server's representation of the spiderMultusConfig, and an error, if there is any. +func (c *FakeSpiderMultusConfigs) Create(ctx context.Context, spiderMultusConfig *v2beta2.SpiderMultusConfig, opts v1.CreateOptions) (result *v2beta2.SpiderMultusConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(spidermultusconfigsResource, c.ns, spiderMultusConfig), &v2beta2.SpiderMultusConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderMultusConfig), err +} + +// Update takes the representation of a spiderMultusConfig and updates it. Returns the server's representation of the spiderMultusConfig, and an error, if there is any. +func (c *FakeSpiderMultusConfigs) Update(ctx context.Context, spiderMultusConfig *v2beta2.SpiderMultusConfig, opts v1.UpdateOptions) (result *v2beta2.SpiderMultusConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(spidermultusconfigsResource, c.ns, spiderMultusConfig), &v2beta2.SpiderMultusConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderMultusConfig), err +} + +// Delete takes name of the spiderMultusConfig and deletes it. Returns an error if one occurs. +func (c *FakeSpiderMultusConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(spidermultusconfigsResource, c.ns, name, opts), &v2beta2.SpiderMultusConfig{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSpiderMultusConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(spidermultusconfigsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v2beta2.SpiderMultusConfigList{}) + return err +} + +// Patch applies the patch and returns the patched spiderMultusConfig. +func (c *FakeSpiderMultusConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderMultusConfig, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(spidermultusconfigsResource, c.ns, name, pt, data, subresources...), &v2beta2.SpiderMultusConfig{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderMultusConfig), err +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderpool.spidernet.io_client.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderpool.spidernet.io_client.go new file mode 100644 index 0000000000..112f1f341c --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spiderpool.spidernet.io_client.go @@ -0,0 +1,35 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeSpiderpoolV2beta2 struct { + *testing.Fake +} + +func (c *FakeSpiderpoolV2beta2) SpiderCoordinators() v2beta2.SpiderCoordinatorInterface { + return &FakeSpiderCoordinators{c} +} + +func (c *FakeSpiderpoolV2beta2) SpiderMultusConfigs(namespace string) v2beta2.SpiderMultusConfigInterface { + return &FakeSpiderMultusConfigs{c, namespace} +} + +func (c *FakeSpiderpoolV2beta2) SpiderSubnets() v2beta2.SpiderSubnetInterface { + return &FakeSpiderSubnets{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeSpiderpoolV2beta2) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidersubnet.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidersubnet.go new file mode 100644 index 0000000000..ea0f219c99 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/fake/fake_spidersubnet.go @@ -0,0 +1,119 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + 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" +) + +// FakeSpiderSubnets implements SpiderSubnetInterface +type FakeSpiderSubnets struct { + Fake *FakeSpiderpoolV2beta2 +} + +var spidersubnetsResource = v2beta2.SchemeGroupVersion.WithResource("spidersubnets") + +var spidersubnetsKind = v2beta2.SchemeGroupVersion.WithKind("SpiderSubnet") + +// Get takes name of the spiderSubnet, and returns the corresponding spiderSubnet object, and an error if there is any. +func (c *FakeSpiderSubnets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderSubnet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(spidersubnetsResource, name), &v2beta2.SpiderSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderSubnet), err +} + +// List takes label and field selectors, and returns the list of SpiderSubnets that match those selectors. +func (c *FakeSpiderSubnets) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderSubnetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(spidersubnetsResource, spidersubnetsKind, opts), &v2beta2.SpiderSubnetList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2beta2.SpiderSubnetList{ListMeta: obj.(*v2beta2.SpiderSubnetList).ListMeta} + for _, item := range obj.(*v2beta2.SpiderSubnetList).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 spiderSubnets. +func (c *FakeSpiderSubnets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(spidersubnetsResource, opts)) +} + +// Create takes the representation of a spiderSubnet and creates it. Returns the server's representation of the spiderSubnet, and an error, if there is any. +func (c *FakeSpiderSubnets) Create(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.CreateOptions) (result *v2beta2.SpiderSubnet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(spidersubnetsResource, spiderSubnet), &v2beta2.SpiderSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderSubnet), err +} + +// Update takes the representation of a spiderSubnet and updates it. Returns the server's representation of the spiderSubnet, and an error, if there is any. +func (c *FakeSpiderSubnets) Update(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.UpdateOptions) (result *v2beta2.SpiderSubnet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(spidersubnetsResource, spiderSubnet), &v2beta2.SpiderSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderSubnet), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeSpiderSubnets) UpdateStatus(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.UpdateOptions) (*v2beta2.SpiderSubnet, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(spidersubnetsResource, "status", spiderSubnet), &v2beta2.SpiderSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderSubnet), err +} + +// Delete takes name of the spiderSubnet and deletes it. Returns an error if one occurs. +func (c *FakeSpiderSubnets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(spidersubnetsResource, name, opts), &v2beta2.SpiderSubnet{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeSpiderSubnets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(spidersubnetsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v2beta2.SpiderSubnetList{}) + return err +} + +// Patch applies the patch and returns the patched spiderSubnet. +func (c *FakeSpiderSubnets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderSubnet, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(spidersubnetsResource, name, pt, data, subresources...), &v2beta2.SpiderSubnet{}) + if obj == nil { + return nil, err + } + return obj.(*v2beta2.SpiderSubnet), err +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/generated_expansion.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/generated_expansion.go new file mode 100644 index 0000000000..ffda07ef5a --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/generated_expansion.go @@ -0,0 +1,12 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +type SpiderCoordinatorExpansion interface{} + +type SpiderMultusConfigExpansion interface{} + +type SpiderSubnetExpansion interface{} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidercoordinator.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidercoordinator.go new file mode 100644 index 0000000000..1d27e6b3f9 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidercoordinator.go @@ -0,0 +1,171 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + "time" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/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" +) + +// SpiderCoordinatorsGetter has a method to return a SpiderCoordinatorInterface. +// A group's client should implement this interface. +type SpiderCoordinatorsGetter interface { + SpiderCoordinators() SpiderCoordinatorInterface +} + +// SpiderCoordinatorInterface has methods to work with SpiderCoordinator resources. +type SpiderCoordinatorInterface interface { + Create(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.CreateOptions) (*v2beta2.SpiderCoordinator, error) + Update(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.UpdateOptions) (*v2beta2.SpiderCoordinator, error) + UpdateStatus(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.UpdateOptions) (*v2beta2.SpiderCoordinator, 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) (*v2beta2.SpiderCoordinator, error) + List(ctx context.Context, opts v1.ListOptions) (*v2beta2.SpiderCoordinatorList, 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 *v2beta2.SpiderCoordinator, err error) + SpiderCoordinatorExpansion +} + +// spiderCoordinators implements SpiderCoordinatorInterface +type spiderCoordinators struct { + client rest.Interface +} + +// newSpiderCoordinators returns a SpiderCoordinators +func newSpiderCoordinators(c *SpiderpoolV2beta2Client) *spiderCoordinators { + return &spiderCoordinators{ + client: c.RESTClient(), + } +} + +// Get takes name of the spiderCoordinator, and returns the corresponding spiderCoordinator object, and an error if there is any. +func (c *spiderCoordinators) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderCoordinator, err error) { + result = &v2beta2.SpiderCoordinator{} + err = c.client.Get(). + Resource("spidercoordinators"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SpiderCoordinators that match those selectors. +func (c *spiderCoordinators) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderCoordinatorList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2beta2.SpiderCoordinatorList{} + err = c.client.Get(). + Resource("spidercoordinators"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested spiderCoordinators. +func (c *spiderCoordinators) 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("spidercoordinators"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a spiderCoordinator and creates it. Returns the server's representation of the spiderCoordinator, and an error, if there is any. +func (c *spiderCoordinators) Create(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.CreateOptions) (result *v2beta2.SpiderCoordinator, err error) { + result = &v2beta2.SpiderCoordinator{} + err = c.client.Post(). + Resource("spidercoordinators"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderCoordinator). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a spiderCoordinator and updates it. Returns the server's representation of the spiderCoordinator, and an error, if there is any. +func (c *spiderCoordinators) Update(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.UpdateOptions) (result *v2beta2.SpiderCoordinator, err error) { + result = &v2beta2.SpiderCoordinator{} + err = c.client.Put(). + Resource("spidercoordinators"). + Name(spiderCoordinator.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderCoordinator). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *spiderCoordinators) UpdateStatus(ctx context.Context, spiderCoordinator *v2beta2.SpiderCoordinator, opts v1.UpdateOptions) (result *v2beta2.SpiderCoordinator, err error) { + result = &v2beta2.SpiderCoordinator{} + err = c.client.Put(). + Resource("spidercoordinators"). + Name(spiderCoordinator.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderCoordinator). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the spiderCoordinator and deletes it. Returns an error if one occurs. +func (c *spiderCoordinators) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("spidercoordinators"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *spiderCoordinators) 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("spidercoordinators"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched spiderCoordinator. +func (c *spiderCoordinators) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderCoordinator, err error) { + result = &v2beta2.SpiderCoordinator{} + err = c.client.Patch(pt). + Resource("spidercoordinators"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go new file mode 100644 index 0000000000..fabd5dc499 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go @@ -0,0 +1,165 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + "time" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/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" +) + +// SpiderMultusConfigsGetter has a method to return a SpiderMultusConfigInterface. +// A group's client should implement this interface. +type SpiderMultusConfigsGetter interface { + SpiderMultusConfigs(namespace string) SpiderMultusConfigInterface +} + +// SpiderMultusConfigInterface has methods to work with SpiderMultusConfig resources. +type SpiderMultusConfigInterface interface { + Create(ctx context.Context, spiderMultusConfig *v2beta2.SpiderMultusConfig, opts v1.CreateOptions) (*v2beta2.SpiderMultusConfig, error) + Update(ctx context.Context, spiderMultusConfig *v2beta2.SpiderMultusConfig, opts v1.UpdateOptions) (*v2beta2.SpiderMultusConfig, 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) (*v2beta2.SpiderMultusConfig, error) + List(ctx context.Context, opts v1.ListOptions) (*v2beta2.SpiderMultusConfigList, 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 *v2beta2.SpiderMultusConfig, err error) + SpiderMultusConfigExpansion +} + +// spiderMultusConfigs implements SpiderMultusConfigInterface +type spiderMultusConfigs struct { + client rest.Interface + ns string +} + +// newSpiderMultusConfigs returns a SpiderMultusConfigs +func newSpiderMultusConfigs(c *SpiderpoolV2beta2Client, namespace string) *spiderMultusConfigs { + return &spiderMultusConfigs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the spiderMultusConfig, and returns the corresponding spiderMultusConfig object, and an error if there is any. +func (c *spiderMultusConfigs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderMultusConfig, err error) { + result = &v2beta2.SpiderMultusConfig{} + err = c.client.Get(). + Namespace(c.ns). + Resource("spidermultusconfigs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SpiderMultusConfigs that match those selectors. +func (c *spiderMultusConfigs) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderMultusConfigList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2beta2.SpiderMultusConfigList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("spidermultusconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested spiderMultusConfigs. +func (c *spiderMultusConfigs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("spidermultusconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a spiderMultusConfig and creates it. Returns the server's representation of the spiderMultusConfig, and an error, if there is any. +func (c *spiderMultusConfigs) Create(ctx context.Context, spiderMultusConfig *v2beta2.SpiderMultusConfig, opts v1.CreateOptions) (result *v2beta2.SpiderMultusConfig, err error) { + result = &v2beta2.SpiderMultusConfig{} + err = c.client.Post(). + Namespace(c.ns). + Resource("spidermultusconfigs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderMultusConfig). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a spiderMultusConfig and updates it. Returns the server's representation of the spiderMultusConfig, and an error, if there is any. +func (c *spiderMultusConfigs) Update(ctx context.Context, spiderMultusConfig *v2beta2.SpiderMultusConfig, opts v1.UpdateOptions) (result *v2beta2.SpiderMultusConfig, err error) { + result = &v2beta2.SpiderMultusConfig{} + err = c.client.Put(). + Namespace(c.ns). + Resource("spidermultusconfigs"). + Name(spiderMultusConfig.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderMultusConfig). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the spiderMultusConfig and deletes it. Returns an error if one occurs. +func (c *spiderMultusConfigs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("spidermultusconfigs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *spiderMultusConfigs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("spidermultusconfigs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched spiderMultusConfig. +func (c *spiderMultusConfigs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderMultusConfig, err error) { + result = &v2beta2.SpiderMultusConfig{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("spidermultusconfigs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderpool.spidernet.io_client.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderpool.spidernet.io_client.go new file mode 100644 index 0000000000..ec9c970668 --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spiderpool.spidernet.io_client.go @@ -0,0 +1,104 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "net/http" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type SpiderpoolV2beta2Interface interface { + RESTClient() rest.Interface + SpiderCoordinatorsGetter + SpiderMultusConfigsGetter + SpiderSubnetsGetter +} + +// SpiderpoolV2beta2Client is used to interact with features provided by the spiderpool.spidernet.io group. +type SpiderpoolV2beta2Client struct { + restClient rest.Interface +} + +func (c *SpiderpoolV2beta2Client) SpiderCoordinators() SpiderCoordinatorInterface { + return newSpiderCoordinators(c) +} + +func (c *SpiderpoolV2beta2Client) SpiderMultusConfigs(namespace string) SpiderMultusConfigInterface { + return newSpiderMultusConfigs(c, namespace) +} + +func (c *SpiderpoolV2beta2Client) SpiderSubnets() SpiderSubnetInterface { + return newSpiderSubnets(c) +} + +// NewForConfig creates a new SpiderpoolV2beta2Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*SpiderpoolV2beta2Client, 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 SpiderpoolV2beta2Client 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) (*SpiderpoolV2beta2Client, 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 &SpiderpoolV2beta2Client{client}, nil +} + +// NewForConfigOrDie creates a new SpiderpoolV2beta2Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *SpiderpoolV2beta2Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new SpiderpoolV2beta2Client for the given RESTClient. +func New(c rest.Interface) *SpiderpoolV2beta2Client { + return &SpiderpoolV2beta2Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v2beta2.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 *SpiderpoolV2beta2Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidersubnet.go b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidersubnet.go new file mode 100644 index 0000000000..9135f2f50f --- /dev/null +++ b/pkg/k8s/client/clientset/versioned/typed/spiderpool.spidernet.io/v2beta2/spidersubnet.go @@ -0,0 +1,171 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + "time" + + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + scheme "github.com/spidernet-io/spiderpool/pkg/k8s/client/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" +) + +// SpiderSubnetsGetter has a method to return a SpiderSubnetInterface. +// A group's client should implement this interface. +type SpiderSubnetsGetter interface { + SpiderSubnets() SpiderSubnetInterface +} + +// SpiderSubnetInterface has methods to work with SpiderSubnet resources. +type SpiderSubnetInterface interface { + Create(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.CreateOptions) (*v2beta2.SpiderSubnet, error) + Update(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.UpdateOptions) (*v2beta2.SpiderSubnet, error) + UpdateStatus(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.UpdateOptions) (*v2beta2.SpiderSubnet, 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) (*v2beta2.SpiderSubnet, error) + List(ctx context.Context, opts v1.ListOptions) (*v2beta2.SpiderSubnetList, 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 *v2beta2.SpiderSubnet, err error) + SpiderSubnetExpansion +} + +// spiderSubnets implements SpiderSubnetInterface +type spiderSubnets struct { + client rest.Interface +} + +// newSpiderSubnets returns a SpiderSubnets +func newSpiderSubnets(c *SpiderpoolV2beta2Client) *spiderSubnets { + return &spiderSubnets{ + client: c.RESTClient(), + } +} + +// Get takes name of the spiderSubnet, and returns the corresponding spiderSubnet object, and an error if there is any. +func (c *spiderSubnets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.SpiderSubnet, err error) { + result = &v2beta2.SpiderSubnet{} + err = c.client.Get(). + Resource("spidersubnets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of SpiderSubnets that match those selectors. +func (c *spiderSubnets) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.SpiderSubnetList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2beta2.SpiderSubnetList{} + err = c.client.Get(). + Resource("spidersubnets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested spiderSubnets. +func (c *spiderSubnets) 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("spidersubnets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a spiderSubnet and creates it. Returns the server's representation of the spiderSubnet, and an error, if there is any. +func (c *spiderSubnets) Create(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.CreateOptions) (result *v2beta2.SpiderSubnet, err error) { + result = &v2beta2.SpiderSubnet{} + err = c.client.Post(). + Resource("spidersubnets"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderSubnet). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a spiderSubnet and updates it. Returns the server's representation of the spiderSubnet, and an error, if there is any. +func (c *spiderSubnets) Update(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.UpdateOptions) (result *v2beta2.SpiderSubnet, err error) { + result = &v2beta2.SpiderSubnet{} + err = c.client.Put(). + Resource("spidersubnets"). + Name(spiderSubnet.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderSubnet). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *spiderSubnets) UpdateStatus(ctx context.Context, spiderSubnet *v2beta2.SpiderSubnet, opts v1.UpdateOptions) (result *v2beta2.SpiderSubnet, err error) { + result = &v2beta2.SpiderSubnet{} + err = c.client.Put(). + Resource("spidersubnets"). + Name(spiderSubnet.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(spiderSubnet). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the spiderSubnet and deletes it. Returns an error if one occurs. +func (c *spiderSubnets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("spidersubnets"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *spiderSubnets) 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("spidersubnets"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched spiderSubnet. +func (c *spiderSubnets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.SpiderSubnet, err error) { + result = &v2beta2.SpiderSubnet{} + err = c.client.Patch(pt). + Resource("spidersubnets"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/k8s/client/informers/externalversions/generic.go b/pkg/k8s/client/informers/externalversions/generic.go index 015301fcb1..9f3a558e7a 100644 --- a/pkg/k8s/client/informers/externalversions/generic.go +++ b/pkg/k8s/client/informers/externalversions/generic.go @@ -9,6 +9,7 @@ import ( "fmt" v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -51,6 +52,14 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v2beta1.SchemeGroupVersion.WithResource("spidersubnets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Spiderpool().V2beta1().SpiderSubnets().Informer()}, nil + // Group=spiderpool.spidernet.io, Version=v2beta2 + case v2beta2.SchemeGroupVersion.WithResource("spidercoordinators"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Spiderpool().V2beta2().SpiderCoordinators().Informer()}, nil + case v2beta2.SchemeGroupVersion.WithResource("spidermultusconfigs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Spiderpool().V2beta2().SpiderMultusConfigs().Informer()}, nil + case v2beta2.SchemeGroupVersion.WithResource("spidersubnets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Spiderpool().V2beta2().SpiderSubnets().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/interface.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/interface.go index 0279dd4130..5cde2eef1c 100644 --- a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/interface.go +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/interface.go @@ -8,12 +8,15 @@ package spiderpool import ( internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" v2beta1 "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta1" + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2" ) // Interface provides access to each of this group's versions. type Interface interface { // V2beta1 provides access to shared informers for resources in V2beta1. V2beta1() v2beta1.Interface + // V2beta2 provides access to shared informers for resources in V2beta2. + V2beta2() v2beta2.Interface } type group struct { @@ -31,3 +34,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V2beta1() v2beta1.Interface { return v2beta1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V2beta2 returns a new v2beta2.Interface. +func (g *group) V2beta2() v2beta2.Interface { + return v2beta2.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/interface.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/interface.go new file mode 100644 index 0000000000..93e1637c33 --- /dev/null +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/interface.go @@ -0,0 +1,46 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // SpiderCoordinators returns a SpiderCoordinatorInformer. + SpiderCoordinators() SpiderCoordinatorInformer + // SpiderMultusConfigs returns a SpiderMultusConfigInformer. + SpiderMultusConfigs() SpiderMultusConfigInformer + // SpiderSubnets returns a SpiderSubnetInformer. + SpiderSubnets() SpiderSubnetInformer +} + +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} +} + +// SpiderCoordinators returns a SpiderCoordinatorInformer. +func (v *version) SpiderCoordinators() SpiderCoordinatorInformer { + return &spiderCoordinatorInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// SpiderMultusConfigs returns a SpiderMultusConfigInformer. +func (v *version) SpiderMultusConfigs() SpiderMultusConfigInformer { + return &spiderMultusConfigInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// SpiderSubnets returns a SpiderSubnetInformer. +func (v *version) SpiderSubnets() SpiderSubnetInformer { + return &spiderSubnetInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidercoordinator.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidercoordinator.go new file mode 100644 index 0000000000..ca6392300e --- /dev/null +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidercoordinator.go @@ -0,0 +1,76 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + time "time" + + spiderpoolspidernetiov2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" + internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2" + 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" +) + +// SpiderCoordinatorInformer provides access to a shared informer and lister for +// SpiderCoordinators. +type SpiderCoordinatorInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta2.SpiderCoordinatorLister +} + +type spiderCoordinatorInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewSpiderCoordinatorInformer constructs a new informer for SpiderCoordinator 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 NewSpiderCoordinatorInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSpiderCoordinatorInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredSpiderCoordinatorInformer constructs a new informer for SpiderCoordinator 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 NewFilteredSpiderCoordinatorInformer(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.SpiderpoolV2beta2().SpiderCoordinators().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SpiderpoolV2beta2().SpiderCoordinators().Watch(context.TODO(), options) + }, + }, + &spiderpoolspidernetiov2beta2.SpiderCoordinator{}, + resyncPeriod, + indexers, + ) +} + +func (f *spiderCoordinatorInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSpiderCoordinatorInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *spiderCoordinatorInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&spiderpoolspidernetiov2beta2.SpiderCoordinator{}, f.defaultInformer) +} + +func (f *spiderCoordinatorInformer) Lister() v2beta2.SpiderCoordinatorLister { + return v2beta2.NewSpiderCoordinatorLister(f.Informer().GetIndexer()) +} diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go new file mode 100644 index 0000000000..1f4e9a87b2 --- /dev/null +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go @@ -0,0 +1,77 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + time "time" + + spiderpoolspidernetiov2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" + internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2" + 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" +) + +// SpiderMultusConfigInformer provides access to a shared informer and lister for +// SpiderMultusConfigs. +type SpiderMultusConfigInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta2.SpiderMultusConfigLister +} + +type spiderMultusConfigInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewSpiderMultusConfigInformer constructs a new informer for SpiderMultusConfig 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 NewSpiderMultusConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSpiderMultusConfigInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredSpiderMultusConfigInformer constructs a new informer for SpiderMultusConfig 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 NewFilteredSpiderMultusConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SpiderpoolV2beta2().SpiderMultusConfigs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SpiderpoolV2beta2().SpiderMultusConfigs(namespace).Watch(context.TODO(), options) + }, + }, + &spiderpoolspidernetiov2beta2.SpiderMultusConfig{}, + resyncPeriod, + indexers, + ) +} + +func (f *spiderMultusConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSpiderMultusConfigInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *spiderMultusConfigInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&spiderpoolspidernetiov2beta2.SpiderMultusConfig{}, f.defaultInformer) +} + +func (f *spiderMultusConfigInformer) Lister() v2beta2.SpiderMultusConfigLister { + return v2beta2.NewSpiderMultusConfigLister(f.Informer().GetIndexer()) +} diff --git a/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidersubnet.go b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidersubnet.go new file mode 100644 index 0000000000..e75915b852 --- /dev/null +++ b/pkg/k8s/client/informers/externalversions/spiderpool.spidernet.io/v2beta2/spidersubnet.go @@ -0,0 +1,76 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + time "time" + + spiderpoolspidernetiov2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + versioned "github.com/spidernet-io/spiderpool/pkg/k8s/client/clientset/versioned" + internalinterfaces "github.com/spidernet-io/spiderpool/pkg/k8s/client/informers/externalversions/internalinterfaces" + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2" + 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" +) + +// SpiderSubnetInformer provides access to a shared informer and lister for +// SpiderSubnets. +type SpiderSubnetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta2.SpiderSubnetLister +} + +type spiderSubnetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewSpiderSubnetInformer constructs a new informer for SpiderSubnet 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 NewSpiderSubnetInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredSpiderSubnetInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredSpiderSubnetInformer constructs a new informer for SpiderSubnet 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 NewFilteredSpiderSubnetInformer(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.SpiderpoolV2beta2().SpiderSubnets().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.SpiderpoolV2beta2().SpiderSubnets().Watch(context.TODO(), options) + }, + }, + &spiderpoolspidernetiov2beta2.SpiderSubnet{}, + resyncPeriod, + indexers, + ) +} + +func (f *spiderSubnetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredSpiderSubnetInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *spiderSubnetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&spiderpoolspidernetiov2beta2.SpiderSubnet{}, f.defaultInformer) +} + +func (f *spiderSubnetInformer) Lister() v2beta2.SpiderSubnetLister { + return v2beta2.NewSpiderSubnetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/expansion_generated.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/expansion_generated.go new file mode 100644 index 0000000000..ef7dbfd121 --- /dev/null +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/expansion_generated.go @@ -0,0 +1,22 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +// SpiderCoordinatorListerExpansion allows custom methods to be added to +// SpiderCoordinatorLister. +type SpiderCoordinatorListerExpansion interface{} + +// SpiderMultusConfigListerExpansion allows custom methods to be added to +// SpiderMultusConfigLister. +type SpiderMultusConfigListerExpansion interface{} + +// SpiderMultusConfigNamespaceListerExpansion allows custom methods to be added to +// SpiderMultusConfigNamespaceLister. +type SpiderMultusConfigNamespaceListerExpansion interface{} + +// SpiderSubnetListerExpansion allows custom methods to be added to +// SpiderSubnetLister. +type SpiderSubnetListerExpansion interface{} diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidercoordinator.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidercoordinator.go new file mode 100644 index 0000000000..41b6866678 --- /dev/null +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidercoordinator.go @@ -0,0 +1,55 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +import ( + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SpiderCoordinatorLister helps list SpiderCoordinators. +// All objects returned here must be treated as read-only. +type SpiderCoordinatorLister interface { + // List lists all SpiderCoordinators in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.SpiderCoordinator, err error) + // Get retrieves the SpiderCoordinator from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta2.SpiderCoordinator, error) + SpiderCoordinatorListerExpansion +} + +// spiderCoordinatorLister implements the SpiderCoordinatorLister interface. +type spiderCoordinatorLister struct { + indexer cache.Indexer +} + +// NewSpiderCoordinatorLister returns a new SpiderCoordinatorLister. +func NewSpiderCoordinatorLister(indexer cache.Indexer) SpiderCoordinatorLister { + return &spiderCoordinatorLister{indexer: indexer} +} + +// List lists all SpiderCoordinators in the indexer. +func (s *spiderCoordinatorLister) List(selector labels.Selector) (ret []*v2beta2.SpiderCoordinator, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.SpiderCoordinator)) + }) + return ret, err +} + +// Get retrieves the SpiderCoordinator from the index for a given name. +func (s *spiderCoordinatorLister) Get(name string) (*v2beta2.SpiderCoordinator, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta2.Resource("spidercoordinator"), name) + } + return obj.(*v2beta2.SpiderCoordinator), nil +} diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go new file mode 100644 index 0000000000..9206af8610 --- /dev/null +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidermultusconfig.go @@ -0,0 +1,86 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +import ( + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SpiderMultusConfigLister helps list SpiderMultusConfigs. +// All objects returned here must be treated as read-only. +type SpiderMultusConfigLister interface { + // List lists all SpiderMultusConfigs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.SpiderMultusConfig, err error) + // SpiderMultusConfigs returns an object that can list and get SpiderMultusConfigs. + SpiderMultusConfigs(namespace string) SpiderMultusConfigNamespaceLister + SpiderMultusConfigListerExpansion +} + +// spiderMultusConfigLister implements the SpiderMultusConfigLister interface. +type spiderMultusConfigLister struct { + indexer cache.Indexer +} + +// NewSpiderMultusConfigLister returns a new SpiderMultusConfigLister. +func NewSpiderMultusConfigLister(indexer cache.Indexer) SpiderMultusConfigLister { + return &spiderMultusConfigLister{indexer: indexer} +} + +// List lists all SpiderMultusConfigs in the indexer. +func (s *spiderMultusConfigLister) List(selector labels.Selector) (ret []*v2beta2.SpiderMultusConfig, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.SpiderMultusConfig)) + }) + return ret, err +} + +// SpiderMultusConfigs returns an object that can list and get SpiderMultusConfigs. +func (s *spiderMultusConfigLister) SpiderMultusConfigs(namespace string) SpiderMultusConfigNamespaceLister { + return spiderMultusConfigNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// SpiderMultusConfigNamespaceLister helps list and get SpiderMultusConfigs. +// All objects returned here must be treated as read-only. +type SpiderMultusConfigNamespaceLister interface { + // List lists all SpiderMultusConfigs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.SpiderMultusConfig, err error) + // Get retrieves the SpiderMultusConfig from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta2.SpiderMultusConfig, error) + SpiderMultusConfigNamespaceListerExpansion +} + +// spiderMultusConfigNamespaceLister implements the SpiderMultusConfigNamespaceLister +// interface. +type spiderMultusConfigNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all SpiderMultusConfigs in the indexer for a given namespace. +func (s spiderMultusConfigNamespaceLister) List(selector labels.Selector) (ret []*v2beta2.SpiderMultusConfig, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.SpiderMultusConfig)) + }) + return ret, err +} + +// Get retrieves the SpiderMultusConfig from the indexer for a given namespace and name. +func (s spiderMultusConfigNamespaceLister) Get(name string) (*v2beta2.SpiderMultusConfig, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta2.Resource("spidermultusconfig"), name) + } + return obj.(*v2beta2.SpiderMultusConfig), nil +} diff --git a/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidersubnet.go b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidersubnet.go new file mode 100644 index 0000000000..a55a7e2e02 --- /dev/null +++ b/pkg/k8s/client/listers/spiderpool.spidernet.io/v2beta2/spidersubnet.go @@ -0,0 +1,55 @@ +// Copyright 2022 Authors of spidernet-io +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +import ( + v2beta2 "github.com/spidernet-io/spiderpool/pkg/k8s/apis/spiderpool.spidernet.io/v2beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// SpiderSubnetLister helps list SpiderSubnets. +// All objects returned here must be treated as read-only. +type SpiderSubnetLister interface { + // List lists all SpiderSubnets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.SpiderSubnet, err error) + // Get retrieves the SpiderSubnet from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta2.SpiderSubnet, error) + SpiderSubnetListerExpansion +} + +// spiderSubnetLister implements the SpiderSubnetLister interface. +type spiderSubnetLister struct { + indexer cache.Indexer +} + +// NewSpiderSubnetLister returns a new SpiderSubnetLister. +func NewSpiderSubnetLister(indexer cache.Indexer) SpiderSubnetLister { + return &spiderSubnetLister{indexer: indexer} +} + +// List lists all SpiderSubnets in the indexer. +func (s *spiderSubnetLister) List(selector labels.Selector) (ret []*v2beta2.SpiderSubnet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.SpiderSubnet)) + }) + return ret, err +} + +// Get retrieves the SpiderSubnet from the index for a given name. +func (s *spiderSubnetLister) Get(name string) (*v2beta2.SpiderSubnet, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta2.Resource("spidersubnet"), name) + } + return obj.(*v2beta2.SpiderSubnet), nil +} diff --git a/tools/k8s-controller-gen/update-controller-gen.sh b/tools/k8s-controller-gen/update-controller-gen.sh index b1a8df736c..93061e19fa 100755 --- a/tools/k8s-controller-gen/update-controller-gen.sh +++ b/tools/k8s-controller-gen/update-controller-gen.sh @@ -24,7 +24,10 @@ set -o pipefail # CONST PROJECT_ROOT=$(dirname ${BASH_SOURCE[0]})/../.. CONTROLLER_GEN_TMP_DIR=${CONTROLLER_GEN_TMP_DIR:-${PROJECT_ROOT}/.controller_gen_tmp} -CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${PROJECT_ROOT}; ls -d -1 ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen 2>/dev/null || echo ../controller-gen)} +CODEGEN_PKG=${CODEGEN_PKG:-$( + cd ${PROJECT_ROOT} + ls -d -1 ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen 2>/dev/null || echo ../controller-gen +)} # ENV # Defines the output path for the artifacts controller-gen generates @@ -34,29 +37,25 @@ OUTPUT_TMP_DIR=${OUTPUT_TMP_DIR:-${CONTROLLER_GEN_TMP_DIR}/old} # Defines the output path of the latest artifacts for diffing OUTPUT_DIFF_DIR=${OUTPUT_DIFF_DIR:-${CONTROLLER_GEN_TMP_DIR}/new} - - controller-gen() { go run ${PROJECT_ROOT}/${CODEGEN_PKG}/main.go "$@" } manifests_gen() { output_dir=$1 - controller-gen \ - crd rbac:roleName="spiderpool-admin" \ - paths="${PWD}/${PROJECT_ROOT}/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" \ - output:crd:artifacts:config="${output_dir}/crds" \ - output:rbac:artifacts:config="${output_dir}/templates" + crd rbac:roleName="spiderpool-admin" \ + paths="${PWD}/${PROJECT_ROOT}/pkg/k8s/apis/spiderpool.spidernet.io/..." \ + output:crd:artifacts:config="${output_dir}/crds" \ + output:rbac:artifacts:config="${output_dir}/templates" } deepcopy_gen() { tmp_header_file=${CONTROLLER_GEN_TMP_DIR}/boilerplate.go.txt - cat ${PROJECT_ROOT}/tools/spdx-copyright-header.txt | sed -E 's?(.*)?// \1?' > ${tmp_header_file} + cat ${PROJECT_ROOT}/tools/spdx-copyright-header.txt | sed -E 's?(.*)?// \1?' >${tmp_header_file} - controller-gen \ - object:headerFile="${tmp_header_file}" \ - paths="${PWD}/${PROJECT_ROOT}/pkg/k8s/apis/spiderpool.spidernet.io/v2beta1" + controller-gen object:headerFile="${tmp_header_file}" \ + paths="${PWD}/${PROJECT_ROOT}/pkg/k8s/apis/spiderpool.spidernet.io/..." } manifests_verify() { @@ -65,7 +64,7 @@ manifests_verify() { mkdir -p ${OUTPUT_TMP_DIR}/crds if [ "$(ls -A ${OUTPUT_BASE_DIR}/crds)" ]; then - cp ${OUTPUT_BASE_DIR}/crds/spiderpool* ${OUTPUT_TMP_DIR}/crds + cp ${OUTPUT_BASE_DIR}/crds/spiderpool* ${OUTPUT_TMP_DIR}/crds fi if [ "$(ls -A ${OUTPUT_BASE_DIR}/templates)" ]; then @@ -79,7 +78,7 @@ manifests_verify() { ret=0 diff -Naupr ${OUTPUT_TMP_DIR} ${OUTPUT_DIFF_DIR} || ret=$? - if [[ $ret -eq 0 ]];then + if [[ $ret -eq 0 ]]; then echo "The Artifacts is up to date." else echo "Error: The Artifacts is out of date! Please run 'make manifests'." @@ -101,19 +100,19 @@ main() { mkdir -p ${CONTROLLER_GEN_TMP_DIR} case ${1:-none} in - manifests) - manifests_gen ${OUTPUT_BASE_DIR} - ;; - deepcopy) - deepcopy_gen - ;; - verify) - manifests_verify - ;; - *|help|-h|--help) - help - ;; + manifests) + manifests_gen ${OUTPUT_BASE_DIR} + ;; + deepcopy) + deepcopy_gen + ;; + verify) + manifests_verify + ;; + * | help | -h | --help) + help + ;; esac } -main "$*" \ No newline at end of file +main "$*"