Merge pull request #125021 from aojea/servicecidrbeta

KEP-1880 Multiple Service CIDRs: Graduate to Beta (2/2)
This commit is contained in:
Kubernetes Prow Robot
2024-06-30 08:53:25 -07:00
committed by GitHub
80 changed files with 5672 additions and 889 deletions

View File

@@ -51,6 +51,7 @@ API rule violation: names_match,k8s.io/api/core/v1,RBDVolumeSource,RadosUser
API rule violation: names_match,k8s.io/api/core/v1,VolumeSource,CephFS
API rule violation: names_match,k8s.io/api/core/v1,VolumeSource,StorageOS
API rule violation: names_match,k8s.io/api/networking/v1alpha1,ServiceCIDRSpec,CIDRs
API rule violation: names_match,k8s.io/api/networking/v1beta1,ServiceCIDRSpec,CIDRs
API rule violation: names_match,k8s.io/api/resource/v1alpha2,NamedResourcesAttributeValue,BoolValue
API rule violation: names_match,k8s.io/api/resource/v1alpha2,NamedResourcesAttributeValue,IntSliceValue
API rule violation: names_match,k8s.io/api/resource/v1alpha2,NamedResourcesAttributeValue,IntValue

View File

@@ -912,7 +912,7 @@
]
}
],
"version": "v1alpha1"
"version": "v1beta1"
}
]
},

View File

@@ -912,7 +912,7 @@
]
}
],
"version": "v1alpha1"
"version": "v1beta1"
}
]
},

View File

@@ -133,8 +133,8 @@
"version": "v1"
},
{
"groupVersion": "networking.k8s.io/v1alpha1",
"version": "v1alpha1"
"groupVersion": "networking.k8s.io/v1beta1",
"version": "v1beta1"
}
]
},

View File

@@ -12,8 +12,8 @@
"version": "v1"
},
{
"groupVersion": "networking.k8s.io/v1alpha1",
"version": "v1alpha1"
"groupVersion": "networking.k8s.io/v1beta1",
"version": "v1beta1"
}
]
}

View File

@@ -1,6 +1,6 @@
{
"apiVersion": "v1",
"groupVersion": "networking.k8s.io/v1alpha1",
"groupVersion": "networking.k8s.io/v1beta1",
"kind": "APIResourceList",
"resources": [
{
@@ -11,7 +11,7 @@
"ip"
],
"singularName": "ipaddress",
"storageVersionHash": "3APLM23DOxw=",
"storageVersionHash": "O4H8VxQhW5Y=",
"verbs": [
"create",
"delete",
@@ -28,7 +28,7 @@
"name": "servicecidrs",
"namespaced": false,
"singularName": "servicecidr",
"storageVersionHash": "3cDF5hqTkLY=",
"storageVersionHash": "8ufAXOnr3Yg=",
"verbs": [
"create",
"delete",

View File

@@ -14054,7 +14054,7 @@
},
"type": "object"
},
"io.k8s.api.networking.v1alpha1.IPAddress": {
"io.k8s.api.networking.v1beta1.IPAddress": {
"description": "IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses. An IP address can be represented in different formats, to guarantee the uniqueness of the IP, the name of the object is the IP address in canonical format, four decimal digits separated by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6. Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 Invalid: 10.01.2.3 or 2001:db8:0:0:0::1",
"properties": {
"apiVersion": {
@@ -14070,7 +14070,7 @@
"description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
},
"spec": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddressSpec",
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddressSpec",
"description": "spec is the desired state of the IPAddress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status"
}
},
@@ -14079,11 +14079,11 @@
{
"group": "networking.k8s.io",
"kind": "IPAddress",
"version": "v1alpha1"
"version": "v1beta1"
}
]
},
"io.k8s.api.networking.v1alpha1.IPAddressList": {
"io.k8s.api.networking.v1beta1.IPAddressList": {
"description": "IPAddressList contains a list of IPAddress.",
"properties": {
"apiVersion": {
@@ -14093,7 +14093,7 @@
"items": {
"description": "items is the list of IPAddresses.",
"items": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddress"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddress"
},
"type": "array"
},
@@ -14114,15 +14114,15 @@
{
"group": "networking.k8s.io",
"kind": "IPAddressList",
"version": "v1alpha1"
"version": "v1beta1"
}
]
},
"io.k8s.api.networking.v1alpha1.IPAddressSpec": {
"io.k8s.api.networking.v1beta1.IPAddressSpec": {
"description": "IPAddressSpec describe the attributes in an IP Address.",
"properties": {
"parentRef": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ParentReference",
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ParentReference",
"description": "ParentRef references the resource that an IPAddress is attached to. An IPAddress must reference a parent object."
}
},
@@ -14131,7 +14131,7 @@
],
"type": "object"
},
"io.k8s.api.networking.v1alpha1.ParentReference": {
"io.k8s.api.networking.v1beta1.ParentReference": {
"description": "ParentReference describes a reference to a parent object.",
"properties": {
"group": {
@@ -14157,7 +14157,7 @@
],
"type": "object"
},
"io.k8s.api.networking.v1alpha1.ServiceCIDR": {
"io.k8s.api.networking.v1beta1.ServiceCIDR": {
"description": "ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). This range is used to allocate ClusterIPs to Service objects.",
"properties": {
"apiVersion": {
@@ -14173,11 +14173,11 @@
"description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
},
"spec": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDRSpec",
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDRSpec",
"description": "spec is the desired state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status"
},
"status": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDRStatus",
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDRStatus",
"description": "status represents the current state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status"
}
},
@@ -14186,11 +14186,11 @@
{
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
]
},
"io.k8s.api.networking.v1alpha1.ServiceCIDRList": {
"io.k8s.api.networking.v1beta1.ServiceCIDRList": {
"description": "ServiceCIDRList contains a list of ServiceCIDR objects.",
"properties": {
"apiVersion": {
@@ -14200,7 +14200,7 @@
"items": {
"description": "items is the list of ServiceCIDRs.",
"items": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
},
"type": "array"
},
@@ -14221,15 +14221,15 @@
{
"group": "networking.k8s.io",
"kind": "ServiceCIDRList",
"version": "v1alpha1"
"version": "v1beta1"
}
]
},
"io.k8s.api.networking.v1alpha1.ServiceCIDRSpec": {
"io.k8s.api.networking.v1beta1.ServiceCIDRSpec": {
"description": "ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.",
"properties": {
"cidrs": {
"description": "CIDRs defines the IP blocks in CIDR notation (e.g. \"192.168.0.0/24\" or \"2001:db8::/64\") from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. The network address of each CIDR, the address that identifies the subnet of a host, is reserved and will not be allocated. The broadcast address for IPv4 CIDRs is also reserved and will not be allocated. This field is immutable.",
"description": "CIDRs defines the IP blocks in CIDR notation (e.g. \"192.168.0.0/24\" or \"2001:db8::/64\") from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. This field is immutable.",
"items": {
"type": "string"
},
@@ -14239,7 +14239,7 @@
},
"type": "object"
},
"io.k8s.api.networking.v1alpha1.ServiceCIDRStatus": {
"io.k8s.api.networking.v1beta1.ServiceCIDRStatus": {
"description": "ServiceCIDRStatus describes the current state of the ServiceCIDR.",
"properties": {
"conditions": {
@@ -64223,7 +64223,7 @@
}
]
},
"/apis/networking.k8s.io/v1alpha1/": {
"/apis/networking.k8s.io/v1beta1/": {
"get": {
"consumes": [
"application/json",
@@ -64231,7 +64231,7 @@
"application/vnd.kubernetes.protobuf"
],
"description": "get available resources",
"operationId": "getNetworkingV1alpha1APIResources",
"operationId": "getNetworkingV1beta1APIResources",
"produces": [
"application/json",
"application/yaml",
@@ -64252,17 +64252,17 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
]
}
},
"/apis/networking.k8s.io/v1alpha1/ipaddresses": {
"/apis/networking.k8s.io/v1beta1/ipaddresses": {
"delete": {
"consumes": [
"*/*"
],
"description": "delete collection of IPAddress",
"operationId": "deleteNetworkingV1alpha1CollectionIPAddress",
"operationId": "deleteNetworkingV1beta1CollectionIPAddress",
"parameters": [
{
"$ref": "#/parameters/body-2Y1dVQaQ"
@@ -64328,13 +64328,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "deletecollection",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "IPAddress",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"get": {
@@ -64342,7 +64342,7 @@
"*/*"
],
"description": "list or watch objects of kind IPAddress",
"operationId": "listNetworkingV1alpha1IPAddress",
"operationId": "listNetworkingV1beta1IPAddress",
"parameters": [
{
"$ref": "#/parameters/allowWatchBookmarks-HC2hJt-J"
@@ -64386,7 +64386,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddressList"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddressList"
}
},
"401": {
@@ -64397,13 +64397,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "list",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "IPAddress",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"parameters": [
@@ -64416,14 +64416,14 @@
"*/*"
],
"description": "create an IPAddress",
"operationId": "createNetworkingV1alpha1IPAddress",
"operationId": "createNetworkingV1beta1IPAddress",
"parameters": [
{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddress"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddress"
}
},
{
@@ -64453,19 +64453,19 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddress"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddress"
}
},
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddress"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddress"
}
},
"202": {
"description": "Accepted",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddress"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddress"
}
},
"401": {
@@ -64476,23 +64476,23 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "post",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "IPAddress",
"version": "v1alpha1"
"version": "v1beta1"
}
}
},
"/apis/networking.k8s.io/v1alpha1/ipaddresses/{name}": {
"/apis/networking.k8s.io/v1beta1/ipaddresses/{name}": {
"delete": {
"consumes": [
"*/*"
],
"description": "delete an IPAddress",
"operationId": "deleteNetworkingV1alpha1IPAddress",
"operationId": "deleteNetworkingV1beta1IPAddress",
"parameters": [
{
"$ref": "#/parameters/body-2Y1dVQaQ"
@@ -64540,13 +64540,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "delete",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "IPAddress",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"get": {
@@ -64554,7 +64554,7 @@
"*/*"
],
"description": "read the specified IPAddress",
"operationId": "readNetworkingV1alpha1IPAddress",
"operationId": "readNetworkingV1beta1IPAddress",
"produces": [
"application/json",
"application/yaml",
@@ -64564,7 +64564,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddress"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddress"
}
},
"401": {
@@ -64575,13 +64575,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "get",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "IPAddress",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"parameters": [
@@ -64605,7 +64605,7 @@
"application/apply-patch+yaml"
],
"description": "partially update the specified IPAddress",
"operationId": "patchNetworkingV1alpha1IPAddress",
"operationId": "patchNetworkingV1beta1IPAddress",
"parameters": [
{
"$ref": "#/parameters/body-78PwaGsr"
@@ -64640,13 +64640,13 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddress"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddress"
}
},
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddress"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddress"
}
},
"401": {
@@ -64657,13 +64657,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "patch",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "IPAddress",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"put": {
@@ -64671,14 +64671,14 @@
"*/*"
],
"description": "replace the specified IPAddress",
"operationId": "replaceNetworkingV1alpha1IPAddress",
"operationId": "replaceNetworkingV1beta1IPAddress",
"parameters": [
{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddress"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddress"
}
},
{
@@ -64708,13 +64708,13 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddress"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddress"
}
},
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.IPAddress"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.IPAddress"
}
},
"401": {
@@ -64725,23 +64725,23 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "put",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "IPAddress",
"version": "v1alpha1"
"version": "v1beta1"
}
}
},
"/apis/networking.k8s.io/v1alpha1/servicecidrs": {
"/apis/networking.k8s.io/v1beta1/servicecidrs": {
"delete": {
"consumes": [
"*/*"
],
"description": "delete collection of ServiceCIDR",
"operationId": "deleteNetworkingV1alpha1CollectionServiceCIDR",
"operationId": "deleteNetworkingV1beta1CollectionServiceCIDR",
"parameters": [
{
"$ref": "#/parameters/body-2Y1dVQaQ"
@@ -64807,13 +64807,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "deletecollection",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"get": {
@@ -64821,7 +64821,7 @@
"*/*"
],
"description": "list or watch objects of kind ServiceCIDR",
"operationId": "listNetworkingV1alpha1ServiceCIDR",
"operationId": "listNetworkingV1beta1ServiceCIDR",
"parameters": [
{
"$ref": "#/parameters/allowWatchBookmarks-HC2hJt-J"
@@ -64865,7 +64865,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDRList"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDRList"
}
},
"401": {
@@ -64876,13 +64876,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "list",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"parameters": [
@@ -64895,14 +64895,14 @@
"*/*"
],
"description": "create a ServiceCIDR",
"operationId": "createNetworkingV1alpha1ServiceCIDR",
"operationId": "createNetworkingV1beta1ServiceCIDR",
"parameters": [
{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
{
@@ -64932,19 +64932,19 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"202": {
"description": "Accepted",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"401": {
@@ -64955,23 +64955,23 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "post",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
}
},
"/apis/networking.k8s.io/v1alpha1/servicecidrs/{name}": {
"/apis/networking.k8s.io/v1beta1/servicecidrs/{name}": {
"delete": {
"consumes": [
"*/*"
],
"description": "delete a ServiceCIDR",
"operationId": "deleteNetworkingV1alpha1ServiceCIDR",
"operationId": "deleteNetworkingV1beta1ServiceCIDR",
"parameters": [
{
"$ref": "#/parameters/body-2Y1dVQaQ"
@@ -65019,13 +65019,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "delete",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"get": {
@@ -65033,7 +65033,7 @@
"*/*"
],
"description": "read the specified ServiceCIDR",
"operationId": "readNetworkingV1alpha1ServiceCIDR",
"operationId": "readNetworkingV1beta1ServiceCIDR",
"produces": [
"application/json",
"application/yaml",
@@ -65043,7 +65043,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"401": {
@@ -65054,13 +65054,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "get",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"parameters": [
@@ -65084,7 +65084,7 @@
"application/apply-patch+yaml"
],
"description": "partially update the specified ServiceCIDR",
"operationId": "patchNetworkingV1alpha1ServiceCIDR",
"operationId": "patchNetworkingV1beta1ServiceCIDR",
"parameters": [
{
"$ref": "#/parameters/body-78PwaGsr"
@@ -65119,13 +65119,13 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"401": {
@@ -65136,13 +65136,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "patch",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"put": {
@@ -65150,14 +65150,14 @@
"*/*"
],
"description": "replace the specified ServiceCIDR",
"operationId": "replaceNetworkingV1alpha1ServiceCIDR",
"operationId": "replaceNetworkingV1beta1ServiceCIDR",
"parameters": [
{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
{
@@ -65187,13 +65187,13 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"401": {
@@ -65204,23 +65204,23 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "put",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
}
},
"/apis/networking.k8s.io/v1alpha1/servicecidrs/{name}/status": {
"/apis/networking.k8s.io/v1beta1/servicecidrs/{name}/status": {
"get": {
"consumes": [
"*/*"
],
"description": "read status of the specified ServiceCIDR",
"operationId": "readNetworkingV1alpha1ServiceCIDRStatus",
"operationId": "readNetworkingV1beta1ServiceCIDRStatus",
"produces": [
"application/json",
"application/yaml",
@@ -65230,7 +65230,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"401": {
@@ -65241,13 +65241,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "get",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"parameters": [
@@ -65271,7 +65271,7 @@
"application/apply-patch+yaml"
],
"description": "partially update status of the specified ServiceCIDR",
"operationId": "patchNetworkingV1alpha1ServiceCIDRStatus",
"operationId": "patchNetworkingV1beta1ServiceCIDRStatus",
"parameters": [
{
"$ref": "#/parameters/body-78PwaGsr"
@@ -65306,13 +65306,13 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"401": {
@@ -65323,13 +65323,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "patch",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"put": {
@@ -65337,14 +65337,14 @@
"*/*"
],
"description": "replace status of the specified ServiceCIDR",
"operationId": "replaceNetworkingV1alpha1ServiceCIDRStatus",
"operationId": "replaceNetworkingV1beta1ServiceCIDRStatus",
"parameters": [
{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
{
@@ -65374,13 +65374,13 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/io.k8s.api.networking.v1alpha1.ServiceCIDR"
"$ref": "#/definitions/io.k8s.api.networking.v1beta1.ServiceCIDR"
}
},
"401": {
@@ -65391,23 +65391,23 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "put",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
}
},
"/apis/networking.k8s.io/v1alpha1/watch/ipaddresses": {
"/apis/networking.k8s.io/v1beta1/watch/ipaddresses": {
"get": {
"consumes": [
"*/*"
],
"description": "watch individual changes to a list of IPAddress. deprecated: use the 'watch' parameter with a list operation instead.",
"operationId": "watchNetworkingV1alpha1IPAddressList",
"operationId": "watchNetworkingV1beta1IPAddressList",
"produces": [
"application/json",
"application/yaml",
@@ -65430,13 +65430,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "watchlist",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "IPAddress",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"parameters": [
@@ -65475,13 +65475,13 @@
}
]
},
"/apis/networking.k8s.io/v1alpha1/watch/ipaddresses/{name}": {
"/apis/networking.k8s.io/v1beta1/watch/ipaddresses/{name}": {
"get": {
"consumes": [
"*/*"
],
"description": "watch changes to an object of kind IPAddress. deprecated: use the 'watch' parameter with a list operation instead, filtered to a single item with the 'fieldSelector' parameter.",
"operationId": "watchNetworkingV1alpha1IPAddress",
"operationId": "watchNetworkingV1beta1IPAddress",
"produces": [
"application/json",
"application/yaml",
@@ -65504,13 +65504,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "watch",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "IPAddress",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"parameters": [
@@ -65557,13 +65557,13 @@
}
]
},
"/apis/networking.k8s.io/v1alpha1/watch/servicecidrs": {
"/apis/networking.k8s.io/v1beta1/watch/servicecidrs": {
"get": {
"consumes": [
"*/*"
],
"description": "watch individual changes to a list of ServiceCIDR. deprecated: use the 'watch' parameter with a list operation instead.",
"operationId": "watchNetworkingV1alpha1ServiceCIDRList",
"operationId": "watchNetworkingV1beta1ServiceCIDRList",
"produces": [
"application/json",
"application/yaml",
@@ -65586,13 +65586,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "watchlist",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"parameters": [
@@ -65631,13 +65631,13 @@
}
]
},
"/apis/networking.k8s.io/v1alpha1/watch/servicecidrs/{name}": {
"/apis/networking.k8s.io/v1beta1/watch/servicecidrs/{name}": {
"get": {
"consumes": [
"*/*"
],
"description": "watch changes to an object of kind ServiceCIDR. deprecated: use the 'watch' parameter with a list operation instead, filtered to a single item with the 'fieldSelector' parameter.",
"operationId": "watchNetworkingV1alpha1ServiceCIDR",
"operationId": "watchNetworkingV1beta1ServiceCIDR",
"produces": [
"application/json",
"application/yaml",
@@ -65660,13 +65660,13 @@
"https"
],
"tags": [
"networking_v1alpha1"
"networking_v1beta1"
],
"x-kubernetes-action": "watch",
"x-kubernetes-group-version-kind": {
"group": "networking.k8s.io",
"kind": "ServiceCIDR",
"version": "v1alpha1"
"version": "v1beta1"
}
},
"parameters": [

View File

@@ -40,6 +40,7 @@ var apiVersionPriorities = merge(controlplaneapiserver.DefaultGenericAPIServiceP
{Group: "batch", Version: "v1beta1"}: {Group: 17400, Version: 9},
{Group: "batch", Version: "v2alpha1"}: {Group: 17400, Version: 9},
{Group: "networking.k8s.io", Version: "v1"}: {Group: 17200, Version: 15},
{Group: "networking.k8s.io", Version: "v1beta1"}: {Group: 17200, Version: 9},
{Group: "networking.k8s.io", Version: "v1alpha1"}: {Group: 17200, Version: 1},
{Group: "policy", Version: "v1"}: {Group: 17100, Version: 15},
{Group: "policy", Version: "v1beta1"}: {Group: 17100, Version: 9},

View File

@@ -40,8 +40,8 @@ func newServiceCIDRsControllerDescriptor() *ControllerDescriptor {
func startServiceCIDRsController(ctx context.Context, controllerContext ControllerContext, controllerName string) (controller.Interface, bool, error) {
go servicecidrs.NewController(
ctx,
controllerContext.InformerFactory.Networking().V1alpha1().ServiceCIDRs(),
controllerContext.InformerFactory.Networking().V1alpha1().IPAddresses(),
controllerContext.InformerFactory.Networking().V1beta1().ServiceCIDRs(),
controllerContext.InformerFactory.Networking().V1beta1().IPAddresses(),
controllerContext.ClientBuilder.ClientOrDie("service-cidrs-controller"),
).Run(ctx, 5)
// TODO use component config

View File

@@ -982,7 +982,7 @@ func (s *ProxyServer) Run(ctx context.Context) error {
go endpointSliceConfig.Run(ctx.Done())
if utilfeature.DefaultFeatureGate.Enabled(features.MultiCIDRServiceAllocator) {
serviceCIDRConfig := config.NewServiceCIDRConfig(ctx, informerFactory.Networking().V1alpha1().ServiceCIDRs(), s.Config.ConfigSyncPeriod.Duration)
serviceCIDRConfig := config.NewServiceCIDRConfig(ctx, informerFactory.Networking().V1beta1().ServiceCIDRs(), s.Config.ConfigSyncPeriod.Duration)
serviceCIDRConfig.RegisterEventHandler(s.Proxier)
go serviceCIDRConfig.Run(wait.NeverStop)
}

View File

@@ -21,14 +21,14 @@ import (
"net"
"net/netip"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
"k8s.io/apimachinery/pkg/labels"
networkinglisters "k8s.io/client-go/listers/networking/v1alpha1"
networkinglisters "k8s.io/client-go/listers/networking/v1beta1"
)
// OverlapsPrefix return the list of ServiceCIDR that overlaps with the prefix passed as argument
func OverlapsPrefix(serviceCIDRLister networkinglisters.ServiceCIDRLister, prefix netip.Prefix) []*networkingv1alpha1.ServiceCIDR {
result := []*networkingv1alpha1.ServiceCIDR{}
func OverlapsPrefix(serviceCIDRLister networkinglisters.ServiceCIDRLister, prefix netip.Prefix) []*networkingv1beta1.ServiceCIDR {
result := []*networkingv1beta1.ServiceCIDR{}
serviceCIDRList, err := serviceCIDRLister.List(labels.Everything())
if err != nil {
return result
@@ -47,8 +47,8 @@ func OverlapsPrefix(serviceCIDRLister networkinglisters.ServiceCIDRLister, prefi
}
// ContainsPrefix return the list of ServiceCIDR that contains the prefix passed as argument
func ContainsPrefix(serviceCIDRLister networkinglisters.ServiceCIDRLister, prefix netip.Prefix) []*networkingv1alpha1.ServiceCIDR {
result := []*networkingv1alpha1.ServiceCIDR{}
func ContainsPrefix(serviceCIDRLister networkinglisters.ServiceCIDRLister, prefix netip.Prefix) []*networkingv1beta1.ServiceCIDR {
result := []*networkingv1beta1.ServiceCIDR{}
serviceCIDRList, err := serviceCIDRLister.List(labels.Everything())
if err != nil {
return result
@@ -67,14 +67,14 @@ func ContainsPrefix(serviceCIDRLister networkinglisters.ServiceCIDRLister, prefi
}
// ContainsIP return the list of ServiceCIDR that contains the IP address passed as argument
func ContainsIP(serviceCIDRLister networkinglisters.ServiceCIDRLister, ip net.IP) []*networkingv1alpha1.ServiceCIDR {
func ContainsIP(serviceCIDRLister networkinglisters.ServiceCIDRLister, ip net.IP) []*networkingv1beta1.ServiceCIDR {
address := IPToAddr(ip)
return ContainsAddress(serviceCIDRLister, address)
}
// ContainsAddress return the list of ServiceCIDR that contains the address passed as argument
func ContainsAddress(serviceCIDRLister networkinglisters.ServiceCIDRLister, address netip.Addr) []*networkingv1alpha1.ServiceCIDR {
result := []*networkingv1alpha1.ServiceCIDR{}
func ContainsAddress(serviceCIDRLister networkinglisters.ServiceCIDRLister, address netip.Addr) []*networkingv1beta1.ServiceCIDR {
result := []*networkingv1beta1.ServiceCIDR{}
serviceCIDRList, err := serviceCIDRLister.List(labels.Everything())
if err != nil {
return result

View File

@@ -22,19 +22,19 @@ import (
"sort"
"testing"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
networkinglisters "k8s.io/client-go/listers/networking/v1alpha1"
networkinglisters "k8s.io/client-go/listers/networking/v1beta1"
"k8s.io/client-go/tools/cache"
netutils "k8s.io/utils/net"
)
func newServiceCIDR(name, primary, secondary string) *networkingv1alpha1.ServiceCIDR {
serviceCIDR := &networkingv1alpha1.ServiceCIDR{
func newServiceCIDR(name, primary, secondary string) *networkingv1beta1.ServiceCIDR {
serviceCIDR := &networkingv1beta1.ServiceCIDR{
ObjectMeta: metav1.ObjectMeta{
Name: name,
},
Spec: networkingv1alpha1.ServiceCIDRSpec{},
Spec: networkingv1beta1.ServiceCIDRSpec{},
}
serviceCIDR.Spec.CIDRs = append(serviceCIDR.Spec.CIDRs, primary)
if secondary != "" {
@@ -46,13 +46,13 @@ func newServiceCIDR(name, primary, secondary string) *networkingv1alpha1.Service
func TestOverlapsPrefix(t *testing.T) {
tests := []struct {
name string
serviceCIDRs []*networkingv1alpha1.ServiceCIDR
serviceCIDRs []*networkingv1beta1.ServiceCIDR
prefix netip.Prefix
want []string
}{
{
name: "only one ServiceCIDR and IPv4 prefix contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("10.0.0.0/26"),
@@ -60,7 +60,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and same IPv4 prefix",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("10.0.0.0/24"),
@@ -68,7 +68,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and larger IPv4 prefix",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("10.0.0.0/16"),
@@ -76,7 +76,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and non contained IPv4 prefix",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("192.168.0.0/24"),
@@ -84,7 +84,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv6 prefix contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("2001:db8::/112"),
@@ -92,7 +92,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and same IPv6 prefix",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("2001:db8::/96"),
@@ -100,7 +100,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv6 larger",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("2001:db8::/64"),
@@ -108,7 +108,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv6 prefix out of range",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("2001:db2::/112"),
@@ -116,7 +116,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv4 prefix contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -125,7 +125,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "two overlapping ServiceCIDR and IPv4 prefix only contained in one",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -134,7 +134,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv4 larger",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -143,7 +143,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv4 prefix not contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -152,7 +152,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv6 prefix contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -161,7 +161,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv6 prefix contained in one",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -170,7 +170,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and aprefix larger",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -179,7 +179,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and prefix out of range",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -188,7 +188,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "multiple ServiceCIDR match with overlap contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("kubernetes2", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
@@ -198,7 +198,7 @@ func TestOverlapsPrefix(t *testing.T) {
},
{
name: "multiple ServiceCIDR match with overlap contains",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("kubernetes2", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
@@ -234,13 +234,13 @@ func TestOverlapsPrefix(t *testing.T) {
func TestContainsPrefix(t *testing.T) {
tests := []struct {
name string
serviceCIDRs []*networkingv1alpha1.ServiceCIDR
serviceCIDRs []*networkingv1beta1.ServiceCIDR
prefix netip.Prefix
want []string
}{
{
name: "only one ServiceCIDR and IPv4 prefix contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("10.0.0.0/26"),
@@ -248,7 +248,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and same IPv4 prefix",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("10.0.0.0/24"),
@@ -256,7 +256,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and larger IPv4 prefix",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("10.0.0.0/16"),
@@ -264,7 +264,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and non containerd IPv4 prefix",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("192.168.0.0/24"),
@@ -272,7 +272,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv6 prefix contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("2001:db8::/112"),
@@ -280,7 +280,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and same IPv6 prefix",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("2001:db8::/96"),
@@ -288,7 +288,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv6 larger",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("2001:db8::/64"),
@@ -296,7 +296,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv6 prefix out of range",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
prefix: netip.MustParsePrefix("2001:db2::/112"),
@@ -304,7 +304,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv4 prefix contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -313,7 +313,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv4 prefix only contained in one",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -322,7 +322,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv4 larger",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -331,7 +331,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv4 prefix not contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -340,7 +340,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv6 prefix contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -349,7 +349,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv6 prefix contained in one",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -358,7 +358,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and aprefix larger",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -367,7 +367,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "two ServiceCIDR and prefix out of range",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -376,7 +376,7 @@ func TestContainsPrefix(t *testing.T) {
},
{
name: "multiple ServiceCIDR match with overlap",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("kubernetes2", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
@@ -412,13 +412,13 @@ func TestContainsPrefix(t *testing.T) {
func TestContainsAddress(t *testing.T) {
tests := []struct {
name string
serviceCIDRs []*networkingv1alpha1.ServiceCIDR
serviceCIDRs []*networkingv1beta1.ServiceCIDR
address netip.Addr
want []string
}{
{
name: "only one ServiceCIDR and IPv4 address contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
address: netip.MustParseAddr("10.0.0.1"),
@@ -426,7 +426,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv4 address broadcast",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
address: netip.MustParseAddr("10.0.0.255"),
@@ -434,7 +434,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv4 address base",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
address: netip.MustParseAddr("10.0.0.0"),
@@ -442,7 +442,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv4 address out of range",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
address: netip.MustParseAddr("192.0.0.1"),
@@ -450,7 +450,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv6 address contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
address: netip.MustParseAddr("2001:db8::2:3"),
@@ -458,7 +458,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv6 address broadcast",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
address: netip.MustParseAddr("2001:db8::ffff:ffff"),
@@ -466,7 +466,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv6 address base",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
address: netip.MustParseAddr("2001:db8::"),
@@ -474,7 +474,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "only one ServiceCIDR and IPv6 address out of range",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
},
address: netip.MustParseAddr("2002:1:2:3::2"),
@@ -482,7 +482,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv4 address contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -491,7 +491,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv4 address broadcast",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -500,7 +500,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv4 address base",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -509,7 +509,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv4 address out of range",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -518,7 +518,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "two ServiceCIDR and IPv6 address contained",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -527,7 +527,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "two ServiceCIDR and address broadcast",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -536,7 +536,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "two ServiceCIDR and address base",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -545,7 +545,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "two ServiceCIDR and address out of range",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),
},
@@ -554,7 +554,7 @@ func TestContainsAddress(t *testing.T) {
},
{
name: "multiple ServiceCIDR match with overlap",
serviceCIDRs: []*networkingv1alpha1.ServiceCIDR{
serviceCIDRs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("kubernetes2", "10.0.0.0/24", "2001:db8::/96"),
newServiceCIDR("secondary", "10.0.0.0/16", "2001:db8::/64"),

View File

@@ -26,6 +26,7 @@ import (
v1 "k8s.io/api/core/v1"
v1beta1 "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
core "k8s.io/kubernetes/pkg/apis/core"
@@ -59,6 +60,36 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.IPAddress)(nil), (*networking.IPAddress)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_IPAddress_To_networking_IPAddress(a.(*v1beta1.IPAddress), b.(*networking.IPAddress), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*networking.IPAddress)(nil), (*v1beta1.IPAddress)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_networking_IPAddress_To_v1beta1_IPAddress(a.(*networking.IPAddress), b.(*v1beta1.IPAddress), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.IPAddressList)(nil), (*networking.IPAddressList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_IPAddressList_To_networking_IPAddressList(a.(*v1beta1.IPAddressList), b.(*networking.IPAddressList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*networking.IPAddressList)(nil), (*v1beta1.IPAddressList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_networking_IPAddressList_To_v1beta1_IPAddressList(a.(*networking.IPAddressList), b.(*v1beta1.IPAddressList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.IPAddressSpec)(nil), (*networking.IPAddressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_IPAddressSpec_To_networking_IPAddressSpec(a.(*v1beta1.IPAddressSpec), b.(*networking.IPAddressSpec), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*networking.IPAddressSpec)(nil), (*v1beta1.IPAddressSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_networking_IPAddressSpec_To_v1beta1_IPAddressSpec(a.(*networking.IPAddressSpec), b.(*v1beta1.IPAddressSpec), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.Ingress)(nil), (*networking.Ingress)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_Ingress_To_networking_Ingress(a.(*v1beta1.Ingress), b.(*networking.Ingress), scope)
}); err != nil {
@@ -189,6 +220,56 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.ParentReference)(nil), (*networking.ParentReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_ParentReference_To_networking_ParentReference(a.(*v1beta1.ParentReference), b.(*networking.ParentReference), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*networking.ParentReference)(nil), (*v1beta1.ParentReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_networking_ParentReference_To_v1beta1_ParentReference(a.(*networking.ParentReference), b.(*v1beta1.ParentReference), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.ServiceCIDR)(nil), (*networking.ServiceCIDR)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_ServiceCIDR_To_networking_ServiceCIDR(a.(*v1beta1.ServiceCIDR), b.(*networking.ServiceCIDR), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*networking.ServiceCIDR)(nil), (*v1beta1.ServiceCIDR)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_networking_ServiceCIDR_To_v1beta1_ServiceCIDR(a.(*networking.ServiceCIDR), b.(*v1beta1.ServiceCIDR), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.ServiceCIDRList)(nil), (*networking.ServiceCIDRList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_ServiceCIDRList_To_networking_ServiceCIDRList(a.(*v1beta1.ServiceCIDRList), b.(*networking.ServiceCIDRList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*networking.ServiceCIDRList)(nil), (*v1beta1.ServiceCIDRList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_networking_ServiceCIDRList_To_v1beta1_ServiceCIDRList(a.(*networking.ServiceCIDRList), b.(*v1beta1.ServiceCIDRList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.ServiceCIDRSpec)(nil), (*networking.ServiceCIDRSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_ServiceCIDRSpec_To_networking_ServiceCIDRSpec(a.(*v1beta1.ServiceCIDRSpec), b.(*networking.ServiceCIDRSpec), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*networking.ServiceCIDRSpec)(nil), (*v1beta1.ServiceCIDRSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_networking_ServiceCIDRSpec_To_v1beta1_ServiceCIDRSpec(a.(*networking.ServiceCIDRSpec), b.(*v1beta1.ServiceCIDRSpec), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.ServiceCIDRStatus)(nil), (*networking.ServiceCIDRStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_ServiceCIDRStatus_To_networking_ServiceCIDRStatus(a.(*v1beta1.ServiceCIDRStatus), b.(*networking.ServiceCIDRStatus), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*networking.ServiceCIDRStatus)(nil), (*v1beta1.ServiceCIDRStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_networking_ServiceCIDRStatus_To_v1beta1_ServiceCIDRStatus(a.(*networking.ServiceCIDRStatus), b.(*v1beta1.ServiceCIDRStatus), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*networking.IngressBackend)(nil), (*v1beta1.IngressBackend)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_networking_IngressBackend_To_v1beta1_IngressBackend(a.(*networking.IngressBackend), b.(*v1beta1.IngressBackend), scope)
}); err != nil {
@@ -280,6 +361,74 @@ func Convert_networking_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in
return autoConvert_networking_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in, out, s)
}
func autoConvert_v1beta1_IPAddress_To_networking_IPAddress(in *v1beta1.IPAddress, out *networking.IPAddress, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_v1beta1_IPAddressSpec_To_networking_IPAddressSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
return nil
}
// Convert_v1beta1_IPAddress_To_networking_IPAddress is an autogenerated conversion function.
func Convert_v1beta1_IPAddress_To_networking_IPAddress(in *v1beta1.IPAddress, out *networking.IPAddress, s conversion.Scope) error {
return autoConvert_v1beta1_IPAddress_To_networking_IPAddress(in, out, s)
}
func autoConvert_networking_IPAddress_To_v1beta1_IPAddress(in *networking.IPAddress, out *v1beta1.IPAddress, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_networking_IPAddressSpec_To_v1beta1_IPAddressSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
return nil
}
// Convert_networking_IPAddress_To_v1beta1_IPAddress is an autogenerated conversion function.
func Convert_networking_IPAddress_To_v1beta1_IPAddress(in *networking.IPAddress, out *v1beta1.IPAddress, s conversion.Scope) error {
return autoConvert_networking_IPAddress_To_v1beta1_IPAddress(in, out, s)
}
func autoConvert_v1beta1_IPAddressList_To_networking_IPAddressList(in *v1beta1.IPAddressList, out *networking.IPAddressList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]networking.IPAddress)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_v1beta1_IPAddressList_To_networking_IPAddressList is an autogenerated conversion function.
func Convert_v1beta1_IPAddressList_To_networking_IPAddressList(in *v1beta1.IPAddressList, out *networking.IPAddressList, s conversion.Scope) error {
return autoConvert_v1beta1_IPAddressList_To_networking_IPAddressList(in, out, s)
}
func autoConvert_networking_IPAddressList_To_v1beta1_IPAddressList(in *networking.IPAddressList, out *v1beta1.IPAddressList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]v1beta1.IPAddress)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_networking_IPAddressList_To_v1beta1_IPAddressList is an autogenerated conversion function.
func Convert_networking_IPAddressList_To_v1beta1_IPAddressList(in *networking.IPAddressList, out *v1beta1.IPAddressList, s conversion.Scope) error {
return autoConvert_networking_IPAddressList_To_v1beta1_IPAddressList(in, out, s)
}
func autoConvert_v1beta1_IPAddressSpec_To_networking_IPAddressSpec(in *v1beta1.IPAddressSpec, out *networking.IPAddressSpec, s conversion.Scope) error {
out.ParentRef = (*networking.ParentReference)(unsafe.Pointer(in.ParentRef))
return nil
}
// Convert_v1beta1_IPAddressSpec_To_networking_IPAddressSpec is an autogenerated conversion function.
func Convert_v1beta1_IPAddressSpec_To_networking_IPAddressSpec(in *v1beta1.IPAddressSpec, out *networking.IPAddressSpec, s conversion.Scope) error {
return autoConvert_v1beta1_IPAddressSpec_To_networking_IPAddressSpec(in, out, s)
}
func autoConvert_networking_IPAddressSpec_To_v1beta1_IPAddressSpec(in *networking.IPAddressSpec, out *v1beta1.IPAddressSpec, s conversion.Scope) error {
out.ParentRef = (*v1beta1.ParentReference)(unsafe.Pointer(in.ParentRef))
return nil
}
// Convert_networking_IPAddressSpec_To_v1beta1_IPAddressSpec is an autogenerated conversion function.
func Convert_networking_IPAddressSpec_To_v1beta1_IPAddressSpec(in *networking.IPAddressSpec, out *v1beta1.IPAddressSpec, s conversion.Scope) error {
return autoConvert_networking_IPAddressSpec_To_v1beta1_IPAddressSpec(in, out, s)
}
func autoConvert_v1beta1_Ingress_To_networking_Ingress(in *v1beta1.Ingress, out *networking.Ingress, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_v1beta1_IngressSpec_To_networking_IngressSpec(&in.Spec, &out.Spec, s); err != nil {
@@ -676,3 +825,123 @@ func autoConvert_networking_IngressTLS_To_v1beta1_IngressTLS(in *networking.Ingr
func Convert_networking_IngressTLS_To_v1beta1_IngressTLS(in *networking.IngressTLS, out *v1beta1.IngressTLS, s conversion.Scope) error {
return autoConvert_networking_IngressTLS_To_v1beta1_IngressTLS(in, out, s)
}
func autoConvert_v1beta1_ParentReference_To_networking_ParentReference(in *v1beta1.ParentReference, out *networking.ParentReference, s conversion.Scope) error {
out.Group = in.Group
out.Resource = in.Resource
out.Namespace = in.Namespace
out.Name = in.Name
return nil
}
// Convert_v1beta1_ParentReference_To_networking_ParentReference is an autogenerated conversion function.
func Convert_v1beta1_ParentReference_To_networking_ParentReference(in *v1beta1.ParentReference, out *networking.ParentReference, s conversion.Scope) error {
return autoConvert_v1beta1_ParentReference_To_networking_ParentReference(in, out, s)
}
func autoConvert_networking_ParentReference_To_v1beta1_ParentReference(in *networking.ParentReference, out *v1beta1.ParentReference, s conversion.Scope) error {
out.Group = in.Group
out.Resource = in.Resource
out.Namespace = in.Namespace
out.Name = in.Name
return nil
}
// Convert_networking_ParentReference_To_v1beta1_ParentReference is an autogenerated conversion function.
func Convert_networking_ParentReference_To_v1beta1_ParentReference(in *networking.ParentReference, out *v1beta1.ParentReference, s conversion.Scope) error {
return autoConvert_networking_ParentReference_To_v1beta1_ParentReference(in, out, s)
}
func autoConvert_v1beta1_ServiceCIDR_To_networking_ServiceCIDR(in *v1beta1.ServiceCIDR, out *networking.ServiceCIDR, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_v1beta1_ServiceCIDRSpec_To_networking_ServiceCIDRSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_v1beta1_ServiceCIDRStatus_To_networking_ServiceCIDRStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
// Convert_v1beta1_ServiceCIDR_To_networking_ServiceCIDR is an autogenerated conversion function.
func Convert_v1beta1_ServiceCIDR_To_networking_ServiceCIDR(in *v1beta1.ServiceCIDR, out *networking.ServiceCIDR, s conversion.Scope) error {
return autoConvert_v1beta1_ServiceCIDR_To_networking_ServiceCIDR(in, out, s)
}
func autoConvert_networking_ServiceCIDR_To_v1beta1_ServiceCIDR(in *networking.ServiceCIDR, out *v1beta1.ServiceCIDR, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_networking_ServiceCIDRSpec_To_v1beta1_ServiceCIDRSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_networking_ServiceCIDRStatus_To_v1beta1_ServiceCIDRStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
// Convert_networking_ServiceCIDR_To_v1beta1_ServiceCIDR is an autogenerated conversion function.
func Convert_networking_ServiceCIDR_To_v1beta1_ServiceCIDR(in *networking.ServiceCIDR, out *v1beta1.ServiceCIDR, s conversion.Scope) error {
return autoConvert_networking_ServiceCIDR_To_v1beta1_ServiceCIDR(in, out, s)
}
func autoConvert_v1beta1_ServiceCIDRList_To_networking_ServiceCIDRList(in *v1beta1.ServiceCIDRList, out *networking.ServiceCIDRList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]networking.ServiceCIDR)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_v1beta1_ServiceCIDRList_To_networking_ServiceCIDRList is an autogenerated conversion function.
func Convert_v1beta1_ServiceCIDRList_To_networking_ServiceCIDRList(in *v1beta1.ServiceCIDRList, out *networking.ServiceCIDRList, s conversion.Scope) error {
return autoConvert_v1beta1_ServiceCIDRList_To_networking_ServiceCIDRList(in, out, s)
}
func autoConvert_networking_ServiceCIDRList_To_v1beta1_ServiceCIDRList(in *networking.ServiceCIDRList, out *v1beta1.ServiceCIDRList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]v1beta1.ServiceCIDR)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_networking_ServiceCIDRList_To_v1beta1_ServiceCIDRList is an autogenerated conversion function.
func Convert_networking_ServiceCIDRList_To_v1beta1_ServiceCIDRList(in *networking.ServiceCIDRList, out *v1beta1.ServiceCIDRList, s conversion.Scope) error {
return autoConvert_networking_ServiceCIDRList_To_v1beta1_ServiceCIDRList(in, out, s)
}
func autoConvert_v1beta1_ServiceCIDRSpec_To_networking_ServiceCIDRSpec(in *v1beta1.ServiceCIDRSpec, out *networking.ServiceCIDRSpec, s conversion.Scope) error {
out.CIDRs = *(*[]string)(unsafe.Pointer(&in.CIDRs))
return nil
}
// Convert_v1beta1_ServiceCIDRSpec_To_networking_ServiceCIDRSpec is an autogenerated conversion function.
func Convert_v1beta1_ServiceCIDRSpec_To_networking_ServiceCIDRSpec(in *v1beta1.ServiceCIDRSpec, out *networking.ServiceCIDRSpec, s conversion.Scope) error {
return autoConvert_v1beta1_ServiceCIDRSpec_To_networking_ServiceCIDRSpec(in, out, s)
}
func autoConvert_networking_ServiceCIDRSpec_To_v1beta1_ServiceCIDRSpec(in *networking.ServiceCIDRSpec, out *v1beta1.ServiceCIDRSpec, s conversion.Scope) error {
out.CIDRs = *(*[]string)(unsafe.Pointer(&in.CIDRs))
return nil
}
// Convert_networking_ServiceCIDRSpec_To_v1beta1_ServiceCIDRSpec is an autogenerated conversion function.
func Convert_networking_ServiceCIDRSpec_To_v1beta1_ServiceCIDRSpec(in *networking.ServiceCIDRSpec, out *v1beta1.ServiceCIDRSpec, s conversion.Scope) error {
return autoConvert_networking_ServiceCIDRSpec_To_v1beta1_ServiceCIDRSpec(in, out, s)
}
func autoConvert_v1beta1_ServiceCIDRStatus_To_networking_ServiceCIDRStatus(in *v1beta1.ServiceCIDRStatus, out *networking.ServiceCIDRStatus, s conversion.Scope) error {
out.Conditions = *(*[]metav1.Condition)(unsafe.Pointer(&in.Conditions))
return nil
}
// Convert_v1beta1_ServiceCIDRStatus_To_networking_ServiceCIDRStatus is an autogenerated conversion function.
func Convert_v1beta1_ServiceCIDRStatus_To_networking_ServiceCIDRStatus(in *v1beta1.ServiceCIDRStatus, out *networking.ServiceCIDRStatus, s conversion.Scope) error {
return autoConvert_v1beta1_ServiceCIDRStatus_To_networking_ServiceCIDRStatus(in, out, s)
}
func autoConvert_networking_ServiceCIDRStatus_To_v1beta1_ServiceCIDRStatus(in *networking.ServiceCIDRStatus, out *v1beta1.ServiceCIDRStatus, s conversion.Scope) error {
out.Conditions = *(*[]metav1.Condition)(unsafe.Pointer(&in.Conditions))
return nil
}
// Convert_networking_ServiceCIDRStatus_To_v1beta1_ServiceCIDRStatus is an autogenerated conversion function.
func Convert_networking_ServiceCIDRStatus_To_v1beta1_ServiceCIDRStatus(in *networking.ServiceCIDRStatus, out *v1beta1.ServiceCIDRStatus, s conversion.Scope) error {
return autoConvert_networking_ServiceCIDRStatus_To_v1beta1_ServiceCIDRStatus(in, out, s)
}

View File

@@ -23,7 +23,7 @@ import (
"time"
v1 "k8s.io/api/core/v1"
networkingapiv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingapiv1beta1 "k8s.io/api/networking/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
@@ -32,12 +32,12 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
metav1apply "k8s.io/client-go/applyconfigurations/meta/v1"
networkingapiv1alpha1apply "k8s.io/client-go/applyconfigurations/networking/v1alpha1"
networkinginformers "k8s.io/client-go/informers/networking/v1alpha1"
networkingapiv1beta1apply "k8s.io/client-go/applyconfigurations/networking/v1beta1"
networkinginformers "k8s.io/client-go/informers/networking/v1beta1"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
networkinglisters "k8s.io/client-go/listers/networking/v1alpha1"
networkinglisters "k8s.io/client-go/listers/networking/v1beta1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/workqueue"
@@ -147,7 +147,7 @@ func (c *Controller) Run(ctx context.Context, workers int) {
}
func (c *Controller) addServiceCIDR(obj interface{}) {
cidr, ok := obj.(*networkingapiv1alpha1.ServiceCIDR)
cidr, ok := obj.(*networkingapiv1beta1.ServiceCIDR)
if !ok {
return
}
@@ -174,7 +174,7 @@ func (c *Controller) deleteServiceCIDR(obj interface{}) {
// addIPAddress may block a ServiceCIDR deletion
func (c *Controller) addIPAddress(obj interface{}) {
ip, ok := obj.(*networkingapiv1alpha1.IPAddress)
ip, ok := obj.(*networkingapiv1beta1.IPAddress)
if !ok {
return
}
@@ -186,13 +186,13 @@ func (c *Controller) addIPAddress(obj interface{}) {
// deleteIPAddress may unblock a ServiceCIDR deletion
func (c *Controller) deleteIPAddress(obj interface{}) {
ip, ok := obj.(*networkingapiv1alpha1.IPAddress)
ip, ok := obj.(*networkingapiv1beta1.IPAddress)
if !ok {
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
return
}
ip, ok = tombstone.Obj.(*networkingapiv1alpha1.IPAddress)
ip, ok = tombstone.Obj.(*networkingapiv1beta1.IPAddress)
if !ok {
return
}
@@ -206,7 +206,7 @@ func (c *Controller) deleteIPAddress(obj interface{}) {
// overlappingServiceCIDRs, given a ServiceCIDR return the ServiceCIDRs that contain or are contained,
// this is required because adding or removing a CIDR will require to recompute the
// state of each ServiceCIDR to check if can be unblocked on deletion.
func (c *Controller) overlappingServiceCIDRs(serviceCIDR *networkingapiv1alpha1.ServiceCIDR) []string {
func (c *Controller) overlappingServiceCIDRs(serviceCIDR *networkingapiv1beta1.ServiceCIDR) []string {
result := sets.New[string]()
for _, cidr := range serviceCIDR.Spec.CIDRs {
if prefix, err := netip.ParsePrefix(cidr); err == nil { // if is empty err will not be nil
@@ -222,9 +222,9 @@ func (c *Controller) overlappingServiceCIDRs(serviceCIDR *networkingapiv1alpha1.
// containingServiceCIDRs, given an IPAddress return the ServiceCIDRs that contains the IP,
// as it may block or be blocking the deletion of the ServiceCIDRs that contain it.
func (c *Controller) containingServiceCIDRs(ip *networkingapiv1alpha1.IPAddress) []string {
func (c *Controller) containingServiceCIDRs(ip *networkingapiv1beta1.IPAddress) []string {
// only process IPs managed by the kube-apiserver
managedBy, ok := ip.Labels[networkingapiv1alpha1.LabelManagedBy]
managedBy, ok := ip.Labels[networkingapiv1beta1.LabelManagedBy]
if !ok || managedBy != ipallocator.ControllerName {
return []string{}
}
@@ -302,15 +302,15 @@ func (c *Controller) sync(ctx context.Context, key string) error {
// update the status to indicate why the ServiceCIDR can not be deleted,
// it will be reevaludated by an event on any ServiceCIDR or IPAddress related object
// that may remove this condition.
svcApplyStatus := networkingapiv1alpha1apply.ServiceCIDRStatus().WithConditions(
svcApplyStatus := networkingapiv1beta1apply.ServiceCIDRStatus().WithConditions(
metav1apply.Condition().
WithType(networkingapiv1alpha1.ServiceCIDRConditionReady).
WithType(networkingapiv1beta1.ServiceCIDRConditionReady).
WithStatus(metav1.ConditionFalse).
WithReason(networkingapiv1alpha1.ServiceCIDRReasonTerminating).
WithReason(networkingapiv1beta1.ServiceCIDRReasonTerminating).
WithMessage("There are still IPAddresses referencing the ServiceCIDR, please remove them or create a new ServiceCIDR").
WithLastTransitionTime(metav1.Now()))
svcApply := networkingapiv1alpha1apply.ServiceCIDR(cidr.Name).WithStatus(svcApplyStatus)
_, err = c.client.NetworkingV1alpha1().ServiceCIDRs().ApplyStatus(ctx, svcApply, metav1.ApplyOptions{FieldManager: controllerName, Force: true})
svcApply := networkingapiv1beta1apply.ServiceCIDR(cidr.Name).WithStatus(svcApplyStatus)
_, err = c.client.NetworkingV1beta1().ServiceCIDRs().ApplyStatus(ctx, svcApply, metav1.ApplyOptions{FieldManager: controllerName, Force: true})
return err
}
// If there are no IPAddress depending on this ServiceCIDR is safe to remove it,
@@ -333,14 +333,14 @@ func (c *Controller) sync(ctx context.Context, key string) error {
}
// Set Ready condition to True.
svcApplyStatus := networkingapiv1alpha1apply.ServiceCIDRStatus().WithConditions(
svcApplyStatus := networkingapiv1beta1apply.ServiceCIDRStatus().WithConditions(
metav1apply.Condition().
WithType(networkingapiv1alpha1.ServiceCIDRConditionReady).
WithType(networkingapiv1beta1.ServiceCIDRConditionReady).
WithStatus(metav1.ConditionTrue).
WithMessage("Kubernetes Service CIDR is ready").
WithLastTransitionTime(metav1.Now()))
svcApply := networkingapiv1alpha1apply.ServiceCIDR(cidr.Name).WithStatus(svcApplyStatus)
if _, err := c.client.NetworkingV1alpha1().ServiceCIDRs().ApplyStatus(ctx, svcApply, metav1.ApplyOptions{FieldManager: controllerName, Force: true}); err != nil {
svcApply := networkingapiv1beta1apply.ServiceCIDR(cidr.Name).WithStatus(svcApplyStatus)
if _, err := c.client.NetworkingV1beta1().ServiceCIDRs().ApplyStatus(ctx, svcApply, metav1.ApplyOptions{FieldManager: controllerName, Force: true}); err != nil {
logger.Info("error updating default ServiceCIDR status", "error", err)
c.eventRecorder.Eventf(cidr, v1.EventTypeWarning, "KubernetesServiceCIDRError", "The ServiceCIDR Status can not be set to Ready=True")
return err
@@ -350,7 +350,7 @@ func (c *Controller) sync(ctx context.Context, key string) error {
}
// canDeleteCIDR checks that the ServiceCIDR can be safely deleted and not leave orphan IPAddresses
func (c *Controller) canDeleteCIDR(ctx context.Context, serviceCIDR *networkingapiv1alpha1.ServiceCIDR) (bool, error) {
func (c *Controller) canDeleteCIDR(ctx context.Context, serviceCIDR *networkingapiv1beta1.ServiceCIDR) (bool, error) {
logger := klog.FromContext(ctx)
// Check if there is a subnet that already contains the ServiceCIDR that is going to be deleted.
hasParent := true
@@ -379,8 +379,8 @@ func (c *Controller) canDeleteCIDR(ctx context.Context, serviceCIDR *networkinga
for _, cidr := range serviceCIDR.Spec.CIDRs {
// get all the IPv4 addresses
ipLabelSelector := labels.Set(map[string]string{
networkingapiv1alpha1.LabelIPAddressFamily: string(convertToV1IPFamily(netutils.IPFamilyOfCIDRString(cidr))),
networkingapiv1alpha1.LabelManagedBy: ipallocator.ControllerName,
networkingapiv1beta1.LabelIPAddressFamily: string(convertToV1IPFamily(netutils.IPFamilyOfCIDRString(cidr))),
networkingapiv1beta1.LabelManagedBy: ipallocator.ControllerName,
}).AsSelectorPreValidated()
ips, err := c.ipAddressLister.List(ipLabelSelector)
if err != nil {
@@ -411,7 +411,7 @@ func (c *Controller) canDeleteCIDR(ctx context.Context, serviceCIDR *networkinga
return true, nil
}
func (c *Controller) addServiceCIDRFinalizerIfNeeded(ctx context.Context, cidr *networkingapiv1alpha1.ServiceCIDR) error {
func (c *Controller) addServiceCIDRFinalizerIfNeeded(ctx context.Context, cidr *networkingapiv1beta1.ServiceCIDR) error {
for _, f := range cidr.GetFinalizers() {
if f == ServiceCIDRProtectionFinalizer {
return nil
@@ -427,7 +427,7 @@ func (c *Controller) addServiceCIDRFinalizerIfNeeded(ctx context.Context, cidr *
if err != nil {
return err
}
_, err = c.client.NetworkingV1alpha1().ServiceCIDRs().Patch(ctx, cidr.Name, types.StrategicMergePatchType, patchBytes, metav1.PatchOptions{})
_, err = c.client.NetworkingV1beta1().ServiceCIDRs().Patch(ctx, cidr.Name, types.StrategicMergePatchType, patchBytes, metav1.PatchOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}
@@ -436,7 +436,7 @@ func (c *Controller) addServiceCIDRFinalizerIfNeeded(ctx context.Context, cidr *
}
func (c *Controller) removeServiceCIDRFinalizerIfNeeded(ctx context.Context, cidr *networkingapiv1alpha1.ServiceCIDR) error {
func (c *Controller) removeServiceCIDRFinalizerIfNeeded(ctx context.Context, cidr *networkingapiv1beta1.ServiceCIDR) error {
found := false
for _, f := range cidr.GetFinalizers() {
if f == ServiceCIDRProtectionFinalizer {
@@ -456,7 +456,7 @@ func (c *Controller) removeServiceCIDRFinalizerIfNeeded(ctx context.Context, cid
if err != nil {
return err
}
_, err = c.client.NetworkingV1alpha1().ServiceCIDRs().Patch(ctx, cidr.Name, types.StrategicMergePatchType, patchBytes, metav1.PatchOptions{})
_, err = c.client.NetworkingV1beta1().ServiceCIDRs().Patch(ctx, cidr.Name, types.StrategicMergePatchType, patchBytes, metav1.PatchOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}

View File

@@ -24,7 +24,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
v1 "k8s.io/api/core/v1"
networkingapiv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingapiv1beta1 "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes/fake"
@@ -44,12 +44,12 @@ type testController struct {
ipaddressesStore cache.Store
}
func newController(ctx context.Context, t *testing.T, cidrs []*networkingapiv1alpha1.ServiceCIDR, ips []*networkingapiv1alpha1.IPAddress) (*fake.Clientset, *testController) {
func newController(ctx context.Context, t *testing.T, cidrs []*networkingapiv1beta1.ServiceCIDR, ips []*networkingapiv1beta1.IPAddress) (*fake.Clientset, *testController) {
client := fake.NewSimpleClientset()
informerFactory := informers.NewSharedInformerFactory(client, controller.NoResyncPeriodFunc())
serviceCIDRInformer := informerFactory.Networking().V1alpha1().ServiceCIDRs()
serviceCIDRInformer := informerFactory.Networking().V1beta1().ServiceCIDRs()
cidrStore := serviceCIDRInformer.Informer().GetStore()
for _, obj := range cidrs {
err := cidrStore.Add(obj)
@@ -57,7 +57,7 @@ func newController(ctx context.Context, t *testing.T, cidrs []*networkingapiv1al
t.Fatal(err)
}
}
ipAddressInformer := informerFactory.Networking().V1alpha1().IPAddresses()
ipAddressInformer := informerFactory.Networking().V1beta1().IPAddresses()
ipStore := ipAddressInformer.Informer().GetStore()
for _, obj := range ips {
err := ipStore.Add(obj)
@@ -97,8 +97,8 @@ func TestControllerSync(t *testing.T) {
testCases := []struct {
name string
cidrs []*networkingapiv1alpha1.ServiceCIDR
ips []*networkingapiv1alpha1.IPAddress
cidrs []*networkingapiv1beta1.ServiceCIDR
ips []*networkingapiv1beta1.IPAddress
cidrSynced string
actions [][]string // verb and resource and subresource
}{
@@ -107,7 +107,7 @@ func TestControllerSync(t *testing.T) {
},
{
name: "default service CIDR must have finalizer",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
},
cidrSynced: defaultservicecidr.DefaultServiceCIDRName,
@@ -115,7 +115,7 @@ func TestControllerSync(t *testing.T) {
},
{
name: "service CIDR must have finalizer",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR("no-finalizer", "192.168.0.0/24", "2001:db2::/64"),
},
cidrSynced: "no-finalizer",
@@ -123,7 +123,7 @@ func TestControllerSync(t *testing.T) {
},
{
name: "service CIDR being deleted must remove the finalizer",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
deletedServiceCIDR,
},
cidrSynced: deletedServiceCIDR.Name,
@@ -131,7 +131,7 @@ func TestControllerSync(t *testing.T) {
},
{
name: "service CIDR being deleted but within the grace period must be requeued not remove the finalizer", // TODO: assert is actually requeued
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
deletingServiceCIDR,
},
cidrSynced: deletingServiceCIDR.Name,
@@ -139,10 +139,10 @@ func TestControllerSync(t *testing.T) {
},
{
name: "service CIDR being deleted with IPv4 addresses should update the status",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
deletedServiceCIDR,
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("192.168.0.1"),
},
cidrSynced: deletedServiceCIDR.Name,
@@ -150,11 +150,11 @@ func TestControllerSync(t *testing.T) {
},
{
name: "service CIDR being deleted and overlapping same range and IPv4 addresses should remove the finalizer",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
deletedServiceCIDR,
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("192.168.0.1"),
},
cidrSynced: deletedServiceCIDR.Name,
@@ -162,11 +162,11 @@ func TestControllerSync(t *testing.T) {
},
{
name: "service CIDR being deleted and overlapping and IPv4 addresses should remove the finalizer",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
deletedServiceCIDR,
makeServiceCIDR("overlapping", "192.168.0.0/16", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("192.168.0.1"),
},
cidrSynced: deletedServiceCIDR.Name,
@@ -174,11 +174,11 @@ func TestControllerSync(t *testing.T) {
},
{
name: "service CIDR being deleted and not overlapping and IPv4 addresses should update the status",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
deletedServiceCIDR,
makeServiceCIDR("overlapping", "192.168.255.0/26", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("192.168.0.1"),
},
cidrSynced: deletedServiceCIDR.Name,
@@ -186,10 +186,10 @@ func TestControllerSync(t *testing.T) {
},
{
name: "service CIDR being deleted with IPv6 addresses should update the status",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
deletedServiceCIDR,
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("2001:db2::1"),
},
cidrSynced: deletedServiceCIDR.Name,
@@ -197,11 +197,11 @@ func TestControllerSync(t *testing.T) {
},
{
name: "service CIDR being deleted and overlapping same range and IPv6 addresses should remove the finalizer",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
deletedServiceCIDR,
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("2001:db2::1"),
},
cidrSynced: deletedServiceCIDR.Name,
@@ -209,11 +209,11 @@ func TestControllerSync(t *testing.T) {
},
{
name: "service CIDR being deleted and overlapping and IPv6 addresses should remove the finalizer",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
deletedServiceCIDR,
makeServiceCIDR("overlapping", "192.168.0.0/16", "2001:db2::/48"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("2001:db2::1"),
},
cidrSynced: deletedServiceCIDR.Name,
@@ -221,11 +221,11 @@ func TestControllerSync(t *testing.T) {
},
{
name: "service CIDR being deleted and not overlapping and IPv6 addresses should update the status",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
deletedServiceCIDR,
makeServiceCIDR("overlapping", "192.168.255.0/26", "2001:db2:a:b::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("2001:db2::1"),
},
cidrSynced: deletedServiceCIDR.Name,
@@ -247,12 +247,12 @@ func TestControllerSync(t *testing.T) {
}
}
func makeServiceCIDR(name, primary, secondary string) *networkingapiv1alpha1.ServiceCIDR {
serviceCIDR := &networkingapiv1alpha1.ServiceCIDR{
func makeServiceCIDR(name, primary, secondary string) *networkingapiv1beta1.ServiceCIDR {
serviceCIDR := &networkingapiv1beta1.ServiceCIDR{
ObjectMeta: metav1.ObjectMeta{
Name: name,
},
Spec: networkingapiv1alpha1.ServiceCIDRSpec{},
Spec: networkingapiv1beta1.ServiceCIDRSpec{},
}
serviceCIDR.Spec.CIDRs = append(serviceCIDR.Spec.CIDRs, primary)
if secondary != "" {
@@ -261,17 +261,17 @@ func makeServiceCIDR(name, primary, secondary string) *networkingapiv1alpha1.Ser
return serviceCIDR
}
func makeIPAddress(name string) *networkingapiv1alpha1.IPAddress {
func makeIPAddress(name string) *networkingapiv1beta1.IPAddress {
family := string(v1.IPv4Protocol)
if netutils.IsIPv6String(name) {
family = string(v1.IPv6Protocol)
}
return &networkingapiv1alpha1.IPAddress{
return &networkingapiv1beta1.IPAddress{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Labels: map[string]string{
networkingapiv1alpha1.LabelIPAddressFamily: family,
networkingapiv1alpha1.LabelManagedBy: ipallocator.ControllerName,
networkingapiv1beta1.LabelIPAddressFamily: family,
networkingapiv1beta1.LabelManagedBy: ipallocator.ControllerName,
},
},
}
@@ -302,9 +302,9 @@ func expectAction(t *testing.T, actions []k8stesting.Action, expected [][]string
func TestController_canDeleteCIDR(t *testing.T) {
tests := []struct {
name string
cidrs []*networkingapiv1alpha1.ServiceCIDR
ips []*networkingapiv1alpha1.IPAddress
cidrSynced *networkingapiv1alpha1.ServiceCIDR
cidrs []*networkingapiv1beta1.ServiceCIDR
ips []*networkingapiv1beta1.IPAddress
cidrSynced *networkingapiv1beta1.ServiceCIDR
want bool
}{
{
@@ -314,7 +314,7 @@ func TestController_canDeleteCIDR(t *testing.T) {
},
{
name: "CIDR and no IPs",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
},
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
@@ -322,10 +322,10 @@ func TestController_canDeleteCIDR(t *testing.T) {
},
{
name: "CIDR with IPs",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("192.168.0.24"),
},
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
@@ -333,10 +333,10 @@ func TestController_canDeleteCIDR(t *testing.T) {
},
{
name: "CIDR without IPs",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("192.168.1.24"),
},
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
@@ -344,10 +344,10 @@ func TestController_canDeleteCIDR(t *testing.T) {
},
{
name: "CIDR with IPv4 address referencing the subnet address",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("192.168.0.0"),
},
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
@@ -355,10 +355,10 @@ func TestController_canDeleteCIDR(t *testing.T) {
},
{
name: "CIDR with IPv4 address referencing the broadcast address",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("192.168.0.255"),
},
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
@@ -366,10 +366,10 @@ func TestController_canDeleteCIDR(t *testing.T) {
},
{
name: "CIDR with IPv6 address referencing the broadcast address",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("2001:0db2::ffff:ffff:ffff:ffff"),
},
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
@@ -377,11 +377,11 @@ func TestController_canDeleteCIDR(t *testing.T) {
},
{
name: "CIDR with same range overlapping and IPs",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("192.168.0.23"),
},
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
@@ -389,11 +389,11 @@ func TestController_canDeleteCIDR(t *testing.T) {
},
{
name: "CIDR with smaller range overlapping and IPs",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping", "192.168.0.0/26", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("192.168.0.23"),
},
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
@@ -401,11 +401,11 @@ func TestController_canDeleteCIDR(t *testing.T) {
},
{
name: "CIDR with smaller range overlapping but IPs orphan",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping", "192.168.0.0/28", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("192.168.0.23"),
},
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
@@ -413,11 +413,11 @@ func TestController_canDeleteCIDR(t *testing.T) {
},
{
name: "CIDR with larger range overlapping and IPs",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping", "192.168.0.0/16", "2001:db2::/64"),
},
ips: []*networkingapiv1alpha1.IPAddress{
ips: []*networkingapiv1beta1.IPAddress{
makeIPAddress("192.168.0.23"),
},
cidrSynced: makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
@@ -442,8 +442,8 @@ func TestController_canDeleteCIDR(t *testing.T) {
func TestController_ipToCidrs(t *testing.T) {
tests := []struct {
name string
cidrs []*networkingapiv1alpha1.ServiceCIDR
ip *networkingapiv1alpha1.IPAddress
cidrs []*networkingapiv1beta1.ServiceCIDR
ip *networkingapiv1beta1.IPAddress
want []string
}{
{
@@ -452,7 +452,7 @@ func TestController_ipToCidrs(t *testing.T) {
want: []string{},
}, {
name: "one CIDR",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("unrelated", "10.0.0.0/24", ""),
makeServiceCIDR("unrelated2", "10.0.0.0/16", ""),
@@ -461,7 +461,7 @@ func TestController_ipToCidrs(t *testing.T) {
want: []string{defaultservicecidr.DefaultServiceCIDRName},
}, {
name: "two equal CIDR",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/96"),
makeServiceCIDR("unrelated", "10.0.0.0/24", ""),
@@ -471,7 +471,7 @@ func TestController_ipToCidrs(t *testing.T) {
want: []string{defaultservicecidr.DefaultServiceCIDRName, "overlapping"},
}, {
name: "three CIDR - two same and one larger",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping2", "192.168.0.0/26", "2001:db2::/96"),
@@ -482,7 +482,7 @@ func TestController_ipToCidrs(t *testing.T) {
want: []string{defaultservicecidr.DefaultServiceCIDRName, "overlapping", "overlapping2"},
}, {
name: "three CIDR - two same and one larger - IPv4 subnet address",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping2", "192.168.0.0/26", "2001:db2::/96"),
@@ -493,7 +493,7 @@ func TestController_ipToCidrs(t *testing.T) {
want: []string{},
}, {
name: "three CIDR - two same and one larger - IPv4 broadcast address",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping2", "192.168.0.0/26", "2001:db2::/96"),
@@ -504,7 +504,7 @@ func TestController_ipToCidrs(t *testing.T) {
want: []string{defaultservicecidr.DefaultServiceCIDRName, "overlapping"},
}, {
name: "three CIDR - two same and one larger - IPv6 subnet address",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping2", "192.168.0.0/26", "2001:db2::/96"),
@@ -515,7 +515,7 @@ func TestController_ipToCidrs(t *testing.T) {
want: []string{},
}, {
name: "three CIDR - two same and one larger - IPv6 broadcast address",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping2", "192.168.0.0/26", "2001:db2::/96"),
@@ -539,8 +539,8 @@ func TestController_ipToCidrs(t *testing.T) {
func TestController_cidrToCidrs(t *testing.T) {
tests := []struct {
name string
cidrs []*networkingapiv1alpha1.ServiceCIDR
cidr *networkingapiv1alpha1.ServiceCIDR
cidrs []*networkingapiv1beta1.ServiceCIDR
cidr *networkingapiv1beta1.ServiceCIDR
want []string
}{
{
@@ -549,7 +549,7 @@ func TestController_cidrToCidrs(t *testing.T) {
want: []string{},
}, {
name: "one CIDR",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("unrelated", "10.0.0.0/24", ""),
makeServiceCIDR("unrelated2", "10.0.0.0/16", ""),
@@ -558,7 +558,7 @@ func TestController_cidrToCidrs(t *testing.T) {
want: []string{defaultservicecidr.DefaultServiceCIDRName},
}, {
name: "two equal CIDR",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/96"),
makeServiceCIDR("unrelated", "10.0.0.0/24", ""),
@@ -568,7 +568,7 @@ func TestController_cidrToCidrs(t *testing.T) {
want: []string{defaultservicecidr.DefaultServiceCIDRName, "overlapping"},
}, {
name: "three CIDR - two same and one larger",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
makeServiceCIDR(defaultservicecidr.DefaultServiceCIDRName, "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping", "192.168.0.0/24", "2001:db2::/64"),
makeServiceCIDR("overlapping2", "192.168.0.0/26", "2001:db2::/96"),

View File

@@ -23,19 +23,19 @@ import (
"time"
v1 "k8s.io/api/core/v1"
networkingapiv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingapiv1beta1 "k8s.io/api/networking/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
metav1apply "k8s.io/client-go/applyconfigurations/meta/v1"
networkingapiv1alpha1apply "k8s.io/client-go/applyconfigurations/networking/v1alpha1"
networkingv1alpha1informers "k8s.io/client-go/informers/networking/v1alpha1"
networkingapiv1beta1apply "k8s.io/client-go/applyconfigurations/networking/v1beta1"
networkingv1beta1informers "k8s.io/client-go/informers/networking/v1beta1"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
networkingv1alpha1listers "k8s.io/client-go/listers/networking/v1alpha1"
networkingv1beta1listers "k8s.io/client-go/listers/networking/v1beta1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/klog/v2"
@@ -67,13 +67,13 @@ func NewController(
}
// instead of using the shared informers from the controlplane instance, we construct our own informer
// because we need such a small subset of the information available, only the kubernetes.default ServiceCIDR
c.serviceCIDRInformer = networkingv1alpha1informers.NewFilteredServiceCIDRInformer(client, 12*time.Hour,
c.serviceCIDRInformer = networkingv1beta1informers.NewFilteredServiceCIDRInformer(client, 12*time.Hour,
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
func(options *metav1.ListOptions) {
options.FieldSelector = fields.OneTermEqualSelector("metadata.name", DefaultServiceCIDRName).String()
})
c.serviceCIDRLister = networkingv1alpha1listers.NewServiceCIDRLister(c.serviceCIDRInformer.GetIndexer())
c.serviceCIDRLister = networkingv1beta1listers.NewServiceCIDRLister(c.serviceCIDRInformer.GetIndexer())
c.serviceCIDRsSynced = c.serviceCIDRInformer.HasSynced
return c
@@ -88,7 +88,7 @@ type Controller struct {
eventRecorder record.EventRecorder
serviceCIDRInformer cache.SharedIndexInformer
serviceCIDRLister networkingv1alpha1listers.ServiceCIDRLister
serviceCIDRLister networkingv1beta1listers.ServiceCIDRLister
serviceCIDRsSynced cache.InformerSynced
interval time.Duration
@@ -149,15 +149,15 @@ func (c *Controller) sync() error {
// default ServiceCIDR does not exist
klog.Infof("Creating default ServiceCIDR with CIDRs: %v", c.cidrs)
serviceCIDR = &networkingapiv1alpha1.ServiceCIDR{
serviceCIDR = &networkingapiv1beta1.ServiceCIDR{
ObjectMeta: metav1.ObjectMeta{
Name: DefaultServiceCIDRName,
},
Spec: networkingapiv1alpha1.ServiceCIDRSpec{
Spec: networkingapiv1beta1.ServiceCIDRSpec{
CIDRs: c.cidrs,
},
}
serviceCIDR, err = c.client.NetworkingV1alpha1().ServiceCIDRs().Create(context.Background(), serviceCIDR, metav1.CreateOptions{})
serviceCIDR, err = c.client.NetworkingV1beta1().ServiceCIDRs().Create(context.Background(), serviceCIDR, metav1.CreateOptions{})
if err != nil && !apierrors.IsAlreadyExists(err) {
c.eventRecorder.Eventf(serviceCIDR, v1.EventTypeWarning, "KubernetesDefaultServiceCIDRError", "The default ServiceCIDR can not be created")
return err
@@ -166,7 +166,7 @@ func (c *Controller) sync() error {
return nil
}
func (c *Controller) syncStatus(serviceCIDR *networkingapiv1alpha1.ServiceCIDR) {
func (c *Controller) syncStatus(serviceCIDR *networkingapiv1beta1.ServiceCIDR) {
// don't sync the status of the ServiceCIDR if is being deleted,
// deletion must be handled by the controller-manager
if !serviceCIDR.GetDeletionTimestamp().IsZero() {
@@ -176,7 +176,7 @@ func (c *Controller) syncStatus(serviceCIDR *networkingapiv1alpha1.ServiceCIDR)
// This controller will set the Ready condition to true if the Ready condition
// does not exist and the CIDR values match this controller CIDR values.
for _, condition := range serviceCIDR.Status.Conditions {
if condition.Type == networkingapiv1alpha1.ServiceCIDRConditionReady {
if condition.Type == networkingapiv1beta1.ServiceCIDRConditionReady {
if condition.Status == metav1.ConditionTrue {
return
}
@@ -188,14 +188,14 @@ func (c *Controller) syncStatus(serviceCIDR *networkingapiv1alpha1.ServiceCIDR)
// set status to ready if the ServiceCIDR matches this configuration
if reflect.DeepEqual(c.cidrs, serviceCIDR.Spec.CIDRs) {
klog.Infof("Setting default ServiceCIDR condition Ready to True")
svcApplyStatus := networkingapiv1alpha1apply.ServiceCIDRStatus().WithConditions(
svcApplyStatus := networkingapiv1beta1apply.ServiceCIDRStatus().WithConditions(
metav1apply.Condition().
WithType(networkingapiv1alpha1.ServiceCIDRConditionReady).
WithType(networkingapiv1beta1.ServiceCIDRConditionReady).
WithStatus(metav1.ConditionTrue).
WithMessage("Kubernetes default Service CIDR is ready").
WithLastTransitionTime(metav1.Now()))
svcApply := networkingapiv1alpha1apply.ServiceCIDR(DefaultServiceCIDRName).WithStatus(svcApplyStatus)
if _, errApply := c.client.NetworkingV1alpha1().ServiceCIDRs().ApplyStatus(context.Background(), svcApply, metav1.ApplyOptions{FieldManager: controllerName, Force: true}); errApply != nil {
svcApply := networkingapiv1beta1apply.ServiceCIDR(DefaultServiceCIDRName).WithStatus(svcApplyStatus)
if _, errApply := c.client.NetworkingV1beta1().ServiceCIDRs().ApplyStatus(context.Background(), svcApply, metav1.ApplyOptions{FieldManager: controllerName, Force: true}); errApply != nil {
klog.Infof("error updating default ServiceCIDR status: %v", errApply)
c.eventRecorder.Eventf(serviceCIDR, v1.EventTypeWarning, "KubernetesDefaultServiceCIDRError", "The default ServiceCIDR Status can not be set to Ready=True")
}

View File

@@ -21,7 +21,7 @@ import (
"time"
"github.com/google/go-cmp/cmp"
networkingapiv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingapiv1beta1 "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes/fake"
@@ -35,11 +35,11 @@ const (
defaultIPv6CIDR = "2001:db8::/64"
)
func newController(t *testing.T, objects []*networkingapiv1alpha1.ServiceCIDR) (*fake.Clientset, *Controller) {
func newController(t *testing.T, objects []*networkingapiv1beta1.ServiceCIDR) (*fake.Clientset, *Controller) {
client := fake.NewSimpleClientset()
informerFactory := informers.NewSharedInformerFactory(client, 0)
serviceCIDRInformer := informerFactory.Networking().V1alpha1().ServiceCIDRs()
serviceCIDRInformer := informerFactory.Networking().V1beta1().ServiceCIDRs()
store := serviceCIDRInformer.Informer().GetStore()
for _, obj := range objects {
@@ -64,7 +64,7 @@ func newController(t *testing.T, objects []*networkingapiv1alpha1.ServiceCIDR) (
func TestControllerSync(t *testing.T) {
testCases := []struct {
name string
cidrs []*networkingapiv1alpha1.ServiceCIDR
cidrs []*networkingapiv1beta1.ServiceCIDR
actions [][]string // verb and resource
}{
{
@@ -73,12 +73,12 @@ func TestControllerSync(t *testing.T) {
},
{
name: "existing default service CIDR update Ready condition",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
{
ObjectMeta: metav1.ObjectMeta{
Name: DefaultServiceCIDRName,
},
Spec: networkingapiv1alpha1.ServiceCIDRSpec{
Spec: networkingapiv1beta1.ServiceCIDRSpec{
CIDRs: []string{defaultIPv4CIDR, defaultIPv6CIDR},
},
},
@@ -87,12 +87,12 @@ func TestControllerSync(t *testing.T) {
},
{
name: "existing default service CIDR not matching cidrs",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
{
ObjectMeta: metav1.ObjectMeta{
Name: DefaultServiceCIDRName,
},
Spec: networkingapiv1alpha1.ServiceCIDRSpec{
Spec: networkingapiv1beta1.ServiceCIDRSpec{
CIDRs: []string{"fd00::/112"},
},
},
@@ -100,18 +100,18 @@ func TestControllerSync(t *testing.T) {
},
{
name: "existing default service CIDR not ready",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
{
ObjectMeta: metav1.ObjectMeta{
Name: DefaultServiceCIDRName,
},
Spec: networkingapiv1alpha1.ServiceCIDRSpec{
Spec: networkingapiv1beta1.ServiceCIDRSpec{
CIDRs: []string{defaultIPv4CIDR, defaultIPv6CIDR},
},
Status: networkingapiv1alpha1.ServiceCIDRStatus{
Status: networkingapiv1beta1.ServiceCIDRStatus{
Conditions: []metav1.Condition{
{
Type: string(networkingapiv1alpha1.ServiceCIDRConditionReady),
Type: string(networkingapiv1beta1.ServiceCIDRConditionReady),
Status: metav1.ConditionFalse,
},
},
@@ -121,13 +121,13 @@ func TestControllerSync(t *testing.T) {
},
{
name: "existing default service CIDR being deleted",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
{
ObjectMeta: metav1.ObjectMeta{
Name: DefaultServiceCIDRName,
DeletionTimestamp: ptr.To(metav1.Now()),
},
Spec: networkingapiv1alpha1.ServiceCIDRSpec{
Spec: networkingapiv1beta1.ServiceCIDRSpec{
CIDRs: []string{defaultIPv4CIDR, defaultIPv6CIDR},
},
},
@@ -135,12 +135,12 @@ func TestControllerSync(t *testing.T) {
},
{
name: "existing service CIDRs but not default",
cidrs: []*networkingapiv1alpha1.ServiceCIDR{
cidrs: []*networkingapiv1beta1.ServiceCIDR{
{
ObjectMeta: metav1.ObjectMeta{
Name: "non-default-cidr",
},
Spec: networkingapiv1alpha1.ServiceCIDRSpec{
Spec: networkingapiv1beta1.ServiceCIDRSpec{
CIDRs: []string{defaultIPv4CIDR, defaultIPv6CIDR},
},
},

View File

@@ -43,6 +43,7 @@ import (
eventsv1 "k8s.io/api/events/v1"
networkingapiv1 "k8s.io/api/networking/v1"
networkingapiv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingapiv1beta1 "k8s.io/api/networking/v1beta1"
nodev1 "k8s.io/api/node/v1"
policyapiv1 "k8s.io/api/policy/v1"
rbacv1 "k8s.io/api/rbac/v1"
@@ -466,6 +467,7 @@ var (
flowcontrolv1beta1.SchemeGroupVersion,
flowcontrolv1beta2.SchemeGroupVersion,
flowcontrolv1beta3.SchemeGroupVersion,
networkingapiv1beta1.SchemeGroupVersion,
}
// alphaAPIGroupVersionsDisabledByDefault holds the alpha APIs we have. They are always disabled by default.

View File

@@ -484,6 +484,7 @@ const (
// owner: @aojea
// kep: https://kep.k8s.io/1880
// alpha: v1.27
// beta: v1.31
//
// Enables the dynamic configuration of Service IP ranges
MultiCIDRServiceAllocator featuregate.Feature = "MultiCIDRServiceAllocator"
@@ -1095,7 +1096,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
MinDomainsInPodTopologySpread: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.32
MultiCIDRServiceAllocator: {Default: false, PreRelease: featuregate.Alpha},
MultiCIDRServiceAllocator: {Default: false, PreRelease: featuregate.Beta},
NewVolumeManagerReconstruction: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.32

View File

@@ -800,6 +800,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
"k8s.io/api/networking/v1alpha1.ServiceCIDRStatus": schema_k8sio_api_networking_v1alpha1_ServiceCIDRStatus(ref),
"k8s.io/api/networking/v1beta1.HTTPIngressPath": schema_k8sio_api_networking_v1beta1_HTTPIngressPath(ref),
"k8s.io/api/networking/v1beta1.HTTPIngressRuleValue": schema_k8sio_api_networking_v1beta1_HTTPIngressRuleValue(ref),
"k8s.io/api/networking/v1beta1.IPAddress": schema_k8sio_api_networking_v1beta1_IPAddress(ref),
"k8s.io/api/networking/v1beta1.IPAddressList": schema_k8sio_api_networking_v1beta1_IPAddressList(ref),
"k8s.io/api/networking/v1beta1.IPAddressSpec": schema_k8sio_api_networking_v1beta1_IPAddressSpec(ref),
"k8s.io/api/networking/v1beta1.Ingress": schema_k8sio_api_networking_v1beta1_Ingress(ref),
"k8s.io/api/networking/v1beta1.IngressBackend": schema_k8sio_api_networking_v1beta1_IngressBackend(ref),
"k8s.io/api/networking/v1beta1.IngressClass": schema_k8sio_api_networking_v1beta1_IngressClass(ref),
@@ -815,6 +818,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
"k8s.io/api/networking/v1beta1.IngressSpec": schema_k8sio_api_networking_v1beta1_IngressSpec(ref),
"k8s.io/api/networking/v1beta1.IngressStatus": schema_k8sio_api_networking_v1beta1_IngressStatus(ref),
"k8s.io/api/networking/v1beta1.IngressTLS": schema_k8sio_api_networking_v1beta1_IngressTLS(ref),
"k8s.io/api/networking/v1beta1.ParentReference": schema_k8sio_api_networking_v1beta1_ParentReference(ref),
"k8s.io/api/networking/v1beta1.ServiceCIDR": schema_k8sio_api_networking_v1beta1_ServiceCIDR(ref),
"k8s.io/api/networking/v1beta1.ServiceCIDRList": schema_k8sio_api_networking_v1beta1_ServiceCIDRList(ref),
"k8s.io/api/networking/v1beta1.ServiceCIDRSpec": schema_k8sio_api_networking_v1beta1_ServiceCIDRSpec(ref),
"k8s.io/api/networking/v1beta1.ServiceCIDRStatus": schema_k8sio_api_networking_v1beta1_ServiceCIDRStatus(ref),
"k8s.io/api/node/v1.Overhead": schema_k8sio_api_node_v1_Overhead(ref),
"k8s.io/api/node/v1.RuntimeClass": schema_k8sio_api_node_v1_RuntimeClass(ref),
"k8s.io/api/node/v1.RuntimeClassList": schema_k8sio_api_node_v1_RuntimeClassList(ref),
@@ -41203,6 +41211,122 @@ func schema_k8sio_api_networking_v1beta1_HTTPIngressRuleValue(ref common.Referen
}
}
func schema_k8sio_api_networking_v1beta1_IPAddress(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses. An IP address can be represented in different formats, to guarantee the uniqueness of the IP, the name of the object is the IP address in canonical format, four decimal digits separated by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6. Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 Invalid: 10.01.2.3 or 2001:db8:0:0:0::1",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Description: "spec is the desired state of the IPAddress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/networking/v1beta1.IPAddressSpec"),
},
},
},
},
},
Dependencies: []string{
"k8s.io/api/networking/v1beta1.IPAddressSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
func schema_k8sio_api_networking_v1beta1_IPAddressList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "IPAddressList contains a list of IPAddress.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Description: "items is the list of IPAddresses.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/networking/v1beta1.IPAddress"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"k8s.io/api/networking/v1beta1.IPAddress", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
func schema_k8sio_api_networking_v1beta1_IPAddressSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "IPAddressSpec describe the attributes in an IP Address.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"parentRef": {
SchemaProps: spec.SchemaProps{
Description: "ParentRef references the resource that an IPAddress is attached to. An IPAddress must reference a parent object.",
Ref: ref("k8s.io/api/networking/v1beta1.ParentReference"),
},
},
},
Required: []string{"parentRef"},
},
},
Dependencies: []string{
"k8s.io/api/networking/v1beta1.ParentReference"},
}
}
func schema_k8sio_api_networking_v1beta1_Ingress(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@@ -41806,6 +41930,221 @@ func schema_k8sio_api_networking_v1beta1_IngressTLS(ref common.ReferenceCallback
}
}
func schema_k8sio_api_networking_v1beta1_ParentReference(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ParentReference describes a reference to a parent object.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"group": {
SchemaProps: spec.SchemaProps{
Description: "Group is the group of the object being referenced.",
Type: []string{"string"},
Format: "",
},
},
"resource": {
SchemaProps: spec.SchemaProps{
Description: "Resource is the resource of the object being referenced.",
Type: []string{"string"},
Format: "",
},
},
"namespace": {
SchemaProps: spec.SchemaProps{
Description: "Namespace is the namespace of the object being referenced.",
Type: []string{"string"},
Format: "",
},
},
"name": {
SchemaProps: spec.SchemaProps{
Description: "Name is the name of the object being referenced.",
Type: []string{"string"},
Format: "",
},
},
},
Required: []string{"resource", "name"},
},
},
}
}
func schema_k8sio_api_networking_v1beta1_ServiceCIDR(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). This range is used to allocate ClusterIPs to Service objects.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Description: "spec is the desired state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/networking/v1beta1.ServiceCIDRSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "status represents the current state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/networking/v1beta1.ServiceCIDRStatus"),
},
},
},
},
},
Dependencies: []string{
"k8s.io/api/networking/v1beta1.ServiceCIDRSpec", "k8s.io/api/networking/v1beta1.ServiceCIDRStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
func schema_k8sio_api_networking_v1beta1_ServiceCIDRList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ServiceCIDRList contains a list of ServiceCIDR objects.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
"apiVersion": {
SchemaProps: spec.SchemaProps{
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Description: "items is the list of ServiceCIDRs.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/api/networking/v1beta1.ServiceCIDR"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"k8s.io/api/networking/v1beta1.ServiceCIDR", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
func schema_k8sio_api_networking_v1beta1_ServiceCIDRSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"cidrs": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
SchemaProps: spec.SchemaProps{
Description: "CIDRs defines the IP blocks in CIDR notation (e.g. \"192.168.0.0/24\" or \"2001:db8::/64\") from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. This field is immutable.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
},
},
},
}
}
func schema_k8sio_api_networking_v1beta1_ServiceCIDRStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ServiceCIDRStatus describes the current state of the ServiceCIDR.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"conditions": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-map-keys": []interface{}{
"type",
},
"x-kubernetes-list-type": "map",
"x-kubernetes-patch-merge-key": "type",
"x-kubernetes-patch-strategy": "merge",
},
},
SchemaProps: spec.SchemaProps{
Description: "conditions holds an array of metav1.Condition that describe the state of the ServiceCIDR. Current service state",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"),
},
},
},
},
},
},
},
},
Dependencies: []string{
"k8s.io/apimachinery/pkg/apis/meta/v1.Condition"},
}
}
func schema_k8sio_api_node_v1_Overhead(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{

View File

@@ -71,8 +71,8 @@ func NewStorageFactoryConfig() *StorageFactoryConfig {
//
// TODO (https://github.com/kubernetes/kubernetes/issues/108451): remove the override in 1.25.
// apisstorage.Resource("csistoragecapacities").WithVersion("v1beta1"),
networking.Resource("ipaddresses").WithVersion("v1alpha1"),
networking.Resource("servicecidrs").WithVersion("v1alpha1"),
networking.Resource("ipaddresses").WithVersion("v1beta1"),
networking.Resource("servicecidrs").WithVersion("v1beta1"),
certificates.Resource("clustertrustbundles").WithVersion("v1alpha1"),
storage.Resource("volumeattributesclasses").WithVersion("v1alpha1"),
storagemigration.Resource("storagemigrations").WithVersion("v1alpha1"),

View File

@@ -38,7 +38,7 @@ import (
discoveryv1beta1 "k8s.io/api/discovery/v1beta1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
flowcontrolv1 "k8s.io/api/flowcontrol/v1"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
rbacv1beta1 "k8s.io/api/rbac/v1beta1"
resourcev1alpha2 "k8s.io/api/resource/v1alpha2"
schedulingv1 "k8s.io/api/scheduling/v1"
@@ -685,7 +685,7 @@ func AddHandlers(h printers.PrintHandler) {
serviceCIDRColumnDefinitions := []metav1.TableColumnDefinition{
{Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]},
{Name: "CIDRs", Type: "string", Description: networkingv1alpha1.ServiceCIDRSpec{}.SwaggerDoc()["cidrs"]},
{Name: "CIDRs", Type: "string", Description: networkingv1beta1.ServiceCIDRSpec{}.SwaggerDoc()["cidrs"]},
{Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]},
}
@@ -694,7 +694,7 @@ func AddHandlers(h printers.PrintHandler) {
ipAddressColumnDefinitions := []metav1.TableColumnDefinition{
{Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]},
{Name: "ParentRef", Type: "string", Description: networkingv1alpha1.IPAddressSpec{}.SwaggerDoc()["parentRef"]},
{Name: "ParentRef", Type: "string", Description: networkingv1beta1.IPAddressSpec{}.SwaggerDoc()["parentRef"]},
}
_ = h.TableHandler(ipAddressColumnDefinitions, printIPAddress)

View File

@@ -24,12 +24,12 @@ import (
v1 "k8s.io/api/core/v1"
discoveryv1 "k8s.io/api/discovery/v1"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/sets"
v1informers "k8s.io/client-go/informers/core/v1"
discoveryv1informers "k8s.io/client-go/informers/discovery/v1"
networkingv1alpha1informers "k8s.io/client-go/informers/networking/v1alpha1"
networkingv1beta1informers "k8s.io/client-go/informers/networking/v1beta1"
"k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"
)
@@ -401,7 +401,7 @@ type ServiceCIDRConfig struct {
}
// NewServiceCIDRConfig creates a new ServiceCIDRConfig.
func NewServiceCIDRConfig(ctx context.Context, serviceCIDRInformer networkingv1alpha1informers.ServiceCIDRInformer, resyncPeriod time.Duration) *ServiceCIDRConfig {
func NewServiceCIDRConfig(ctx context.Context, serviceCIDRInformer networkingv1beta1informers.ServiceCIDRInformer, resyncPeriod time.Duration) *ServiceCIDRConfig {
result := &ServiceCIDRConfig{
listerSynced: serviceCIDRInformer.Informer().HasSynced,
cidrs: sets.New[string](),
@@ -443,11 +443,11 @@ func (c *ServiceCIDRConfig) Run(stopCh <-chan struct{}) {
// handleServiceCIDREvent is a helper function to handle Add, Update and Delete
// events on ServiceCIDR objects and call downstream event handlers.
func (c *ServiceCIDRConfig) handleServiceCIDREvent(oldObj, newObj interface{}) {
var oldServiceCIDR, newServiceCIDR *networkingv1alpha1.ServiceCIDR
var oldServiceCIDR, newServiceCIDR *networkingv1beta1.ServiceCIDR
var ok bool
if oldObj != nil {
oldServiceCIDR, ok = oldObj.(*networkingv1alpha1.ServiceCIDR)
oldServiceCIDR, ok = oldObj.(*networkingv1beta1.ServiceCIDR)
if !ok {
utilruntime.HandleError(fmt.Errorf("unexpected object type: %v", oldObj))
return
@@ -455,7 +455,7 @@ func (c *ServiceCIDRConfig) handleServiceCIDREvent(oldObj, newObj interface{}) {
}
if newObj != nil {
newServiceCIDR, ok = newObj.(*networkingv1alpha1.ServiceCIDR)
newServiceCIDR, ok = newObj.(*networkingv1beta1.ServiceCIDR)
if !ok {
utilruntime.HandleError(fmt.Errorf("unexpected object type: %v", newObj))
return

View File

@@ -34,7 +34,7 @@ import (
serverstorage "k8s.io/apiserver/pkg/server/storage"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/kubernetes"
networkingv1alpha1client "k8s.io/client-go/kubernetes/typed/networking/v1alpha1"
networkingv1beta1client "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
policyclient "k8s.io/client-go/kubernetes/typed/policy/v1"
"k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/api/legacyscheme"
@@ -140,8 +140,8 @@ func New(c Config) (*legacyProvider, error) {
c.Services.IPRepairInterval,
client,
c.Informers.Core().V1().Services(),
c.Informers.Networking().V1alpha1().ServiceCIDRs(),
c.Informers.Networking().V1alpha1().IPAddresses(),
c.Informers.Networking().V1beta1().ServiceCIDRs(),
c.Informers.Networking().V1beta1().IPAddresses(),
).RunUntil
}
@@ -348,7 +348,7 @@ func (c *Config) newServiceIPAllocators() (registries rangeRegistries, primaryCl
return rangeRegistries{}, nil, nil, nil, fmt.Errorf("cannot create cluster IP allocator: %v", err)
}
} else {
networkingv1alphaClient, err := networkingv1alpha1client.NewForConfig(c.LoopbackClientConfig)
networkingv1beta1Client, err := networkingv1beta1client.NewForConfig(c.LoopbackClientConfig)
if err != nil {
return rangeRegistries{}, nil, nil, nil, err
}
@@ -388,9 +388,9 @@ func (c *Config) newServiceIPAllocators() (registries rangeRegistries, primaryCl
// sets the default IPFamily that may not be coherent with the
// existing default ServiceCIDR
primaryClusterIPAllocator, err = ipallocator.NewMetaAllocator(
networkingv1alphaClient,
c.Informers.Networking().V1alpha1().ServiceCIDRs(),
c.Informers.Networking().V1alpha1().IPAddresses(),
networkingv1beta1Client,
c.Informers.Networking().V1beta1().ServiceCIDRs(),
c.Informers.Networking().V1beta1().IPAddresses(),
netutils.IsIPv6CIDR(&serviceClusterIPRange),
bitmapAllocator,
)
@@ -420,7 +420,7 @@ func (c *Config) newServiceIPAllocators() (registries rangeRegistries, primaryCl
return rangeRegistries{}, nil, nil, nil, fmt.Errorf("cannot create cluster secondary IP allocator: %v", err)
}
} else {
networkingv1alphaClient, err := networkingv1alpha1client.NewForConfig(c.LoopbackClientConfig)
networkingv1beta1Client, err := networkingv1beta1client.NewForConfig(c.LoopbackClientConfig)
if err != nil {
return rangeRegistries{}, nil, nil, nil, err
}
@@ -460,9 +460,9 @@ func (c *Config) newServiceIPAllocators() (registries rangeRegistries, primaryCl
// sets the default IPFamily that may not be coherent with the
// existing default ServiceCIDR
secondaryClusterIPAllocator, err = ipallocator.NewMetaAllocator(
networkingv1alphaClient,
c.Informers.Networking().V1alpha1().ServiceCIDRs(),
c.Informers.Networking().V1alpha1().IPAddresses(),
networkingv1beta1Client,
c.Informers.Networking().V1beta1().ServiceCIDRs(),
c.Informers.Networking().V1beta1().IPAddresses(),
netutils.IsIPv6CIDR(&c.Services.SecondaryClusterIPRange),
bitmapAllocator,
)

View File

@@ -24,16 +24,16 @@ import (
"time"
v1 "k8s.io/api/core/v1"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
utilfeature "k8s.io/apiserver/pkg/util/feature"
networkingv1alpha1informers "k8s.io/client-go/informers/networking/v1alpha1"
networkingv1alpha1client "k8s.io/client-go/kubernetes/typed/networking/v1alpha1"
networkingv1alpha1listers "k8s.io/client-go/listers/networking/v1alpha1"
networkingv1beta1informers "k8s.io/client-go/informers/networking/v1beta1"
networkingv1beta1client "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
networkingv1beta1listers "k8s.io/client-go/listers/networking/v1beta1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
"k8s.io/klog/v2"
@@ -52,12 +52,12 @@ import (
// MetaAllocator implements current allocator interface using
// ServiceCIDR and IPAddress API objects.
type MetaAllocator struct {
client networkingv1alpha1client.NetworkingV1alpha1Interface
serviceCIDRLister networkingv1alpha1listers.ServiceCIDRLister
client networkingv1beta1client.NetworkingV1beta1Interface
serviceCIDRLister networkingv1beta1listers.ServiceCIDRLister
serviceCIDRSynced cache.InformerSynced
ipAddressLister networkingv1alpha1listers.IPAddressLister
ipAddressLister networkingv1beta1listers.IPAddressLister
ipAddressSynced cache.InformerSynced
ipAddressInformer networkingv1alpha1informers.IPAddressInformer
ipAddressInformer networkingv1beta1informers.IPAddressInformer
queue workqueue.TypedRateLimitingInterface[string]
internalStopCh chan struct{}
@@ -87,9 +87,9 @@ var _ Interface = &MetaAllocator{}
// and ServiceCIDR objects to track the assigned IP addresses,
// using an informer cache as storage.
func NewMetaAllocator(
client networkingv1alpha1client.NetworkingV1alpha1Interface,
serviceCIDRInformer networkingv1alpha1informers.ServiceCIDRInformer,
ipAddressInformer networkingv1alpha1informers.IPAddressInformer,
client networkingv1beta1client.NetworkingV1beta1Interface,
serviceCIDRInformer networkingv1beta1informers.ServiceCIDRInformer,
ipAddressInformer networkingv1beta1informers.IPAddressInformer,
isIPv6 bool,
bitmapAllocator Interface,
) (*MetaAllocator, error) {
@@ -100,9 +100,9 @@ func NewMetaAllocator(
}
// newMetaAllocator is used to build the allocator for testing
func newMetaAllocator(client networkingv1alpha1client.NetworkingV1alpha1Interface,
serviceCIDRInformer networkingv1alpha1informers.ServiceCIDRInformer,
ipAddressInformer networkingv1alpha1informers.IPAddressInformer,
func newMetaAllocator(client networkingv1beta1client.NetworkingV1beta1Interface,
serviceCIDRInformer networkingv1beta1informers.ServiceCIDRInformer,
ipAddressInformer networkingv1beta1informers.IPAddressInformer,
isIPv6 bool,
bitmapAllocator Interface,
) *MetaAllocator {
@@ -152,13 +152,13 @@ func (c *MetaAllocator) enqueueServiceCIDR(obj interface{}) {
}
func (c *MetaAllocator) deleteServiceCIDR(obj interface{}) {
serviceCIDR, ok := obj.(*networkingv1alpha1.ServiceCIDR)
serviceCIDR, ok := obj.(*networkingv1beta1.ServiceCIDR)
if !ok {
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
return
}
serviceCIDR, ok = tombstone.Obj.(*networkingv1alpha1.ServiceCIDR)
serviceCIDR, ok = tombstone.Obj.(*networkingv1beta1.ServiceCIDR)
if !ok {
return
}
@@ -414,8 +414,8 @@ func (c *MetaAllocator) Release(ip net.IP) error {
}
func (c *MetaAllocator) ForEach(f func(ip net.IP)) {
ipLabelSelector := labels.Set(map[string]string{
networkingv1alpha1.LabelIPAddressFamily: string(c.IPFamily()),
networkingv1alpha1.LabelManagedBy: ControllerName,
networkingv1beta1.LabelIPAddressFamily: string(c.IPFamily()),
networkingv1beta1.LabelManagedBy: ControllerName,
}).AsSelectorPreValidated()
ips, err := c.ipAddressLister.List(ipLabelSelector)
if err != nil {
@@ -454,8 +454,8 @@ func (c *MetaAllocator) Destroy() {
// for testing
func (c *MetaAllocator) Used() int {
ipLabelSelector := labels.Set(map[string]string{
networkingv1alpha1.LabelIPAddressFamily: string(c.IPFamily()),
networkingv1alpha1.LabelManagedBy: ControllerName,
networkingv1beta1.LabelIPAddressFamily: string(c.IPFamily()),
networkingv1beta1.LabelManagedBy: ControllerName,
}).AsSelectorPreValidated()
ips, err := c.ipAddressLister.List(ipLabelSelector)
if err != nil {
@@ -512,13 +512,13 @@ func (c *MetaAllocator) DryRun() Interface {
return &Allocator{}
}
func isReady(serviceCIDR *networkingv1alpha1.ServiceCIDR) bool {
func isReady(serviceCIDR *networkingv1beta1.ServiceCIDR) bool {
if serviceCIDR == nil {
return false
}
for _, condition := range serviceCIDR.Status.Conditions {
if condition.Type == networkingv1alpha1.ServiceCIDRConditionReady {
if condition.Type == networkingv1beta1.ServiceCIDRConditionReady {
return condition.Status == metav1.ConditionStatus(metav1.ConditionTrue)
}
}

View File

@@ -23,7 +23,7 @@ import (
"testing"
"time"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
@@ -41,13 +41,13 @@ func newTestMetaAllocator() (*MetaAllocator, error) {
client := fake.NewSimpleClientset()
informerFactory := informers.NewSharedInformerFactory(client, 0*time.Second)
serviceCIDRInformer := informerFactory.Networking().V1alpha1().ServiceCIDRs()
serviceCIDRInformer := informerFactory.Networking().V1beta1().ServiceCIDRs()
serviceCIDRStore := serviceCIDRInformer.Informer().GetIndexer()
ipInformer := informerFactory.Networking().V1alpha1().IPAddresses()
ipInformer := informerFactory.Networking().V1beta1().IPAddresses()
ipStore := ipInformer.Informer().GetIndexer()
client.PrependReactor("create", "servicecidrs", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
cidr := action.(k8stesting.CreateAction).GetObject().(*networkingv1alpha1.ServiceCIDR)
cidr := action.(k8stesting.CreateAction).GetObject().(*networkingv1beta1.ServiceCIDR)
_, exists, err := serviceCIDRStore.GetByKey(cidr.Name)
if exists && err != nil {
return false, nil, fmt.Errorf("cidr already exist")
@@ -59,16 +59,16 @@ func newTestMetaAllocator() (*MetaAllocator, error) {
client.PrependReactor("delete", "servicecidrs", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
name := action.(k8stesting.DeleteAction).GetName()
obj, exists, err := serviceCIDRStore.GetByKey(name)
cidr := &networkingv1alpha1.ServiceCIDR{}
cidr := &networkingv1beta1.ServiceCIDR{}
if exists && err == nil {
cidr = obj.(*networkingv1alpha1.ServiceCIDR)
cidr = obj.(*networkingv1beta1.ServiceCIDR)
err = serviceCIDRStore.Delete(cidr)
}
return false, cidr, err
}))
client.PrependReactor("create", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
ip := action.(k8stesting.CreateAction).GetObject().(*networkingv1alpha1.IPAddress)
ip := action.(k8stesting.CreateAction).GetObject().(*networkingv1beta1.IPAddress)
_, exists, err := ipStore.GetByKey(ip.Name)
if exists && err != nil {
return false, nil, fmt.Errorf("ip already exist")
@@ -80,15 +80,15 @@ func newTestMetaAllocator() (*MetaAllocator, error) {
client.PrependReactor("delete", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
name := action.(k8stesting.DeleteAction).GetName()
obj, exists, err := ipStore.GetByKey(name)
ip := &networkingv1alpha1.IPAddress{}
ip := &networkingv1beta1.IPAddress{}
if exists && err == nil {
ip = obj.(*networkingv1alpha1.IPAddress)
ip = obj.(*networkingv1beta1.IPAddress)
err = ipStore.Delete(ip)
}
return false, ip, err
}))
c := newMetaAllocator(client.NetworkingV1alpha1(), serviceCIDRInformer, ipInformer, false, nil)
c := newMetaAllocator(client.NetworkingV1beta1(), serviceCIDRInformer, ipInformer, false, nil)
c.serviceCIDRSynced = func() bool { return true }
c.ipAddressSynced = func() bool { return true }
@@ -602,18 +602,18 @@ func TestCIDRAllocateDualWriteCollision(t *testing.T) {
}
// TODO: add IPv6 and dual stack test cases
func newServiceCIDR(name, cidr string) *networkingv1alpha1.ServiceCIDR {
return &networkingv1alpha1.ServiceCIDR{
func newServiceCIDR(name, cidr string) *networkingv1beta1.ServiceCIDR {
return &networkingv1beta1.ServiceCIDR{
ObjectMeta: metav1.ObjectMeta{
Name: name,
},
Spec: networkingv1alpha1.ServiceCIDRSpec{
Spec: networkingv1beta1.ServiceCIDRSpec{
CIDRs: []string{cidr},
},
Status: networkingv1alpha1.ServiceCIDRStatus{
Status: networkingv1beta1.ServiceCIDRStatus{
Conditions: []metav1.Condition{
{
Type: string(networkingv1alpha1.ServiceCIDRConditionReady),
Type: string(networkingv1beta1.ServiceCIDRConditionReady),
Status: metav1.ConditionTrue,
},
},

View File

@@ -23,17 +23,17 @@ import (
"time"
v1 "k8s.io/api/core/v1"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
coreinformers "k8s.io/client-go/informers/core/v1"
networkinginformers "k8s.io/client-go/informers/networking/v1alpha1"
networkinginformers "k8s.io/client-go/informers/networking/v1beta1"
"k8s.io/client-go/kubernetes"
corelisters "k8s.io/client-go/listers/core/v1"
networkinglisters "k8s.io/client-go/listers/networking/v1alpha1"
networkinglisters "k8s.io/client-go/listers/networking/v1beta1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/events"
"k8s.io/client-go/util/retry"
@@ -263,7 +263,7 @@ func (r *RepairIPAddress) doRunOnce() error {
// Check that there is no IP created by the allocator without
// a Service associated.
ipLabelSelector := labels.Set(map[string]string{
networkingv1alpha1.LabelManagedBy: ipallocator.ControllerName,
networkingv1beta1.LabelManagedBy: ipallocator.ControllerName,
}).AsSelectorPreValidated()
ipAddresses, err := r.ipAddressLister.List(ipLabelSelector)
if err != nil {
@@ -360,7 +360,7 @@ func (r *RepairIPAddress) syncService(key string) error {
// ClusterIP doesn't seem to be allocated, create it.
r.recorder.Eventf(svc, nil, v1.EventTypeWarning, "ClusterIPNotAllocated", "ClusterIPAllocation", "Cluster IP [%v]: %s is not allocated; repairing", family, ip)
runtime.HandleError(fmt.Errorf("the ClusterIP [%v]: %s for Service %s/%s is not allocated; repairing", family, ip, svc.Namespace, svc.Name))
_, err := r.client.NetworkingV1alpha1().IPAddresses().Create(context.Background(), newIPAddress(ip.String(), svc), metav1.CreateOptions{})
_, err := r.client.NetworkingV1beta1().IPAddresses().Create(context.Background(), newIPAddress(ip.String(), svc), metav1.CreateOptions{})
if err != nil {
return err
}
@@ -417,11 +417,11 @@ func (r *RepairIPAddress) syncService(key string) error {
}
func (r *RepairIPAddress) recreateIPAddress(name string, svc *v1.Service) error {
err := r.client.NetworkingV1alpha1().IPAddresses().Delete(context.Background(), name, metav1.DeleteOptions{})
err := r.client.NetworkingV1beta1().IPAddresses().Delete(context.Background(), name, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}
_, err = r.client.NetworkingV1alpha1().IPAddresses().Create(context.Background(), newIPAddress(name, svc), metav1.CreateOptions{})
_, err = r.client.NetworkingV1beta1().IPAddresses().Create(context.Background(), newIPAddress(name, svc), metav1.CreateOptions{})
if err != nil {
return err
}
@@ -482,7 +482,7 @@ func (r *RepairIPAddress) syncIPAddress(key string) error {
if ipAddress.Spec.ParentRef.Group != "" || ipAddress.Spec.ParentRef.Resource != "services" {
runtime.HandleError(fmt.Errorf("IPAddress %s appears to have been modified, not referencing a Service %v: cleaning up", ipAddress.Name, ipAddress.Spec.ParentRef))
r.recorder.Eventf(ipAddress, nil, v1.EventTypeWarning, "IPAddressNotAllocated", "IPAddressAllocation", "IPAddress %s appears to have been modified, not referencing a Service %v: cleaning up", ipAddress.Name, ipAddress.Spec.ParentRef)
err := r.client.NetworkingV1alpha1().IPAddresses().Delete(context.Background(), ipAddress.Name, metav1.DeleteOptions{})
err := r.client.NetworkingV1beta1().IPAddresses().Delete(context.Background(), ipAddress.Name, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}
@@ -499,7 +499,7 @@ func (r *RepairIPAddress) syncIPAddress(key string) error {
if ipLifetime > gracePeriod {
runtime.HandleError(fmt.Errorf("IPAddress %s appears to have leaked: cleaning up", ipAddress.Name))
r.recorder.Eventf(ipAddress, nil, v1.EventTypeWarning, "IPAddressNotAllocated", "IPAddressAllocation", "IPAddress: %s for Service %s/%s appears to have leaked: cleaning up", ipAddress.Name, ipAddress.Spec.ParentRef.Namespace, ipAddress.Spec.ParentRef.Name)
err := r.client.NetworkingV1alpha1().IPAddresses().Delete(context.Background(), ipAddress.Name, metav1.DeleteOptions{})
err := r.client.NetworkingV1beta1().IPAddresses().Delete(context.Background(), ipAddress.Name, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}
@@ -522,7 +522,7 @@ func (r *RepairIPAddress) syncIPAddress(key string) error {
}
runtime.HandleError(fmt.Errorf("the IPAddress: %s for Service %s/%s has a wrong reference %#v; cleaning up", ipAddress.Name, svc.Name, svc.Namespace, ipAddress.Spec.ParentRef))
r.recorder.Eventf(ipAddress, nil, v1.EventTypeWarning, "IPAddressWrongReference", "IPAddressAllocation", "IPAddress: %s for Service %s/%s has a wrong reference; cleaning up", ipAddress.Name, svc.Namespace, svc.Name)
err = r.client.NetworkingV1alpha1().IPAddresses().Delete(context.Background(), ipAddress.Name, metav1.DeleteOptions{})
err = r.client.NetworkingV1beta1().IPAddresses().Delete(context.Background(), ipAddress.Name, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return err
}
@@ -535,31 +535,31 @@ func (r *RepairIPAddress) isIPOutOfRange(ip net.IP) bool {
return len(servicecidr.ContainsIP(r.serviceCIDRLister, ip)) == 0
}
func newIPAddress(name string, svc *v1.Service) *networkingv1alpha1.IPAddress {
func newIPAddress(name string, svc *v1.Service) *networkingv1beta1.IPAddress {
family := string(v1.IPv4Protocol)
if netutils.IsIPv6String(name) {
family = string(v1.IPv6Protocol)
}
return &networkingv1alpha1.IPAddress{
return &networkingv1beta1.IPAddress{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Labels: map[string]string{
networkingv1alpha1.LabelIPAddressFamily: family,
networkingv1alpha1.LabelManagedBy: ipallocator.ControllerName,
networkingv1beta1.LabelIPAddressFamily: family,
networkingv1beta1.LabelManagedBy: ipallocator.ControllerName,
},
},
Spec: networkingv1alpha1.IPAddressSpec{
Spec: networkingv1beta1.IPAddressSpec{
ParentRef: serviceToRef(svc),
},
}
}
func serviceToRef(svc *v1.Service) *networkingv1alpha1.ParentReference {
func serviceToRef(svc *v1.Service) *networkingv1beta1.ParentReference {
if svc == nil {
return nil
}
return &networkingv1alpha1.ParentReference{
return &networkingv1beta1.ParentReference{
Group: "",
Resource: "services",
Namespace: svc.Namespace,
@@ -576,16 +576,16 @@ func getFamilyByIP(ip net.IP) v1.IPFamily {
// managedByController returns true if the controller of the provided
// EndpointSlices is the EndpointSlice controller.
func managedByController(ip *networkingv1alpha1.IPAddress) bool {
managedBy, ok := ip.Labels[networkingv1alpha1.LabelManagedBy]
func managedByController(ip *networkingv1beta1.IPAddress) bool {
managedBy, ok := ip.Labels[networkingv1beta1.LabelManagedBy]
if !ok {
return false
}
return managedBy == ipallocator.ControllerName
}
func verifyIPAddressLabels(ip *networkingv1alpha1.IPAddress) bool {
labelFamily, ok := ip.Labels[networkingv1alpha1.LabelIPAddressFamily]
func verifyIPAddressLabels(ip *networkingv1beta1.IPAddress) bool {
labelFamily, ok := ip.Labels[networkingv1beta1.LabelIPAddressFamily]
if !ok {
return false
}

View File

@@ -23,7 +23,7 @@ import (
"github.com/google/go-cmp/cmp"
v1 "k8s.io/api/core/v1"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/wait"
@@ -54,25 +54,25 @@ func newFakeRepair() (*fake.Clientset, *fakeRepair) {
serviceInformer := informerFactory.Core().V1().Services()
serviceIndexer := serviceInformer.Informer().GetIndexer()
serviceCIDRInformer := informerFactory.Networking().V1alpha1().ServiceCIDRs()
serviceCIDRInformer := informerFactory.Networking().V1beta1().ServiceCIDRs()
serviceCIDRIndexer := serviceCIDRInformer.Informer().GetIndexer()
ipInformer := informerFactory.Networking().V1alpha1().IPAddresses()
ipInformer := informerFactory.Networking().V1beta1().IPAddresses()
ipIndexer := ipInformer.Informer().GetIndexer()
fakeClient.PrependReactor("create", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
ip := action.(k8stesting.CreateAction).GetObject().(*networkingv1alpha1.IPAddress)
ip := action.(k8stesting.CreateAction).GetObject().(*networkingv1beta1.IPAddress)
err := ipIndexer.Add(ip)
return false, ip, err
}))
fakeClient.PrependReactor("update", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
ip := action.(k8stesting.UpdateAction).GetObject().(*networkingv1alpha1.IPAddress)
ip := action.(k8stesting.UpdateAction).GetObject().(*networkingv1beta1.IPAddress)
return false, ip, fmt.Errorf("IPAddress is inmutable after creation")
}))
fakeClient.PrependReactor("delete", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
ip := action.(k8stesting.DeleteAction).GetName()
err := ipIndexer.Delete(ip)
return false, &networkingv1alpha1.IPAddress{}, err
return false, &networkingv1beta1.IPAddress{}, err
}))
r := NewRepairIPAddress(0*time.Second,
@@ -88,8 +88,8 @@ func TestRepairServiceIP(t *testing.T) {
tests := []struct {
name string
svcs []*v1.Service
ipAddresses []*networkingv1alpha1.IPAddress
cidrs []*networkingv1alpha1.ServiceCIDR
ipAddresses []*networkingv1beta1.IPAddress
cidrs []*networkingv1beta1.ServiceCIDR
expectedIPs []string
actions [][]string // verb and resource
events []string
@@ -97,10 +97,10 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "no changes needed single stack",
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1"})},
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("10.0.1.1", newService("test-svc", []string{"10.0.1.1"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
expectedIPs: []string{"10.0.1.1"},
@@ -110,11 +110,11 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "no changes needed dual stack",
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1", "2001:db8::10"})},
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("10.0.1.1", newService("test-svc", []string{"10.0.1.1"})),
newIPAddress("2001:db8::10", newService("test-svc", []string{"2001:db8::10"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
expectedIPs: []string{"10.0.1.1", "2001:db8::10"},
@@ -124,11 +124,11 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "no changes needed dual stack multiple cidrs",
svcs: []*v1.Service{newService("test-svc", []string{"192.168.0.1", "2001:db8:a:b::10"})},
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("192.168.0.1", newService("test-svc", []string{"192.168.0.1"})),
newIPAddress("2001:db8:a:b::10", newService("test-svc", []string{"2001:db8:a:b::10"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
newServiceCIDR("custom", "192.168.0.0/24", "2001:db8:a:b::/64"),
},
@@ -140,7 +140,7 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "create IPAddress single stack",
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1"})},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
expectedIPs: []string{"10.0.1.1"},
@@ -150,7 +150,7 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "create IPAddresses dual stack",
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1", "2001:db8::10"})},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
expectedIPs: []string{"10.0.1.1", "2001:db8::10"},
@@ -163,7 +163,7 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "create IPAddress single stack from secondary",
svcs: []*v1.Service{newService("test-svc", []string{"192.168.1.1"})},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
newServiceCIDR("custom", "192.168.1.0/24", ""),
},
@@ -174,10 +174,10 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "reconcile IPAddress single stack wrong reference",
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1"})},
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("10.0.1.1", newService("test-svc2", []string{"10.0.1.1"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
expectedIPs: []string{"10.0.1.1"},
@@ -187,11 +187,11 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "reconcile IPAddresses dual stack",
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1", "2001:db8::10"})},
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("10.0.1.1", newService("test-svc2", []string{"10.0.1.1"})),
newIPAddress("2001:db8::10", newService("test-svc2", []string{"2001:db8::10"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
expectedIPs: []string{"10.0.1.1", "2001:db8::10"},
@@ -204,11 +204,11 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "one IP out of range",
svcs: []*v1.Service{newService("test-svc", []string{"192.168.1.1", "2001:db8::10"})},
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("192.168.1.1", newService("test-svc", []string{"192.168.1.1"})),
newIPAddress("2001:db8::10", newService("test-svc", []string{"2001:db8::10"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
expectedIPs: []string{"2001:db8::10"},
@@ -217,10 +217,10 @@ func TestRepairServiceIP(t *testing.T) {
},
{
name: "one IP orphan",
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("10.0.1.1", newService("test-svc", []string{"10.0.1.1"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
actions: [][]string{{"delete", "ipaddresses"}},
@@ -229,10 +229,10 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "one IP out of range matching the network address",
svcs: []*v1.Service{newService("test-svc", []string{"10.0.0.0"})},
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("10.0.0.0", newService("test-svc", []string{"10.0.0.0"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
expectedIPs: []string{"10.0.0.0"},
@@ -242,10 +242,10 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "one IP out of range matching the broadcast address",
svcs: []*v1.Service{newService("test-svc", []string{"10.0.255.255"})},
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("10.0.255.255", newService("test-svc", []string{"10.0.255.255"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
expectedIPs: []string{"10.0.255.255"},
@@ -255,10 +255,10 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "one IPv6 out of range matching the subnet address",
svcs: []*v1.Service{newService("test-svc", []string{"2001:db8::"})},
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("2001:db8::", newService("test-svc", []string{"2001:db8::"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
expectedIPs: []string{"2001:db8::"},
@@ -268,20 +268,20 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "one IPv6 matching the broadcast address",
svcs: []*v1.Service{newService("test-svc", []string{"2001:db8::ffff:ffff:ffff:ffff"})},
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("2001:db8::ffff:ffff:ffff:ffff", newService("test-svc", []string{"2001:db8::ffff:ffff:ffff:ffff"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
expectedIPs: []string{"2001:db8::ffff:ffff:ffff:ffff"},
},
{
name: "one IP orphan matching the broadcast address",
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("10.0.255.255", newService("test-svc", []string{"10.0.255.255"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
actions: [][]string{{"delete", "ipaddresses"}},
@@ -290,11 +290,11 @@ func TestRepairServiceIP(t *testing.T) {
{
name: "Two IPAddresses referencing the same service",
svcs: []*v1.Service{newService("test-svc", []string{"10.0.1.1"})},
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("10.0.1.1", newService("test-svc", []string{"10.0.1.1"})),
newIPAddress("10.0.1.2", newService("test-svc", []string{"10.0.1.1"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
actions: [][]string{{"delete", "ipaddresses"}},
@@ -306,10 +306,10 @@ func TestRepairServiceIP(t *testing.T) {
newService("test-svc", []string{"10.0.1.1"}),
newService("test-svc2", []string{"10.0.1.1"}),
},
ipAddresses: []*networkingv1alpha1.IPAddress{
ipAddresses: []*networkingv1beta1.IPAddress{
newIPAddress("10.0.1.1", newService("test-svc2", []string{"10.0.1.1"})),
},
cidrs: []*networkingv1alpha1.ServiceCIDR{
cidrs: []*networkingv1beta1.ServiceCIDR{
newServiceCIDR("kubernetes", serviceCIDRv4, serviceCIDRv6),
},
events: []string{"Warning ClusterIPAlreadyAllocated Cluster IP [IPv4]:10.0.1.1 was assigned to multiple services; please recreate service"},
@@ -370,23 +370,23 @@ func TestRepairServiceIP(t *testing.T) {
func TestRepairIPAddress_syncIPAddress(t *testing.T) {
tests := []struct {
name string
ip *networkingv1alpha1.IPAddress
ip *networkingv1beta1.IPAddress
actions [][]string // verb and resource
wantErr bool
}{
{
name: "correct ipv4 address",
ip: &networkingv1alpha1.IPAddress{
ip: &networkingv1beta1.IPAddress{
ObjectMeta: metav1.ObjectMeta{
Name: "10.0.1.1",
Labels: map[string]string{
networkingv1alpha1.LabelIPAddressFamily: string(v1.IPv4Protocol),
networkingv1alpha1.LabelManagedBy: ipallocator.ControllerName,
networkingv1beta1.LabelIPAddressFamily: string(v1.IPv4Protocol),
networkingv1beta1.LabelManagedBy: ipallocator.ControllerName,
},
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
},
Spec: networkingv1alpha1.IPAddressSpec{
ParentRef: &networkingv1alpha1.ParentReference{
Spec: networkingv1beta1.IPAddressSpec{
ParentRef: &networkingv1beta1.ParentReference{
Group: "",
Resource: "services",
Name: "foo",
@@ -397,17 +397,17 @@ func TestRepairIPAddress_syncIPAddress(t *testing.T) {
},
{
name: "correct ipv6 address",
ip: &networkingv1alpha1.IPAddress{
ip: &networkingv1beta1.IPAddress{
ObjectMeta: metav1.ObjectMeta{
Name: "2001:db8::11",
Labels: map[string]string{
networkingv1alpha1.LabelIPAddressFamily: string(v1.IPv6Protocol),
networkingv1alpha1.LabelManagedBy: ipallocator.ControllerName,
networkingv1beta1.LabelIPAddressFamily: string(v1.IPv6Protocol),
networkingv1beta1.LabelManagedBy: ipallocator.ControllerName,
},
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
},
Spec: networkingv1alpha1.IPAddressSpec{
ParentRef: &networkingv1alpha1.ParentReference{
Spec: networkingv1beta1.IPAddressSpec{
ParentRef: &networkingv1beta1.ParentReference{
Group: "",
Resource: "services",
Name: "foo",
@@ -418,17 +418,17 @@ func TestRepairIPAddress_syncIPAddress(t *testing.T) {
},
{
name: "not managed by this controller",
ip: &networkingv1alpha1.IPAddress{
ip: &networkingv1beta1.IPAddress{
ObjectMeta: metav1.ObjectMeta{
Name: "2001:db8::11",
Labels: map[string]string{
networkingv1alpha1.LabelIPAddressFamily: string(v1.IPv6Protocol),
networkingv1alpha1.LabelManagedBy: "controller-foo",
networkingv1beta1.LabelIPAddressFamily: string(v1.IPv6Protocol),
networkingv1beta1.LabelManagedBy: "controller-foo",
},
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
},
Spec: networkingv1alpha1.IPAddressSpec{
ParentRef: &networkingv1alpha1.ParentReference{
Spec: networkingv1beta1.IPAddressSpec{
ParentRef: &networkingv1beta1.ParentReference{
Group: "networking.gateway.k8s.io",
Resource: "gateway",
Name: "foo",
@@ -439,17 +439,17 @@ func TestRepairIPAddress_syncIPAddress(t *testing.T) {
},
{
name: "out of range",
ip: &networkingv1alpha1.IPAddress{
ip: &networkingv1beta1.IPAddress{
ObjectMeta: metav1.ObjectMeta{
Name: "fd00:db8::11",
Labels: map[string]string{
networkingv1alpha1.LabelIPAddressFamily: string(v1.IPv6Protocol),
networkingv1alpha1.LabelManagedBy: ipallocator.ControllerName,
networkingv1beta1.LabelIPAddressFamily: string(v1.IPv6Protocol),
networkingv1beta1.LabelManagedBy: ipallocator.ControllerName,
},
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
},
Spec: networkingv1alpha1.IPAddressSpec{
ParentRef: &networkingv1alpha1.ParentReference{
Spec: networkingv1beta1.IPAddressSpec{
ParentRef: &networkingv1beta1.ParentReference{
Group: "",
Resource: "services",
Name: "foo",
@@ -460,17 +460,17 @@ func TestRepairIPAddress_syncIPAddress(t *testing.T) {
},
{
name: "leaked ip",
ip: &networkingv1alpha1.IPAddress{
ip: &networkingv1beta1.IPAddress{
ObjectMeta: metav1.ObjectMeta{
Name: "10.0.1.1",
Labels: map[string]string{
networkingv1alpha1.LabelIPAddressFamily: string(v1.IPv6Protocol),
networkingv1alpha1.LabelManagedBy: ipallocator.ControllerName,
networkingv1beta1.LabelIPAddressFamily: string(v1.IPv6Protocol),
networkingv1beta1.LabelManagedBy: ipallocator.ControllerName,
},
CreationTimestamp: metav1.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
},
Spec: networkingv1alpha1.IPAddressSpec{
ParentRef: &networkingv1alpha1.ParentReference{
Spec: networkingv1beta1.IPAddressSpec{
ParentRef: &networkingv1beta1.ParentReference{
Group: "",
Resource: "services",
Name: "noexist",
@@ -522,12 +522,12 @@ func newService(name string, ips []string) *v1.Service {
return svc
}
func newServiceCIDR(name, primary, secondary string) *networkingv1alpha1.ServiceCIDR {
serviceCIDR := &networkingv1alpha1.ServiceCIDR{
func newServiceCIDR(name, primary, secondary string) *networkingv1beta1.ServiceCIDR {
serviceCIDR := &networkingv1beta1.ServiceCIDR{
ObjectMeta: metav1.ObjectMeta{
Name: name,
},
Spec: networkingv1alpha1.ServiceCIDRSpec{},
Spec: networkingv1beta1.ServiceCIDRSpec{},
}
serviceCIDR.Spec.CIDRs = append(serviceCIDR.Spec.CIDRs, primary)
if secondary != "" {

View File

@@ -27,13 +27,13 @@ import (
"sync/atomic"
"time"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
networkingv1alpha1informers "k8s.io/client-go/informers/networking/v1alpha1"
networkingv1alpha1client "k8s.io/client-go/kubernetes/typed/networking/v1alpha1"
networkingv1alpha1listers "k8s.io/client-go/listers/networking/v1alpha1"
networkingv1beta1informers "k8s.io/client-go/informers/networking/v1beta1"
networkingv1beta1client "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
networkingv1beta1listers "k8s.io/client-go/listers/networking/v1beta1"
"k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"
api "k8s.io/kubernetes/pkg/apis/core"
@@ -56,8 +56,8 @@ type Allocator struct {
rangeOffset int // subdivides the assigned IP range to prefer dynamic allocation from the upper range
size uint64 // cap the total number of IPs available to maxInt64
client networkingv1alpha1client.NetworkingV1alpha1Interface
ipAddressLister networkingv1alpha1listers.IPAddressLister
client networkingv1beta1client.NetworkingV1beta1Interface
ipAddressLister networkingv1beta1listers.IPAddressLister
ipAddressSynced cache.InformerSynced
// ready indicates if the allocator is able to allocate new IP addresses.
// This is required because it depends on the ServiceCIDR to be ready.
@@ -77,8 +77,8 @@ var _ Interface = &Allocator{}
// using an informer cache as storage.
func NewIPAllocator(
cidr *net.IPNet,
client networkingv1alpha1client.NetworkingV1alpha1Interface,
ipAddressInformer networkingv1alpha1informers.IPAddressInformer,
client networkingv1beta1client.NetworkingV1beta1Interface,
ipAddressInformer networkingv1beta1informers.IPAddressInformer,
) (*Allocator, error) {
prefix, err := netip.ParsePrefix(cidr.String())
if err != nil {
@@ -139,15 +139,15 @@ func NewIPAllocator(
}
func (a *Allocator) createIPAddress(name string, svc *api.Service, scope string) error {
ipAddress := networkingv1alpha1.IPAddress{
ipAddress := networkingv1beta1.IPAddress{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Labels: map[string]string{
networkingv1alpha1.LabelIPAddressFamily: string(a.IPFamily()),
networkingv1alpha1.LabelManagedBy: ControllerName,
networkingv1beta1.LabelIPAddressFamily: string(a.IPFamily()),
networkingv1beta1.LabelManagedBy: ControllerName,
},
},
Spec: networkingv1alpha1.IPAddressSpec{
Spec: networkingv1beta1.IPAddressSpec{
ParentRef: serviceToRef(svc),
},
}
@@ -379,8 +379,8 @@ func (a *Allocator) release(ip net.IP, dryRun bool) error {
// This is required to satisfy the Allocator Interface only
func (a *Allocator) ForEach(f func(net.IP)) {
ipLabelSelector := labels.Set(map[string]string{
networkingv1alpha1.LabelIPAddressFamily: string(a.IPFamily()),
networkingv1alpha1.LabelManagedBy: ControllerName,
networkingv1beta1.LabelIPAddressFamily: string(a.IPFamily()),
networkingv1beta1.LabelManagedBy: ControllerName,
}).AsSelectorPreValidated()
ips, err := a.ipAddressLister.List(ipLabelSelector)
if err != nil {
@@ -413,8 +413,8 @@ func (a *Allocator) IPFamily() api.IPFamily {
// for testing, it assumes this is the allocator is unique for the ipFamily
func (a *Allocator) Used() int {
ipLabelSelector := labels.Set(map[string]string{
networkingv1alpha1.LabelIPAddressFamily: string(a.IPFamily()),
networkingv1alpha1.LabelManagedBy: ControllerName,
networkingv1beta1.LabelIPAddressFamily: string(a.IPFamily()),
networkingv1beta1.LabelManagedBy: ControllerName,
}).AsSelectorPreValidated()
ips, err := a.ipAddressLister.List(ipLabelSelector)
if err != nil {
@@ -568,12 +568,12 @@ func broadcastAddress(subnet netip.Prefix) (netip.Addr, error) {
}
// serviceToRef obtain the Service Parent Reference
func serviceToRef(svc *api.Service) *networkingv1alpha1.ParentReference {
func serviceToRef(svc *api.Service) *networkingv1beta1.ParentReference {
if svc == nil {
return nil
}
return &networkingv1alpha1.ParentReference{
return &networkingv1beta1.ParentReference{
Group: "",
Resource: "services",
Namespace: svc.Namespace,

View File

@@ -25,7 +25,7 @@ import (
"testing"
"time"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/informers"
@@ -40,11 +40,11 @@ func newTestAllocator(cidr *net.IPNet) (*Allocator, error) {
client := fake.NewSimpleClientset()
informerFactory := informers.NewSharedInformerFactory(client, 0*time.Second)
ipInformer := informerFactory.Networking().V1alpha1().IPAddresses()
ipInformer := informerFactory.Networking().V1beta1().IPAddresses()
ipStore := ipInformer.Informer().GetIndexer()
client.PrependReactor("create", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
ip := action.(k8stesting.CreateAction).GetObject().(*networkingv1alpha1.IPAddress)
ip := action.(k8stesting.CreateAction).GetObject().(*networkingv1beta1.IPAddress)
_, exists, err := ipStore.GetByKey(ip.Name)
if exists && err != nil {
return false, nil, fmt.Errorf("ip already exist")
@@ -56,15 +56,15 @@ func newTestAllocator(cidr *net.IPNet) (*Allocator, error) {
client.PrependReactor("delete", "ipaddresses", k8stesting.ReactionFunc(func(action k8stesting.Action) (bool, runtime.Object, error) {
name := action.(k8stesting.DeleteAction).GetName()
obj, exists, err := ipStore.GetByKey(name)
ip := &networkingv1alpha1.IPAddress{}
ip := &networkingv1beta1.IPAddress{}
if exists && err == nil {
ip = obj.(*networkingv1alpha1.IPAddress)
ip = obj.(*networkingv1beta1.IPAddress)
err = ipStore.Delete(ip)
}
return false, ip, err
}))
c, err := NewIPAllocator(cidr, client.NetworkingV1alpha1(), ipInformer)
c, err := NewIPAllocator(cidr, client.NetworkingV1beta1(), ipInformer)
if err != nil {
return nil, err
}

View File

@@ -18,7 +18,7 @@ package rest
import (
networkingapiv1 "k8s.io/api/networking/v1"
networkingapiv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingapiv1beta1 "k8s.io/api/networking/v1beta1"
"k8s.io/apiserver/pkg/registry/generic"
"k8s.io/apiserver/pkg/registry/rest"
genericapiserver "k8s.io/apiserver/pkg/server"
@@ -42,7 +42,7 @@ func (p RESTStorageProvider) NewRESTStorage(apiResourceConfigSource serverstorag
if storageMap, err := p.v1alpha1Storage(apiResourceConfigSource, restOptionsGetter); err != nil {
return genericapiserver.APIGroupInfo{}, err
} else if len(storageMap) > 0 {
apiGroupInfo.VersionedResourcesStorageMap[networkingapiv1alpha1.SchemeGroupVersion.Version] = storageMap
apiGroupInfo.VersionedResourcesStorageMap[networkingapiv1beta1.SchemeGroupVersion.Version] = storageMap
}
if storageMap, err := p.v1Storage(apiResourceConfigSource, restOptionsGetter); err != nil {
@@ -92,7 +92,7 @@ func (p RESTStorageProvider) v1alpha1Storage(apiResourceConfigSource serverstora
storage := map[string]rest.Storage{}
// ipaddress
if resource := "ipaddresses"; apiResourceConfigSource.ResourceEnabled(networkingapiv1alpha1.SchemeGroupVersion.WithResource(resource)) {
if resource := "ipaddresses"; apiResourceConfigSource.ResourceEnabled(networkingapiv1beta1.SchemeGroupVersion.WithResource(resource)) {
ipAddressStorage, err := ipaddressstore.NewREST(restOptionsGetter)
if err != nil {
return storage, err
@@ -101,7 +101,7 @@ func (p RESTStorageProvider) v1alpha1Storage(apiResourceConfigSource serverstora
}
// servicecidrs
if resource := "servicecidrs"; apiResourceConfigSource.ResourceEnabled(networkingapiv1alpha1.SchemeGroupVersion.WithResource(resource)) {
if resource := "servicecidrs"; apiResourceConfigSource.ResourceEnabled(networkingapiv1beta1.SchemeGroupVersion.WithResource(resource)) {
serviceCIDRStorage, serviceCIDRStatusStorage, err := servicecidrstore.NewREST(restOptionsGetter)
if err != nil {
return storage, err

View File

@@ -53,6 +53,9 @@ func (serviceCIDRStrategy) NamespaceScoped() bool {
// and should not be modified by the user.
func (serviceCIDRStrategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
fields := map[fieldpath.APIVersion]*fieldpath.Set{
"networking/v1beta1": fieldpath.NewSet(
fieldpath.MakePathOrDie("status"),
),
"networking/v1alpha1": fieldpath.NewSet(
fieldpath.MakePathOrDie("status"),
),
@@ -125,6 +128,9 @@ var StatusStrategy = serviceCIDRStatusStrategy{Strategy}
// and should not be modified by the user.
func (serviceCIDRStatusStrategy) GetResetFields() map[fieldpath.APIVersion]*fieldpath.Set {
fields := map[fieldpath.APIVersion]*fieldpath.Set{
"networking/v1beta1": fieldpath.NewSet(
fieldpath.MakePathOrDie("spec"),
),
"networking/v1alpha1": fieldpath.NewSet(
fieldpath.MakePathOrDie("spec"),
),

View File

@@ -43,10 +43,6 @@ func TestServiceCIDRStrategy(t *testing.T) {
t.Errorf("Expected ServiceCIDR to be cluster-scoped")
}
resetFields := Strategy.GetResetFields()
if len(resetFields) != 1 {
t.Errorf("ResetFields should have 1 element, but have %d", len(resetFields))
}
obj := &networking.ServiceCIDR{Spec: networking.ServiceCIDRSpec{CIDRs: []string{"bad cidr"}}}
errors := Strategy.Validate(context.TODO(), obj)
@@ -64,11 +60,6 @@ func TestServiceCIDRStrategy(t *testing.T) {
}
func TestServiceCIDRStatusStrategy(t *testing.T) {
resetFields := StatusStrategy.GetResetFields()
if len(resetFields) != 1 {
t.Errorf("ResetFields should have 1 element, but have %d", len(resetFields))
}
oldObj := &networking.ServiceCIDR{Spec: networking.ServiceCIDRSpec{}}
newObj := &networking.ServiceCIDR{
Spec: networking.ServiceCIDRSpec{

File diff suppressed because it is too large Load Diff

View File

@@ -73,6 +73,44 @@ message HTTPIngressRuleValue {
repeated HTTPIngressPath paths = 1;
}
// IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs
// that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses.
// An IP address can be represented in different formats, to guarantee the uniqueness of the IP,
// the name of the object is the IP address in canonical format, four decimal digits separated
// by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6.
// Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1
// Invalid: 10.01.2.3 or 2001:db8:0:0:0::1
message IPAddress {
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// spec is the desired state of the IPAddress.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
optional IPAddressSpec spec = 2;
}
// IPAddressList contains a list of IPAddress.
message IPAddressList {
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
// items is the list of IPAddresses.
repeated IPAddress items = 2;
}
// IPAddressSpec describe the attributes in an IP Address.
message IPAddressSpec {
// ParentRef references the resource that an IPAddress is attached to.
// An IPAddress must reference a parent object.
// +required
optional ParentReference parentRef = 1;
}
// Ingress is a collection of rules that allow inbound connections to reach the
// endpoints defined by a backend. An Ingress can be configured to give services
// externally-reachable urls, load balance traffic, terminate SSL, offer name
@@ -351,3 +389,74 @@ message IngressTLS {
optional string secretName = 2;
}
// ParentReference describes a reference to a parent object.
message ParentReference {
// Group is the group of the object being referenced.
// +optional
optional string group = 1;
// Resource is the resource of the object being referenced.
// +required
optional string resource = 2;
// Namespace is the namespace of the object being referenced.
// +optional
optional string namespace = 3;
// Name is the name of the object being referenced.
// +required
optional string name = 4;
}
// ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64).
// This range is used to allocate ClusterIPs to Service objects.
message ServiceCIDR {
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// spec is the desired state of the ServiceCIDR.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
optional ServiceCIDRSpec spec = 2;
// status represents the current state of the ServiceCIDR.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
optional ServiceCIDRStatus status = 3;
}
// ServiceCIDRList contains a list of ServiceCIDR objects.
message ServiceCIDRList {
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
// items is the list of ServiceCIDRs.
repeated ServiceCIDR items = 2;
}
// ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.
message ServiceCIDRSpec {
// CIDRs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64")
// from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family.
// This field is immutable.
// +optional
// +listType=atomic
repeated string cidrs = 1;
}
// ServiceCIDRStatus describes the current state of the ServiceCIDR.
message ServiceCIDRStatus {
// conditions holds an array of metav1.Condition that describe the state of the ServiceCIDR.
// Current service state
// +optional
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1;
}

View File

@@ -51,6 +51,10 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&IngressList{},
&IngressClass{},
&IngressClassList{},
&IPAddress{},
&IPAddressList{},
&ServiceCIDR{},
&ServiceCIDRList{},
)
// Add the watch version that applies
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)

View File

@@ -421,3 +421,133 @@ type IngressClassList struct {
// items is the list of IngressClasses.
Items []IngressClass `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.31
// IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs
// that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses.
// An IP address can be represented in different formats, to guarantee the uniqueness of the IP,
// the name of the object is the IP address in canonical format, four decimal digits separated
// by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6.
// Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1
// Invalid: 10.01.2.3 or 2001:db8:0:0:0::1
type IPAddress struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// spec is the desired state of the IPAddress.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Spec IPAddressSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
}
// IPAddressSpec describe the attributes in an IP Address.
type IPAddressSpec struct {
// ParentRef references the resource that an IPAddress is attached to.
// An IPAddress must reference a parent object.
// +required
ParentRef *ParentReference `json:"parentRef,omitempty" protobuf:"bytes,1,opt,name=parentRef"`
}
// ParentReference describes a reference to a parent object.
type ParentReference struct {
// Group is the group of the object being referenced.
// +optional
Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"`
// Resource is the resource of the object being referenced.
// +required
Resource string `json:"resource,omitempty" protobuf:"bytes,2,opt,name=resource"`
// Namespace is the namespace of the object being referenced.
// +optional
Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"`
// Name is the name of the object being referenced.
// +required
Name string `json:"name,omitempty" protobuf:"bytes,4,opt,name=name"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.31
// IPAddressList contains a list of IPAddress.
type IPAddressList struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// items is the list of IPAddresses.
Items []IPAddress `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.31
// ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64).
// This range is used to allocate ClusterIPs to Service objects.
type ServiceCIDR struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// spec is the desired state of the ServiceCIDR.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Spec ServiceCIDRSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// status represents the current state of the ServiceCIDR.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Status ServiceCIDRStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.
type ServiceCIDRSpec struct {
// CIDRs defines the IP blocks in CIDR notation (e.g. "192.168.0.0/24" or "2001:db8::/64")
// from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family.
// This field is immutable.
// +optional
// +listType=atomic
CIDRs []string `json:"cidrs,omitempty" protobuf:"bytes,1,opt,name=cidrs"`
}
const (
// ServiceCIDRConditionReady represents status of a ServiceCIDR that is ready to be used by the
// apiserver to allocate ClusterIPs for Services.
ServiceCIDRConditionReady = "Ready"
// ServiceCIDRReasonTerminating represents a reason where a ServiceCIDR is not ready because it is
// being deleted.
ServiceCIDRReasonTerminating = "Terminating"
)
// ServiceCIDRStatus describes the current state of the ServiceCIDR.
type ServiceCIDRStatus struct {
// conditions holds an array of metav1.Condition that describe the state of the ServiceCIDR.
// Current service state
// +optional
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.31
// ServiceCIDRList contains a list of ServiceCIDR objects.
type ServiceCIDRList struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// items is the list of ServiceCIDRs.
Items []ServiceCIDR `json:"items" protobuf:"bytes,2,rep,name=items"`
}

View File

@@ -47,6 +47,35 @@ func (HTTPIngressRuleValue) SwaggerDoc() map[string]string {
return map_HTTPIngressRuleValue
}
var map_IPAddress = map[string]string{
"": "IPAddress represents a single IP of a single IP Family. The object is designed to be used by APIs that operate on IP addresses. The object is used by the Service core API for allocation of IP addresses. An IP address can be represented in different formats, to guarantee the uniqueness of the IP, the name of the object is the IP address in canonical format, four decimal digits separated by dots suppressing leading zeros for IPv4 and the representation defined by RFC 5952 for IPv6. Valid: 192.168.1.5 or 2001:db8::1 or 2001:db8:aaaa:bbbb:cccc:dddd:eeee:1 Invalid: 10.01.2.3 or 2001:db8:0:0:0::1",
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"spec": "spec is the desired state of the IPAddress. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
}
func (IPAddress) SwaggerDoc() map[string]string {
return map_IPAddress
}
var map_IPAddressList = map[string]string{
"": "IPAddressList contains a list of IPAddress.",
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"items": "items is the list of IPAddresses.",
}
func (IPAddressList) SwaggerDoc() map[string]string {
return map_IPAddressList
}
var map_IPAddressSpec = map[string]string{
"": "IPAddressSpec describe the attributes in an IP Address.",
"parentRef": "ParentRef references the resource that an IPAddress is attached to. An IPAddress must reference a parent object.",
}
func (IPAddressSpec) SwaggerDoc() map[string]string {
return map_IPAddressSpec
}
var map_Ingress = map[string]string{
"": "Ingress is a collection of rules that allow inbound connections to reach the endpoints defined by a backend. An Ingress can be configured to give services externally-reachable urls, load balance traffic, terminate SSL, offer name based virtual hosting etc.",
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
@@ -201,4 +230,55 @@ func (IngressTLS) SwaggerDoc() map[string]string {
return map_IngressTLS
}
var map_ParentReference = map[string]string{
"": "ParentReference describes a reference to a parent object.",
"group": "Group is the group of the object being referenced.",
"resource": "Resource is the resource of the object being referenced.",
"namespace": "Namespace is the namespace of the object being referenced.",
"name": "Name is the name of the object being referenced.",
}
func (ParentReference) SwaggerDoc() map[string]string {
return map_ParentReference
}
var map_ServiceCIDR = map[string]string{
"": "ServiceCIDR defines a range of IP addresses using CIDR format (e.g. 192.168.0.0/24 or 2001:db2::/64). This range is used to allocate ClusterIPs to Service objects.",
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"spec": "spec is the desired state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
"status": "status represents the current state of the ServiceCIDR. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
}
func (ServiceCIDR) SwaggerDoc() map[string]string {
return map_ServiceCIDR
}
var map_ServiceCIDRList = map[string]string{
"": "ServiceCIDRList contains a list of ServiceCIDR objects.",
"metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"items": "items is the list of ServiceCIDRs.",
}
func (ServiceCIDRList) SwaggerDoc() map[string]string {
return map_ServiceCIDRList
}
var map_ServiceCIDRSpec = map[string]string{
"": "ServiceCIDRSpec define the CIDRs the user wants to use for allocating ClusterIPs for Services.",
"cidrs": "CIDRs defines the IP blocks in CIDR notation (e.g. \"192.168.0.0/24\" or \"2001:db8::/64\") from which to assign service cluster IPs. Max of two CIDRs is allowed, one of each IP family. This field is immutable.",
}
func (ServiceCIDRSpec) SwaggerDoc() map[string]string {
return map_ServiceCIDRSpec
}
var map_ServiceCIDRStatus = map[string]string{
"": "ServiceCIDRStatus describes the current state of the ServiceCIDR.",
"conditions": "conditions holds an array of metav1.Condition that describe the state of the ServiceCIDR. Current service state",
}
func (ServiceCIDRStatus) SwaggerDoc() map[string]string {
return map_ServiceCIDRStatus
}
// AUTO-GENERATED FUNCTIONS END HERE

View File

@@ -0,0 +1,33 @@
/*
Copyright 2023 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
const (
// TODO: Use IPFamily as field with a field selector,And the value is set based on
// the name at create time and immutable.
// LabelIPAddressFamily is used to indicate the IP family of a Kubernetes IPAddress.
// This label simplify dual-stack client operations allowing to obtain the list of
// IP addresses filtered by family.
LabelIPAddressFamily = "ipaddress.kubernetes.io/ip-family"
// LabelManagedBy is used to indicate the controller or entity that manages
// an IPAddress. This label aims to enable different IPAddress
// objects to be managed by different controllers or entities within the
// same cluster. It is highly recommended to configure this label for all
// IPAddress objects.
LabelManagedBy = "ipaddress.kubernetes.io/managed-by"
)

View File

@@ -23,6 +23,7 @@ package v1beta1
import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@@ -71,6 +72,87 @@ func (in *HTTPIngressRuleValue) DeepCopy() *HTTPIngressRuleValue {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *IPAddress) DeepCopyInto(out *IPAddress) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddress.
func (in *IPAddress) DeepCopy() *IPAddress {
if in == nil {
return nil
}
out := new(IPAddress)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *IPAddress) 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 *IPAddressList) DeepCopyInto(out *IPAddressList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]IPAddress, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressList.
func (in *IPAddressList) DeepCopy() *IPAddressList {
if in == nil {
return nil
}
out := new(IPAddressList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *IPAddressList) 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 *IPAddressSpec) DeepCopyInto(out *IPAddressSpec) {
*out = *in
if in.ParentRef != nil {
in, out := &in.ParentRef, &out.ParentRef
*out = new(ParentReference)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IPAddressSpec.
func (in *IPAddressSpec) DeepCopy() *IPAddressSpec {
if in == nil {
return nil
}
out := new(IPAddressSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Ingress) DeepCopyInto(out *Ingress) {
*out = *in
@@ -448,3 +530,124 @@ func (in *IngressTLS) DeepCopy() *IngressTLS {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ParentReference) DeepCopyInto(out *ParentReference) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParentReference.
func (in *ParentReference) DeepCopy() *ParentReference {
if in == nil {
return nil
}
out := new(ParentReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServiceCIDR) DeepCopyInto(out *ServiceCIDR) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceCIDR.
func (in *ServiceCIDR) DeepCopy() *ServiceCIDR {
if in == nil {
return nil
}
out := new(ServiceCIDR)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ServiceCIDR) 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 *ServiceCIDRList) DeepCopyInto(out *ServiceCIDRList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ServiceCIDR, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceCIDRList.
func (in *ServiceCIDRList) DeepCopy() *ServiceCIDRList {
if in == nil {
return nil
}
out := new(ServiceCIDRList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ServiceCIDRList) 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 *ServiceCIDRSpec) DeepCopyInto(out *ServiceCIDRSpec) {
*out = *in
if in.CIDRs != nil {
in, out := &in.CIDRs, &out.CIDRs
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceCIDRSpec.
func (in *ServiceCIDRSpec) DeepCopy() *ServiceCIDRSpec {
if in == nil {
return nil
}
out := new(ServiceCIDRSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServiceCIDRStatus) DeepCopyInto(out *ServiceCIDRStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]metav1.Condition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceCIDRStatus.
func (in *ServiceCIDRStatus) DeepCopy() *ServiceCIDRStatus {
if in == nil {
return nil
}
out := new(ServiceCIDRStatus)
in.DeepCopyInto(out)
return out
}

View File

@@ -25,6 +25,42 @@ import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
)
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *IPAddress) APILifecycleIntroduced() (major, minor int) {
return 1, 31
}
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *IPAddress) APILifecycleDeprecated() (major, minor int) {
return 1, 34
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *IPAddress) APILifecycleRemoved() (major, minor int) {
return 1, 37
}
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *IPAddressList) APILifecycleIntroduced() (major, minor int) {
return 1, 31
}
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *IPAddressList) APILifecycleDeprecated() (major, minor int) {
return 1, 34
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *IPAddressList) APILifecycleRemoved() (major, minor int) {
return 1, 37
}
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *Ingress) APILifecycleIntroduced() (major, minor int) {
@@ -120,3 +156,39 @@ func (in *IngressList) APILifecycleReplacement() schema.GroupVersionKind {
func (in *IngressList) APILifecycleRemoved() (major, minor int) {
return 1, 22
}
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *ServiceCIDR) APILifecycleIntroduced() (major, minor int) {
return 1, 31
}
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *ServiceCIDR) APILifecycleDeprecated() (major, minor int) {
return 1, 34
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *ServiceCIDR) APILifecycleRemoved() (major, minor int) {
return 1, 37
}
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *ServiceCIDRList) APILifecycleIntroduced() (major, minor int) {
return 1, 31
}
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *ServiceCIDRList) APILifecycleDeprecated() (major, minor int) {
return 1, 34
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *ServiceCIDRList) APILifecycleRemoved() (major, minor int) {
return 1, 37
}

View File

@@ -0,0 +1,54 @@
{
"kind": "IPAddress",
"apiVersion": "networking.k8s.io/v1beta1",
"metadata": {
"name": "nameValue",
"generateName": "generateNameValue",
"namespace": "namespaceValue",
"selfLink": "selfLinkValue",
"uid": "uidValue",
"resourceVersion": "resourceVersionValue",
"generation": 7,
"creationTimestamp": "2008-01-01T01:01:01Z",
"deletionTimestamp": "2009-01-01T01:01:01Z",
"deletionGracePeriodSeconds": 10,
"labels": {
"labelsKey": "labelsValue"
},
"annotations": {
"annotationsKey": "annotationsValue"
},
"ownerReferences": [
{
"apiVersion": "apiVersionValue",
"kind": "kindValue",
"name": "nameValue",
"uid": "uidValue",
"controller": true,
"blockOwnerDeletion": true
}
],
"finalizers": [
"finalizersValue"
],
"managedFields": [
{
"manager": "managerValue",
"operation": "operationValue",
"apiVersion": "apiVersionValue",
"time": "2004-01-01T01:01:01Z",
"fieldsType": "fieldsTypeValue",
"fieldsV1": {},
"subresource": "subresourceValue"
}
]
},
"spec": {
"parentRef": {
"group": "groupValue",
"resource": "resourceValue",
"namespace": "namespaceValue",
"name": "nameValue"
}
}
}

View File

@@ -0,0 +1,40 @@
apiVersion: networking.k8s.io/v1beta1
kind: IPAddress
metadata:
annotations:
annotationsKey: annotationsValue
creationTimestamp: "2008-01-01T01:01:01Z"
deletionGracePeriodSeconds: 10
deletionTimestamp: "2009-01-01T01:01:01Z"
finalizers:
- finalizersValue
generateName: generateNameValue
generation: 7
labels:
labelsKey: labelsValue
managedFields:
- apiVersion: apiVersionValue
fieldsType: fieldsTypeValue
fieldsV1: {}
manager: managerValue
operation: operationValue
subresource: subresourceValue
time: "2004-01-01T01:01:01Z"
name: nameValue
namespace: namespaceValue
ownerReferences:
- apiVersion: apiVersionValue
blockOwnerDeletion: true
controller: true
kind: kindValue
name: nameValue
uid: uidValue
resourceVersion: resourceVersionValue
selfLink: selfLinkValue
uid: uidValue
spec:
parentRef:
group: groupValue
name: nameValue
namespace: namespaceValue
resource: resourceValue

View File

@@ -0,0 +1,63 @@
{
"kind": "ServiceCIDR",
"apiVersion": "networking.k8s.io/v1beta1",
"metadata": {
"name": "nameValue",
"generateName": "generateNameValue",
"namespace": "namespaceValue",
"selfLink": "selfLinkValue",
"uid": "uidValue",
"resourceVersion": "resourceVersionValue",
"generation": 7,
"creationTimestamp": "2008-01-01T01:01:01Z",
"deletionTimestamp": "2009-01-01T01:01:01Z",
"deletionGracePeriodSeconds": 10,
"labels": {
"labelsKey": "labelsValue"
},
"annotations": {
"annotationsKey": "annotationsValue"
},
"ownerReferences": [
{
"apiVersion": "apiVersionValue",
"kind": "kindValue",
"name": "nameValue",
"uid": "uidValue",
"controller": true,
"blockOwnerDeletion": true
}
],
"finalizers": [
"finalizersValue"
],
"managedFields": [
{
"manager": "managerValue",
"operation": "operationValue",
"apiVersion": "apiVersionValue",
"time": "2004-01-01T01:01:01Z",
"fieldsType": "fieldsTypeValue",
"fieldsV1": {},
"subresource": "subresourceValue"
}
]
},
"spec": {
"cidrs": [
"cidrsValue"
]
},
"status": {
"conditions": [
{
"type": "typeValue",
"status": "statusValue",
"observedGeneration": 3,
"lastTransitionTime": "2004-01-01T01:01:01Z",
"reason": "reasonValue",
"message": "messageValue"
}
]
}
}

View File

@@ -0,0 +1,45 @@
apiVersion: networking.k8s.io/v1beta1
kind: ServiceCIDR
metadata:
annotations:
annotationsKey: annotationsValue
creationTimestamp: "2008-01-01T01:01:01Z"
deletionGracePeriodSeconds: 10
deletionTimestamp: "2009-01-01T01:01:01Z"
finalizers:
- finalizersValue
generateName: generateNameValue
generation: 7
labels:
labelsKey: labelsValue
managedFields:
- apiVersion: apiVersionValue
fieldsType: fieldsTypeValue
fieldsV1: {}
manager: managerValue
operation: operationValue
subresource: subresourceValue
time: "2004-01-01T01:01:01Z"
name: nameValue
namespace: namespaceValue
ownerReferences:
- apiVersion: apiVersionValue
blockOwnerDeletion: true
controller: true
kind: kindValue
name: nameValue
uid: uidValue
resourceVersion: resourceVersionValue
selfLink: selfLinkValue
uid: uidValue
spec:
cidrs:
- cidrsValue
status:
conditions:
- lastTransitionTime: "2004-01-01T01:01:01Z"
message: messageValue
observedGeneration: 3
reason: reasonValue
status: statusValue
type: typeValue

View File

@@ -11078,6 +11078,29 @@ var schemaYAML = typed.YAMLObject(`types:
elementType:
namedType: io.k8s.api.networking.v1beta1.HTTPIngressPath
elementRelationship: atomic
- name: io.k8s.api.networking.v1beta1.IPAddress
map:
fields:
- name: apiVersion
type:
scalar: string
- name: kind
type:
scalar: string
- name: metadata
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: spec
type:
namedType: io.k8s.api.networking.v1beta1.IPAddressSpec
default: {}
- name: io.k8s.api.networking.v1beta1.IPAddressSpec
map:
fields:
- name: parentRef
type:
namedType: io.k8s.api.networking.v1beta1.ParentReference
- name: io.k8s.api.networking.v1beta1.Ingress
map:
fields:
@@ -11244,6 +11267,62 @@ var schemaYAML = typed.YAMLObject(`types:
- name: secretName
type:
scalar: string
- name: io.k8s.api.networking.v1beta1.ParentReference
map:
fields:
- name: group
type:
scalar: string
- name: name
type:
scalar: string
- name: namespace
type:
scalar: string
- name: resource
type:
scalar: string
- name: io.k8s.api.networking.v1beta1.ServiceCIDR
map:
fields:
- name: apiVersion
type:
scalar: string
- name: kind
type:
scalar: string
- name: metadata
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: spec
type:
namedType: io.k8s.api.networking.v1beta1.ServiceCIDRSpec
default: {}
- name: status
type:
namedType: io.k8s.api.networking.v1beta1.ServiceCIDRStatus
default: {}
- name: io.k8s.api.networking.v1beta1.ServiceCIDRSpec
map:
fields:
- name: cidrs
type:
list:
elementType:
scalar: string
elementRelationship: atomic
- name: io.k8s.api.networking.v1beta1.ServiceCIDRStatus
map:
fields:
- name: conditions
type:
list:
elementType:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition
elementRelationship: associative
keys:
- type
- name: io.k8s.api.node.v1.Overhead
map:
fields:

View File

@@ -0,0 +1,253 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta1
import (
networkingv1beta1 "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
internal "k8s.io/client-go/applyconfigurations/internal"
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
// IPAddressApplyConfiguration represents a declarative configuration of the IPAddress type for use
// with apply.
type IPAddressApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"`
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
Spec *IPAddressSpecApplyConfiguration `json:"spec,omitempty"`
}
// IPAddress constructs a declarative configuration of the IPAddress type for use with
// apply.
func IPAddress(name string) *IPAddressApplyConfiguration {
b := &IPAddressApplyConfiguration{}
b.WithName(name)
b.WithKind("IPAddress")
b.WithAPIVersion("networking.k8s.io/v1beta1")
return b
}
// ExtractIPAddress extracts the applied configuration owned by fieldManager from
// iPAddress. If no managedFields are found in iPAddress for fieldManager, a
// IPAddressApplyConfiguration is returned with only the Name, Namespace (if applicable),
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
// the fieldManager never owned fields any fields.
// iPAddress must be a unmodified IPAddress API object that was retrieved from the Kubernetes API.
// ExtractIPAddress provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
// Experimental!
func ExtractIPAddress(iPAddress *networkingv1beta1.IPAddress, fieldManager string) (*IPAddressApplyConfiguration, error) {
return extractIPAddress(iPAddress, fieldManager, "")
}
// ExtractIPAddressStatus is the same as ExtractIPAddress except
// that it extracts the status subresource applied configuration.
// Experimental!
func ExtractIPAddressStatus(iPAddress *networkingv1beta1.IPAddress, fieldManager string) (*IPAddressApplyConfiguration, error) {
return extractIPAddress(iPAddress, fieldManager, "status")
}
func extractIPAddress(iPAddress *networkingv1beta1.IPAddress, fieldManager string, subresource string) (*IPAddressApplyConfiguration, error) {
b := &IPAddressApplyConfiguration{}
err := managedfields.ExtractInto(iPAddress, internal.Parser().Type("io.k8s.api.networking.v1beta1.IPAddress"), fieldManager, b, subresource)
if err != nil {
return nil, err
}
b.WithName(iPAddress.Name)
b.WithKind("IPAddress")
b.WithAPIVersion("networking.k8s.io/v1beta1")
return b, nil
}
// WithKind sets the Kind field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Kind field is set to the value of the last call.
func (b *IPAddressApplyConfiguration) WithKind(value string) *IPAddressApplyConfiguration {
b.Kind = &value
return b
}
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the APIVersion field is set to the value of the last call.
func (b *IPAddressApplyConfiguration) WithAPIVersion(value string) *IPAddressApplyConfiguration {
b.APIVersion = &value
return b
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *IPAddressApplyConfiguration) WithName(value string) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.Name = &value
return b
}
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the GenerateName field is set to the value of the last call.
func (b *IPAddressApplyConfiguration) WithGenerateName(value string) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.GenerateName = &value
return b
}
// WithNamespace sets the Namespace field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Namespace field is set to the value of the last call.
func (b *IPAddressApplyConfiguration) WithNamespace(value string) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.Namespace = &value
return b
}
// WithUID sets the UID field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the UID field is set to the value of the last call.
func (b *IPAddressApplyConfiguration) WithUID(value types.UID) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.UID = &value
return b
}
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceVersion field is set to the value of the last call.
func (b *IPAddressApplyConfiguration) WithResourceVersion(value string) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ResourceVersion = &value
return b
}
// WithGeneration sets the Generation field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Generation field is set to the value of the last call.
func (b *IPAddressApplyConfiguration) WithGeneration(value int64) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.Generation = &value
return b
}
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
func (b *IPAddressApplyConfiguration) WithCreationTimestamp(value metav1.Time) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.CreationTimestamp = &value
return b
}
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
func (b *IPAddressApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.DeletionTimestamp = &value
return b
}
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
func (b *IPAddressApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.DeletionGracePeriodSeconds = &value
return b
}
// WithLabels puts the entries into the Labels field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Labels field,
// overwriting an existing map entries in Labels field with the same key.
func (b *IPAddressApplyConfiguration) WithLabels(entries map[string]string) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.Labels == nil && len(entries) > 0 {
b.Labels = make(map[string]string, len(entries))
}
for k, v := range entries {
b.Labels[k] = v
}
return b
}
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Annotations field,
// overwriting an existing map entries in Annotations field with the same key.
func (b *IPAddressApplyConfiguration) WithAnnotations(entries map[string]string) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.Annotations == nil && len(entries) > 0 {
b.Annotations = make(map[string]string, len(entries))
}
for k, v := range entries {
b.Annotations[k] = v
}
return b
}
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
func (b *IPAddressApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
if values[i] == nil {
panic("nil value passed to WithOwnerReferences")
}
b.OwnerReferences = append(b.OwnerReferences, *values[i])
}
return b
}
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Finalizers field.
func (b *IPAddressApplyConfiguration) WithFinalizers(values ...string) *IPAddressApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
b.Finalizers = append(b.Finalizers, values[i])
}
return b
}
func (b *IPAddressApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
if b.ObjectMetaApplyConfiguration == nil {
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
}
}
// WithSpec sets the Spec field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Spec field is set to the value of the last call.
func (b *IPAddressApplyConfiguration) WithSpec(value *IPAddressSpecApplyConfiguration) *IPAddressApplyConfiguration {
b.Spec = value
return b
}
// GetName retrieves the value of the Name field in the declarative configuration.
func (b *IPAddressApplyConfiguration) GetName() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.Name
}

View File

@@ -0,0 +1,39 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta1
// IPAddressSpecApplyConfiguration represents a declarative configuration of the IPAddressSpec type for use
// with apply.
type IPAddressSpecApplyConfiguration struct {
ParentRef *ParentReferenceApplyConfiguration `json:"parentRef,omitempty"`
}
// IPAddressSpecApplyConfiguration constructs a declarative configuration of the IPAddressSpec type for use with
// apply.
func IPAddressSpec() *IPAddressSpecApplyConfiguration {
return &IPAddressSpecApplyConfiguration{}
}
// WithParentRef sets the ParentRef field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ParentRef field is set to the value of the last call.
func (b *IPAddressSpecApplyConfiguration) WithParentRef(value *ParentReferenceApplyConfiguration) *IPAddressSpecApplyConfiguration {
b.ParentRef = value
return b
}

View File

@@ -0,0 +1,66 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta1
// ParentReferenceApplyConfiguration represents a declarative configuration of the ParentReference type for use
// with apply.
type ParentReferenceApplyConfiguration struct {
Group *string `json:"group,omitempty"`
Resource *string `json:"resource,omitempty"`
Namespace *string `json:"namespace,omitempty"`
Name *string `json:"name,omitempty"`
}
// ParentReferenceApplyConfiguration constructs a declarative configuration of the ParentReference type for use with
// apply.
func ParentReference() *ParentReferenceApplyConfiguration {
return &ParentReferenceApplyConfiguration{}
}
// WithGroup sets the Group field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Group field is set to the value of the last call.
func (b *ParentReferenceApplyConfiguration) WithGroup(value string) *ParentReferenceApplyConfiguration {
b.Group = &value
return b
}
// WithResource sets the Resource field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Resource field is set to the value of the last call.
func (b *ParentReferenceApplyConfiguration) WithResource(value string) *ParentReferenceApplyConfiguration {
b.Resource = &value
return b
}
// WithNamespace sets the Namespace field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Namespace field is set to the value of the last call.
func (b *ParentReferenceApplyConfiguration) WithNamespace(value string) *ParentReferenceApplyConfiguration {
b.Namespace = &value
return b
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *ParentReferenceApplyConfiguration) WithName(value string) *ParentReferenceApplyConfiguration {
b.Name = &value
return b
}

View File

@@ -0,0 +1,262 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta1
import (
networkingv1beta1 "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
internal "k8s.io/client-go/applyconfigurations/internal"
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
// ServiceCIDRApplyConfiguration represents a declarative configuration of the ServiceCIDR type for use
// with apply.
type ServiceCIDRApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"`
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
Spec *ServiceCIDRSpecApplyConfiguration `json:"spec,omitempty"`
Status *ServiceCIDRStatusApplyConfiguration `json:"status,omitempty"`
}
// ServiceCIDR constructs a declarative configuration of the ServiceCIDR type for use with
// apply.
func ServiceCIDR(name string) *ServiceCIDRApplyConfiguration {
b := &ServiceCIDRApplyConfiguration{}
b.WithName(name)
b.WithKind("ServiceCIDR")
b.WithAPIVersion("networking.k8s.io/v1beta1")
return b
}
// ExtractServiceCIDR extracts the applied configuration owned by fieldManager from
// serviceCIDR. If no managedFields are found in serviceCIDR for fieldManager, a
// ServiceCIDRApplyConfiguration is returned with only the Name, Namespace (if applicable),
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
// the fieldManager never owned fields any fields.
// serviceCIDR must be a unmodified ServiceCIDR API object that was retrieved from the Kubernetes API.
// ExtractServiceCIDR provides a way to perform a extract/modify-in-place/apply workflow.
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
// applied if another fieldManager has updated or force applied any of the previously applied fields.
// Experimental!
func ExtractServiceCIDR(serviceCIDR *networkingv1beta1.ServiceCIDR, fieldManager string) (*ServiceCIDRApplyConfiguration, error) {
return extractServiceCIDR(serviceCIDR, fieldManager, "")
}
// ExtractServiceCIDRStatus is the same as ExtractServiceCIDR except
// that it extracts the status subresource applied configuration.
// Experimental!
func ExtractServiceCIDRStatus(serviceCIDR *networkingv1beta1.ServiceCIDR, fieldManager string) (*ServiceCIDRApplyConfiguration, error) {
return extractServiceCIDR(serviceCIDR, fieldManager, "status")
}
func extractServiceCIDR(serviceCIDR *networkingv1beta1.ServiceCIDR, fieldManager string, subresource string) (*ServiceCIDRApplyConfiguration, error) {
b := &ServiceCIDRApplyConfiguration{}
err := managedfields.ExtractInto(serviceCIDR, internal.Parser().Type("io.k8s.api.networking.v1beta1.ServiceCIDR"), fieldManager, b, subresource)
if err != nil {
return nil, err
}
b.WithName(serviceCIDR.Name)
b.WithKind("ServiceCIDR")
b.WithAPIVersion("networking.k8s.io/v1beta1")
return b, nil
}
// WithKind sets the Kind field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Kind field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithKind(value string) *ServiceCIDRApplyConfiguration {
b.Kind = &value
return b
}
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the APIVersion field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithAPIVersion(value string) *ServiceCIDRApplyConfiguration {
b.APIVersion = &value
return b
}
// WithName sets the Name field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Name field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithName(value string) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.Name = &value
return b
}
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the GenerateName field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithGenerateName(value string) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.GenerateName = &value
return b
}
// WithNamespace sets the Namespace field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Namespace field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithNamespace(value string) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.Namespace = &value
return b
}
// WithUID sets the UID field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the UID field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithUID(value types.UID) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.UID = &value
return b
}
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ResourceVersion field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithResourceVersion(value string) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ResourceVersion = &value
return b
}
// WithGeneration sets the Generation field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Generation field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithGeneration(value int64) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.Generation = &value
return b
}
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.CreationTimestamp = &value
return b
}
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.DeletionTimestamp = &value
return b
}
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.DeletionGracePeriodSeconds = &value
return b
}
// WithLabels puts the entries into the Labels field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Labels field,
// overwriting an existing map entries in Labels field with the same key.
func (b *ServiceCIDRApplyConfiguration) WithLabels(entries map[string]string) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.Labels == nil && len(entries) > 0 {
b.Labels = make(map[string]string, len(entries))
}
for k, v := range entries {
b.Labels[k] = v
}
return b
}
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Annotations field,
// overwriting an existing map entries in Annotations field with the same key.
func (b *ServiceCIDRApplyConfiguration) WithAnnotations(entries map[string]string) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.Annotations == nil && len(entries) > 0 {
b.Annotations = make(map[string]string, len(entries))
}
for k, v := range entries {
b.Annotations[k] = v
}
return b
}
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
func (b *ServiceCIDRApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
if values[i] == nil {
panic("nil value passed to WithOwnerReferences")
}
b.OwnerReferences = append(b.OwnerReferences, *values[i])
}
return b
}
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Finalizers field.
func (b *ServiceCIDRApplyConfiguration) WithFinalizers(values ...string) *ServiceCIDRApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
b.Finalizers = append(b.Finalizers, values[i])
}
return b
}
func (b *ServiceCIDRApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
if b.ObjectMetaApplyConfiguration == nil {
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
}
}
// WithSpec sets the Spec field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Spec field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithSpec(value *ServiceCIDRSpecApplyConfiguration) *ServiceCIDRApplyConfiguration {
b.Spec = value
return b
}
// WithStatus sets the Status field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Status field is set to the value of the last call.
func (b *ServiceCIDRApplyConfiguration) WithStatus(value *ServiceCIDRStatusApplyConfiguration) *ServiceCIDRApplyConfiguration {
b.Status = value
return b
}
// GetName retrieves the value of the Name field in the declarative configuration.
func (b *ServiceCIDRApplyConfiguration) GetName() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.Name
}

View File

@@ -0,0 +1,41 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta1
// ServiceCIDRSpecApplyConfiguration represents a declarative configuration of the ServiceCIDRSpec type for use
// with apply.
type ServiceCIDRSpecApplyConfiguration struct {
CIDRs []string `json:"cidrs,omitempty"`
}
// ServiceCIDRSpecApplyConfiguration constructs a declarative configuration of the ServiceCIDRSpec type for use with
// apply.
func ServiceCIDRSpec() *ServiceCIDRSpecApplyConfiguration {
return &ServiceCIDRSpecApplyConfiguration{}
}
// WithCIDRs adds the given value to the CIDRs field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the CIDRs field.
func (b *ServiceCIDRSpecApplyConfiguration) WithCIDRs(values ...string) *ServiceCIDRSpecApplyConfiguration {
for i := range values {
b.CIDRs = append(b.CIDRs, values[i])
}
return b
}

View File

@@ -0,0 +1,48 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1beta1
import (
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
// ServiceCIDRStatusApplyConfiguration represents a declarative configuration of the ServiceCIDRStatus type for use
// with apply.
type ServiceCIDRStatusApplyConfiguration struct {
Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"`
}
// ServiceCIDRStatusApplyConfiguration constructs a declarative configuration of the ServiceCIDRStatus type for use with
// apply.
func ServiceCIDRStatus() *ServiceCIDRStatusApplyConfiguration {
return &ServiceCIDRStatusApplyConfiguration{}
}
// WithConditions adds the given value to the Conditions field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Conditions field.
func (b *ServiceCIDRStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *ServiceCIDRStatusApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithConditions")
}
b.Conditions = append(b.Conditions, *values[i])
}
return b
}

View File

@@ -1436,6 +1436,18 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationsnetworkingv1beta1.IngressStatusApplyConfiguration{}
case networkingv1beta1.SchemeGroupVersion.WithKind("IngressTLS"):
return &applyconfigurationsnetworkingv1beta1.IngressTLSApplyConfiguration{}
case networkingv1beta1.SchemeGroupVersion.WithKind("IPAddress"):
return &applyconfigurationsnetworkingv1beta1.IPAddressApplyConfiguration{}
case networkingv1beta1.SchemeGroupVersion.WithKind("IPAddressSpec"):
return &applyconfigurationsnetworkingv1beta1.IPAddressSpecApplyConfiguration{}
case networkingv1beta1.SchemeGroupVersion.WithKind("ParentReference"):
return &applyconfigurationsnetworkingv1beta1.ParentReferenceApplyConfiguration{}
case networkingv1beta1.SchemeGroupVersion.WithKind("ServiceCIDR"):
return &applyconfigurationsnetworkingv1beta1.ServiceCIDRApplyConfiguration{}
case networkingv1beta1.SchemeGroupVersion.WithKind("ServiceCIDRSpec"):
return &applyconfigurationsnetworkingv1beta1.ServiceCIDRSpecApplyConfiguration{}
case networkingv1beta1.SchemeGroupVersion.WithKind("ServiceCIDRStatus"):
return &applyconfigurationsnetworkingv1beta1.ServiceCIDRStatusApplyConfiguration{}
// Group=node.k8s.io, Version=v1
case nodev1.SchemeGroupVersion.WithKind("Overhead"):

View File

@@ -307,10 +307,14 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha1().ServiceCIDRs().Informer()}, nil
// Group=networking.k8s.io, Version=v1beta1
case networkingv1beta1.SchemeGroupVersion.WithResource("ipaddresses"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().IPAddresses().Informer()}, nil
case networkingv1beta1.SchemeGroupVersion.WithResource("ingresses"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().Ingresses().Informer()}, nil
case networkingv1beta1.SchemeGroupVersion.WithResource("ingressclasses"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().IngressClasses().Informer()}, nil
case networkingv1beta1.SchemeGroupVersion.WithResource("servicecidrs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1beta1().ServiceCIDRs().Informer()}, nil
// Group=node.k8s.io, Version=v1
case nodev1.SchemeGroupVersion.WithResource("runtimeclasses"):

View File

@@ -24,10 +24,14 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
// IPAddresses returns a IPAddressInformer.
IPAddresses() IPAddressInformer
// Ingresses returns a IngressInformer.
Ingresses() IngressInformer
// IngressClasses returns a IngressClassInformer.
IngressClasses() IngressClassInformer
// ServiceCIDRs returns a ServiceCIDRInformer.
ServiceCIDRs() ServiceCIDRInformer
}
type version struct {
@@ -41,6 +45,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// IPAddresses returns a IPAddressInformer.
func (v *version) IPAddresses() IPAddressInformer {
return &iPAddressInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// Ingresses returns a IngressInformer.
func (v *version) Ingresses() IngressInformer {
return &ingressInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
@@ -50,3 +59,8 @@ func (v *version) Ingresses() IngressInformer {
func (v *version) IngressClasses() IngressClassInformer {
return &ingressClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// ServiceCIDRs returns a ServiceCIDRInformer.
func (v *version) ServiceCIDRs() ServiceCIDRInformer {
return &serviceCIDRInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}

View File

@@ -0,0 +1,89 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1beta1
import (
"context"
time "time"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
v1beta1 "k8s.io/client-go/listers/networking/v1beta1"
cache "k8s.io/client-go/tools/cache"
)
// IPAddressInformer provides access to a shared informer and lister for
// IPAddresses.
type IPAddressInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.IPAddressLister
}
type iPAddressInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewIPAddressInformer constructs a new informer for IPAddress 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 NewIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredIPAddressInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredIPAddressInformer constructs a new informer for IPAddress 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 NewFilteredIPAddressInformer(client kubernetes.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.NetworkingV1beta1().IPAddresses().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkingV1beta1().IPAddresses().Watch(context.TODO(), options)
},
},
&networkingv1beta1.IPAddress{},
resyncPeriod,
indexers,
)
}
func (f *iPAddressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredIPAddressInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *iPAddressInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&networkingv1beta1.IPAddress{}, f.defaultInformer)
}
func (f *iPAddressInformer) Lister() v1beta1.IPAddressLister {
return v1beta1.NewIPAddressLister(f.Informer().GetIndexer())
}

View File

@@ -0,0 +1,89 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1beta1
import (
"context"
time "time"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
v1beta1 "k8s.io/client-go/listers/networking/v1beta1"
cache "k8s.io/client-go/tools/cache"
)
// ServiceCIDRInformer provides access to a shared informer and lister for
// ServiceCIDRs.
type ServiceCIDRInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.ServiceCIDRLister
}
type serviceCIDRInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewServiceCIDRInformer constructs a new informer for ServiceCIDR 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 NewServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredServiceCIDRInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredServiceCIDRInformer constructs a new informer for ServiceCIDR 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 NewFilteredServiceCIDRInformer(client kubernetes.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.NetworkingV1beta1().ServiceCIDRs().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.NetworkingV1beta1().ServiceCIDRs().Watch(context.TODO(), options)
},
},
&networkingv1beta1.ServiceCIDR{},
resyncPeriod,
indexers,
)
}
func (f *serviceCIDRInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredServiceCIDRInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *serviceCIDRInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&networkingv1beta1.ServiceCIDR{}, f.defaultInformer)
}
func (f *serviceCIDRInformer) Lister() v1beta1.ServiceCIDRLister {
return v1beta1.NewServiceCIDRLister(f.Informer().GetIndexer())
}

View File

@@ -0,0 +1,151 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
json "encoding/json"
"fmt"
v1beta1 "k8s.io/api/networking/v1beta1"
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"
networkingv1beta1 "k8s.io/client-go/applyconfigurations/networking/v1beta1"
testing "k8s.io/client-go/testing"
)
// FakeIPAddresses implements IPAddressInterface
type FakeIPAddresses struct {
Fake *FakeNetworkingV1beta1
}
var ipaddressesResource = v1beta1.SchemeGroupVersion.WithResource("ipaddresses")
var ipaddressesKind = v1beta1.SchemeGroupVersion.WithKind("IPAddress")
// Get takes name of the iPAddress, and returns the corresponding iPAddress object, and an error if there is any.
func (c *FakeIPAddresses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.IPAddress, err error) {
emptyResult := &v1beta1.IPAddress{}
obj, err := c.Fake.
Invokes(testing.NewRootGetActionWithOptions(ipaddressesResource, name, options), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.IPAddress), err
}
// List takes label and field selectors, and returns the list of IPAddresses that match those selectors.
func (c *FakeIPAddresses) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.IPAddressList, err error) {
emptyResult := &v1beta1.IPAddressList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(ipaddressesResource, ipaddressesKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.IPAddressList{ListMeta: obj.(*v1beta1.IPAddressList).ListMeta}
for _, item := range obj.(*v1beta1.IPAddressList).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 iPAddresses.
func (c *FakeIPAddresses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(ipaddressesResource, opts))
}
// Create takes the representation of a iPAddress and creates it. Returns the server's representation of the iPAddress, and an error, if there is any.
func (c *FakeIPAddresses) Create(ctx context.Context, iPAddress *v1beta1.IPAddress, opts v1.CreateOptions) (result *v1beta1.IPAddress, err error) {
emptyResult := &v1beta1.IPAddress{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(ipaddressesResource, iPAddress, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.IPAddress), err
}
// Update takes the representation of a iPAddress and updates it. Returns the server's representation of the iPAddress, and an error, if there is any.
func (c *FakeIPAddresses) Update(ctx context.Context, iPAddress *v1beta1.IPAddress, opts v1.UpdateOptions) (result *v1beta1.IPAddress, err error) {
emptyResult := &v1beta1.IPAddress{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(ipaddressesResource, iPAddress, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.IPAddress), err
}
// Delete takes name of the iPAddress and deletes it. Returns an error if one occurs.
func (c *FakeIPAddresses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(ipaddressesResource, name, opts), &v1beta1.IPAddress{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeIPAddresses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(ipaddressesResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.IPAddressList{})
return err
}
// Patch applies the patch and returns the patched iPAddress.
func (c *FakeIPAddresses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.IPAddress, err error) {
emptyResult := &v1beta1.IPAddress{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(ipaddressesResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.IPAddress), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied iPAddress.
func (c *FakeIPAddresses) Apply(ctx context.Context, iPAddress *networkingv1beta1.IPAddressApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.IPAddress, err error) {
if iPAddress == nil {
return nil, fmt.Errorf("iPAddress provided to Apply must not be nil")
}
data, err := json.Marshal(iPAddress)
if err != nil {
return nil, err
}
name := iPAddress.Name
if name == nil {
return nil, fmt.Errorf("iPAddress.Name must be provided to Apply")
}
emptyResult := &v1beta1.IPAddress{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(ipaddressesResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.IPAddress), err
}

View File

@@ -28,6 +28,10 @@ type FakeNetworkingV1beta1 struct {
*testing.Fake
}
func (c *FakeNetworkingV1beta1) IPAddresses() v1beta1.IPAddressInterface {
return &FakeIPAddresses{c}
}
func (c *FakeNetworkingV1beta1) Ingresses(namespace string) v1beta1.IngressInterface {
return &FakeIngresses{c, namespace}
}
@@ -36,6 +40,10 @@ func (c *FakeNetworkingV1beta1) IngressClasses() v1beta1.IngressClassInterface {
return &FakeIngressClasses{c}
}
func (c *FakeNetworkingV1beta1) ServiceCIDRs() v1beta1.ServiceCIDRInterface {
return &FakeServiceCIDRs{c}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeNetworkingV1beta1) RESTClient() rest.Interface {

View File

@@ -0,0 +1,186 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
json "encoding/json"
"fmt"
v1beta1 "k8s.io/api/networking/v1beta1"
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"
networkingv1beta1 "k8s.io/client-go/applyconfigurations/networking/v1beta1"
testing "k8s.io/client-go/testing"
)
// FakeServiceCIDRs implements ServiceCIDRInterface
type FakeServiceCIDRs struct {
Fake *FakeNetworkingV1beta1
}
var servicecidrsResource = v1beta1.SchemeGroupVersion.WithResource("servicecidrs")
var servicecidrsKind = v1beta1.SchemeGroupVersion.WithKind("ServiceCIDR")
// Get takes name of the serviceCIDR, and returns the corresponding serviceCIDR object, and an error if there is any.
func (c *FakeServiceCIDRs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ServiceCIDR, err error) {
emptyResult := &v1beta1.ServiceCIDR{}
obj, err := c.Fake.
Invokes(testing.NewRootGetActionWithOptions(servicecidrsResource, name, options), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ServiceCIDR), err
}
// List takes label and field selectors, and returns the list of ServiceCIDRs that match those selectors.
func (c *FakeServiceCIDRs) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ServiceCIDRList, err error) {
emptyResult := &v1beta1.ServiceCIDRList{}
obj, err := c.Fake.
Invokes(testing.NewRootListActionWithOptions(servicecidrsResource, servicecidrsKind, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.ServiceCIDRList{ListMeta: obj.(*v1beta1.ServiceCIDRList).ListMeta}
for _, item := range obj.(*v1beta1.ServiceCIDRList).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 serviceCIDRs.
func (c *FakeServiceCIDRs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchActionWithOptions(servicecidrsResource, opts))
}
// Create takes the representation of a serviceCIDR and creates it. Returns the server's representation of the serviceCIDR, and an error, if there is any.
func (c *FakeServiceCIDRs) Create(ctx context.Context, serviceCIDR *v1beta1.ServiceCIDR, opts v1.CreateOptions) (result *v1beta1.ServiceCIDR, err error) {
emptyResult := &v1beta1.ServiceCIDR{}
obj, err := c.Fake.
Invokes(testing.NewRootCreateActionWithOptions(servicecidrsResource, serviceCIDR, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ServiceCIDR), err
}
// Update takes the representation of a serviceCIDR and updates it. Returns the server's representation of the serviceCIDR, and an error, if there is any.
func (c *FakeServiceCIDRs) Update(ctx context.Context, serviceCIDR *v1beta1.ServiceCIDR, opts v1.UpdateOptions) (result *v1beta1.ServiceCIDR, err error) {
emptyResult := &v1beta1.ServiceCIDR{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateActionWithOptions(servicecidrsResource, serviceCIDR, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ServiceCIDR), 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 *FakeServiceCIDRs) UpdateStatus(ctx context.Context, serviceCIDR *v1beta1.ServiceCIDR, opts v1.UpdateOptions) (result *v1beta1.ServiceCIDR, err error) {
emptyResult := &v1beta1.ServiceCIDR{}
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceActionWithOptions(servicecidrsResource, "status", serviceCIDR, opts), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ServiceCIDR), err
}
// Delete takes name of the serviceCIDR and deletes it. Returns an error if one occurs.
func (c *FakeServiceCIDRs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteActionWithOptions(servicecidrsResource, name, opts), &v1beta1.ServiceCIDR{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeServiceCIDRs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionActionWithOptions(servicecidrsResource, opts, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.ServiceCIDRList{})
return err
}
// Patch applies the patch and returns the patched serviceCIDR.
func (c *FakeServiceCIDRs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ServiceCIDR, err error) {
emptyResult := &v1beta1.ServiceCIDR{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(servicecidrsResource, name, pt, data, opts, subresources...), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ServiceCIDR), err
}
// Apply takes the given apply declarative configuration, applies it and returns the applied serviceCIDR.
func (c *FakeServiceCIDRs) Apply(ctx context.Context, serviceCIDR *networkingv1beta1.ServiceCIDRApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ServiceCIDR, err error) {
if serviceCIDR == nil {
return nil, fmt.Errorf("serviceCIDR provided to Apply must not be nil")
}
data, err := json.Marshal(serviceCIDR)
if err != nil {
return nil, err
}
name := serviceCIDR.Name
if name == nil {
return nil, fmt.Errorf("serviceCIDR.Name must be provided to Apply")
}
emptyResult := &v1beta1.ServiceCIDR{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(servicecidrsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions()), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ServiceCIDR), err
}
// ApplyStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
func (c *FakeServiceCIDRs) ApplyStatus(ctx context.Context, serviceCIDR *networkingv1beta1.ServiceCIDRApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ServiceCIDR, err error) {
if serviceCIDR == nil {
return nil, fmt.Errorf("serviceCIDR provided to Apply must not be nil")
}
data, err := json.Marshal(serviceCIDR)
if err != nil {
return nil, err
}
name := serviceCIDR.Name
if name == nil {
return nil, fmt.Errorf("serviceCIDR.Name must be provided to Apply")
}
emptyResult := &v1beta1.ServiceCIDR{}
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceActionWithOptions(servicecidrsResource, *name, types.ApplyPatchType, data, opts.ToPatchOptions(), "status"), emptyResult)
if obj == nil {
return emptyResult, err
}
return obj.(*v1beta1.ServiceCIDR), err
}

View File

@@ -18,6 +18,10 @@ limitations under the License.
package v1beta1
type IPAddressExpansion interface{}
type IngressExpansion interface{}
type IngressClassExpansion interface{}
type ServiceCIDRExpansion interface{}

View File

@@ -0,0 +1,69 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
"context"
v1beta1 "k8s.io/api/networking/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
networkingv1beta1 "k8s.io/client-go/applyconfigurations/networking/v1beta1"
gentype "k8s.io/client-go/gentype"
scheme "k8s.io/client-go/kubernetes/scheme"
)
// IPAddressesGetter has a method to return a IPAddressInterface.
// A group's client should implement this interface.
type IPAddressesGetter interface {
IPAddresses() IPAddressInterface
}
// IPAddressInterface has methods to work with IPAddress resources.
type IPAddressInterface interface {
Create(ctx context.Context, iPAddress *v1beta1.IPAddress, opts v1.CreateOptions) (*v1beta1.IPAddress, error)
Update(ctx context.Context, iPAddress *v1beta1.IPAddress, opts v1.UpdateOptions) (*v1beta1.IPAddress, 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) (*v1beta1.IPAddress, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.IPAddressList, 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 *v1beta1.IPAddress, err error)
Apply(ctx context.Context, iPAddress *networkingv1beta1.IPAddressApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.IPAddress, err error)
IPAddressExpansion
}
// iPAddresses implements IPAddressInterface
type iPAddresses struct {
*gentype.ClientWithListAndApply[*v1beta1.IPAddress, *v1beta1.IPAddressList, *networkingv1beta1.IPAddressApplyConfiguration]
}
// newIPAddresses returns a IPAddresses
func newIPAddresses(c *NetworkingV1beta1Client) *iPAddresses {
return &iPAddresses{
gentype.NewClientWithListAndApply[*v1beta1.IPAddress, *v1beta1.IPAddressList, *networkingv1beta1.IPAddressApplyConfiguration](
"ipaddresses",
c.RESTClient(),
scheme.ParameterCodec,
"",
func() *v1beta1.IPAddress { return &v1beta1.IPAddress{} },
func() *v1beta1.IPAddressList { return &v1beta1.IPAddressList{} }),
}
}

View File

@@ -28,8 +28,10 @@ import (
type NetworkingV1beta1Interface interface {
RESTClient() rest.Interface
IPAddressesGetter
IngressesGetter
IngressClassesGetter
ServiceCIDRsGetter
}
// NetworkingV1beta1Client is used to interact with features provided by the networking.k8s.io group.
@@ -37,6 +39,10 @@ type NetworkingV1beta1Client struct {
restClient rest.Interface
}
func (c *NetworkingV1beta1Client) IPAddresses() IPAddressInterface {
return newIPAddresses(c)
}
func (c *NetworkingV1beta1Client) Ingresses(namespace string) IngressInterface {
return newIngresses(c, namespace)
}
@@ -45,6 +51,10 @@ func (c *NetworkingV1beta1Client) IngressClasses() IngressClassInterface {
return newIngressClasses(c)
}
func (c *NetworkingV1beta1Client) ServiceCIDRs() ServiceCIDRInterface {
return newServiceCIDRs(c)
}
// NewForConfig creates a new NetworkingV1beta1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).

View File

@@ -0,0 +1,73 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
"context"
v1beta1 "k8s.io/api/networking/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
networkingv1beta1 "k8s.io/client-go/applyconfigurations/networking/v1beta1"
gentype "k8s.io/client-go/gentype"
scheme "k8s.io/client-go/kubernetes/scheme"
)
// ServiceCIDRsGetter has a method to return a ServiceCIDRInterface.
// A group's client should implement this interface.
type ServiceCIDRsGetter interface {
ServiceCIDRs() ServiceCIDRInterface
}
// ServiceCIDRInterface has methods to work with ServiceCIDR resources.
type ServiceCIDRInterface interface {
Create(ctx context.Context, serviceCIDR *v1beta1.ServiceCIDR, opts v1.CreateOptions) (*v1beta1.ServiceCIDR, error)
Update(ctx context.Context, serviceCIDR *v1beta1.ServiceCIDR, opts v1.UpdateOptions) (*v1beta1.ServiceCIDR, error)
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
UpdateStatus(ctx context.Context, serviceCIDR *v1beta1.ServiceCIDR, opts v1.UpdateOptions) (*v1beta1.ServiceCIDR, 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) (*v1beta1.ServiceCIDR, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ServiceCIDRList, 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 *v1beta1.ServiceCIDR, err error)
Apply(ctx context.Context, serviceCIDR *networkingv1beta1.ServiceCIDRApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ServiceCIDR, err error)
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
ApplyStatus(ctx context.Context, serviceCIDR *networkingv1beta1.ServiceCIDRApplyConfiguration, opts v1.ApplyOptions) (result *v1beta1.ServiceCIDR, err error)
ServiceCIDRExpansion
}
// serviceCIDRs implements ServiceCIDRInterface
type serviceCIDRs struct {
*gentype.ClientWithListAndApply[*v1beta1.ServiceCIDR, *v1beta1.ServiceCIDRList, *networkingv1beta1.ServiceCIDRApplyConfiguration]
}
// newServiceCIDRs returns a ServiceCIDRs
func newServiceCIDRs(c *NetworkingV1beta1Client) *serviceCIDRs {
return &serviceCIDRs{
gentype.NewClientWithListAndApply[*v1beta1.ServiceCIDR, *v1beta1.ServiceCIDRList, *networkingv1beta1.ServiceCIDRApplyConfiguration](
"servicecidrs",
c.RESTClient(),
scheme.ParameterCodec,
"",
func() *v1beta1.ServiceCIDR { return &v1beta1.ServiceCIDR{} },
func() *v1beta1.ServiceCIDRList { return &v1beta1.ServiceCIDRList{} }),
}
}

View File

@@ -18,6 +18,10 @@ limitations under the License.
package v1beta1
// IPAddressListerExpansion allows custom methods to be added to
// IPAddressLister.
type IPAddressListerExpansion interface{}
// IngressListerExpansion allows custom methods to be added to
// IngressLister.
type IngressListerExpansion interface{}
@@ -29,3 +33,7 @@ type IngressNamespaceListerExpansion interface{}
// IngressClassListerExpansion allows custom methods to be added to
// IngressClassLister.
type IngressClassListerExpansion interface{}
// ServiceCIDRListerExpansion allows custom methods to be added to
// ServiceCIDRLister.
type ServiceCIDRListerExpansion interface{}

View File

@@ -0,0 +1,48 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1beta1
import (
v1beta1 "k8s.io/api/networking/v1beta1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/listers"
"k8s.io/client-go/tools/cache"
)
// IPAddressLister helps list IPAddresses.
// All objects returned here must be treated as read-only.
type IPAddressLister interface {
// List lists all IPAddresses in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.IPAddress, err error)
// Get retrieves the IPAddress from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1beta1.IPAddress, error)
IPAddressListerExpansion
}
// iPAddressLister implements the IPAddressLister interface.
type iPAddressLister struct {
listers.ResourceIndexer[*v1beta1.IPAddress]
}
// NewIPAddressLister returns a new IPAddressLister.
func NewIPAddressLister(indexer cache.Indexer) IPAddressLister {
return &iPAddressLister{listers.New[*v1beta1.IPAddress](indexer, v1beta1.Resource("ipaddress"))}
}

View File

@@ -0,0 +1,48 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1beta1
import (
v1beta1 "k8s.io/api/networking/v1beta1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/listers"
"k8s.io/client-go/tools/cache"
)
// ServiceCIDRLister helps list ServiceCIDRs.
// All objects returned here must be treated as read-only.
type ServiceCIDRLister interface {
// List lists all ServiceCIDRs in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.ServiceCIDR, err error)
// Get retrieves the ServiceCIDR from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1beta1.ServiceCIDR, error)
ServiceCIDRListerExpansion
}
// serviceCIDRLister implements the ServiceCIDRLister interface.
type serviceCIDRLister struct {
listers.ResourceIndexer[*v1beta1.ServiceCIDR]
}
// NewServiceCIDRLister returns a new ServiceCIDRLister.
func NewServiceCIDRLister(indexer cache.Indexer) ServiceCIDRLister {
return &serviceCIDRLister{listers.New[*v1beta1.ServiceCIDR](indexer, v1beta1.Resource("servicecidr"))}
}

View File

@@ -45,7 +45,6 @@ import (
discoveryv1beta1 "k8s.io/api/discovery/v1beta1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
networkingv1 "k8s.io/api/networking/v1"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
policyv1 "k8s.io/api/policy/v1"
policyv1beta1 "k8s.io/api/policy/v1beta1"
@@ -216,8 +215,8 @@ func describerMap(clientConfig *rest.Config) (map[schema.GroupKind]ResourceDescr
{Group: networkingv1beta1.GroupName, Kind: "IngressClass"}: &IngressClassDescriber{c},
{Group: networkingv1.GroupName, Kind: "Ingress"}: &IngressDescriber{c},
{Group: networkingv1.GroupName, Kind: "IngressClass"}: &IngressClassDescriber{c},
{Group: networkingv1alpha1.GroupName, Kind: "ServiceCIDR"}: &ServiceCIDRDescriber{c},
{Group: networkingv1alpha1.GroupName, Kind: "IPAddress"}: &IPAddressDescriber{c},
{Group: networkingv1beta1.GroupName, Kind: "ServiceCIDR"}: &ServiceCIDRDescriber{c},
{Group: networkingv1beta1.GroupName, Kind: "IPAddress"}: &IPAddressDescriber{c},
{Group: batchv1.GroupName, Kind: "Job"}: &JobDescriber{c},
{Group: batchv1.GroupName, Kind: "CronJob"}: &CronJobDescriber{c},
{Group: batchv1beta1.GroupName, Kind: "CronJob"}: &CronJobDescriber{c},
@@ -2871,17 +2870,17 @@ type ServiceCIDRDescriber struct {
func (c *ServiceCIDRDescriber) Describe(namespace, name string, describerSettings DescriberSettings) (string, error) {
var events *corev1.EventList
svcV1alpha1, err := c.client.NetworkingV1alpha1().ServiceCIDRs().Get(context.TODO(), name, metav1.GetOptions{})
svcV1beta1, err := c.client.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), name, metav1.GetOptions{})
if err == nil {
if describerSettings.ShowEvents {
events, _ = searchEvents(c.client.CoreV1(), svcV1alpha1, describerSettings.ChunkSize)
events, _ = searchEvents(c.client.CoreV1(), svcV1beta1, describerSettings.ChunkSize)
}
return c.describeServiceCIDRV1alpha1(svcV1alpha1, events)
return c.describeServiceCIDRV1beta1(svcV1beta1, events)
}
return "", err
}
func (c *ServiceCIDRDescriber) describeServiceCIDRV1alpha1(svc *networkingv1alpha1.ServiceCIDR, events *corev1.EventList) (string, error) {
func (c *ServiceCIDRDescriber) describeServiceCIDRV1beta1(svc *networkingv1beta1.ServiceCIDR, events *corev1.EventList) (string, error) {
return tabbedString(func(out io.Writer) error {
w := NewPrefixWriter(out)
w.Write(LEVEL_0, "Name:\t%v\n", svc.Name)
@@ -2920,17 +2919,17 @@ type IPAddressDescriber struct {
func (c *IPAddressDescriber) Describe(namespace, name string, describerSettings DescriberSettings) (string, error) {
var events *corev1.EventList
ipV1alpha1, err := c.client.NetworkingV1alpha1().IPAddresses().Get(context.TODO(), name, metav1.GetOptions{})
ipV1beta1, err := c.client.NetworkingV1beta1().IPAddresses().Get(context.TODO(), name, metav1.GetOptions{})
if err == nil {
if describerSettings.ShowEvents {
events, _ = searchEvents(c.client.CoreV1(), ipV1alpha1, describerSettings.ChunkSize)
events, _ = searchEvents(c.client.CoreV1(), ipV1beta1, describerSettings.ChunkSize)
}
return c.describeIPAddressV1alpha1(ipV1alpha1, events)
return c.describeIPAddressV1beta1(ipV1beta1, events)
}
return "", err
}
func (c *IPAddressDescriber) describeIPAddressV1alpha1(ip *networkingv1alpha1.IPAddress, events *corev1.EventList) (string, error) {
func (c *IPAddressDescriber) describeIPAddressV1beta1(ip *networkingv1beta1.IPAddress, events *corev1.EventList) (string, error) {
return tabbedString(func(out io.Writer) error {
w := NewPrefixWriter(out)
w.Write(LEVEL_0, "Name:\t%v\n", ip.Name)

View File

@@ -37,7 +37,6 @@ import (
discoveryv1 "k8s.io/api/discovery/v1"
discoveryv1beta1 "k8s.io/api/discovery/v1beta1"
networkingv1 "k8s.io/api/networking/v1"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
policyv1 "k8s.io/api/policy/v1"
policyv1beta1 "k8s.io/api/policy/v1beta1"
@@ -6368,12 +6367,12 @@ func TestDescribeServiceCIDR(t *testing.T) {
input *fake.Clientset
output string
}{
"ServiceCIDR v1alpha1": {
input: fake.NewSimpleClientset(&networkingv1alpha1.ServiceCIDR{
"ServiceCIDR v1beta1": {
input: fake.NewSimpleClientset(&networkingv1beta1.ServiceCIDR{
ObjectMeta: metav1.ObjectMeta{
Name: "foo.123",
},
Spec: networkingv1alpha1.ServiceCIDRSpec{
Spec: networkingv1beta1.ServiceCIDRSpec{
CIDRs: []string{"10.1.0.0/16", "fd00:1:1::/64"},
},
}),
@@ -6384,12 +6383,12 @@ Annotations: <none>
CIDRs: 10.1.0.0/16, fd00:1:1::/64
Events: <none>` + "\n",
},
"ServiceCIDR v1alpha1 IPv4": {
input: fake.NewSimpleClientset(&networkingv1alpha1.ServiceCIDR{
"ServiceCIDR v1beta1 IPv4": {
input: fake.NewSimpleClientset(&networkingv1beta1.ServiceCIDR{
ObjectMeta: metav1.ObjectMeta{
Name: "foo.123",
},
Spec: networkingv1alpha1.ServiceCIDRSpec{
Spec: networkingv1beta1.ServiceCIDRSpec{
CIDRs: []string{"10.1.0.0/16"},
},
}),
@@ -6400,12 +6399,12 @@ Annotations: <none>
CIDRs: 10.1.0.0/16
Events: <none>` + "\n",
},
"ServiceCIDR v1alpha1 IPv6": {
input: fake.NewSimpleClientset(&networkingv1alpha1.ServiceCIDR{
"ServiceCIDR v1beta1 IPv6": {
input: fake.NewSimpleClientset(&networkingv1beta1.ServiceCIDR{
ObjectMeta: metav1.ObjectMeta{
Name: "foo.123",
},
Spec: networkingv1alpha1.ServiceCIDRSpec{
Spec: networkingv1beta1.ServiceCIDRSpec{
CIDRs: []string{"fd00:1:1::/64"},
},
}),
@@ -6439,13 +6438,13 @@ func TestDescribeIPAddress(t *testing.T) {
input *fake.Clientset
output string
}{
"IPAddress v1alpha1": {
input: fake.NewSimpleClientset(&networkingv1alpha1.IPAddress{
"IPAddress v1beta1": {
input: fake.NewSimpleClientset(&networkingv1beta1.IPAddress{
ObjectMeta: metav1.ObjectMeta{
Name: "foo.123",
},
Spec: networkingv1alpha1.IPAddressSpec{
ParentRef: &networkingv1alpha1.ParentReference{
Spec: networkingv1beta1.IPAddressSpec{
ParentRef: &networkingv1beta1.ParentReference{
Group: "mygroup",
Resource: "myresource",
Namespace: "mynamespace",

View File

@@ -21,7 +21,7 @@ import (
"github.com/onsi/ginkgo/v2"
v1 "k8s.io/api/core/v1"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/wait"
@@ -62,18 +62,18 @@ var _ = common.SIGDescribe(feature.ServiceCIDRs, func() {
ginkgo.It("should create Services and servce on different Service CIDRs", func(ctx context.Context) {
// create a new service CIDR
svcCIDR := &networkingv1alpha1.ServiceCIDR{
svcCIDR := &networkingv1beta1.ServiceCIDR{
ObjectMeta: metav1.ObjectMeta{
Name: "test-svc-cidr",
},
Spec: networkingv1alpha1.ServiceCIDRSpec{
Spec: networkingv1beta1.ServiceCIDRSpec{
CIDRs: []string{"10.196.196.0/24"},
},
}
_, err := cs.NetworkingV1alpha1().ServiceCIDRs().Create(context.TODO(), svcCIDR, metav1.CreateOptions{})
_, err := cs.NetworkingV1beta1().ServiceCIDRs().Create(context.TODO(), svcCIDR, metav1.CreateOptions{})
framework.ExpectNoError(err, "error creating ServiceCIDR")
if pollErr := wait.PollUntilContextTimeout(ctx, framework.Poll, e2eservice.RespondingTimeout, false, func(ctx context.Context) (bool, error) {
svcCIDR, err := cs.NetworkingV1alpha1().ServiceCIDRs().Get(ctx, svcCIDR.Name, metav1.GetOptions{})
svcCIDR, err := cs.NetworkingV1beta1().ServiceCIDRs().Get(ctx, svcCIDR.Name, metav1.GetOptions{})
if err != nil {
return false, nil
}
@@ -103,13 +103,13 @@ var _ = common.SIGDescribe(feature.ServiceCIDRs, func() {
})
func isReady(serviceCIDR *networkingv1alpha1.ServiceCIDR) bool {
func isReady(serviceCIDR *networkingv1beta1.ServiceCIDR) bool {
if serviceCIDR == nil {
return false
}
for _, condition := range serviceCIDR.Status.Conditions {
if condition.Type == string(networkingv1alpha1.ServiceCIDRConditionReady) {
if condition.Type == string(networkingv1beta1.ServiceCIDRConditionReady) {
return condition.Status == metav1.ConditionStatus(metav1.ConditionTrue)
}
}

View File

@@ -67,6 +67,7 @@ var resetFieldsStatusData = map[schema.GroupVersionResource]string{
gvr("admissionregistration.k8s.io", "v1beta1", "validatingadmissionpolicies"): `{"status": {"conditions":[{"type":"Accepted","status":"True","lastTransitionTime":"2020-01-01T00:00:00Z","reason":"RuleApplied","message":"Rule was applied"}]}}`,
gvr("admissionregistration.k8s.io", "v1", "validatingadmissionpolicies"): `{"status": {"conditions":[{"type":"Accepted","status":"True","lastTransitionTime":"2020-01-01T00:00:00Z","reason":"RuleApplied","message":"Rule was applied"}]}}`,
gvr("networking.k8s.io", "v1alpha1", "servicecidrs"): `{"status": {"conditions":[{"type":"Accepted","status":"True","lastTransitionTime":"2020-01-01T00:00:00Z","reason":"RuleApplied","message":"Rule was applied"}]}}`,
gvr("networking.k8s.io", "v1beta1", "servicecidrs"): `{"status": {"conditions":[{"type":"Accepted","status":"True","lastTransitionTime":"2020-01-01T00:00:00Z","reason":"RuleApplied","message":"Rule was applied"}]}}`,
}
// resetFieldsStatusDefault conflicts with statusDefault
@@ -140,6 +141,7 @@ var resetFieldsSpecData = map[schema.GroupVersionResource]string{
gvr("networking.k8s.io", "v1beta1", "ingresses"): `{"spec": {"backend": {"serviceName": "service2"}}}`,
gvr("networking.k8s.io", "v1", "ingresses"): `{"spec": {"defaultBackend": {"service": {"name": "service2"}}}}`,
gvr("networking.k8s.io", "v1alpha1", "servicecidrs"): `{}`,
gvr("networking.k8s.io", "v1beta1", "servicecidrs"): `{}`,
gvr("policy", "v1", "poddisruptionbudgets"): `{"spec": {"selector": {"matchLabels": {"anokkey2": "anokvalue"}}}}`,
gvr("policy", "v1beta1", "poddisruptionbudgets"): `{"spec": {"selector": {"matchLabels": {"anokkey2": "anokvalue"}}}}`,
gvr("storage.k8s.io", "v1alpha1", "volumeattachments"): `{"metadata": {"name": "va3"}, "spec": {"nodeName": "localhost2"}}`,

View File

@@ -202,17 +202,17 @@ func GetEtcdStorageDataForNamespace(namespace string) map[schema.GroupVersionRes
},
// --
// k8s.io/kubernetes/pkg/apis/networking/v1alpha1
gvr("networking.k8s.io", "v1alpha1", "ipaddresses"): {
Stub: `{"metadata": {"name": "192.168.1.2"}, "spec": {"parentRef": {"resource": "services","name": "test", "namespace": "ns"}}}`,
ExpectedEtcdPath: "/registry/ipaddresses/192.168.1.2",
// k8s.io/kubernetes/pkg/apis/networking/v1beta1
gvr("networking.k8s.io", "v1beta1", "ipaddresses"): {
Stub: `{"metadata": {"name": "192.168.1.3"}, "spec": {"parentRef": {"resource": "services","name": "test", "namespace": "ns"}}}`,
ExpectedEtcdPath: "/registry/ipaddresses/192.168.1.3",
},
// --
// k8s.io/kubernetes/pkg/apis/networking/v1alpha1
gvr("networking.k8s.io", "v1alpha1", "servicecidrs"): {
Stub: `{"metadata": {"name": "range1"}, "spec": {"cidrs": ["192.168.0.0/16","fd00:1::/120"]}}`,
ExpectedEtcdPath: "/registry/servicecidrs/range1",
// k8s.io/kubernetes/pkg/apis/networking/v1beta1
gvr("networking.k8s.io", "v1beta1", "servicecidrs"): {
Stub: `{"metadata": {"name": "range-b1"}, "spec": {"cidrs": ["192.168.0.0/16","fd00:1::/120"]}}`,
ExpectedEtcdPath: "/registry/servicecidrs/range-b1",
},
// --

View File

@@ -74,7 +74,7 @@ func TestServiceAllocation(t *testing.T) {
s1 := kubeapiservertesting.StartTestServerOrDie(t,
apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=true",
"--runtime-config=networking.k8s.io/v1beta1=true",
"--service-cluster-ip-range=" + serviceCIDR,
"--advertise-address=10.0.0.2",
"--disable-admission-plugins=ServiceAccount",
@@ -159,7 +159,7 @@ func TestServiceAllocIPAddressLargeCIDR(t *testing.T) {
s1 := kubeapiservertesting.StartTestServerOrDie(t,
apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=true",
"--runtime-config=networking.k8s.io/v1beta1=true",
"--service-cluster-ip-range=" + serviceCIDR,
"--advertise-address=2001:db8::10",
"--disable-admission-plugins=ServiceAccount",
@@ -205,7 +205,7 @@ func TestServiceAllocIPAddressLargeCIDR(t *testing.T) {
if err != nil {
t.Error(err)
}
_, err = client.NetworkingV1alpha1().IPAddresses().Get(tCtx, svc.Spec.ClusterIP, metav1.GetOptions{})
_, err = client.NetworkingV1beta1().IPAddresses().Get(tCtx, svc.Spec.ClusterIP, metav1.GetOptions{})
if err != nil {
t.Error(err)
}
@@ -218,7 +218,8 @@ func TestServiceAllocIPAddressLargeCIDR(t *testing.T) {
if _, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, lastSvc, metav1.CreateOptions{}); err != nil {
t.Errorf("unexpected error text: %v", err)
}
_, err = client.NetworkingV1alpha1().IPAddresses().Get(tCtx, lastSvc.Spec.ClusterIP, metav1.GetOptions{})
_, err = client.NetworkingV1beta1().IPAddresses().Get(context.TODO(), lastSvc.Spec.ClusterIP, metav1.GetOptions{})
if err != nil {
t.Error(err)
}
@@ -231,7 +232,7 @@ func TestMigrateService(t *testing.T) {
s := kubeapiservertesting.StartTestServerOrDie(t,
apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=true",
"--runtime-config=networking.k8s.io/v1beta1=true",
"--service-cluster-ip-range=10.0.0.0/24",
"--advertise-address=10.1.1.1",
"--disable-admission-plugins=ServiceAccount",
@@ -285,7 +286,7 @@ func TestMigrateService(t *testing.T) {
err = wait.PollImmediate(1*time.Second, 10*time.Second, func() (bool, error) {
// The repair loop must create the IP address associated
_, err = kubeclient.NetworkingV1alpha1().IPAddresses().Get(context.TODO(), svc.Spec.ClusterIP, metav1.GetOptions{})
_, err = kubeclient.NetworkingV1beta1().IPAddresses().Get(context.TODO(), svc.Spec.ClusterIP, metav1.GetOptions{})
if err != nil {
return false, nil
}
@@ -319,7 +320,7 @@ func TestSkewedAllocatorsRollback(t *testing.T) {
// s1 uses IPAddress allocator
s1 := kubeapiservertesting.StartTestServerOrDie(t, apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=true",
"--runtime-config=networking.k8s.io/v1beta1=true",
"--service-cluster-ip-range=10.0.0.0/24",
"--disable-admission-plugins=ServiceAccount",
fmt.Sprintf("--feature-gates=%s=true,%s=true", features.MultiCIDRServiceAllocator, features.DisableAllocatorDualWrite)},
@@ -338,7 +339,7 @@ func TestSkewedAllocatorsRollback(t *testing.T) {
t.Error(err)
continue
}
_, err = kubeclient1.NetworkingV1alpha1().IPAddresses().Get(context.TODO(), service.Spec.ClusterIP, metav1.GetOptions{})
_, err = kubeclient1.NetworkingV1beta1().IPAddresses().Get(context.TODO(), service.Spec.ClusterIP, metav1.GetOptions{})
if err != nil {
t.Error(err)
}
@@ -347,7 +348,7 @@ func TestSkewedAllocatorsRollback(t *testing.T) {
// s2 uses bitmap allocator
s2 := kubeapiservertesting.StartTestServerOrDie(t, apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=false",
"--runtime-config=networking.k8s.io/v1beta1=false",
"--service-cluster-ip-range=10.0.0.0/24",
"--disable-admission-plugins=ServiceAccount",
fmt.Sprintf("--feature-gates=%s=false", features.MultiCIDRServiceAllocator)},
@@ -368,7 +369,7 @@ func TestSkewedAllocatorsRollback(t *testing.T) {
err = wait.PollImmediate(1*time.Second, 10*time.Second, func() (bool, error) {
// The repair loop must create the IP address associated
_, err = kubeclient1.NetworkingV1alpha1().IPAddresses().Get(context.TODO(), service.Spec.ClusterIP, metav1.GetOptions{})
_, err = kubeclient1.NetworkingV1beta1().IPAddresses().Get(context.TODO(), service.Spec.ClusterIP, metav1.GetOptions{})
if err != nil {
return false, nil
}
@@ -409,7 +410,7 @@ func TestSkewAllocatorsRollout(t *testing.T) {
// oldServer uses bitmap allocator
oldServer := kubeapiservertesting.StartTestServerOrDie(t, apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=false",
"--runtime-config=networking.k8s.io/v1beta1=false",
"--service-cluster-ip-range=10.0.0.0/16",
"--disable-admission-plugins=ServiceAccount",
fmt.Sprintf("--feature-gates=%s=false", features.MultiCIDRServiceAllocator)},
@@ -423,7 +424,7 @@ func TestSkewAllocatorsRollout(t *testing.T) {
// s1 uses IPAddress allocator
newServer := kubeapiservertesting.StartTestServerOrDie(t, apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=true",
"--runtime-config=networking.k8s.io/v1beta1=true",
"--service-cluster-ip-range=10.0.0.0/16",
"--disable-admission-plugins=ServiceAccount",
fmt.Sprintf("--feature-gates=%s=true,%s=false", features.MultiCIDRServiceAllocator, features.DisableAllocatorDualWrite)},
@@ -497,7 +498,7 @@ func TestSkewAllocatorsRollout(t *testing.T) {
// It takes some time for the repairip loop to create the corresponding IPAddress objects
// ClusterIPs are synchronized through the bitmap.
err = wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 10*time.Second, true, func(context.Context) (bool, error) {
ips, err := kubeclientNew.NetworkingV1alpha1().IPAddresses().List(context.Background(), metav1.ListOptions{})
ips, err := kubeclientNew.NetworkingV1beta1().IPAddresses().List(context.Background(), metav1.ListOptions{})
if err != nil {
return false, nil
}
@@ -526,7 +527,7 @@ func TestSkewAllocatorsRollout(t *testing.T) {
ip := fmt.Sprintf("10.0.0.%d", i)
err = wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 10*time.Second, true, func(context.Context) (bool, error) {
// The repair loop must create the IP address associated
_, err = kubeclientNew.NetworkingV1alpha1().IPAddresses().Get(context.Background(), ip, metav1.GetOptions{})
_, err = kubeclientNew.NetworkingV1beta1().IPAddresses().Get(context.Background(), ip, metav1.GetOptions{})
if err != nil {
return false, nil
}
@@ -558,7 +559,7 @@ func TestFlagsIPAllocator(t *testing.T) {
// s1 uses IPAddress allocator
s1 := kubeapiservertesting.StartTestServerOrDie(t, apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=true",
"--runtime-config=networking.k8s.io/v1beta1=true",
"--service-cluster-ip-range=10.0.0.0/24",
fmt.Sprintf("--feature-gates=%s=true", features.MultiCIDRServiceAllocator)},
etcdOptions)
@@ -576,7 +577,7 @@ func TestFlagsIPAllocator(t *testing.T) {
t.Error(err)
continue
}
_, err = kubeclient1.NetworkingV1alpha1().IPAddresses().Get(context.TODO(), service.Spec.ClusterIP, metav1.GetOptions{})
_, err = kubeclient1.NetworkingV1beta1().IPAddresses().Get(context.TODO(), service.Spec.ClusterIP, metav1.GetOptions{})
if err != nil {
t.Error(err)
}

View File

@@ -49,7 +49,7 @@ func TestEnableDisableServiceCIDR(t *testing.T) {
apiServerOptions := kubeapiservertesting.NewDefaultTestServerOptions()
s1 := kubeapiservertesting.StartTestServerOrDie(t, apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=false",
"--runtime-config=networking.k8s.io/v1beta1=false",
"--service-cluster-ip-range=10.0.0.0/24",
"--disable-admission-plugins=ServiceAccount",
fmt.Sprintf("--feature-gates=%s=false", features.MultiCIDRServiceAllocator)},
@@ -82,7 +82,7 @@ func TestEnableDisableServiceCIDR(t *testing.T) {
// apiserver with the feature enabled
s2 := kubeapiservertesting.StartTestServerOrDie(t, apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=true",
"--runtime-config=networking.k8s.io/v1beta1=true",
"--service-cluster-ip-range=10.0.0.0/24",
"--disable-admission-plugins=ServiceAccount",
fmt.Sprintf("--feature-gates=%s=true", features.MultiCIDRServiceAllocator)},
@@ -113,7 +113,7 @@ func TestEnableDisableServiceCIDR(t *testing.T) {
// start an apiserver with the feature disabled
s3 := kubeapiservertesting.StartTestServerOrDie(t, apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=false",
"--runtime-config=networking.k8s.io/v1beta1=false",
"--service-cluster-ip-range=10.0.0.0/24",
"--disable-admission-plugins=ServiceAccount",
fmt.Sprintf("--feature-gates=%s=false", features.MultiCIDRServiceAllocator)},

View File

@@ -23,7 +23,7 @@ import (
"time"
v1 "k8s.io/api/core/v1"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
@@ -57,7 +57,7 @@ func TestMigrateServiceCIDR(t *testing.T) {
s1 := kubeapiservertesting.StartTestServerOrDie(t,
apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=true",
"--runtime-config=networking.k8s.io/v1beta1=true",
"--service-cluster-ip-range=" + cidr1,
"--advertise-address=10.1.1.1",
"--disable-admission-plugins=ServiceAccount",
@@ -77,15 +77,15 @@ func TestMigrateServiceCIDR(t *testing.T) {
// ServiceCIDR controller
go servicecidrs.NewController(
tCtx,
informers1.Networking().V1alpha1().ServiceCIDRs(),
informers1.Networking().V1alpha1().IPAddresses(),
informers1.Networking().V1beta1().ServiceCIDRs(),
informers1.Networking().V1beta1().IPAddresses(),
client1,
).Run(tCtx, 5)
informers1.Start(tCtx.Done())
// the default serviceCIDR should have a finalizer and ready condition set to true
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
cidr, err := client1.NetworkingV1alpha1().ServiceCIDRs().Get(context.TODO(), defaultservicecidr.DefaultServiceCIDRName, metav1.GetOptions{})
cidr, err := client1.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), defaultservicecidr.DefaultServiceCIDRName, metav1.GetOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return false, err
}
@@ -119,13 +119,13 @@ func TestMigrateServiceCIDR(t *testing.T) {
}
}
// Add a new service CIDR to be able to migrate the apiserver
if _, err := client1.NetworkingV1alpha1().ServiceCIDRs().Create(context.Background(), makeServiceCIDR("migration-cidr", cidr2, ""), metav1.CreateOptions{}); err != nil {
if _, err := client1.NetworkingV1beta1().ServiceCIDRs().Create(context.Background(), makeServiceCIDR("migration-cidr", cidr2, ""), metav1.CreateOptions{}); err != nil {
t.Fatalf("got unexpected error: %v", err)
}
// wait ServiceCIDR is ready
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
cidr, err := client1.NetworkingV1alpha1().ServiceCIDRs().Get(context.TODO(), "migration-cidr", metav1.GetOptions{})
cidr, err := client1.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), "migration-cidr", metav1.GetOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return false, err
}
@@ -135,18 +135,18 @@ func TestMigrateServiceCIDR(t *testing.T) {
}
// delete the default ServiceCIDR so is no longer used for allocating IPs
if err := client1.NetworkingV1alpha1().ServiceCIDRs().Delete(context.Background(), defaultservicecidr.DefaultServiceCIDRName, metav1.DeleteOptions{}); err != nil {
if err := client1.NetworkingV1beta1().ServiceCIDRs().Delete(context.Background(), defaultservicecidr.DefaultServiceCIDRName, metav1.DeleteOptions{}); err != nil {
t.Fatalf("got unexpected error: %v", err)
}
// the default serviceCIDR should be pending deletion with Ready condition set to false
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
cidr, err := client1.NetworkingV1alpha1().ServiceCIDRs().Get(context.TODO(), defaultservicecidr.DefaultServiceCIDRName, metav1.GetOptions{})
cidr, err := client1.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), defaultservicecidr.DefaultServiceCIDRName, metav1.GetOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return false, err
}
for _, condition := range cidr.Status.Conditions {
if condition.Type == networkingv1alpha1.ServiceCIDRConditionReady {
if condition.Type == networkingv1beta1.ServiceCIDRConditionReady {
return condition.Status == metav1.ConditionFalse, nil
}
}
@@ -191,7 +191,7 @@ func TestMigrateServiceCIDR(t *testing.T) {
s2 := kubeapiservertesting.StartTestServerOrDie(t,
apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=true",
"--runtime-config=networking.k8s.io/v1beta1=true",
"--service-cluster-ip-range=" + cidr2,
"--advertise-address=10.1.1.1",
"--disable-admission-plugins=ServiceAccount",
@@ -215,8 +215,8 @@ func TestMigrateServiceCIDR(t *testing.T) {
informers2 := informers.NewSharedInformerFactory(client2, resyncPeriod)
go servicecidrs.NewController(
tCtx2,
informers2.Networking().V1alpha1().ServiceCIDRs(),
informers2.Networking().V1alpha1().IPAddresses(),
informers2.Networking().V1beta1().ServiceCIDRs(),
informers2.Networking().V1beta1().IPAddresses(),
client2,
).Run(tCtx2, 5)
informers2.Start(tCtx2.Done())
@@ -229,7 +229,7 @@ func TestMigrateServiceCIDR(t *testing.T) {
// the default serviceCIDR should be the new one
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
cidr, err := client2.NetworkingV1alpha1().ServiceCIDRs().Get(context.TODO(), defaultservicecidr.DefaultServiceCIDRName, metav1.GetOptions{})
cidr, err := client2.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), defaultservicecidr.DefaultServiceCIDRName, metav1.GetOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return false, err
}
@@ -250,7 +250,7 @@ func TestMigrateServiceCIDR(t *testing.T) {
}
for _, condition := range cidr.Status.Conditions {
if condition.Type == networkingv1alpha1.ServiceCIDRConditionReady {
if condition.Type == networkingv1beta1.ServiceCIDRConditionReady {
t.Logf("Expected Condition %s to be %s", condition.Status, metav1.ConditionTrue)
return condition.Status == metav1.ConditionTrue, nil
}
@@ -275,13 +275,13 @@ func TestMigrateServiceCIDR(t *testing.T) {
}
// The temporary ServiceCIDR can be deleted now since the Default ServiceCIDR will cover it
if err := client2.NetworkingV1alpha1().ServiceCIDRs().Delete(context.Background(), "migration-cidr", metav1.DeleteOptions{}); err != nil {
if err := client2.NetworkingV1beta1().ServiceCIDRs().Delete(context.Background(), "migration-cidr", metav1.DeleteOptions{}); err != nil {
t.Fatalf("got unexpected error: %v", err)
}
// wait ServiceCIDR no longer exist
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
_, err := client2.NetworkingV1alpha1().ServiceCIDRs().Get(context.TODO(), "migration-cidr", metav1.GetOptions{})
_, err := client2.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), "migration-cidr", metav1.GetOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return false, nil
}

View File

@@ -89,7 +89,7 @@ func TestServiceAllocPerformance(t *testing.T) {
s1 := kubeapiservertesting.StartTestServerOrDie(t,
apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=true",
"--runtime-config=networking.k8s.io/v1beta1=true",
"--service-cluster-ip-range=" + "10.0.0.0/12",
"--advertise-address=10.0.0.1",
"--disable-admission-plugins=ServiceAccount",
@@ -108,7 +108,7 @@ func TestServiceAllocPerformance(t *testing.T) {
// 100 workers for 15k services
nworkers := 100
nservices := 15000
nservices := 150
jobs := make(chan int, nservices)
results := make(chan error, nservices)
t.Log("Starting workers to create ClusterIP Service")

View File

@@ -25,7 +25,7 @@ import (
"time"
v1 "k8s.io/api/core/v1"
networkingv1alpha1 "k8s.io/api/networking/v1alpha1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
@@ -43,7 +43,7 @@ func TestServiceAllocNewServiceCIDR(t *testing.T) {
s := kubeapiservertesting.StartTestServerOrDie(t,
apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=true",
"--runtime-config=networking.k8s.io/v1beta1=true",
"--service-cluster-ip-range=192.168.0.0/29",
"--advertise-address=10.1.1.1",
"--disable-admission-plugins=ServiceAccount",
@@ -63,8 +63,8 @@ func TestServiceAllocNewServiceCIDR(t *testing.T) {
informerFactory := informers.NewSharedInformerFactory(client, resyncPeriod)
go servicecidrs.NewController(
ctx,
informerFactory.Networking().V1alpha1().ServiceCIDRs(),
informerFactory.Networking().V1alpha1().IPAddresses(),
informerFactory.Networking().V1beta1().ServiceCIDRs(),
informerFactory.Networking().V1beta1().IPAddresses(),
client,
).Run(ctx, 5)
informerFactory.Start(ctx.Done())
@@ -96,12 +96,12 @@ func TestServiceAllocNewServiceCIDR(t *testing.T) {
// Add a new service CIDR to be able to create new IPs.
cidr := makeServiceCIDR("test2", "10.168.0.0/24", "")
if _, err := client.NetworkingV1alpha1().ServiceCIDRs().Create(context.Background(), cidr, metav1.CreateOptions{}); err != nil {
if _, err := client.NetworkingV1beta1().ServiceCIDRs().Create(context.Background(), cidr, metav1.CreateOptions{}); err != nil {
t.Fatalf("got unexpected error: %v", err)
}
// wait ServiceCIDR is ready
if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, time.Minute, false, func(ctx context.Context) (bool, error) {
cidr, err := client.NetworkingV1alpha1().ServiceCIDRs().Get(context.TODO(), cidr.Name, metav1.GetOptions{})
cidr, err := client.NetworkingV1beta1().ServiceCIDRs().Get(context.TODO(), cidr.Name, metav1.GetOptions{})
if err != nil {
return false, err
}
@@ -140,7 +140,7 @@ func TestServiceCIDRDeletion(t *testing.T) {
s := kubeapiservertesting.StartTestServerOrDie(t,
apiServerOptions,
[]string{
"--runtime-config=networking.k8s.io/v1alpha1=true",
"--runtime-config=networking.k8s.io/v1beta1=true",
"--service-cluster-ip-range=" + cidr1,
"--advertise-address=172.16.1.1",
"--disable-admission-plugins=ServiceAccount",
@@ -164,8 +164,8 @@ func TestServiceCIDRDeletion(t *testing.T) {
informerFactory := informers.NewSharedInformerFactory(client, resyncPeriod)
go servicecidrs.NewController(
ctx,
informerFactory.Networking().V1alpha1().ServiceCIDRs(),
informerFactory.Networking().V1alpha1().IPAddresses(),
informerFactory.Networking().V1beta1().ServiceCIDRs(),
informerFactory.Networking().V1beta1().IPAddresses(),
client,
).Run(ctx, 5)
informerFactory.Start(ctx.Done())
@@ -178,13 +178,13 @@ func TestServiceCIDRDeletion(t *testing.T) {
}
}
// create a new ServiceCIDRs that overlaps the default one
_, err = client.NetworkingV1alpha1().ServiceCIDRs().Create(ctx, makeServiceCIDR("cidr1", cidr1, ""), metav1.CreateOptions{})
_, err = client.NetworkingV1beta1().ServiceCIDRs().Create(ctx, makeServiceCIDR("cidr1", cidr1, ""), metav1.CreateOptions{})
if err != nil {
t.Fatal((err))
}
// Wait until is ready.
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
cidr, err := client.NetworkingV1alpha1().ServiceCIDRs().Get(ctx, "cidr1", metav1.GetOptions{})
cidr, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr1", metav1.GetOptions{})
if err != nil {
return false, nil
}
@@ -193,13 +193,13 @@ func TestServiceCIDRDeletion(t *testing.T) {
t.Fatalf("cidr1 is not ready")
}
// we should be able to delete the ServiceCIDR despite it contains IP addresses as it overlaps with the default ServiceCIDR
err = client.NetworkingV1alpha1().ServiceCIDRs().Delete(ctx, "cidr1", metav1.DeleteOptions{})
err = client.NetworkingV1beta1().ServiceCIDRs().Delete(ctx, "cidr1", metav1.DeleteOptions{})
if err != nil {
t.Fatal((err))
}
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
_, err := client.NetworkingV1alpha1().ServiceCIDRs().Get(ctx, "cidr1", metav1.GetOptions{})
_, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr1", metav1.GetOptions{})
if err != nil && apierrors.IsNotFound(err) {
return true, nil
}
@@ -209,14 +209,14 @@ func TestServiceCIDRDeletion(t *testing.T) {
}
// add a new ServiceCIDR with a new range
_, err = client.NetworkingV1alpha1().ServiceCIDRs().Create(ctx, makeServiceCIDR("cidr2", cidr2, ""), metav1.CreateOptions{})
_, err = client.NetworkingV1beta1().ServiceCIDRs().Create(ctx, makeServiceCIDR("cidr2", cidr2, ""), metav1.CreateOptions{})
if err != nil {
t.Fatal((err))
}
// wait the allocator process the new ServiceCIDR
// Wait until is ready.
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
cidr, err := client.NetworkingV1alpha1().ServiceCIDRs().Get(ctx, "cidr2", metav1.GetOptions{})
cidr, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr2", metav1.GetOptions{})
if err != nil {
return false, nil
}
@@ -235,13 +235,13 @@ func TestServiceCIDRDeletion(t *testing.T) {
}
// add a new ServiceCIDR that overlaps the existing one
_, err = client.NetworkingV1alpha1().ServiceCIDRs().Create(ctx, makeServiceCIDR("cidr3", cidr3, ""), metav1.CreateOptions{})
_, err = client.NetworkingV1beta1().ServiceCIDRs().Create(ctx, makeServiceCIDR("cidr3", cidr3, ""), metav1.CreateOptions{})
if err != nil {
t.Fatal((err))
}
// Wait until is ready.
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
cidr, err := client.NetworkingV1alpha1().ServiceCIDRs().Get(ctx, "cidr3", metav1.GetOptions{})
cidr, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr3", metav1.GetOptions{})
if err != nil {
return false, nil
}
@@ -250,13 +250,13 @@ func TestServiceCIDRDeletion(t *testing.T) {
t.Fatalf("cidr3 is not ready")
}
// we should be able to delete the ServiceCIDR2 despite it contains IP addresses as it is contained on ServiceCIDR3
err = client.NetworkingV1alpha1().ServiceCIDRs().Delete(ctx, "cidr2", metav1.DeleteOptions{})
err = client.NetworkingV1beta1().ServiceCIDRs().Delete(ctx, "cidr2", metav1.DeleteOptions{})
if err != nil {
t.Fatal((err))
}
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
_, err := client.NetworkingV1alpha1().ServiceCIDRs().Get(ctx, "cidr2", metav1.GetOptions{})
_, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr2", metav1.GetOptions{})
if err != nil && apierrors.IsNotFound(err) {
return true, nil
}
@@ -266,18 +266,18 @@ func TestServiceCIDRDeletion(t *testing.T) {
}
// serviceCIDR3 will not be able to be deleted until the IPAddress is removed
err = client.NetworkingV1alpha1().ServiceCIDRs().Delete(ctx, "cidr3", metav1.DeleteOptions{})
err = client.NetworkingV1beta1().ServiceCIDRs().Delete(ctx, "cidr3", metav1.DeleteOptions{})
if err != nil {
t.Fatal((err))
}
// Wait until is not ready.
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
cidr, err := client.NetworkingV1alpha1().ServiceCIDRs().Get(ctx, "cidr3", metav1.GetOptions{})
cidr, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr3", metav1.GetOptions{})
if err != nil {
return false, nil
}
for _, condition := range cidr.Status.Conditions {
if condition.Type == networkingv1alpha1.ServiceCIDRConditionReady {
if condition.Type == networkingv1beta1.ServiceCIDRConditionReady {
return condition.Status == metav1.ConditionStatus(metav1.ConditionFalse), nil
}
}
@@ -293,7 +293,7 @@ func TestServiceCIDRDeletion(t *testing.T) {
// cidr3 must not exist
if err := wait.PollUntilContextTimeout(context.Background(), 250*time.Millisecond, 30*time.Second, false, func(ctx context.Context) (bool, error) {
_, err := client.NetworkingV1alpha1().ServiceCIDRs().Get(ctx, "cidr3", metav1.GetOptions{})
_, err := client.NetworkingV1beta1().ServiceCIDRs().Get(ctx, "cidr3", metav1.GetOptions{})
if err != nil && apierrors.IsNotFound(err) {
return true, nil
}
@@ -303,12 +303,12 @@ func TestServiceCIDRDeletion(t *testing.T) {
}
}
func makeServiceCIDR(name, primary, secondary string) *networkingv1alpha1.ServiceCIDR {
serviceCIDR := &networkingv1alpha1.ServiceCIDR{
func makeServiceCIDR(name, primary, secondary string) *networkingv1beta1.ServiceCIDR {
serviceCIDR := &networkingv1beta1.ServiceCIDR{
ObjectMeta: metav1.ObjectMeta{
Name: name,
},
Spec: networkingv1alpha1.ServiceCIDRSpec{},
Spec: networkingv1beta1.ServiceCIDRSpec{},
}
serviceCIDR.Spec.CIDRs = append(serviceCIDR.Spec.CIDRs, primary)
if secondary != "" {
@@ -332,13 +332,13 @@ func makeService(name string) *v1.Service {
}
// returns true of the ServiceCIDRConditionReady is true
func isServiceCIDRReady(serviceCIDR *networkingv1alpha1.ServiceCIDR) bool {
func isServiceCIDRReady(serviceCIDR *networkingv1beta1.ServiceCIDR) bool {
if serviceCIDR == nil {
return false
}
for _, condition := range serviceCIDR.Status.Conditions {
if condition.Type == networkingv1alpha1.ServiceCIDRConditionReady {
if condition.Type == networkingv1beta1.ServiceCIDRConditionReady {
return condition.Status == metav1.ConditionStatus(metav1.ConditionTrue)
}
}