diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index 5cc07b43941..d766fb23b23 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -12021,7 +12021,7 @@ }, "type": "object" }, - "io.k8s.api.discovery.v1alpha1.Endpoint": { + "io.k8s.api.discovery.v1beta1.Endpoint": { "description": "Endpoint represents a single logical \"backend\" implementing a service.", "properties": { "addresses": { @@ -12033,7 +12033,7 @@ "x-kubernetes-list-type": "set" }, "conditions": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointConditions", + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointConditions", "description": "conditions contains information about the current status of the endpoint." }, "hostname": { @@ -12057,7 +12057,7 @@ ], "type": "object" }, - "io.k8s.api.discovery.v1alpha1.EndpointConditions": { + "io.k8s.api.discovery.v1beta1.EndpointConditions": { "description": "EndpointConditions represents the current condition of an endpoint.", "properties": { "ready": { @@ -12067,7 +12067,7 @@ }, "type": "object" }, - "io.k8s.api.discovery.v1alpha1.EndpointPort": { + "io.k8s.api.discovery.v1beta1.EndpointPort": { "description": "EndpointPort represents a Port used by an EndpointSlice", "properties": { "appProtocol": { @@ -12090,7 +12090,7 @@ }, "type": "object" }, - "io.k8s.api.discovery.v1alpha1.EndpointSlice": { + "io.k8s.api.discovery.v1beta1.EndpointSlice": { "description": "EndpointSlice represents a subset of the endpoints that implement a service. For a given service there may be multiple EndpointSlice objects, selected by labels, which must be joined to produce the full set of endpoints.", "properties": { "addressType": { @@ -12104,7 +12104,7 @@ "endpoints": { "description": "endpoints is a list of unique endpoints in this slice. Each slice may include a maximum of 1000 endpoints.", "items": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.Endpoint" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.Endpoint" }, "type": "array", "x-kubernetes-list-type": "atomic" @@ -12120,7 +12120,7 @@ "ports": { "description": "ports specifies the list of network ports exposed by each endpoint in this slice. Each port must have a unique name. When ports is empty, it indicates that there are no defined ports. When a port is defined with a nil port value, it indicates \"all ports\". Each slice may include a maximum of 100 ports.", "items": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointPort" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointPort" }, "type": "array", "x-kubernetes-list-type": "atomic" @@ -12135,11 +12135,11 @@ { "group": "discovery.k8s.io", "kind": "EndpointSlice", - "version": "v1alpha1" + "version": "v1beta1" } ] }, - "io.k8s.api.discovery.v1alpha1.EndpointSliceList": { + "io.k8s.api.discovery.v1beta1.EndpointSliceList": { "description": "EndpointSliceList represents a list of endpoint slices", "properties": { "apiVersion": { @@ -12149,7 +12149,7 @@ "items": { "description": "List of endpoint slices", "items": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointSlice" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointSlice" }, "type": "array", "x-kubernetes-list-type": "set" @@ -12171,7 +12171,7 @@ { "group": "discovery.k8s.io", "kind": "EndpointSliceList", - "version": "v1alpha1" + "version": "v1beta1" } ] }, @@ -19611,6 +19611,11 @@ "kind": "DeleteOptions", "version": "v1alpha1" }, + { + "group": "discovery.k8s.io", + "kind": "DeleteOptions", + "version": "v1beta1" + }, { "group": "events.k8s.io", "kind": "DeleteOptions", @@ -20252,6 +20257,11 @@ "kind": "WatchEvent", "version": "v1alpha1" }, + { + "group": "discovery.k8s.io", + "kind": "WatchEvent", + "version": "v1beta1" + }, { "group": "events.k8s.io", "kind": "WatchEvent", @@ -77651,7 +77661,7 @@ ] } }, - "/apis/discovery.k8s.io/v1alpha1/": { + "/apis/discovery.k8s.io/v1beta1/": { "get": { "consumes": [ "application/json", @@ -77659,7 +77669,7 @@ "application/vnd.kubernetes.protobuf" ], "description": "get available resources", - "operationId": "getDiscoveryV1alpha1APIResources", + "operationId": "getDiscoveryV1beta1APIResources", "produces": [ "application/json", "application/yaml", @@ -77680,17 +77690,17 @@ "https" ], "tags": [ - "discovery_v1alpha1" + "discovery_v1beta1" ] } }, - "/apis/discovery.k8s.io/v1alpha1/endpointslices": { + "/apis/discovery.k8s.io/v1beta1/endpointslices": { "get": { "consumes": [ "*/*" ], "description": "list or watch objects of kind EndpointSlice", - "operationId": "listDiscoveryV1alpha1EndpointSliceForAllNamespaces", + "operationId": "listDiscoveryV1beta1EndpointSliceForAllNamespaces", "produces": [ "application/json", "application/yaml", @@ -77702,7 +77712,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointSliceList" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointSliceList" } }, "401": { @@ -77713,13 +77723,13 @@ "https" ], "tags": [ - "discovery_v1alpha1" + "discovery_v1beta1" ], "x-kubernetes-action": "list", "x-kubernetes-group-version-kind": { "group": "discovery.k8s.io", "kind": "EndpointSlice", - "version": "v1alpha1" + "version": "v1beta1" } }, "parameters": [ @@ -77788,13 +77798,13 @@ } ] }, - "/apis/discovery.k8s.io/v1alpha1/namespaces/{namespace}/endpointslices": { + "/apis/discovery.k8s.io/v1beta1/namespaces/{namespace}/endpointslices": { "delete": { "consumes": [ "*/*" ], "description": "delete collection of EndpointSlice", - "operationId": "deleteDiscoveryV1alpha1CollectionNamespacedEndpointSlice", + "operationId": "deleteDiscoveryV1beta1CollectionNamespacedEndpointSlice", "parameters": [ { "description": "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.", @@ -77908,13 +77918,13 @@ "https" ], "tags": [ - "discovery_v1alpha1" + "discovery_v1beta1" ], "x-kubernetes-action": "deletecollection", "x-kubernetes-group-version-kind": { "group": "discovery.k8s.io", "kind": "EndpointSlice", - "version": "v1alpha1" + "version": "v1beta1" } }, "get": { @@ -77922,7 +77932,7 @@ "*/*" ], "description": "list or watch objects of kind EndpointSlice", - "operationId": "listDiscoveryV1alpha1NamespacedEndpointSlice", + "operationId": "listDiscoveryV1beta1NamespacedEndpointSlice", "parameters": [ { "description": "allowWatchBookmarks requests watch events with type \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored.", @@ -77992,7 +78002,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointSliceList" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointSliceList" } }, "401": { @@ -78003,13 +78013,13 @@ "https" ], "tags": [ - "discovery_v1alpha1" + "discovery_v1beta1" ], "x-kubernetes-action": "list", "x-kubernetes-group-version-kind": { "group": "discovery.k8s.io", "kind": "EndpointSlice", - "version": "v1alpha1" + "version": "v1beta1" } }, "parameters": [ @@ -78034,14 +78044,14 @@ "*/*" ], "description": "create an EndpointSlice", - "operationId": "createDiscoveryV1alpha1NamespacedEndpointSlice", + "operationId": "createDiscoveryV1beta1NamespacedEndpointSlice", "parameters": [ { "in": "body", "name": "body", "required": true, "schema": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointSlice" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointSlice" } }, { @@ -78068,19 +78078,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointSlice" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointSlice" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointSlice" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointSlice" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointSlice" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointSlice" } }, "401": { @@ -78091,23 +78101,23 @@ "https" ], "tags": [ - "discovery_v1alpha1" + "discovery_v1beta1" ], "x-kubernetes-action": "post", "x-kubernetes-group-version-kind": { "group": "discovery.k8s.io", "kind": "EndpointSlice", - "version": "v1alpha1" + "version": "v1beta1" } } }, - "/apis/discovery.k8s.io/v1alpha1/namespaces/{namespace}/endpointslices/{name}": { + "/apis/discovery.k8s.io/v1beta1/namespaces/{namespace}/endpointslices/{name}": { "delete": { "consumes": [ "*/*" ], "description": "delete an EndpointSlice", - "operationId": "deleteDiscoveryV1alpha1NamespacedEndpointSlice", + "operationId": "deleteDiscoveryV1beta1NamespacedEndpointSlice", "parameters": [ { "in": "body", @@ -78171,13 +78181,13 @@ "https" ], "tags": [ - "discovery_v1alpha1" + "discovery_v1beta1" ], "x-kubernetes-action": "delete", "x-kubernetes-group-version-kind": { "group": "discovery.k8s.io", "kind": "EndpointSlice", - "version": "v1alpha1" + "version": "v1beta1" } }, "get": { @@ -78185,7 +78195,7 @@ "*/*" ], "description": "read the specified EndpointSlice", - "operationId": "readDiscoveryV1alpha1NamespacedEndpointSlice", + "operationId": "readDiscoveryV1beta1NamespacedEndpointSlice", "parameters": [ { "description": "Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'. Deprecated. Planned for removal in 1.18.", @@ -78211,7 +78221,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointSlice" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointSlice" } }, "401": { @@ -78222,13 +78232,13 @@ "https" ], "tags": [ - "discovery_v1alpha1" + "discovery_v1beta1" ], "x-kubernetes-action": "get", "x-kubernetes-group-version-kind": { "group": "discovery.k8s.io", "kind": "EndpointSlice", - "version": "v1alpha1" + "version": "v1beta1" } }, "parameters": [ @@ -78264,7 +78274,7 @@ "application/apply-patch+yaml" ], "description": "partially update the specified EndpointSlice", - "operationId": "patchDiscoveryV1alpha1NamespacedEndpointSlice", + "operationId": "patchDiscoveryV1beta1NamespacedEndpointSlice", "parameters": [ { "in": "body", @@ -78305,7 +78315,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointSlice" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointSlice" } }, "401": { @@ -78316,13 +78326,13 @@ "https" ], "tags": [ - "discovery_v1alpha1" + "discovery_v1beta1" ], "x-kubernetes-action": "patch", "x-kubernetes-group-version-kind": { "group": "discovery.k8s.io", "kind": "EndpointSlice", - "version": "v1alpha1" + "version": "v1beta1" } }, "put": { @@ -78330,14 +78340,14 @@ "*/*" ], "description": "replace the specified EndpointSlice", - "operationId": "replaceDiscoveryV1alpha1NamespacedEndpointSlice", + "operationId": "replaceDiscoveryV1beta1NamespacedEndpointSlice", "parameters": [ { "in": "body", "name": "body", "required": true, "schema": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointSlice" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointSlice" } }, { @@ -78364,13 +78374,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointSlice" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointSlice" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/io.k8s.api.discovery.v1alpha1.EndpointSlice" + "$ref": "#/definitions/io.k8s.api.discovery.v1beta1.EndpointSlice" } }, "401": { @@ -78381,23 +78391,23 @@ "https" ], "tags": [ - "discovery_v1alpha1" + "discovery_v1beta1" ], "x-kubernetes-action": "put", "x-kubernetes-group-version-kind": { "group": "discovery.k8s.io", "kind": "EndpointSlice", - "version": "v1alpha1" + "version": "v1beta1" } } }, - "/apis/discovery.k8s.io/v1alpha1/watch/endpointslices": { + "/apis/discovery.k8s.io/v1beta1/watch/endpointslices": { "get": { "consumes": [ "*/*" ], "description": "watch individual changes to a list of EndpointSlice. deprecated: use the 'watch' parameter with a list operation instead.", - "operationId": "watchDiscoveryV1alpha1EndpointSliceListForAllNamespaces", + "operationId": "watchDiscoveryV1beta1EndpointSliceListForAllNamespaces", "produces": [ "application/json", "application/yaml", @@ -78420,13 +78430,13 @@ "https" ], "tags": [ - "discovery_v1alpha1" + "discovery_v1beta1" ], "x-kubernetes-action": "watchlist", "x-kubernetes-group-version-kind": { "group": "discovery.k8s.io", "kind": "EndpointSlice", - "version": "v1alpha1" + "version": "v1beta1" } }, "parameters": [ @@ -78495,13 +78505,13 @@ } ] }, - "/apis/discovery.k8s.io/v1alpha1/watch/namespaces/{namespace}/endpointslices": { + "/apis/discovery.k8s.io/v1beta1/watch/namespaces/{namespace}/endpointslices": { "get": { "consumes": [ "*/*" ], "description": "watch individual changes to a list of EndpointSlice. deprecated: use the 'watch' parameter with a list operation instead.", - "operationId": "watchDiscoveryV1alpha1NamespacedEndpointSliceList", + "operationId": "watchDiscoveryV1beta1NamespacedEndpointSliceList", "produces": [ "application/json", "application/yaml", @@ -78524,13 +78534,13 @@ "https" ], "tags": [ - "discovery_v1alpha1" + "discovery_v1beta1" ], "x-kubernetes-action": "watchlist", "x-kubernetes-group-version-kind": { "group": "discovery.k8s.io", "kind": "EndpointSlice", - "version": "v1alpha1" + "version": "v1beta1" } }, "parameters": [ @@ -78607,13 +78617,13 @@ } ] }, - "/apis/discovery.k8s.io/v1alpha1/watch/namespaces/{namespace}/endpointslices/{name}": { + "/apis/discovery.k8s.io/v1beta1/watch/namespaces/{namespace}/endpointslices/{name}": { "get": { "consumes": [ "*/*" ], "description": "watch changes to an object of kind EndpointSlice. deprecated: use the 'watch' parameter with a list operation instead, filtered to a single item with the 'fieldSelector' parameter.", - "operationId": "watchDiscoveryV1alpha1NamespacedEndpointSlice", + "operationId": "watchDiscoveryV1beta1NamespacedEndpointSlice", "produces": [ "application/json", "application/yaml", @@ -78636,13 +78646,13 @@ "https" ], "tags": [ - "discovery_v1alpha1" + "discovery_v1beta1" ], "x-kubernetes-action": "watch", "x-kubernetes-group-version-kind": { "group": "discovery.k8s.io", "kind": "EndpointSlice", - "version": "v1alpha1" + "version": "v1beta1" } }, "parameters": [ diff --git a/build/kazel_generated.bzl b/build/kazel_generated.bzl index 1524fba6ff1..b29c66f88e3 100644 --- a/build/kazel_generated.bzl +++ b/build/kazel_generated.bzl @@ -60,6 +60,7 @@ tags_values_pkgs = {"openapi-gen": { "staging/src/k8s.io/api/coordination/v1beta1", "staging/src/k8s.io/api/core/v1", "staging/src/k8s.io/api/discovery/v1alpha1", + "staging/src/k8s.io/api/discovery/v1beta1", "staging/src/k8s.io/api/events/v1beta1", "staging/src/k8s.io/api/extensions/v1beta1", "staging/src/k8s.io/api/flowcontrol/v1alpha1", @@ -143,6 +144,7 @@ tags_pkgs_values = {"openapi-gen": { "true", ], "staging/src/k8s.io/api/discovery/v1alpha1": ["true"], + "staging/src/k8s.io/api/discovery/v1beta1": ["true"], "staging/src/k8s.io/api/events/v1beta1": ["true"], "staging/src/k8s.io/api/extensions/v1beta1": ["true"], "staging/src/k8s.io/api/flowcontrol/v1alpha1": ["true"], diff --git a/cmd/kube-apiserver/app/aggregator.go b/cmd/kube-apiserver/app/aggregator.go index f014419c40b..6c0c23f83bb 100644 --- a/cmd/kube-apiserver/app/aggregator.go +++ b/cmd/kube-apiserver/app/aggregator.go @@ -285,6 +285,7 @@ var apiVersionPriorities = map[schema.GroupVersion]priority{ {Group: "auditregistration.k8s.io", Version: "v1alpha1"}: {group: 16400, version: 1}, {Group: "node.k8s.io", Version: "v1alpha1"}: {group: 16300, version: 1}, {Group: "node.k8s.io", Version: "v1beta1"}: {group: 16300, version: 9}, + {Group: "discovery.k8s.io", Version: "v1beta1"}: {group: 16200, version: 12}, {Group: "discovery.k8s.io", Version: "v1alpha1"}: {group: 16200, version: 9}, // Append a new group to the end of the list if unsure. // You can use min(existing group)-100 as the initial value for a group. diff --git a/cmd/kube-controller-manager/app/BUILD b/cmd/kube-controller-manager/app/BUILD index 0497eea4700..6ccdf043e1a 100644 --- a/cmd/kube-controller-manager/app/BUILD +++ b/cmd/kube-controller-manager/app/BUILD @@ -109,7 +109,6 @@ go_library( "//pkg/volume/util:go_default_library", "//pkg/volume/vsphere_volume:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", diff --git a/cmd/kube-controller-manager/app/controllermanager.go b/cmd/kube-controller-manager/app/controllermanager.go index 8a1b6cea5e2..6d026bf47bd 100644 --- a/cmd/kube-controller-manager/app/controllermanager.go +++ b/cmd/kube-controller-manager/app/controllermanager.go @@ -360,7 +360,6 @@ func KnownControllers() []string { // ControllersDisabledByDefault is the set of controllers which is disabled by default var ControllersDisabledByDefault = sets.NewString( "bootstrapsigner", - "endpointslice", "tokencleaner", ) diff --git a/cmd/kube-controller-manager/app/discovery.go b/cmd/kube-controller-manager/app/discovery.go index 7570ea7dde0..7306ccd8da4 100644 --- a/cmd/kube-controller-manager/app/discovery.go +++ b/cmd/kube-controller-manager/app/discovery.go @@ -23,22 +23,15 @@ package app import ( "net/http" - discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" - "k8s.io/klog" endpointslicecontroller "k8s.io/kubernetes/pkg/controller/endpointslice" ) func startEndpointSliceController(ctx ControllerContext) (http.Handler, bool, error) { - if !ctx.AvailableResources[discoveryv1alpha1.SchemeGroupVersion.WithResource("endpointslices")] { - klog.Warningf("Not starting endpointslice-controller, discovery.k8s.io/v1alpha1 resources are not available") - return nil, false, nil - } - go endpointslicecontroller.NewController( ctx.InformerFactory.Core().V1().Pods(), ctx.InformerFactory.Core().V1().Services(), ctx.InformerFactory.Core().V1().Nodes(), - ctx.InformerFactory.Discovery().V1alpha1().EndpointSlices(), + ctx.InformerFactory.Discovery().V1beta1().EndpointSlices(), ctx.ComponentConfig.EndpointSliceController.MaxEndpointsPerSlice, ctx.ClientBuilder.ClientOrDie("endpointslice-controller"), ).Run(int(ctx.ComponentConfig.EndpointSliceController.ConcurrentServiceEndpointSyncs), ctx.Stop) diff --git a/cmd/kube-proxy/app/server.go b/cmd/kube-proxy/app/server.go index 3b97c44adfa..89e3ded7b1c 100644 --- a/cmd/kube-proxy/app/server.go +++ b/cmd/kube-proxy/app/server.go @@ -677,7 +677,7 @@ func (s *ProxyServer) Run() error { go serviceConfig.Run(wait.NeverStop) if utilfeature.DefaultFeatureGate.Enabled(features.EndpointSlice) { - endpointSliceConfig := config.NewEndpointSliceConfig(informerFactory.Discovery().V1alpha1().EndpointSlices(), s.ConfigSyncPeriod) + endpointSliceConfig := config.NewEndpointSliceConfig(informerFactory.Discovery().V1beta1().EndpointSlices(), s.ConfigSyncPeriod) endpointSliceConfig.RegisterEventHandler(s.Proxier) go endpointSliceConfig.Run(wait.NeverStop) } else { diff --git a/hack/.golint_failures b/hack/.golint_failures index 99e12b080a3..5cfce89b47e 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -31,6 +31,7 @@ pkg/apis/core/v1/helper/qos pkg/apis/core/v1/validation pkg/apis/core/validation pkg/apis/discovery/v1alpha1 +pkg/apis/discovery/v1beta1 pkg/apis/events/v1beta1 pkg/apis/extensions pkg/apis/extensions/v1beta1 diff --git a/hack/.import-aliases b/hack/.import-aliases index 87cc94be1f2..d2d90b72713 100644 --- a/hack/.import-aliases +++ b/hack/.import-aliases @@ -19,6 +19,7 @@ "k8s.io/api/coordination/v1beta1": "coordinationv1beta1", "k8s.io/api/core/v1": "v1", "k8s.io/api/discovery/v1alpha1": "discoveryv1alpha1", + "k8s.io/api/discovery/v1beta1": "discoveryv1beta1", "k8s.io/api/events/v1beta1": "eventsv1beta1", "k8s.io/api/extensions/v1beta1": "extensionsv1beta1", "k8s.io/api/imagepolicy/v1alpha1": "imagepolicyv1alpha1", diff --git a/hack/lib/init.sh b/hack/lib/init.sh index dffbc01e113..b7a3e5ae08f 100755 --- a/hack/lib/init.sh +++ b/hack/lib/init.sh @@ -85,6 +85,7 @@ certificates.k8s.io/v1beta1 \ coordination.k8s.io/v1beta1 \ coordination.k8s.io/v1 \ discovery.k8s.io/v1alpha1 \ +discovery.k8s.io/v1beta1 \ extensions/v1beta1 \ events.k8s.io/v1beta1 \ imagepolicy.k8s.io/v1alpha1 \ diff --git a/pkg/api/testing/defaulting_test.go b/pkg/api/testing/defaulting_test.go index 1614b0bd75b..b9367217567 100644 --- a/pkg/api/testing/defaulting_test.go +++ b/pkg/api/testing/defaulting_test.go @@ -91,6 +91,8 @@ func TestDefaulting(t *testing.T) { {Group: "certificates.k8s.io", Version: "v1beta1", Kind: "CertificateSigningRequestList"}: {}, {Group: "discovery.k8s.io", Version: "v1alpha1", Kind: "EndpointSlice"}: {}, {Group: "discovery.k8s.io", Version: "v1alpha1", Kind: "EndpointSliceList"}: {}, + {Group: "discovery.k8s.io", Version: "v1beta1", Kind: "EndpointSlice"}: {}, + {Group: "discovery.k8s.io", Version: "v1beta1", Kind: "EndpointSliceList"}: {}, {Group: "kubeadm.k8s.io", Version: "v1alpha1", Kind: "MasterConfiguration"}: {}, // This object contains only int fields which currently breaks the defaulting test because // it's pretty stupid. Once we add non integer fields, we should uncomment this. diff --git a/pkg/apis/discovery/BUILD b/pkg/apis/discovery/BUILD index d1347afd1a5..239cdc13236 100644 --- a/pkg/apis/discovery/BUILD +++ b/pkg/apis/discovery/BUILD @@ -32,6 +32,7 @@ filegroup( "//pkg/apis/discovery/fuzzer:all-srcs", "//pkg/apis/discovery/install:all-srcs", "//pkg/apis/discovery/v1alpha1:all-srcs", + "//pkg/apis/discovery/v1beta1:all-srcs", "//pkg/apis/discovery/validation:all-srcs", ], tags = ["automanaged"], diff --git a/pkg/apis/discovery/install/BUILD b/pkg/apis/discovery/install/BUILD index 4a43e9cbe88..825bd82ee85 100644 --- a/pkg/apis/discovery/install/BUILD +++ b/pkg/apis/discovery/install/BUILD @@ -9,6 +9,7 @@ go_library( "//pkg/api/legacyscheme:go_default_library", "//pkg/apis/discovery:go_default_library", "//pkg/apis/discovery/v1alpha1:go_default_library", + "//pkg/apis/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library", ], diff --git a/pkg/apis/discovery/install/install.go b/pkg/apis/discovery/install/install.go index 0f2e9a650ef..828f13883d4 100644 --- a/pkg/apis/discovery/install/install.go +++ b/pkg/apis/discovery/install/install.go @@ -24,6 +24,7 @@ import ( "k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/apis/discovery" "k8s.io/kubernetes/pkg/apis/discovery/v1alpha1" + "k8s.io/kubernetes/pkg/apis/discovery/v1beta1" ) func init() { @@ -34,5 +35,6 @@ func init() { func Install(scheme *runtime.Scheme) { utilruntime.Must(discovery.AddToScheme(scheme)) utilruntime.Must(v1alpha1.AddToScheme(scheme)) - utilruntime.Must(scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion)) + utilruntime.Must(v1beta1.AddToScheme(scheme)) + utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion, v1alpha1.SchemeGroupVersion)) } diff --git a/pkg/apis/discovery/v1beta1/BUILD b/pkg/apis/discovery/v1beta1/BUILD new file mode 100644 index 00000000000..58cfb5af334 --- /dev/null +++ b/pkg/apis/discovery/v1beta1/BUILD @@ -0,0 +1,52 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "go_default_library", + srcs = [ + "defaults.go", + "doc.go", + "register.go", + "zz_generated.conversion.go", + "zz_generated.defaults.go", + ], + importpath = "k8s.io/kubernetes/pkg/apis/discovery/v1beta1", + visibility = ["//visibility:public"], + deps = [ + "//pkg/apis/core:go_default_library", + "//pkg/apis/discovery:go_default_library", + "//staging/src/k8s.io/api/core/v1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", + ], +) + +go_test( + name = "go_default_test", + srcs = ["defaults_test.go"], + embed = [":go_default_library"], + deps = [ + "//pkg/api/legacyscheme:go_default_library", + "//pkg/apis/discovery/install:go_default_library", + "//staging/src/k8s.io/api/core/v1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library", + "//vendor/github.com/google/go-cmp/cmp:go_default_library", + "//vendor/k8s.io/utils/pointer:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/pkg/apis/discovery/v1beta1/defaults.go b/pkg/apis/discovery/v1beta1/defaults.go new file mode 100644 index 00000000000..47161f1f1c3 --- /dev/null +++ b/pkg/apis/discovery/v1beta1/defaults.go @@ -0,0 +1,42 @@ +/* +Copyright 2019 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 + +import ( + v1 "k8s.io/api/core/v1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" + "k8s.io/apimachinery/pkg/runtime" +) + +var ( + defaultPortName = "" + defaultProtocol = v1.ProtocolTCP +) + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return RegisterDefaults(scheme) +} + +func SetDefaults_EndpointPort(obj *discoveryv1beta1.EndpointPort) { + if obj.Name == nil { + obj.Name = &defaultPortName + } + + if obj.Protocol == nil { + obj.Protocol = &defaultProtocol + } +} diff --git a/pkg/apis/discovery/v1beta1/defaults_test.go b/pkg/apis/discovery/v1beta1/defaults_test.go new file mode 100644 index 00000000000..ac1bb887a17 --- /dev/null +++ b/pkg/apis/discovery/v1beta1/defaults_test.go @@ -0,0 +1,77 @@ +/* +Copyright 2019 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_test + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + v1 "k8s.io/api/core/v1" + discovery "k8s.io/api/discovery/v1beta1" + apiequality "k8s.io/apimachinery/pkg/api/equality" + "k8s.io/kubernetes/pkg/api/legacyscheme" + _ "k8s.io/kubernetes/pkg/apis/discovery/install" + utilpointer "k8s.io/utils/pointer" +) + +func TestSetDefaultEndpointPort(t *testing.T) { + emptyStr := "" + fooStr := "foo" + protoTCP := v1.ProtocolTCP + protoUDP := v1.ProtocolUDP + + tests := map[string]struct { + original *discovery.EndpointSlice + expected *discovery.EndpointSlice + }{ + "should set appropriate defaults": { + original: &discovery.EndpointSlice{Ports: []discovery.EndpointPort{{ + Port: utilpointer.Int32Ptr(80), + }}}, + expected: &discovery.EndpointSlice{ + Ports: []discovery.EndpointPort{{ + Name: &emptyStr, + Protocol: &protoTCP, + Port: utilpointer.Int32Ptr(80), + }}, + }, + }, + "should not overwrite values with defaults when set": { + original: &discovery.EndpointSlice{ + Ports: []discovery.EndpointPort{{ + Name: &fooStr, + Protocol: &protoUDP, + }}, + }, + expected: &discovery.EndpointSlice{ + Ports: []discovery.EndpointPort{{ + Name: &fooStr, + Protocol: &protoUDP, + }}, + }, + }, + } + + for _, test := range tests { + actual := test.original + expected := test.expected + legacyscheme.Scheme.Default(actual) + if !apiequality.Semantic.DeepEqual(actual, expected) { + t.Error(cmp.Diff(expected, actual)) + } + } +} diff --git a/pkg/apis/discovery/v1beta1/doc.go b/pkg/apis/discovery/v1beta1/doc.go new file mode 100644 index 00000000000..495aeb822eb --- /dev/null +++ b/pkg/apis/discovery/v1beta1/doc.go @@ -0,0 +1,22 @@ +/* +Copyright 2019 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. +*/ + +// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/discovery +// +k8s:conversion-gen-external-types=k8s.io/api/discovery/v1beta1 +// +k8s:defaulter-gen=TypeMeta +// +k8s:defaulter-gen-input=../../../../vendor/k8s.io/api/discovery/v1beta1 + +package v1beta1 // import "k8s.io/kubernetes/pkg/apis/discovery/v1beta1" diff --git a/pkg/apis/discovery/v1beta1/register.go b/pkg/apis/discovery/v1beta1/register.go new file mode 100644 index 00000000000..4f696ca1dd3 --- /dev/null +++ b/pkg/apis/discovery/v1beta1/register.go @@ -0,0 +1,45 @@ +/* +Copyright 2019 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 + +import ( + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name used in this package +const GroupName = "discovery.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + localSchemeBuilder = &discoveryv1beta1.SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addDefaultingFuncs) +} diff --git a/pkg/apis/discovery/v1beta1/zz_generated.conversion.go b/pkg/apis/discovery/v1beta1/zz_generated.conversion.go new file mode 100644 index 00000000000..c7eb5cd62da --- /dev/null +++ b/pkg/apis/discovery/v1beta1/zz_generated.conversion.go @@ -0,0 +1,218 @@ +// +build !ignore_autogenerated + +/* +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 conversion-gen. DO NOT EDIT. + +package v1beta1 + +import ( + unsafe "unsafe" + + v1 "k8s.io/api/core/v1" + v1beta1 "k8s.io/api/discovery/v1beta1" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + core "k8s.io/kubernetes/pkg/apis/core" + discovery "k8s.io/kubernetes/pkg/apis/discovery" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*v1beta1.Endpoint)(nil), (*discovery.Endpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_Endpoint_To_discovery_Endpoint(a.(*v1beta1.Endpoint), b.(*discovery.Endpoint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*discovery.Endpoint)(nil), (*v1beta1.Endpoint)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_discovery_Endpoint_To_v1beta1_Endpoint(a.(*discovery.Endpoint), b.(*v1beta1.Endpoint), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta1.EndpointConditions)(nil), (*discovery.EndpointConditions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_EndpointConditions_To_discovery_EndpointConditions(a.(*v1beta1.EndpointConditions), b.(*discovery.EndpointConditions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*discovery.EndpointConditions)(nil), (*v1beta1.EndpointConditions)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_discovery_EndpointConditions_To_v1beta1_EndpointConditions(a.(*discovery.EndpointConditions), b.(*v1beta1.EndpointConditions), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta1.EndpointPort)(nil), (*discovery.EndpointPort)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_EndpointPort_To_discovery_EndpointPort(a.(*v1beta1.EndpointPort), b.(*discovery.EndpointPort), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*discovery.EndpointPort)(nil), (*v1beta1.EndpointPort)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_discovery_EndpointPort_To_v1beta1_EndpointPort(a.(*discovery.EndpointPort), b.(*v1beta1.EndpointPort), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta1.EndpointSlice)(nil), (*discovery.EndpointSlice)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_EndpointSlice_To_discovery_EndpointSlice(a.(*v1beta1.EndpointSlice), b.(*discovery.EndpointSlice), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*discovery.EndpointSlice)(nil), (*v1beta1.EndpointSlice)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_discovery_EndpointSlice_To_v1beta1_EndpointSlice(a.(*discovery.EndpointSlice), b.(*v1beta1.EndpointSlice), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta1.EndpointSliceList)(nil), (*discovery.EndpointSliceList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_EndpointSliceList_To_discovery_EndpointSliceList(a.(*v1beta1.EndpointSliceList), b.(*discovery.EndpointSliceList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*discovery.EndpointSliceList)(nil), (*v1beta1.EndpointSliceList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_discovery_EndpointSliceList_To_v1beta1_EndpointSliceList(a.(*discovery.EndpointSliceList), b.(*v1beta1.EndpointSliceList), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1beta1_Endpoint_To_discovery_Endpoint(in *v1beta1.Endpoint, out *discovery.Endpoint, s conversion.Scope) error { + out.Addresses = *(*[]string)(unsafe.Pointer(&in.Addresses)) + if err := Convert_v1beta1_EndpointConditions_To_discovery_EndpointConditions(&in.Conditions, &out.Conditions, s); err != nil { + return err + } + out.Hostname = (*string)(unsafe.Pointer(in.Hostname)) + out.TargetRef = (*core.ObjectReference)(unsafe.Pointer(in.TargetRef)) + out.Topology = *(*map[string]string)(unsafe.Pointer(&in.Topology)) + return nil +} + +// Convert_v1beta1_Endpoint_To_discovery_Endpoint is an autogenerated conversion function. +func Convert_v1beta1_Endpoint_To_discovery_Endpoint(in *v1beta1.Endpoint, out *discovery.Endpoint, s conversion.Scope) error { + return autoConvert_v1beta1_Endpoint_To_discovery_Endpoint(in, out, s) +} + +func autoConvert_discovery_Endpoint_To_v1beta1_Endpoint(in *discovery.Endpoint, out *v1beta1.Endpoint, s conversion.Scope) error { + out.Addresses = *(*[]string)(unsafe.Pointer(&in.Addresses)) + if err := Convert_discovery_EndpointConditions_To_v1beta1_EndpointConditions(&in.Conditions, &out.Conditions, s); err != nil { + return err + } + out.Hostname = (*string)(unsafe.Pointer(in.Hostname)) + out.TargetRef = (*v1.ObjectReference)(unsafe.Pointer(in.TargetRef)) + out.Topology = *(*map[string]string)(unsafe.Pointer(&in.Topology)) + return nil +} + +// Convert_discovery_Endpoint_To_v1beta1_Endpoint is an autogenerated conversion function. +func Convert_discovery_Endpoint_To_v1beta1_Endpoint(in *discovery.Endpoint, out *v1beta1.Endpoint, s conversion.Scope) error { + return autoConvert_discovery_Endpoint_To_v1beta1_Endpoint(in, out, s) +} + +func autoConvert_v1beta1_EndpointConditions_To_discovery_EndpointConditions(in *v1beta1.EndpointConditions, out *discovery.EndpointConditions, s conversion.Scope) error { + out.Ready = (*bool)(unsafe.Pointer(in.Ready)) + return nil +} + +// Convert_v1beta1_EndpointConditions_To_discovery_EndpointConditions is an autogenerated conversion function. +func Convert_v1beta1_EndpointConditions_To_discovery_EndpointConditions(in *v1beta1.EndpointConditions, out *discovery.EndpointConditions, s conversion.Scope) error { + return autoConvert_v1beta1_EndpointConditions_To_discovery_EndpointConditions(in, out, s) +} + +func autoConvert_discovery_EndpointConditions_To_v1beta1_EndpointConditions(in *discovery.EndpointConditions, out *v1beta1.EndpointConditions, s conversion.Scope) error { + out.Ready = (*bool)(unsafe.Pointer(in.Ready)) + return nil +} + +// Convert_discovery_EndpointConditions_To_v1beta1_EndpointConditions is an autogenerated conversion function. +func Convert_discovery_EndpointConditions_To_v1beta1_EndpointConditions(in *discovery.EndpointConditions, out *v1beta1.EndpointConditions, s conversion.Scope) error { + return autoConvert_discovery_EndpointConditions_To_v1beta1_EndpointConditions(in, out, s) +} + +func autoConvert_v1beta1_EndpointPort_To_discovery_EndpointPort(in *v1beta1.EndpointPort, out *discovery.EndpointPort, s conversion.Scope) error { + out.Name = (*string)(unsafe.Pointer(in.Name)) + out.Protocol = (*core.Protocol)(unsafe.Pointer(in.Protocol)) + out.Port = (*int32)(unsafe.Pointer(in.Port)) + out.AppProtocol = (*string)(unsafe.Pointer(in.AppProtocol)) + return nil +} + +// Convert_v1beta1_EndpointPort_To_discovery_EndpointPort is an autogenerated conversion function. +func Convert_v1beta1_EndpointPort_To_discovery_EndpointPort(in *v1beta1.EndpointPort, out *discovery.EndpointPort, s conversion.Scope) error { + return autoConvert_v1beta1_EndpointPort_To_discovery_EndpointPort(in, out, s) +} + +func autoConvert_discovery_EndpointPort_To_v1beta1_EndpointPort(in *discovery.EndpointPort, out *v1beta1.EndpointPort, s conversion.Scope) error { + out.Name = (*string)(unsafe.Pointer(in.Name)) + out.Protocol = (*v1.Protocol)(unsafe.Pointer(in.Protocol)) + out.Port = (*int32)(unsafe.Pointer(in.Port)) + out.AppProtocol = (*string)(unsafe.Pointer(in.AppProtocol)) + return nil +} + +// Convert_discovery_EndpointPort_To_v1beta1_EndpointPort is an autogenerated conversion function. +func Convert_discovery_EndpointPort_To_v1beta1_EndpointPort(in *discovery.EndpointPort, out *v1beta1.EndpointPort, s conversion.Scope) error { + return autoConvert_discovery_EndpointPort_To_v1beta1_EndpointPort(in, out, s) +} + +func autoConvert_v1beta1_EndpointSlice_To_discovery_EndpointSlice(in *v1beta1.EndpointSlice, out *discovery.EndpointSlice, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.AddressType = discovery.AddressType(in.AddressType) + out.Endpoints = *(*[]discovery.Endpoint)(unsafe.Pointer(&in.Endpoints)) + out.Ports = *(*[]discovery.EndpointPort)(unsafe.Pointer(&in.Ports)) + return nil +} + +// Convert_v1beta1_EndpointSlice_To_discovery_EndpointSlice is an autogenerated conversion function. +func Convert_v1beta1_EndpointSlice_To_discovery_EndpointSlice(in *v1beta1.EndpointSlice, out *discovery.EndpointSlice, s conversion.Scope) error { + return autoConvert_v1beta1_EndpointSlice_To_discovery_EndpointSlice(in, out, s) +} + +func autoConvert_discovery_EndpointSlice_To_v1beta1_EndpointSlice(in *discovery.EndpointSlice, out *v1beta1.EndpointSlice, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.AddressType = v1beta1.AddressType(in.AddressType) + out.Endpoints = *(*[]v1beta1.Endpoint)(unsafe.Pointer(&in.Endpoints)) + out.Ports = *(*[]v1beta1.EndpointPort)(unsafe.Pointer(&in.Ports)) + return nil +} + +// Convert_discovery_EndpointSlice_To_v1beta1_EndpointSlice is an autogenerated conversion function. +func Convert_discovery_EndpointSlice_To_v1beta1_EndpointSlice(in *discovery.EndpointSlice, out *v1beta1.EndpointSlice, s conversion.Scope) error { + return autoConvert_discovery_EndpointSlice_To_v1beta1_EndpointSlice(in, out, s) +} + +func autoConvert_v1beta1_EndpointSliceList_To_discovery_EndpointSliceList(in *v1beta1.EndpointSliceList, out *discovery.EndpointSliceList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]discovery.EndpointSlice)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1beta1_EndpointSliceList_To_discovery_EndpointSliceList is an autogenerated conversion function. +func Convert_v1beta1_EndpointSliceList_To_discovery_EndpointSliceList(in *v1beta1.EndpointSliceList, out *discovery.EndpointSliceList, s conversion.Scope) error { + return autoConvert_v1beta1_EndpointSliceList_To_discovery_EndpointSliceList(in, out, s) +} + +func autoConvert_discovery_EndpointSliceList_To_v1beta1_EndpointSliceList(in *discovery.EndpointSliceList, out *v1beta1.EndpointSliceList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]v1beta1.EndpointSlice)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_discovery_EndpointSliceList_To_v1beta1_EndpointSliceList is an autogenerated conversion function. +func Convert_discovery_EndpointSliceList_To_v1beta1_EndpointSliceList(in *discovery.EndpointSliceList, out *v1beta1.EndpointSliceList, s conversion.Scope) error { + return autoConvert_discovery_EndpointSliceList_To_v1beta1_EndpointSliceList(in, out, s) +} diff --git a/pkg/apis/discovery/v1beta1/zz_generated.defaults.go b/pkg/apis/discovery/v1beta1/zz_generated.defaults.go new file mode 100644 index 00000000000..bfcd0afbf29 --- /dev/null +++ b/pkg/apis/discovery/v1beta1/zz_generated.defaults.go @@ -0,0 +1,49 @@ +// +build !ignore_autogenerated + +/* +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 defaulter-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/discovery/v1beta1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// RegisterDefaults adds defaulters functions to the given scheme. +// Public to allow building arbitrary schemes. +// All generated defaulters are covering - they call all nested defaulters. +func RegisterDefaults(scheme *runtime.Scheme) error { + scheme.AddTypeDefaultingFunc(&v1beta1.EndpointSlice{}, func(obj interface{}) { SetObjectDefaults_EndpointSlice(obj.(*v1beta1.EndpointSlice)) }) + scheme.AddTypeDefaultingFunc(&v1beta1.EndpointSliceList{}, func(obj interface{}) { SetObjectDefaults_EndpointSliceList(obj.(*v1beta1.EndpointSliceList)) }) + return nil +} + +func SetObjectDefaults_EndpointSlice(in *v1beta1.EndpointSlice) { + for i := range in.Ports { + a := &in.Ports[i] + SetDefaults_EndpointPort(a) + } +} + +func SetObjectDefaults_EndpointSliceList(in *v1beta1.EndpointSliceList) { + for i := range in.Items { + a := &in.Items[i] + SetObjectDefaults_EndpointSlice(a) + } +} diff --git a/pkg/controller/.import-restrictions b/pkg/controller/.import-restrictions index a56a130fa3e..768f5ee89aa 100644 --- a/pkg/controller/.import-restrictions +++ b/pkg/controller/.import-restrictions @@ -27,7 +27,7 @@ "k8s.io/api/certificates/v1beta1", "k8s.io/api/core/v1", "k8s.io/api/coordination/v1", - "k8s.io/api/discovery/v1alpha1", + "k8s.io/api/discovery/v1beta1", "k8s.io/api/extensions/v1beta1", "k8s.io/api/policy/v1beta1", "k8s.io/api/rbac/v1", @@ -150,6 +150,8 @@ "k8s.io/client-go/listers/coordination/v1", "k8s.io/client-go/listers/core/v1", "k8s.io/client-go/listers/discovery/v1alpha1", + "k8s.io/client-go/listers/discovery/v1beta1", + "k8s.io/client-go/listers/coordination/v1", "k8s.io/client-go/listers/extensions/v1beta1", "k8s.io/client-go/listers/policy/v1beta1", "k8s.io/client-go/listers/rbac/v1", diff --git a/pkg/controller/endpointslice/BUILD b/pkg/controller/endpointslice/BUILD index 7749558dfb1..38b71d92328 100644 --- a/pkg/controller/endpointslice/BUILD +++ b/pkg/controller/endpointslice/BUILD @@ -18,7 +18,7 @@ go_library( "//pkg/controller/endpointslice/metrics:go_default_library", "//pkg/controller/util/endpoint:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", @@ -30,12 +30,12 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//staging/src/k8s.io/client-go/informers/core/v1:go_default_library", - "//staging/src/k8s.io/client-go/informers/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/client-go/informers/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/client-go/kubernetes:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library", "//staging/src/k8s.io/client-go/listers/core/v1:go_default_library", - "//staging/src/k8s.io/client-go/listers/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/client-go/listers/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/client-go/tools/cache:go_default_library", "//staging/src/k8s.io/client-go/tools/record:go_default_library", "//staging/src/k8s.io/client-go/util/workqueue:go_default_library", @@ -58,7 +58,7 @@ go_test( "//pkg/controller/endpointslice/metrics:go_default_library", "//pkg/controller/util/endpoint:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", diff --git a/pkg/controller/endpointslice/endpointset.go b/pkg/controller/endpointslice/endpointset.go index 22e3065e8db..5ed20b95415 100644 --- a/pkg/controller/endpointslice/endpointset.go +++ b/pkg/controller/endpointslice/endpointset.go @@ -19,7 +19,7 @@ package endpointslice import ( "sort" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" endpointutil "k8s.io/kubernetes/pkg/controller/util/endpoint" ) diff --git a/pkg/controller/endpointslice/endpointslice_controller.go b/pkg/controller/endpointslice/endpointslice_controller.go index ca51ffb9c82..4e7adf9cead 100644 --- a/pkg/controller/endpointslice/endpointslice_controller.go +++ b/pkg/controller/endpointslice/endpointslice_controller.go @@ -21,18 +21,18 @@ import ( "time" v1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" coreinformers "k8s.io/client-go/informers/core/v1" - discoveryinformers "k8s.io/client-go/informers/discovery/v1alpha1" + discoveryinformers "k8s.io/client-go/informers/discovery/v1beta1" clientset "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" v1core "k8s.io/client-go/kubernetes/typed/core/v1" corelisters "k8s.io/client-go/listers/core/v1" - discoverylisters "k8s.io/client-go/listers/discovery/v1alpha1" + discoverylisters "k8s.io/client-go/listers/discovery/v1beta1" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" "k8s.io/client-go/util/workqueue" @@ -84,7 +84,7 @@ func NewController(podInformer coreinformers.PodInformer, recorder := broadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "endpoint-slice-controller"}) if client != nil && client.CoreV1().RESTClient().GetRateLimiter() != nil { - ratelimiter.RegisterMetricAndTrackRateLimiterUsage("endpoint_slice_controller", client.DiscoveryV1alpha1().RESTClient().GetRateLimiter()) + ratelimiter.RegisterMetricAndTrackRateLimiterUsage("endpoint_slice_controller", client.DiscoveryV1beta1().RESTClient().GetRateLimiter()) } endpointslicemetrics.RegisterMetrics() @@ -399,7 +399,7 @@ func (c *Controller) ensureSetupManagedByAnnotation(service *v1.Service) error { } endpointSlice.Labels[discovery.LabelManagedBy] = controllerName - _, err = c.client.DiscoveryV1alpha1().EndpointSlices(endpointSlice.Namespace).Update(endpointSlice) + _, err = c.client.DiscoveryV1beta1().EndpointSlices(endpointSlice.Namespace).Update(endpointSlice) if err != nil { return err } diff --git a/pkg/controller/endpointslice/endpointslice_controller_test.go b/pkg/controller/endpointslice/endpointslice_controller_test.go index 2d3d69ffb62..0a050c48ac6 100644 --- a/pkg/controller/endpointslice/endpointslice_controller_test.go +++ b/pkg/controller/endpointslice/endpointslice_controller_test.go @@ -24,7 +24,7 @@ import ( "github.com/stretchr/testify/assert" v1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/informers" @@ -62,7 +62,7 @@ func newController(nodeNames []string) (*fake.Clientset, *endpointSliceControlle informerFactory.Core().V1().Pods(), informerFactory.Core().V1().Services(), nodeInformer, - informerFactory.Discovery().V1alpha1().EndpointSlices(), + informerFactory.Discovery().V1beta1().EndpointSlices(), int32(100), client) @@ -73,7 +73,7 @@ func newController(nodeNames []string) (*fake.Clientset, *endpointSliceControlle return client, &endpointSliceController{ esController, - informerFactory.Discovery().V1alpha1().EndpointSlices().Informer().GetStore(), + informerFactory.Discovery().V1beta1().EndpointSlices().Informer().GetStore(), informerFactory.Core().V1().Nodes().Informer().GetStore(), informerFactory.Core().V1().Pods().Informer().GetStore(), informerFactory.Core().V1().Services().Informer().GetStore(), @@ -105,7 +105,7 @@ func TestSyncServiceWithSelector(t *testing.T) { standardSyncService(t, esController, ns, serviceName, "true") expectActions(t, client.Actions(), 1, "create", "endpointslices") - sliceList, err := client.DiscoveryV1alpha1().EndpointSlices(ns).List(metav1.ListOptions{}) + sliceList, err := client.DiscoveryV1beta1().EndpointSlices(ns).List(metav1.ListOptions{}) assert.Nil(t, err, "Expected no error fetching endpoint slices") assert.Len(t, sliceList.Items, 1, "Expected 1 endpoint slices") slice := sliceList.Items[0] @@ -172,7 +172,7 @@ func TestSyncServicePodSelection(t *testing.T) { expectActions(t, client.Actions(), 1, "create", "endpointslices") // an endpoint slice should be created, it should only reference pod1 (not pod2) - slices, err := client.DiscoveryV1alpha1().EndpointSlices(ns).List(metav1.ListOptions{}) + slices, err := client.DiscoveryV1beta1().EndpointSlices(ns).List(metav1.ListOptions{}) assert.Nil(t, err, "Expected no error fetching endpoint slices") assert.Len(t, slices.Items, 1, "Expected 1 endpoint slices") slice := slices.Items[0] @@ -246,7 +246,7 @@ func TestSyncServiceEndpointSliceLabelSelection(t *testing.T) { if err != nil { t.Fatalf("Expected no error adding EndpointSlice: %v", err) } - _, err = client.DiscoveryV1alpha1().EndpointSlices(ns).Create(endpointSlice) + _, err = client.DiscoveryV1beta1().EndpointSlices(ns).Create(endpointSlice) if err != nil { t.Fatalf("Expected no error creating EndpointSlice: %v", err) } @@ -315,7 +315,7 @@ func TestSyncServiceFull(t *testing.T) { // last action should be to create endpoint slice expectActions(t, client.Actions(), 1, "create", "endpointslices") - sliceList, err := client.DiscoveryV1alpha1().EndpointSlices(namespace).List(metav1.ListOptions{}) + sliceList, err := client.DiscoveryV1beta1().EndpointSlices(namespace).List(metav1.ListOptions{}) assert.Nil(t, err, "Expected no error fetching endpoint slices") assert.Len(t, sliceList.Items, 1, "Expected 1 endpoint slices") @@ -323,18 +323,18 @@ func TestSyncServiceFull(t *testing.T) { slice := sliceList.Items[0] assert.Len(t, slice.Endpoints, 1, "Expected 1 endpoints in first slice") assert.Equal(t, slice.Annotations["endpoints.kubernetes.io/last-change-trigger-time"], serviceCreateTime.Format(time.RFC3339Nano)) - assert.ElementsMatch(t, []discovery.EndpointPort{{ - Name: strPtr("tcp-example"), - Protocol: protoPtr(v1.ProtocolTCP), - Port: int32Ptr(int32(80)), + assert.EqualValues(t, []discovery.EndpointPort{{ + Name: strPtr("sctp-example"), + Protocol: protoPtr(v1.ProtocolSCTP), + Port: int32Ptr(int32(3456)), }, { Name: strPtr("udp-example"), Protocol: protoPtr(v1.ProtocolUDP), Port: int32Ptr(int32(161)), }, { - Name: strPtr("sctp-example"), - Protocol: protoPtr(v1.ProtocolSCTP), - Port: int32Ptr(int32(3456)), + Name: strPtr("tcp-example"), + Protocol: protoPtr(v1.ProtocolTCP), + Port: int32Ptr(int32(80)), }}, slice.Ports) assert.ElementsMatch(t, []discovery.Endpoint{{ @@ -417,7 +417,7 @@ func TestEnsureSetupManagedByAnnotation(t *testing.T) { t.Fatalf("Expected no error adding EndpointSlice: %v", err) } - _, err = client.DiscoveryV1alpha1().EndpointSlices(ns).Create(endpointSlice) + _, err = client.DiscoveryV1beta1().EndpointSlices(ns).Create(endpointSlice) if err != nil { t.Fatalf("Expected no error creating EndpointSlice: %v", err) } @@ -433,7 +433,7 @@ func TestEnsureSetupManagedByAnnotation(t *testing.T) { t.Errorf("Expected managedBySetupAnnotation: %+v, got: %+v", managedBySetupCompleteValue, updatedService.Annotations[managedBySetupAnnotation]) } - updatedSlice, err := client.DiscoveryV1alpha1().EndpointSlices(ns).Get(endpointSlice.Name, metav1.GetOptions{}) + updatedSlice, err := client.DiscoveryV1beta1().EndpointSlices(ns).Get(endpointSlice.Name, metav1.GetOptions{}) if err != nil { t.Fatalf("Expected no error getting EndpointSlice: %v", err) } diff --git a/pkg/controller/endpointslice/metrics/BUILD b/pkg/controller/endpointslice/metrics/BUILD index ea78d6d6a07..c1d242596fd 100644 --- a/pkg/controller/endpointslice/metrics/BUILD +++ b/pkg/controller/endpointslice/metrics/BUILD @@ -36,7 +36,7 @@ go_test( embed = [":go_default_library"], deps = [ "//pkg/controller/util/endpoint:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", ], ) diff --git a/pkg/controller/endpointslice/metrics/cache_test.go b/pkg/controller/endpointslice/metrics/cache_test.go index 8d5d74ef223..af6db208636 100644 --- a/pkg/controller/endpointslice/metrics/cache_test.go +++ b/pkg/controller/endpointslice/metrics/cache_test.go @@ -19,7 +19,7 @@ package metrics import ( "testing" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" "k8s.io/apimachinery/pkg/types" endpointutil "k8s.io/kubernetes/pkg/controller/util/endpoint" ) diff --git a/pkg/controller/endpointslice/reconciler.go b/pkg/controller/endpointslice/reconciler.go index 8b8dae4c022..4f6af23e2ee 100644 --- a/pkg/controller/endpointslice/reconciler.go +++ b/pkg/controller/endpointslice/reconciler.go @@ -22,7 +22,7 @@ import ( "time" corev1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -56,7 +56,8 @@ type endpointMeta struct { // to ensure the desired set of pods are represented by endpoint slices. func (r *reconciler) reconcile(service *corev1.Service, pods []*corev1.Pod, existingSlices []*discovery.EndpointSlice, triggerTime time.Time) error { addressType := discovery.AddressTypeIPv4 - if service.Spec.IPFamily != nil && *service.Spec.IPFamily == corev1.IPv6Protocol { + + if isIPv6Service(service) { addressType = discovery.AddressTypeIPv6 } @@ -203,7 +204,7 @@ func (r *reconciler) finalize( for _, endpointSlice := range slicesToCreate { addTriggerTimeAnnotation(endpointSlice, triggerTime) - _, err := r.client.DiscoveryV1alpha1().EndpointSlices(service.Namespace).Create(endpointSlice) + _, err := r.client.DiscoveryV1beta1().EndpointSlices(service.Namespace).Create(endpointSlice) if err != nil { // If the namespace is terminating, creates will continue to fail. Simply drop the item. if errors.HasStatusCause(err, corev1.NamespaceTerminatingCause) { @@ -217,7 +218,7 @@ func (r *reconciler) finalize( for _, endpointSlice := range slicesToUpdate { addTriggerTimeAnnotation(endpointSlice, triggerTime) - _, err := r.client.DiscoveryV1alpha1().EndpointSlices(service.Namespace).Update(endpointSlice) + _, err := r.client.DiscoveryV1beta1().EndpointSlices(service.Namespace).Update(endpointSlice) if err != nil { errs = append(errs, fmt.Errorf("Error updating %s EndpointSlice for Service %s/%s: %v", endpointSlice.Name, service.Namespace, service.Name, err)) } else { @@ -226,7 +227,7 @@ func (r *reconciler) finalize( } for _, endpointSlice := range slicesToDelete { - err := r.client.DiscoveryV1alpha1().EndpointSlices(service.Namespace).Delete(endpointSlice.Name, &metav1.DeleteOptions{}) + err := r.client.DiscoveryV1beta1().EndpointSlices(service.Namespace).Delete(endpointSlice.Name, &metav1.DeleteOptions{}) if err != nil { errs = append(errs, fmt.Errorf("Error deleting %s EndpointSlice for Service %s/%s: %v", endpointSlice.Name, service.Namespace, service.Name, err)) } else { diff --git a/pkg/controller/endpointslice/reconciler_test.go b/pkg/controller/endpointslice/reconciler_test.go index babbc02a9bb..a8b0644e4bb 100644 --- a/pkg/controller/endpointslice/reconciler_test.go +++ b/pkg/controller/endpointslice/reconciler_test.go @@ -27,7 +27,7 @@ import ( "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" apiequality "k8s.io/apimachinery/pkg/api/equality" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" @@ -72,6 +72,8 @@ func TestReconcile1Pod(t *testing.T) { svcv4, _ := newServiceAndEndpointMeta("foo", namespace) svcv6, _ := newServiceAndEndpointMeta("foo", namespace) svcv6.Spec.IPFamily = &ipv6Family + svcv6ClusterIP, _ := newServiceAndEndpointMeta("foo", namespace) + svcv6ClusterIP.Spec.ClusterIP = "1234::5678:0000:0000:9abc:def1" pod1 := newPod(1, namespace, true, 1) pod1.Status.PodIPs = []corev1.PodIP{{IP: "1.2.3.4"}, {IP: "1234::5678:0000:0000:9abc:def0"}} @@ -127,6 +129,24 @@ func TestReconcile1Pod(t *testing.T) { }, }, }, + "ipv6-clusterip": { + service: svcv6ClusterIP, + expectedAddressType: discovery.AddressTypeIPv6, + expectedEndpoint: discovery.Endpoint{ + Addresses: []string{"1234::5678:0000:0000:9abc:def0"}, + Conditions: discovery.EndpointConditions{Ready: utilpointer.BoolPtr(true)}, + Topology: map[string]string{ + "kubernetes.io/hostname": "node-1", + "topology.kubernetes.io/zone": "us-central1-a", + "topology.kubernetes.io/region": "us-central1", + }, + TargetRef: &corev1.ObjectReference{ + Kind: "Pod", + Namespace: namespace, + Name: "pod1", + }, + }, + }, } for name, testCase := range testCases { @@ -183,7 +203,7 @@ func TestReconcile1EndpointSlice(t *testing.T) { svc, endpointMeta := newServiceAndEndpointMeta("foo", namespace) endpointSlice1 := newEmptyEndpointSlice(1, namespace, endpointMeta, svc) - _, createErr := client.DiscoveryV1alpha1().EndpointSlices(namespace).Create(endpointSlice1) + _, createErr := client.DiscoveryV1beta1().EndpointSlices(namespace).Create(endpointSlice1) assert.Nil(t, createErr, "Expected no error creating endpoint slice") numActionsBefore := len(client.Actions()) @@ -786,7 +806,7 @@ func portsAndAddressTypeEqual(slice1, slice2 discovery.EndpointSlice) bool { func createEndpointSlices(t *testing.T, client *fake.Clientset, namespace string, endpointSlices []*discovery.EndpointSlice) { t.Helper() for _, endpointSlice := range endpointSlices { - _, err := client.DiscoveryV1alpha1().EndpointSlices(namespace).Create(endpointSlice) + _, err := client.DiscoveryV1beta1().EndpointSlices(namespace).Create(endpointSlice) if err != nil { t.Fatalf("Expected no error creating Endpoint Slice, got: %v", err) } @@ -795,7 +815,7 @@ func createEndpointSlices(t *testing.T, client *fake.Clientset, namespace string func fetchEndpointSlices(t *testing.T, client *fake.Clientset, namespace string) []discovery.EndpointSlice { t.Helper() - fetchedSlices, err := client.DiscoveryV1alpha1().EndpointSlices(namespace).List(metav1.ListOptions{}) + fetchedSlices, err := client.DiscoveryV1beta1().EndpointSlices(namespace).List(metav1.ListOptions{}) if err != nil { t.Fatalf("Expected no error fetching Endpoint Slices, got: %v", err) return []discovery.EndpointSlice{} diff --git a/pkg/controller/endpointslice/utils.go b/pkg/controller/endpointslice/utils.go index e1e4b670e59..88fedf15b6a 100644 --- a/pkg/controller/endpointslice/utils.go +++ b/pkg/controller/endpointslice/utils.go @@ -22,7 +22,7 @@ import ( "time" corev1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" apiequality "k8s.io/apimachinery/pkg/api/equality" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" @@ -71,7 +71,7 @@ func podToEndpoint(pod *corev1.Pod, node *corev1.Node, service *corev1.Service) ready := service.Spec.PublishNotReadyAddresses || podutil.IsPodReady(pod) ep := discovery.Endpoint{ - Addresses: getEndpointAddresses(pod.Status, service.Spec.IPFamily), + Addresses: getEndpointAddresses(pod.Status, service), Conditions: discovery.EndpointConditions{ Ready: &ready, }, @@ -125,13 +125,12 @@ func getEndpointPorts(service *corev1.Service, pod *corev1.Pod) []discovery.Endp } // getEndpointAddresses returns a list of addresses generated from a pod status. -func getEndpointAddresses(podStatus corev1.PodStatus, ipFamily *corev1.IPFamily) []string { - isIPv6Family := ipFamily != nil && *ipFamily == corev1.IPv6Protocol +func getEndpointAddresses(podStatus corev1.PodStatus, service *corev1.Service) []string { addresses := []string{} for _, podIP := range podStatus.PodIPs { isIPv6PodIP := utilnet.IsIPv6String(podIP.IP) - if isIPv6Family == isIPv6PodIP { + if isIPv6PodIP == isIPv6Service(service) { addresses = append(addresses, podIP.IP) } } @@ -139,6 +138,12 @@ func getEndpointAddresses(podStatus corev1.PodStatus, ipFamily *corev1.IPFamily) return addresses } +// isIPv6Service returns true if the Service uses IPv6 addresses. +func isIPv6Service(service *corev1.Service) bool { + // IPFamily is not guaranteed to be set, even in an IPv6 only cluster. + return (service.Spec.IPFamily != nil && *service.Spec.IPFamily == corev1.IPv6Protocol) || utilnet.IsIPv6String(service.Spec.ClusterIP) +} + // endpointsEqualBeyondHash returns true if endpoints have equal attributes // but excludes equality checks that would have already been covered with // endpoint hashing (see hashEndpoint func for more info). diff --git a/pkg/controller/endpointslice/utils_test.go b/pkg/controller/endpointslice/utils_test.go index ad0cb3ba69d..a9c60026ef2 100644 --- a/pkg/controller/endpointslice/utils_test.go +++ b/pkg/controller/endpointslice/utils_test.go @@ -24,7 +24,7 @@ import ( "github.com/stretchr/testify/assert" v1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/controller/util/endpoint/BUILD b/pkg/controller/util/endpoint/BUILD index dc0331f6807..3a17c9c71f9 100644 --- a/pkg/controller/util/endpoint/BUILD +++ b/pkg/controller/util/endpoint/BUILD @@ -13,7 +13,7 @@ go_library( "//pkg/controller:go_default_library", "//pkg/util/hash:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", diff --git a/pkg/controller/util/endpoint/controller_utils.go b/pkg/controller/util/endpoint/controller_utils.go index cf07089e9b2..4d597ba66aa 100644 --- a/pkg/controller/util/endpoint/controller_utils.go +++ b/pkg/controller/util/endpoint/controller_utils.go @@ -25,7 +25,7 @@ import ( "sync" v1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" "k8s.io/apimachinery/pkg/labels" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/sets" diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go index bdf0ca05424..1d94ea77c72 100644 --- a/pkg/features/kube_features.go +++ b/pkg/features/kube_features.go @@ -576,7 +576,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS VolumePVCDataSource: {Default: true, PreRelease: featuregate.Beta}, PodOverhead: {Default: false, PreRelease: featuregate.Alpha}, IPv6DualStack: {Default: false, PreRelease: featuregate.Alpha}, - EndpointSlice: {Default: false, PreRelease: featuregate.Alpha}, + EndpointSlice: {Default: true, PreRelease: featuregate.Beta}, EvenPodsSpread: {Default: false, PreRelease: featuregate.Alpha}, StartupProbe: {Default: false, PreRelease: featuregate.Alpha}, AllowInsecureBackendProxy: {Default: true, PreRelease: featuregate.Beta}, diff --git a/pkg/master/BUILD b/pkg/master/BUILD index 24fb140945d..cfe4d5f7c4f 100644 --- a/pkg/master/BUILD +++ b/pkg/master/BUILD @@ -91,7 +91,7 @@ go_library( "//staging/src/k8s.io/api/coordination/v1:go_default_library", "//staging/src/k8s.io/api/coordination/v1beta1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/api/events/v1beta1:go_default_library", "//staging/src/k8s.io/api/extensions/v1beta1:go_default_library", "//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library", @@ -127,7 +127,7 @@ go_library( "//staging/src/k8s.io/client-go/informers:go_default_library", "//staging/src/k8s.io/client-go/kubernetes:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library", - "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/client-go/rest:go_default_library", "//vendor/github.com/prometheus/client_golang/prometheus:go_default_library", "//vendor/k8s.io/klog:go_default_library", diff --git a/pkg/master/master.go b/pkg/master/master.go index fe080c2103c..590f867c7cb 100644 --- a/pkg/master/master.go +++ b/pkg/master/master.go @@ -44,7 +44,7 @@ import ( coordinationapiv1 "k8s.io/api/coordination/v1" coordinationapiv1beta1 "k8s.io/api/coordination/v1beta1" apiv1 "k8s.io/api/core/v1" - discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" eventsv1beta1 "k8s.io/api/events/v1beta1" extensionsapiv1beta1 "k8s.io/api/extensions/v1beta1" flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" @@ -77,7 +77,7 @@ import ( "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" corev1client "k8s.io/client-go/kubernetes/typed/core/v1" - discoveryclient "k8s.io/client-go/kubernetes/typed/discovery/v1alpha1" + discoveryclient "k8s.io/client-go/kubernetes/typed/discovery/v1beta1" api "k8s.io/kubernetes/pkg/apis/core" "k8s.io/kubernetes/pkg/features" kubeoptions "k8s.io/kubernetes/pkg/kubeapiserver/options" @@ -579,6 +579,7 @@ func DefaultAPIResourceConfigSource() *serverstorage.ResourceConfig { certificatesapiv1beta1.SchemeGroupVersion, coordinationapiv1.SchemeGroupVersion, coordinationapiv1beta1.SchemeGroupVersion, + discoveryv1beta1.SchemeGroupVersion, eventsv1beta1.SchemeGroupVersion, extensionsapiv1beta1.SchemeGroupVersion, networkingapiv1.SchemeGroupVersion, @@ -614,7 +615,6 @@ func DefaultAPIResourceConfigSource() *serverstorage.ResourceConfig { ret.DisableVersions( auditregistrationv1alpha1.SchemeGroupVersion, batchapiv2alpha1.SchemeGroupVersion, - discoveryv1alpha1.SchemeGroupVersion, nodev1alpha1.SchemeGroupVersion, rbacv1alpha1.SchemeGroupVersion, schedulingv1alpha1.SchemeGroupVersion, diff --git a/pkg/master/reconcilers/BUILD b/pkg/master/reconcilers/BUILD index b6cec8280fc..a0a16d2a2c7 100644 --- a/pkg/master/reconcilers/BUILD +++ b/pkg/master/reconcilers/BUILD @@ -15,7 +15,7 @@ go_library( deps = [ "//pkg/api/v1/endpoints:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", @@ -24,7 +24,7 @@ go_library( "//staging/src/k8s.io/apiserver/pkg/registry/rest:go_default_library", "//staging/src/k8s.io/apiserver/pkg/storage:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library", - "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/client-go/util/retry:go_default_library", "//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/utils/net:go_default_library", @@ -40,7 +40,7 @@ go_test( embed = [":go_default_library"], deps = [ "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", diff --git a/pkg/master/reconcilers/endpointsadapter.go b/pkg/master/reconcilers/endpointsadapter.go index deed9ff2e75..5ad8cb687d9 100644 --- a/pkg/master/reconcilers/endpointsadapter.go +++ b/pkg/master/reconcilers/endpointsadapter.go @@ -18,12 +18,12 @@ package reconcilers import ( corev1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" corev1client "k8s.io/client-go/kubernetes/typed/core/v1" - discoveryclient "k8s.io/client-go/kubernetes/typed/discovery/v1alpha1" + discoveryclient "k8s.io/client-go/kubernetes/typed/discovery/v1beta1" utilnet "k8s.io/utils/net" ) @@ -123,7 +123,7 @@ func endpointSliceFromEndpoints(endpoints *corev1.Endpoints) *discovery.Endpoint endpointSlice.Name = endpoints.Name endpointSlice.Labels = map[string]string{discovery.LabelServiceName: endpoints.Name} - // TODO: Add support for IPv6 addresses here (and in the rest of + // TODO: Add support for dual stack here (and in the rest of // EndpointsAdapter). endpointSlice.AddressType = discovery.AddressTypeIPv4 @@ -136,6 +136,11 @@ func endpointSliceFromEndpoints(endpoints *corev1.Endpoints) *discovery.Endpoint Protocol: &subset.Ports[i].Protocol, }) } + + if allAddressesIPv6(append(subset.Addresses, subset.NotReadyAddresses...)) { + endpointSlice.AddressType = discovery.AddressTypeIPv6 + } + endpointSlice.Endpoints = append(endpointSlice.Endpoints, getEndpointsFromAddresses(subset.Addresses, endpointSlice.AddressType, true)...) endpointSlice.Endpoints = append(endpointSlice.Endpoints, getEndpointsFromAddresses(subset.NotReadyAddresses, endpointSlice.AddressType, false)...) } @@ -172,3 +177,18 @@ func endpointFromAddress(address corev1.EndpointAddress, ready bool) discovery.E Topology: topology, } } + +// allAddressesIPv6 returns true if all provided addresses are IPv6. +func allAddressesIPv6(addresses []corev1.EndpointAddress) bool { + if len(addresses) == 0 { + return false + } + + for _, address := range addresses { + if !utilnet.IsIPv6String(address.IP) { + return false + } + } + + return true +} diff --git a/pkg/master/reconcilers/endpointsadapter_test.go b/pkg/master/reconcilers/endpointsadapter_test.go index a418d2bd125..16edff0863d 100644 --- a/pkg/master/reconcilers/endpointsadapter_test.go +++ b/pkg/master/reconcilers/endpointsadapter_test.go @@ -21,7 +21,7 @@ import ( "testing" corev1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -79,7 +79,7 @@ func TestEndpointsAdapterGet(t *testing.T) { client := fake.NewSimpleClientset() epAdapter := EndpointsAdapter{endpointClient: client.CoreV1()} if testCase.endpointSlicesEnabled { - epAdapter.endpointSliceClient = client.DiscoveryV1alpha1() + epAdapter.endpointSliceClient = client.DiscoveryV1beta1() } for _, endpoints := range testCase.endpoints { @@ -110,6 +110,11 @@ func TestEndpointsAdapterCreate(t *testing.T) { endpoints2, _ := generateEndpointsAndSlice("foo", "testing", []int{80}, []string{"10.1.2.5", "10.1.2.6", "1234::5678:0000:0000:9abc:def0"}) _, epSlice2 := generateEndpointsAndSlice("foo", "testing", []int{80}, []string{"10.1.2.5", "10.1.2.6"}) + // ensure that Endpoints with only IPv6 addresses result in EndpointSlice + // with an IPv6 address type. + endpoints3, epSlice3 := generateEndpointsAndSlice("foo", "testing", []int{80}, []string{"1234::5678:0000:0000:9abc:def0"}) + epSlice3.AddressType = discovery.AddressTypeIPv6 + testCases := map[string]struct { endpointSlicesEnabled bool expectedError error @@ -129,7 +134,7 @@ func TestEndpointsAdapterCreate(t *testing.T) { namespaceParam: endpoints1.Namespace, endpointsParam: endpoints1, }, - "single-endpoint-with-ipv6": { + "single-endpoint-partial-ipv6": { endpointSlicesEnabled: true, expectedError: nil, expectedEndpoints: endpoints2, @@ -138,6 +143,15 @@ func TestEndpointsAdapterCreate(t *testing.T) { namespaceParam: endpoints2.Namespace, endpointsParam: endpoints2, }, + "single-endpoint-full-ipv6": { + endpointSlicesEnabled: true, + expectedError: nil, + expectedEndpoints: endpoints3, + expectedEndpointSlice: epSlice3, + endpoints: []*corev1.Endpoints{}, + namespaceParam: endpoints3.Namespace, + endpointsParam: endpoints3, + }, "single-endpoint-no-slices": { endpointSlicesEnabled: false, expectedError: nil, @@ -163,7 +177,7 @@ func TestEndpointsAdapterCreate(t *testing.T) { client := fake.NewSimpleClientset() epAdapter := EndpointsAdapter{endpointClient: client.CoreV1()} if testCase.endpointSlicesEnabled { - epAdapter.endpointSliceClient = client.DiscoveryV1alpha1() + epAdapter.endpointSliceClient = client.DiscoveryV1beta1() } for _, endpoints := range testCase.endpoints { @@ -183,7 +197,7 @@ func TestEndpointsAdapterCreate(t *testing.T) { t.Errorf("Expected endpoints: %v, got: %v", testCase.expectedEndpoints, endpoints) } - epSliceList, err := client.DiscoveryV1alpha1().EndpointSlices(testCase.namespaceParam).List(metav1.ListOptions{}) + epSliceList, err := client.DiscoveryV1beta1().EndpointSlices(testCase.namespaceParam).List(metav1.ListOptions{}) if err != nil { t.Fatalf("Error listing Endpoint Slices: %v", err) } @@ -274,7 +288,7 @@ func TestEndpointsAdapterUpdate(t *testing.T) { client := fake.NewSimpleClientset() epAdapter := EndpointsAdapter{endpointClient: client.CoreV1()} if testCase.endpointSlicesEnabled { - epAdapter.endpointSliceClient = client.DiscoveryV1alpha1() + epAdapter.endpointSliceClient = client.DiscoveryV1beta1() } for _, endpoints := range testCase.endpoints { @@ -294,7 +308,7 @@ func TestEndpointsAdapterUpdate(t *testing.T) { t.Errorf("Expected endpoints: %v, got: %v", testCase.expectedEndpoints, endpoints) } - epSliceList, err := client.DiscoveryV1alpha1().EndpointSlices(testCase.namespaceParam).List(metav1.ListOptions{}) + epSliceList, err := client.DiscoveryV1beta1().EndpointSlices(testCase.namespaceParam).List(metav1.ListOptions{}) if err != nil { t.Fatalf("Error listing Endpoint Slices: %v", err) } @@ -416,11 +430,11 @@ func TestEndpointsAdapterEnsureEndpointSliceFromEndpoints(t *testing.T) { client := fake.NewSimpleClientset() epAdapter := EndpointsAdapter{endpointClient: client.CoreV1()} if testCase.endpointSlicesEnabled { - epAdapter.endpointSliceClient = client.DiscoveryV1alpha1() + epAdapter.endpointSliceClient = client.DiscoveryV1beta1() } for _, endpointSlice := range testCase.endpointSlices { - _, err := client.DiscoveryV1alpha1().EndpointSlices(endpointSlice.Namespace).Create(endpointSlice) + _, err := client.DiscoveryV1beta1().EndpointSlices(endpointSlice.Namespace).Create(endpointSlice) if err != nil { t.Fatalf("Error creating EndpointSlice: %v", err) } @@ -431,7 +445,7 @@ func TestEndpointsAdapterEnsureEndpointSliceFromEndpoints(t *testing.T) { t.Errorf("Expected error: %v, got: %v", testCase.expectedError, err) } - endpointSlice, err := client.DiscoveryV1alpha1().EndpointSlices(testCase.namespaceParam).Get(testCase.endpointsParam.Name, metav1.GetOptions{}) + endpointSlice, err := client.DiscoveryV1beta1().EndpointSlices(testCase.namespaceParam).Get(testCase.endpointsParam.Name, metav1.GetOptions{}) if err != nil && !errors.IsNotFound(err) { t.Fatalf("Error getting Endpoint Slice: %v", err) } diff --git a/pkg/master/storageversionhashdata/data.go b/pkg/master/storageversionhashdata/data.go index a77a8d5639e..ff87134f61b 100644 --- a/pkg/master/storageversionhashdata/data.go +++ b/pkg/master/storageversionhashdata/data.go @@ -65,6 +65,7 @@ var GVRToStorageVersionHash = map[string]string{ "certificates.k8s.io/v1beta1/certificatesigningrequests": "UQh3YTCDIf0=", "coordination.k8s.io/v1beta1/leases": "/sY7hl8ol1U=", "coordination.k8s.io/v1/leases": "/sY7hl8ol1U=", + "discovery.k8s.io/v1beta1/endpointslices": "Nx3SIv6I0mE=", "extensions/v1beta1/ingresses": "ZOAfGflaKd0=", "networking.k8s.io/v1/networkpolicies": "YpfwF18m1G8=", "networking.k8s.io/v1beta1/ingresses": "ZOAfGflaKd0=", diff --git a/pkg/printers/internalversion/BUILD b/pkg/printers/internalversion/BUILD index e2cd4fa646b..8d2e0ad72fd 100644 --- a/pkg/printers/internalversion/BUILD +++ b/pkg/printers/internalversion/BUILD @@ -92,7 +92,7 @@ go_library( "//staging/src/k8s.io/api/certificates/v1beta1:go_default_library", "//staging/src/k8s.io/api/coordination/v1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/api/extensions/v1beta1:go_default_library", "//staging/src/k8s.io/api/policy/v1beta1:go_default_library", "//staging/src/k8s.io/api/rbac/v1beta1:go_default_library", diff --git a/pkg/printers/internalversion/printers.go b/pkg/printers/internalversion/printers.go index d244d40bcb1..c62da194e09 100644 --- a/pkg/printers/internalversion/printers.go +++ b/pkg/printers/internalversion/printers.go @@ -32,7 +32,7 @@ import ( certificatesv1beta1 "k8s.io/api/certificates/v1beta1" coordinationv1 "k8s.io/api/coordination/v1" apiv1 "k8s.io/api/core/v1" - discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" extensionsv1beta1 "k8s.io/api/extensions/v1beta1" policyv1beta1 "k8s.io/api/policy/v1beta1" rbacv1beta1 "k8s.io/api/rbac/v1beta1" @@ -475,9 +475,9 @@ func AddHandlers(h printers.PrintHandler) { endpointSliceColumnDefinitions := []metav1beta1.TableColumnDefinition{ {Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]}, - {Name: "AddressType", Type: "string", Description: discoveryv1alpha1.EndpointSlice{}.SwaggerDoc()["addressType"]}, - {Name: "Ports", Type: "string", Description: discoveryv1alpha1.EndpointSlice{}.SwaggerDoc()["ports"]}, - {Name: "Endpoints", Type: "string", Description: discoveryv1alpha1.EndpointSlice{}.SwaggerDoc()["endpoints"]}, + {Name: "AddressType", Type: "string", Description: discoveryv1beta1.EndpointSlice{}.SwaggerDoc()["addressType"]}, + {Name: "Ports", Type: "string", Description: discoveryv1beta1.EndpointSlice{}.SwaggerDoc()["ports"]}, + {Name: "Endpoints", Type: "string", Description: discoveryv1beta1.EndpointSlice{}.SwaggerDoc()["endpoints"]}, {Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]}, } h.TableHandler(endpointSliceColumnDefinitions, printEndpointSlice) diff --git a/pkg/proxy/BUILD b/pkg/proxy/BUILD index 761d0aec8b9..0e2c5d1e541 100644 --- a/pkg/proxy/BUILD +++ b/pkg/proxy/BUILD @@ -22,7 +22,7 @@ go_library( "//pkg/proxy/metrics:go_default_library", "//pkg/proxy/util:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//staging/src/k8s.io/client-go/tools/record:go_default_library", @@ -66,7 +66,7 @@ go_test( embed = [":go_default_library"], deps = [ "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library", diff --git a/pkg/proxy/config/BUILD b/pkg/proxy/config/BUILD index 92881120869..b8223cbf40a 100644 --- a/pkg/proxy/config/BUILD +++ b/pkg/proxy/config/BUILD @@ -15,10 +15,10 @@ go_library( importpath = "k8s.io/kubernetes/pkg/proxy/config", deps = [ "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library", "//staging/src/k8s.io/client-go/informers/core/v1:go_default_library", - "//staging/src/k8s.io/client-go/informers/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/client-go/informers/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/client-go/tools/cache:go_default_library", "//vendor/k8s.io/klog:go_default_library", ], diff --git a/pkg/proxy/config/config.go b/pkg/proxy/config/config.go index 76947e73327..3010821f85a 100644 --- a/pkg/proxy/config/config.go +++ b/pkg/proxy/config/config.go @@ -21,10 +21,10 @@ import ( "time" "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" utilruntime "k8s.io/apimachinery/pkg/util/runtime" coreinformers "k8s.io/client-go/informers/core/v1" - discoveryinformers "k8s.io/client-go/informers/discovery/v1alpha1" + discoveryinformers "k8s.io/client-go/informers/discovery/v1beta1" "k8s.io/client-go/tools/cache" "k8s.io/klog" ) diff --git a/pkg/proxy/endpoints.go b/pkg/proxy/endpoints.go index 7916c88b215..76a4e0da9b6 100644 --- a/pkg/proxy/endpoints.go +++ b/pkg/proxy/endpoints.go @@ -26,7 +26,7 @@ import ( "k8s.io/klog" v1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/tools/record" diff --git a/pkg/proxy/endpoints_test.go b/pkg/proxy/endpoints_test.go index db35ca83f5e..4238aaaa299 100644 --- a/pkg/proxy/endpoints_test.go +++ b/pkg/proxy/endpoints_test.go @@ -24,7 +24,7 @@ import ( "github.com/davecgh/go-spew/spew" "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" diff --git a/pkg/proxy/endpointslicecache.go b/pkg/proxy/endpointslicecache.go index d1fdeb963ab..85882bf5c35 100644 --- a/pkg/proxy/endpointslicecache.go +++ b/pkg/proxy/endpointslicecache.go @@ -24,7 +24,7 @@ import ( "sync" "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" "k8s.io/klog" diff --git a/pkg/proxy/endpointslicecache_test.go b/pkg/proxy/endpointslicecache_test.go index bfd38c8690c..244348413e0 100644 --- a/pkg/proxy/endpointslicecache_test.go +++ b/pkg/proxy/endpointslicecache_test.go @@ -22,7 +22,7 @@ import ( "testing" "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" utilpointer "k8s.io/utils/pointer" diff --git a/pkg/proxy/iptables/BUILD b/pkg/proxy/iptables/BUILD index 3ba4b3ff738..188925f9588 100644 --- a/pkg/proxy/iptables/BUILD +++ b/pkg/proxy/iptables/BUILD @@ -21,7 +21,7 @@ go_library( "//pkg/util/iptables:go_default_library", "//pkg/util/sysctl:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library", @@ -46,7 +46,7 @@ go_test( "//pkg/util/iptables:go_default_library", "//pkg/util/iptables/testing:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library", diff --git a/pkg/proxy/iptables/proxier.go b/pkg/proxy/iptables/proxier.go index ff040cc793f..9f17033e588 100644 --- a/pkg/proxy/iptables/proxier.go +++ b/pkg/proxy/iptables/proxier.go @@ -32,8 +32,8 @@ import ( "sync/atomic" "time" - v1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + "k8s.io/api/core/v1" + discovery "k8s.io/api/discovery/v1beta1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" utilfeature "k8s.io/apiserver/pkg/util/feature" diff --git a/pkg/proxy/iptables/proxier_test.go b/pkg/proxy/iptables/proxier_test.go index b2cc8d30571..381b6e1a902 100644 --- a/pkg/proxy/iptables/proxier_test.go +++ b/pkg/proxy/iptables/proxier_test.go @@ -30,7 +30,7 @@ import ( "github.com/stretchr/testify/assert" v1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" diff --git a/pkg/proxy/ipvs/BUILD b/pkg/proxy/ipvs/BUILD index 517067424e0..838c8c2bcf3 100644 --- a/pkg/proxy/ipvs/BUILD +++ b/pkg/proxy/ipvs/BUILD @@ -28,7 +28,7 @@ go_test( "//pkg/util/ipvs:go_default_library", "//pkg/util/ipvs/testing:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library", @@ -66,7 +66,7 @@ go_library( "//pkg/util/ipvs:go_default_library", "//pkg/util/sysctl:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library", diff --git a/pkg/proxy/ipvs/meta_proxier.go b/pkg/proxy/ipvs/meta_proxier.go index 45083c61909..9c567c26416 100644 --- a/pkg/proxy/ipvs/meta_proxier.go +++ b/pkg/proxy/ipvs/meta_proxier.go @@ -24,7 +24,7 @@ import ( "k8s.io/kubernetes/pkg/proxy" utilnet "k8s.io/utils/net" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" ) type metaProxier struct { diff --git a/pkg/proxy/ipvs/proxier.go b/pkg/proxy/ipvs/proxier.go index 28eeea1d1a2..7549c7e2665 100644 --- a/pkg/proxy/ipvs/proxier.go +++ b/pkg/proxy/ipvs/proxier.go @@ -31,7 +31,7 @@ import ( "time" v1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/version" diff --git a/pkg/proxy/ipvs/proxier_test.go b/pkg/proxy/ipvs/proxier_test.go index 322bc9e0040..1332a464c3b 100644 --- a/pkg/proxy/ipvs/proxier_test.go +++ b/pkg/proxy/ipvs/proxier_test.go @@ -28,7 +28,7 @@ import ( "github.com/stretchr/testify/assert" v1 "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" diff --git a/pkg/proxy/userspace/BUILD b/pkg/proxy/userspace/BUILD index 69058018ad7..9c76a02c01e 100644 --- a/pkg/proxy/userspace/BUILD +++ b/pkg/proxy/userspace/BUILD @@ -86,7 +86,7 @@ go_test( "//pkg/proxy:go_default_library", "//pkg/util/iptables/testing:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/net:go_default_library", diff --git a/pkg/proxy/userspace/proxier_test.go b/pkg/proxy/userspace/proxier_test.go index cb5b66c840b..5ae26b4fbfb 100644 --- a/pkg/proxy/userspace/proxier_test.go +++ b/pkg/proxy/userspace/proxier_test.go @@ -31,7 +31,7 @@ import ( "time" "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/runtime" diff --git a/pkg/proxy/winkernel/BUILD b/pkg/proxy/winkernel/BUILD index d78cffbc651..204b7ee23f0 100644 --- a/pkg/proxy/winkernel/BUILD +++ b/pkg/proxy/winkernel/BUILD @@ -64,7 +64,7 @@ go_test( "//pkg/proxy:go_default_library", "//pkg/proxy/healthcheck:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/github.com/Microsoft/hcsshim/hcn:go_default_library", diff --git a/pkg/proxy/winkernel/proxier_test.go b/pkg/proxy/winkernel/proxier_test.go index 1d2c09dc370..935ebbee446 100644 --- a/pkg/proxy/winkernel/proxier_test.go +++ b/pkg/proxy/winkernel/proxier_test.go @@ -20,7 +20,7 @@ package winkernel import ( "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" "k8s.io/apimachinery/pkg/types" "k8s.io/kubernetes/pkg/proxy" "k8s.io/kubernetes/pkg/proxy/healthcheck" diff --git a/pkg/proxy/winuserspace/BUILD b/pkg/proxy/winuserspace/BUILD index f360cb67a40..eebb3ab3579 100644 --- a/pkg/proxy/winuserspace/BUILD +++ b/pkg/proxy/winuserspace/BUILD @@ -45,7 +45,7 @@ go_test( "//pkg/proxy:go_default_library", "//pkg/util/netsh/testing:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library", diff --git a/pkg/proxy/winuserspace/proxier_test.go b/pkg/proxy/winuserspace/proxier_test.go index cb1a7216237..3951433e091 100644 --- a/pkg/proxy/winuserspace/proxier_test.go +++ b/pkg/proxy/winuserspace/proxier_test.go @@ -30,7 +30,7 @@ import ( "time" "k8s.io/api/core/v1" - discovery "k8s.io/api/discovery/v1alpha1" + discovery "k8s.io/api/discovery/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/runtime" diff --git a/pkg/registry/discovery/rest/BUILD b/pkg/registry/discovery/rest/BUILD index f21b97f249d..ed4cdf9723f 100644 --- a/pkg/registry/discovery/rest/BUILD +++ b/pkg/registry/discovery/rest/BUILD @@ -10,6 +10,7 @@ go_library( "//pkg/apis/discovery:go_default_library", "//pkg/registry/discovery/endpointslice/storage:go_default_library", "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/apiserver/pkg/registry/generic:go_default_library", "//staging/src/k8s.io/apiserver/pkg/registry/rest:go_default_library", "//staging/src/k8s.io/apiserver/pkg/server:go_default_library", diff --git a/pkg/registry/discovery/rest/storage_discovery.go b/pkg/registry/discovery/rest/storage_discovery.go index a8fdeac73d2..a9354b41661 100644 --- a/pkg/registry/discovery/rest/storage_discovery.go +++ b/pkg/registry/discovery/rest/storage_discovery.go @@ -18,6 +18,7 @@ package rest import ( discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" "k8s.io/apiserver/pkg/registry/generic" "k8s.io/apiserver/pkg/registry/rest" genericapiserver "k8s.io/apiserver/pkg/server" @@ -44,6 +45,14 @@ func (p StorageProvider) NewRESTStorage(apiResourceConfigSource serverstorage.AP apiGroupInfo.VersionedResourcesStorageMap[discoveryv1alpha1.SchemeGroupVersion.Version] = storageMap } + if apiResourceConfigSource.VersionEnabled(discoveryv1beta1.SchemeGroupVersion) { + storageMap, err := p.v1beta1Storage(apiResourceConfigSource, restOptionsGetter) + if err != nil { + return genericapiserver.APIGroupInfo{}, false, err + } + apiGroupInfo.VersionedResourcesStorageMap[discoveryv1beta1.SchemeGroupVersion.Version] = storageMap + } + return apiGroupInfo, true, nil } @@ -59,7 +68,19 @@ func (p StorageProvider) v1alpha1Storage(apiResourceConfigSource serverstorage.A return storage, err } +func (p StorageProvider) v1beta1Storage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (map[string]rest.Storage, error) { + storage := map[string]rest.Storage{} + + endpointSliceStorage, err := endpointslicestorage.NewREST(restOptionsGetter) + if err != nil { + return storage, err + } + + storage["endpointslices"] = endpointSliceStorage + return storage, err +} + // GroupName is the group name for the storage provider. func (p StorageProvider) GroupName() string { - return discoveryv1alpha1.GroupName + return discovery.GroupName } diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml index d0860cf9c85..f2902321090 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/cluster-roles.yaml @@ -1049,6 +1049,13 @@ items: - create - patch - update + - apiGroups: + - discovery.k8s.io + resources: + - endpointslices + verbs: + - list + - watch - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-role-bindings.yaml b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-role-bindings.yaml index 6d5cb73e50d..8a1ab919472 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-role-bindings.yaml +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-role-bindings.yaml @@ -136,6 +136,23 @@ items: - kind: ServiceAccount name: endpoint-controller namespace: kube-system +- apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRoleBinding + metadata: + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" + creationTimestamp: null + labels: + kubernetes.io/bootstrapping: rbac-defaults + name: system:controller:endpointslice-controller + roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: system:controller:endpointslice-controller + subjects: + - kind: ServiceAccount + name: endpointslice-controller + namespace: kube-system - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: diff --git a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml index 969d81fe10b..b47b6c69d22 100644 --- a/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml +++ b/plugin/pkg/auth/authorizer/rbac/bootstrappolicy/testdata/controller-roles.yaml @@ -447,6 +447,45 @@ items: - create - patch - update +- apiVersion: rbac.authorization.k8s.io/v1 + kind: ClusterRole + metadata: + annotations: + rbac.authorization.kubernetes.io/autoupdate: "true" + creationTimestamp: null + labels: + kubernetes.io/bootstrapping: rbac-defaults + name: system:controller:endpointslice-controller + rules: + - apiGroups: + - "" + resources: + - nodes + - pods + - services + verbs: + - get + - list + - watch + - apiGroups: + - discovery.k8s.io + resources: + - endpointslices + verbs: + - create + - delete + - get + - list + - update + - apiGroups: + - "" + - events.k8s.io + resources: + - events + verbs: + - create + - patch + - update - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: diff --git a/staging/src/k8s.io/api/BUILD b/staging/src/k8s.io/api/BUILD index 5b8c352537c..bd9a271ff69 100644 --- a/staging/src/k8s.io/api/BUILD +++ b/staging/src/k8s.io/api/BUILD @@ -87,6 +87,7 @@ filegroup( "//staging/src/k8s.io/api/coordination/v1beta1:all-srcs", "//staging/src/k8s.io/api/core/v1:all-srcs", "//staging/src/k8s.io/api/discovery/v1alpha1:all-srcs", + "//staging/src/k8s.io/api/discovery/v1beta1:all-srcs", "//staging/src/k8s.io/api/events/v1beta1:all-srcs", "//staging/src/k8s.io/api/extensions/v1beta1:all-srcs", "//staging/src/k8s.io/api/flowcontrol/v1alpha1:all-srcs", diff --git a/staging/src/k8s.io/api/discovery/v1beta1/BUILD b/staging/src/k8s.io/api/discovery/v1beta1/BUILD new file mode 100644 index 00000000000..b6a9064a62b --- /dev/null +++ b/staging/src/k8s.io/api/discovery/v1beta1/BUILD @@ -0,0 +1,39 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "generated.pb.go", + "register.go", + "types.go", + "types_swagger_doc_generated.go", + "well_known_labels.go", + "zz_generated.deepcopy.go", + ], + importmap = "k8s.io/kubernetes/vendor/k8s.io/api/discovery/v1beta1", + importpath = "k8s.io/api/discovery/v1beta1", + visibility = ["//visibility:public"], + deps = [ + "//staging/src/k8s.io/api/core/v1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", + "//vendor/github.com/gogo/protobuf/proto:go_default_library", + "//vendor/github.com/gogo/protobuf/sortkeys:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/staging/src/k8s.io/api/discovery/v1beta1/doc.go b/staging/src/k8s.io/api/discovery/v1beta1/doc.go new file mode 100644 index 00000000000..9b54d1b94ce --- /dev/null +++ b/staging/src/k8s.io/api/discovery/v1beta1/doc.go @@ -0,0 +1,22 @@ +/* +Copyright 2019 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. +*/ + +// +k8s:deepcopy-gen=package +// +k8s:protobuf-gen=package +// +k8s:openapi-gen=true +// +groupName=discovery.k8s.io + +package v1beta1 // import "k8s.io/api/discovery/v1beta1" diff --git a/staging/src/k8s.io/api/discovery/v1beta1/generated.pb.go b/staging/src/k8s.io/api/discovery/v1beta1/generated.pb.go new file mode 100644 index 00000000000..2283d12d658 --- /dev/null +++ b/staging/src/k8s.io/api/discovery/v1beta1/generated.pb.go @@ -0,0 +1,1730 @@ +/* +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 protoc-gen-gogo. DO NOT EDIT. +// source: k8s.io/kubernetes/vendor/k8s.io/api/discovery/v1beta1/generated.proto + +package v1beta1 + +import ( + fmt "fmt" + + io "io" + + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + k8s_io_api_core_v1 "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" + + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +func (m *Endpoint) Reset() { *m = Endpoint{} } +func (*Endpoint) ProtoMessage() {} +func (*Endpoint) Descriptor() ([]byte, []int) { + return fileDescriptor_ece80bbc872d519b, []int{0} +} +func (m *Endpoint) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Endpoint) XXX_Merge(src proto.Message) { + xxx_messageInfo_Endpoint.Merge(m, src) +} +func (m *Endpoint) XXX_Size() int { + return m.Size() +} +func (m *Endpoint) XXX_DiscardUnknown() { + xxx_messageInfo_Endpoint.DiscardUnknown(m) +} + +var xxx_messageInfo_Endpoint proto.InternalMessageInfo + +func (m *EndpointConditions) Reset() { *m = EndpointConditions{} } +func (*EndpointConditions) ProtoMessage() {} +func (*EndpointConditions) Descriptor() ([]byte, []int) { + return fileDescriptor_ece80bbc872d519b, []int{1} +} +func (m *EndpointConditions) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EndpointConditions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EndpointConditions) XXX_Merge(src proto.Message) { + xxx_messageInfo_EndpointConditions.Merge(m, src) +} +func (m *EndpointConditions) XXX_Size() int { + return m.Size() +} +func (m *EndpointConditions) XXX_DiscardUnknown() { + xxx_messageInfo_EndpointConditions.DiscardUnknown(m) +} + +var xxx_messageInfo_EndpointConditions proto.InternalMessageInfo + +func (m *EndpointPort) Reset() { *m = EndpointPort{} } +func (*EndpointPort) ProtoMessage() {} +func (*EndpointPort) Descriptor() ([]byte, []int) { + return fileDescriptor_ece80bbc872d519b, []int{2} +} +func (m *EndpointPort) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EndpointPort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EndpointPort) XXX_Merge(src proto.Message) { + xxx_messageInfo_EndpointPort.Merge(m, src) +} +func (m *EndpointPort) XXX_Size() int { + return m.Size() +} +func (m *EndpointPort) XXX_DiscardUnknown() { + xxx_messageInfo_EndpointPort.DiscardUnknown(m) +} + +var xxx_messageInfo_EndpointPort proto.InternalMessageInfo + +func (m *EndpointSlice) Reset() { *m = EndpointSlice{} } +func (*EndpointSlice) ProtoMessage() {} +func (*EndpointSlice) Descriptor() ([]byte, []int) { + return fileDescriptor_ece80bbc872d519b, []int{3} +} +func (m *EndpointSlice) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EndpointSlice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EndpointSlice) XXX_Merge(src proto.Message) { + xxx_messageInfo_EndpointSlice.Merge(m, src) +} +func (m *EndpointSlice) XXX_Size() int { + return m.Size() +} +func (m *EndpointSlice) XXX_DiscardUnknown() { + xxx_messageInfo_EndpointSlice.DiscardUnknown(m) +} + +var xxx_messageInfo_EndpointSlice proto.InternalMessageInfo + +func (m *EndpointSliceList) Reset() { *m = EndpointSliceList{} } +func (*EndpointSliceList) ProtoMessage() {} +func (*EndpointSliceList) Descriptor() ([]byte, []int) { + return fileDescriptor_ece80bbc872d519b, []int{4} +} +func (m *EndpointSliceList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EndpointSliceList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *EndpointSliceList) XXX_Merge(src proto.Message) { + xxx_messageInfo_EndpointSliceList.Merge(m, src) +} +func (m *EndpointSliceList) XXX_Size() int { + return m.Size() +} +func (m *EndpointSliceList) XXX_DiscardUnknown() { + xxx_messageInfo_EndpointSliceList.DiscardUnknown(m) +} + +var xxx_messageInfo_EndpointSliceList proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Endpoint)(nil), "k8s.io.api.discovery.v1beta1.Endpoint") + proto.RegisterMapType((map[string]string)(nil), "k8s.io.api.discovery.v1beta1.Endpoint.TopologyEntry") + proto.RegisterType((*EndpointConditions)(nil), "k8s.io.api.discovery.v1beta1.EndpointConditions") + proto.RegisterType((*EndpointPort)(nil), "k8s.io.api.discovery.v1beta1.EndpointPort") + proto.RegisterType((*EndpointSlice)(nil), "k8s.io.api.discovery.v1beta1.EndpointSlice") + proto.RegisterType((*EndpointSliceList)(nil), "k8s.io.api.discovery.v1beta1.EndpointSliceList") +} + +func init() { + proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/api/discovery/v1beta1/generated.proto", fileDescriptor_ece80bbc872d519b) +} + +var fileDescriptor_ece80bbc872d519b = []byte{ + // 745 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcf, 0x6b, 0xdb, 0x48, + 0x14, 0xb6, 0xe2, 0x88, 0x95, 0xc6, 0x31, 0x9b, 0x0c, 0x7b, 0x30, 0xde, 0x20, 0x19, 0x2f, 0x2c, + 0x66, 0x43, 0xa4, 0x75, 0xc8, 0x2e, 0x61, 0xf7, 0x14, 0xed, 0x86, 0xb6, 0xd0, 0x36, 0x66, 0x1a, + 0x28, 0x94, 0x1e, 0x3a, 0x96, 0x26, 0xb2, 0x6a, 0x5b, 0x23, 0x34, 0x63, 0x83, 0x6f, 0xfd, 0x13, + 0xfa, 0xf7, 0xf4, 0x5a, 0x28, 0x39, 0xe6, 0x98, 0x93, 0xa8, 0xd5, 0xff, 0x22, 0xa7, 0x32, 0xa3, + 0x5f, 0x76, 0xdd, 0x1f, 0xbe, 0xcd, 0x7c, 0xf3, 0xbe, 0xef, 0xbd, 0xf7, 0xcd, 0x7b, 0xe0, 0x62, + 0x7c, 0xc6, 0xac, 0x80, 0xda, 0xe3, 0xd9, 0x90, 0xc4, 0x21, 0xe1, 0x84, 0xd9, 0x73, 0x12, 0x7a, + 0x34, 0xb6, 0xf3, 0x07, 0x1c, 0x05, 0xb6, 0x17, 0x30, 0x97, 0xce, 0x49, 0xbc, 0xb0, 0xe7, 0xfd, + 0x21, 0xe1, 0xb8, 0x6f, 0xfb, 0x24, 0x24, 0x31, 0xe6, 0xc4, 0xb3, 0xa2, 0x98, 0x72, 0x0a, 0x0f, + 0xb3, 0x68, 0x0b, 0x47, 0x81, 0x55, 0x46, 0x5b, 0x79, 0x74, 0xfb, 0xd8, 0x0f, 0xf8, 0x68, 0x36, + 0xb4, 0x5c, 0x3a, 0xb5, 0x7d, 0xea, 0x53, 0x5b, 0x92, 0x86, 0xb3, 0x6b, 0x79, 0x93, 0x17, 0x79, + 0xca, 0xc4, 0xda, 0xdd, 0x95, 0xd4, 0x2e, 0x8d, 0x89, 0x3d, 0xdf, 0x48, 0xd8, 0x3e, 0xad, 0x62, + 0xa6, 0xd8, 0x1d, 0x05, 0xa1, 0xa8, 0x2e, 0x1a, 0xfb, 0x02, 0x60, 0xf6, 0x94, 0x70, 0xfc, 0x35, + 0x96, 0xfd, 0x2d, 0x56, 0x3c, 0x0b, 0x79, 0x30, 0x25, 0x1b, 0x84, 0xbf, 0x7f, 0x44, 0x60, 0xee, + 0x88, 0x4c, 0xf1, 0x97, 0xbc, 0xee, 0xbb, 0x3a, 0xd0, 0x2e, 0x42, 0x2f, 0xa2, 0x41, 0xc8, 0xe1, + 0x11, 0xd0, 0xb1, 0xe7, 0xc5, 0x84, 0x31, 0xc2, 0x5a, 0x4a, 0xa7, 0xde, 0xd3, 0x9d, 0x66, 0x9a, + 0x98, 0xfa, 0x79, 0x01, 0xa2, 0xea, 0x1d, 0x7a, 0x00, 0xb8, 0x34, 0xf4, 0x02, 0x1e, 0xd0, 0x90, + 0xb5, 0x76, 0x3a, 0x4a, 0xaf, 0x71, 0xf2, 0xa7, 0xf5, 0x3d, 0x7b, 0xad, 0x22, 0xd1, 0x7f, 0x25, + 0xcf, 0x81, 0x37, 0x89, 0x59, 0x4b, 0x13, 0x13, 0x54, 0x18, 0x5a, 0xd1, 0x85, 0x3d, 0xa0, 0x8d, + 0x28, 0xe3, 0x21, 0x9e, 0x92, 0x56, 0xbd, 0xa3, 0xf4, 0x74, 0x67, 0x2f, 0x4d, 0x4c, 0xed, 0x61, + 0x8e, 0xa1, 0xf2, 0x15, 0x0e, 0x80, 0xce, 0x71, 0xec, 0x13, 0x8e, 0xc8, 0x75, 0x6b, 0x57, 0x96, + 0xf3, 0xdb, 0x6a, 0x39, 0xe2, 0x83, 0xac, 0x79, 0xdf, 0xba, 0x1c, 0xbe, 0x26, 0xae, 0x08, 0x22, + 0x31, 0x09, 0x5d, 0x92, 0x75, 0x78, 0x55, 0x30, 0x51, 0x25, 0x02, 0x87, 0x40, 0xe3, 0x34, 0xa2, + 0x13, 0xea, 0x2f, 0x5a, 0x6a, 0xa7, 0xde, 0x6b, 0x9c, 0x9c, 0x6e, 0xd7, 0x9f, 0x75, 0x95, 0xd3, + 0x2e, 0x42, 0x1e, 0x2f, 0x9c, 0xfd, 0xbc, 0x47, 0xad, 0x80, 0x51, 0xa9, 0xdb, 0xfe, 0x17, 0x34, + 0xd7, 0x82, 0xe1, 0x3e, 0xa8, 0x8f, 0xc9, 0xa2, 0xa5, 0x88, 0x5e, 0x91, 0x38, 0xc2, 0x5f, 0x80, + 0x3a, 0xc7, 0x93, 0x19, 0x91, 0x1e, 0xeb, 0x28, 0xbb, 0xfc, 0xb3, 0x73, 0xa6, 0x74, 0xff, 0x02, + 0x70, 0xd3, 0x52, 0x68, 0x02, 0x35, 0x26, 0xd8, 0xcb, 0x34, 0x34, 0x47, 0x4f, 0x13, 0x53, 0x45, + 0x02, 0x40, 0x19, 0xde, 0xfd, 0xa0, 0x80, 0xbd, 0x82, 0x37, 0xa0, 0x31, 0x87, 0x87, 0x60, 0x57, + 0x1a, 0x2c, 0x93, 0x3a, 0x5a, 0x9a, 0x98, 0xbb, 0x4f, 0x85, 0xb9, 0x12, 0x85, 0x0f, 0x80, 0x26, + 0x67, 0xc5, 0xa5, 0x93, 0xac, 0x04, 0xe7, 0x48, 0x34, 0x33, 0xc8, 0xb1, 0xfb, 0xc4, 0xfc, 0x75, + 0x73, 0x0f, 0xac, 0xe2, 0x19, 0x95, 0x64, 0x91, 0x26, 0xa2, 0x31, 0x97, 0xff, 0xa8, 0x66, 0x69, + 0x44, 0x7a, 0x24, 0x51, 0xd8, 0x07, 0x0d, 0x1c, 0x45, 0x05, 0x4d, 0xfe, 0xa0, 0xee, 0xfc, 0x9c, + 0x26, 0x66, 0xe3, 0xbc, 0x82, 0xd1, 0x6a, 0x4c, 0x77, 0xb9, 0x03, 0x9a, 0x45, 0x23, 0xcf, 0x26, + 0x81, 0x4b, 0xe0, 0x2b, 0xa0, 0x89, 0x95, 0xf2, 0x30, 0xc7, 0xb2, 0x9b, 0xf5, 0x91, 0x2c, 0x37, + 0xc3, 0x8a, 0xc6, 0xbe, 0x00, 0x98, 0x25, 0xa2, 0xab, 0xa9, 0x78, 0x42, 0x38, 0xae, 0x46, 0xb2, + 0xc2, 0x50, 0xa9, 0x0a, 0xff, 0x07, 0x8d, 0x7c, 0x07, 0xae, 0x16, 0x11, 0xc9, 0xcb, 0xec, 0xe6, + 0x94, 0xc6, 0x79, 0xf5, 0x74, 0xbf, 0x7e, 0x45, 0xab, 0x34, 0xf8, 0x1c, 0xe8, 0x24, 0x2f, 0x5c, + 0xec, 0x8e, 0x98, 0xad, 0xdf, 0xb7, 0x9b, 0x2d, 0xe7, 0x20, 0xcf, 0xa5, 0x17, 0x08, 0x43, 0x95, + 0x16, 0xbc, 0x04, 0xaa, 0x70, 0x93, 0xb5, 0xea, 0x52, 0xf4, 0x8f, 0xed, 0x44, 0xc5, 0x37, 0x38, + 0xcd, 0x5c, 0x58, 0x15, 0x37, 0x86, 0x32, 0x9d, 0xee, 0x7b, 0x05, 0x1c, 0xac, 0x79, 0xfc, 0x38, + 0x60, 0x1c, 0xbe, 0xdc, 0xf0, 0xd9, 0xda, 0xce, 0x67, 0xc1, 0x96, 0x2e, 0x97, 0x4b, 0x51, 0x20, + 0x2b, 0x1e, 0x0f, 0x80, 0x1a, 0x70, 0x32, 0x2d, 0x9c, 0x39, 0xda, 0xae, 0x09, 0x59, 0x5d, 0xd5, + 0xc5, 0x23, 0xa1, 0x80, 0x32, 0x21, 0xe7, 0xf8, 0x66, 0x69, 0xd4, 0x6e, 0x97, 0x46, 0xed, 0x6e, + 0x69, 0xd4, 0xde, 0xa4, 0x86, 0x72, 0x93, 0x1a, 0xca, 0x6d, 0x6a, 0x28, 0x77, 0xa9, 0xa1, 0x7c, + 0x4c, 0x0d, 0xe5, 0xed, 0x27, 0xa3, 0xf6, 0xe2, 0xa7, 0x5c, 0xf2, 0x73, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x29, 0x1a, 0xa2, 0x6f, 0x6d, 0x06, 0x00, 0x00, +} + +func (m *Endpoint) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Endpoint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Endpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Topology) > 0 { + keysForTopology := make([]string, 0, len(m.Topology)) + for k := range m.Topology { + keysForTopology = append(keysForTopology, string(k)) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForTopology) + for iNdEx := len(keysForTopology) - 1; iNdEx >= 0; iNdEx-- { + v := m.Topology[string(keysForTopology[iNdEx])] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintGenerated(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(keysForTopology[iNdEx]) + copy(dAtA[i:], keysForTopology[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(keysForTopology[iNdEx]))) + i-- + dAtA[i] = 0xa + i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x2a + } + } + if m.TargetRef != nil { + { + size, err := m.TargetRef.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.Hostname != nil { + i -= len(*m.Hostname) + copy(dAtA[i:], *m.Hostname) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Hostname))) + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Conditions.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Addresses) > 0 { + for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Addresses[iNdEx]) + copy(dAtA[i:], m.Addresses[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Addresses[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *EndpointConditions) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EndpointConditions) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EndpointConditions) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Ready != nil { + i-- + if *m.Ready { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EndpointPort) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EndpointPort) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EndpointPort) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AppProtocol != nil { + i -= len(*m.AppProtocol) + copy(dAtA[i:], *m.AppProtocol) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.AppProtocol))) + i-- + dAtA[i] = 0x22 + } + if m.Port != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Port)) + i-- + dAtA[i] = 0x18 + } + if m.Protocol != nil { + i -= len(*m.Protocol) + copy(dAtA[i:], *m.Protocol) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Protocol))) + i-- + dAtA[i] = 0x12 + } + if m.Name != nil { + i -= len(*m.Name) + copy(dAtA[i:], *m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EndpointSlice) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EndpointSlice) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EndpointSlice) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.AddressType) + copy(dAtA[i:], m.AddressType) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.AddressType))) + i-- + dAtA[i] = 0x22 + if len(m.Ports) > 0 { + for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Ports[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Endpoints) > 0 { + for iNdEx := len(m.Endpoints) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Endpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EndpointSliceList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EndpointSliceList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EndpointSliceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Endpoint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Addresses) > 0 { + for _, s := range m.Addresses { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + l = m.Conditions.Size() + n += 1 + l + sovGenerated(uint64(l)) + if m.Hostname != nil { + l = len(*m.Hostname) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.TargetRef != nil { + l = m.TargetRef.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.Topology) > 0 { + for k, v := range m.Topology { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } + return n +} + +func (m *EndpointConditions) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Ready != nil { + n += 2 + } + return n +} + +func (m *EndpointPort) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Name != nil { + l = len(*m.Name) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Protocol != nil { + l = len(*m.Protocol) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Port != nil { + n += 1 + sovGenerated(uint64(*m.Port)) + } + if m.AppProtocol != nil { + l = len(*m.AppProtocol) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *EndpointSlice) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Endpoints) > 0 { + for _, e := range m.Endpoints { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.Ports) > 0 { + for _, e := range m.Ports { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + l = len(m.AddressType) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *EndpointSliceList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func sovGenerated(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Endpoint) String() string { + if this == nil { + return "nil" + } + keysForTopology := make([]string, 0, len(this.Topology)) + for k := range this.Topology { + keysForTopology = append(keysForTopology, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForTopology) + mapStringForTopology := "map[string]string{" + for _, k := range keysForTopology { + mapStringForTopology += fmt.Sprintf("%v: %v,", k, this.Topology[k]) + } + mapStringForTopology += "}" + s := strings.Join([]string{`&Endpoint{`, + `Addresses:` + fmt.Sprintf("%v", this.Addresses) + `,`, + `Conditions:` + strings.Replace(strings.Replace(this.Conditions.String(), "EndpointConditions", "EndpointConditions", 1), `&`, ``, 1) + `,`, + `Hostname:` + valueToStringGenerated(this.Hostname) + `,`, + `TargetRef:` + strings.Replace(fmt.Sprintf("%v", this.TargetRef), "ObjectReference", "v1.ObjectReference", 1) + `,`, + `Topology:` + mapStringForTopology + `,`, + `}`, + }, "") + return s +} +func (this *EndpointConditions) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&EndpointConditions{`, + `Ready:` + valueToStringGenerated(this.Ready) + `,`, + `}`, + }, "") + return s +} +func (this *EndpointPort) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&EndpointPort{`, + `Name:` + valueToStringGenerated(this.Name) + `,`, + `Protocol:` + valueToStringGenerated(this.Protocol) + `,`, + `Port:` + valueToStringGenerated(this.Port) + `,`, + `AppProtocol:` + valueToStringGenerated(this.AppProtocol) + `,`, + `}`, + }, "") + return s +} +func (this *EndpointSlice) String() string { + if this == nil { + return "nil" + } + repeatedStringForEndpoints := "[]Endpoint{" + for _, f := range this.Endpoints { + repeatedStringForEndpoints += strings.Replace(strings.Replace(f.String(), "Endpoint", "Endpoint", 1), `&`, ``, 1) + "," + } + repeatedStringForEndpoints += "}" + repeatedStringForPorts := "[]EndpointPort{" + for _, f := range this.Ports { + repeatedStringForPorts += strings.Replace(strings.Replace(f.String(), "EndpointPort", "EndpointPort", 1), `&`, ``, 1) + "," + } + repeatedStringForPorts += "}" + s := strings.Join([]string{`&EndpointSlice{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v11.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Endpoints:` + repeatedStringForEndpoints + `,`, + `Ports:` + repeatedStringForPorts + `,`, + `AddressType:` + fmt.Sprintf("%v", this.AddressType) + `,`, + `}`, + }, "") + return s +} +func (this *EndpointSliceList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]EndpointSlice{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "EndpointSlice", "EndpointSlice", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&EndpointSliceList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v11.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Endpoint) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Endpoint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Endpoint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Conditions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Hostname = &s + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetRef", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TargetRef == nil { + m.TargetRef = &v1.ObjectReference{} + } + if err := m.TargetRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Topology == nil { + m.Topology = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Topology[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EndpointConditions) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EndpointConditions: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EndpointConditions: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Ready", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.Ready = &b + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EndpointPort) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EndpointPort: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EndpointPort: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Name = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := k8s_io_api_core_v1.Protocol(dAtA[iNdEx:postIndex]) + m.Protocol = &s + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Port = &v + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AppProtocol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.AppProtocol = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EndpointSlice) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EndpointSlice: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EndpointSlice: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Endpoints = append(m.Endpoints, Endpoint{}) + if err := m.Endpoints[len(m.Endpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ports = append(m.Ports, EndpointPort{}) + if err := m.Ports[len(m.Ports)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AddressType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AddressType = AddressType(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EndpointSliceList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EndpointSliceList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EndpointSliceList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, EndpointSlice{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenerated(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenerated + } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthGenerated + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipGenerated(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthGenerated + } + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") +) diff --git a/staging/src/k8s.io/api/discovery/v1beta1/generated.proto b/staging/src/k8s.io/api/discovery/v1beta1/generated.proto new file mode 100644 index 00000000000..cce6f970da8 --- /dev/null +++ b/staging/src/k8s.io/api/discovery/v1beta1/generated.proto @@ -0,0 +1,157 @@ +/* +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. +*/ + + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +syntax = 'proto2'; + +package k8s.io.api.discovery.v1beta1; + +import "k8s.io/api/core/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; + +// Package-wide variables from generator "generated". +option go_package = "v1beta1"; + +// Endpoint represents a single logical "backend" implementing a service. +message Endpoint { + // addresses of this endpoint. The contents of this field are interpreted + // according to the corresponding EndpointSlice addressType field. Consumers + // must handle different types of addresses in the context of their own + // capabilities. This must contain at least one address but no more than + // 100. + // +listType=set + repeated string addresses = 1; + + // conditions contains information about the current status of the endpoint. + optional EndpointConditions conditions = 2; + + // hostname of this endpoint. This field may be used by consumers of + // endpoints to distinguish endpoints from each other (e.g. in DNS names). + // Multiple endpoints which use the same hostname should be considered + // fungible (e.g. multiple A values in DNS). Must pass DNS Label (RFC 1123) + // validation. + // +optional + optional string hostname = 3; + + // targetRef is a reference to a Kubernetes object that represents this + // endpoint. + // +optional + optional k8s.io.api.core.v1.ObjectReference targetRef = 4; + + // topology contains arbitrary topology information associated with the + // endpoint. These key/value pairs must conform with the label format. + // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + // Topology may include a maximum of 16 key/value pairs. This includes, but + // is not limited to the following well known keys: + // * kubernetes.io/hostname: the value indicates the hostname of the node + // where the endpoint is located. This should match the corresponding + // node label. + // * topology.kubernetes.io/zone: the value indicates the zone where the + // endpoint is located. This should match the corresponding node label. + // * topology.kubernetes.io/region: the value indicates the region where the + // endpoint is located. This should match the corresponding node label. + // +optional + map topology = 5; +} + +// EndpointConditions represents the current condition of an endpoint. +message EndpointConditions { + // ready indicates that this endpoint is prepared to receive traffic, + // according to whatever system is managing the endpoint. A nil value + // indicates an unknown state. In most cases consumers should interpret this + // unknown state as ready. + // +optional + optional bool ready = 1; +} + +// EndpointPort represents a Port used by an EndpointSlice +message EndpointPort { + // The name of this port. All ports in an EndpointSlice must have a unique + // name. If the EndpointSlice is dervied from a Kubernetes service, this + // corresponds to the Service.ports[].name. + // Name must either be an empty string or pass DNS_LABEL validation: + // * must be no more than 63 characters long. + // * must consist of lower case alphanumeric characters or '-'. + // * must start and end with an alphanumeric character. + // Default is empty string. + optional string name = 1; + + // The IP protocol for this port. + // Must be UDP, TCP, or SCTP. + // Default is TCP. + optional string protocol = 2; + + // The port number of the endpoint. + // If this is not specified, ports are not restricted and must be + // interpreted in the context of the specific consumer. + optional int32 port = 3; + + // The application protocol for this port. + // This field follows standard Kubernetes label syntax. + // Un-prefixed names are reserved for IANA standard service names (as per + // RFC-6335 and http://www.iana.org/assignments/service-names). + // Non-standard protocols should use prefixed names. + // Default is empty string. + optional string appProtocol = 4; +} + +// EndpointSlice represents a subset of the endpoints that implement a service. +// For a given service there may be multiple EndpointSlice objects, selected by +// labels, which must be joined to produce the full set of endpoints. +message EndpointSlice { + // Standard object's metadata. + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // addressType specifies the type of address carried by this EndpointSlice. + // All addresses in this slice must be the same type. This field is + // immutable after creation. The following address types are currently + // supported: + // * IPv4: Represents an IPv4 Address. + // * IPv6: Represents an IPv6 Address. + // * FQDN: Represents a Fully Qualified Domain Name. + optional string addressType = 4; + + // endpoints is a list of unique endpoints in this slice. Each slice may + // include a maximum of 1000 endpoints. + // +listType=atomic + repeated Endpoint endpoints = 2; + + // ports specifies the list of network ports exposed by each endpoint in + // this slice. Each port must have a unique name. When ports is empty, it + // indicates that there are no defined ports. When a port is defined with a + // nil port value, it indicates "all ports". Each slice may include a + // maximum of 100 ports. + // +optional + // +listType=atomic + repeated EndpointPort ports = 3; +} + +// EndpointSliceList represents a list of endpoint slices +message EndpointSliceList { + // Standard list metadata. + // +optional + optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // List of endpoint slices + // +listType=set + repeated EndpointSlice items = 2; +} + diff --git a/staging/src/k8s.io/api/discovery/v1beta1/register.go b/staging/src/k8s.io/api/discovery/v1beta1/register.go new file mode 100644 index 00000000000..fc993c5f2d5 --- /dev/null +++ b/staging/src/k8s.io/api/discovery/v1beta1/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2019 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 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName is the group name used in this package +const GroupName = "discovery.k8s.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"} + +// Kind takes an unqualified kind and returns a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder is the scheme builder with scheme init functions to run for this API package + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &EndpointSlice{}, + &EndpointSliceList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/staging/src/k8s.io/api/discovery/v1beta1/types.go b/staging/src/k8s.io/api/discovery/v1beta1/types.go new file mode 100644 index 00000000000..e3dc56539c0 --- /dev/null +++ b/staging/src/k8s.io/api/discovery/v1beta1/types.go @@ -0,0 +1,162 @@ +/* +Copyright 2019 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 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// EndpointSlice represents a subset of the endpoints that implement a service. +// For a given service there may be multiple EndpointSlice objects, selected by +// labels, which must be joined to produce the full set of endpoints. +type EndpointSlice struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + // addressType specifies the type of address carried by this EndpointSlice. + // All addresses in this slice must be the same type. This field is + // immutable after creation. The following address types are currently + // supported: + // * IPv4: Represents an IPv4 Address. + // * IPv6: Represents an IPv6 Address. + // * FQDN: Represents a Fully Qualified Domain Name. + AddressType AddressType `json:"addressType" protobuf:"bytes,4,rep,name=addressType"` + // endpoints is a list of unique endpoints in this slice. Each slice may + // include a maximum of 1000 endpoints. + // +listType=atomic + Endpoints []Endpoint `json:"endpoints" protobuf:"bytes,2,rep,name=endpoints"` + // ports specifies the list of network ports exposed by each endpoint in + // this slice. Each port must have a unique name. When ports is empty, it + // indicates that there are no defined ports. When a port is defined with a + // nil port value, it indicates "all ports". Each slice may include a + // maximum of 100 ports. + // +optional + // +listType=atomic + Ports []EndpointPort `json:"ports" protobuf:"bytes,3,rep,name=ports"` +} + +// AddressType represents the type of address referred to by an endpoint. +type AddressType string + +const ( + // AddressTypeIP represents an IP Address. + // This address type has been deprecated and has been replaced by the IPv4 + // and IPv6 adddress types. New resources with this address type will be + // considered invalid. This will be fully removed in 1.18. + // +deprecated + AddressTypeIP = AddressType("IP") + // AddressTypeIPv4 represents an IPv4 Address. + AddressTypeIPv4 = AddressType(v1.IPv4Protocol) + // AddressTypeIPv6 represents an IPv6 Address. + AddressTypeIPv6 = AddressType(v1.IPv6Protocol) + // AddressTypeFQDN represents a FQDN. + AddressTypeFQDN = AddressType("FQDN") +) + +// Endpoint represents a single logical "backend" implementing a service. +type Endpoint struct { + // addresses of this endpoint. The contents of this field are interpreted + // according to the corresponding EndpointSlice addressType field. Consumers + // must handle different types of addresses in the context of their own + // capabilities. This must contain at least one address but no more than + // 100. + // +listType=set + Addresses []string `json:"addresses" protobuf:"bytes,1,rep,name=addresses"` + // conditions contains information about the current status of the endpoint. + Conditions EndpointConditions `json:"conditions,omitempty" protobuf:"bytes,2,opt,name=conditions"` + // hostname of this endpoint. This field may be used by consumers of + // endpoints to distinguish endpoints from each other (e.g. in DNS names). + // Multiple endpoints which use the same hostname should be considered + // fungible (e.g. multiple A values in DNS). Must pass DNS Label (RFC 1123) + // validation. + // +optional + Hostname *string `json:"hostname,omitempty" protobuf:"bytes,3,opt,name=hostname"` + // targetRef is a reference to a Kubernetes object that represents this + // endpoint. + // +optional + TargetRef *v1.ObjectReference `json:"targetRef,omitempty" protobuf:"bytes,4,opt,name=targetRef"` + // topology contains arbitrary topology information associated with the + // endpoint. These key/value pairs must conform with the label format. + // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels + // Topology may include a maximum of 16 key/value pairs. This includes, but + // is not limited to the following well known keys: + // * kubernetes.io/hostname: the value indicates the hostname of the node + // where the endpoint is located. This should match the corresponding + // node label. + // * topology.kubernetes.io/zone: the value indicates the zone where the + // endpoint is located. This should match the corresponding node label. + // * topology.kubernetes.io/region: the value indicates the region where the + // endpoint is located. This should match the corresponding node label. + // +optional + Topology map[string]string `json:"topology,omitempty" protobuf:"bytes,5,opt,name=topology"` +} + +// EndpointConditions represents the current condition of an endpoint. +type EndpointConditions struct { + // ready indicates that this endpoint is prepared to receive traffic, + // according to whatever system is managing the endpoint. A nil value + // indicates an unknown state. In most cases consumers should interpret this + // unknown state as ready. + // +optional + Ready *bool `json:"ready,omitempty" protobuf:"bytes,1,name=ready"` +} + +// EndpointPort represents a Port used by an EndpointSlice +type EndpointPort struct { + // The name of this port. All ports in an EndpointSlice must have a unique + // name. If the EndpointSlice is dervied from a Kubernetes service, this + // corresponds to the Service.ports[].name. + // Name must either be an empty string or pass DNS_LABEL validation: + // * must be no more than 63 characters long. + // * must consist of lower case alphanumeric characters or '-'. + // * must start and end with an alphanumeric character. + // Default is empty string. + Name *string `json:"name,omitempty" protobuf:"bytes,1,name=name"` + // The IP protocol for this port. + // Must be UDP, TCP, or SCTP. + // Default is TCP. + Protocol *v1.Protocol `json:"protocol,omitempty" protobuf:"bytes,2,name=protocol"` + // The port number of the endpoint. + // If this is not specified, ports are not restricted and must be + // interpreted in the context of the specific consumer. + Port *int32 `json:"port,omitempty" protobuf:"bytes,3,opt,name=port"` + // The application protocol for this port. + // This field follows standard Kubernetes label syntax. + // Un-prefixed names are reserved for IANA standard service names (as per + // RFC-6335 and http://www.iana.org/assignments/service-names). + // Non-standard protocols should use prefixed names. + // Default is empty string. + AppProtocol *string `json:"appProtocol,omitempty" protobuf:"bytes,4,name=appProtocol"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// EndpointSliceList represents a list of endpoint slices +type EndpointSliceList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata. + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + // List of endpoint slices + // +listType=set + Items []EndpointSlice `json:"items" protobuf:"bytes,2,rep,name=items"` +} diff --git a/staging/src/k8s.io/api/discovery/v1beta1/types_swagger_doc_generated.go b/staging/src/k8s.io/api/discovery/v1beta1/types_swagger_doc_generated.go new file mode 100644 index 00000000000..9dd3a03522c --- /dev/null +++ b/staging/src/k8s.io/api/discovery/v1beta1/types_swagger_doc_generated.go @@ -0,0 +1,86 @@ +/* +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. +*/ + +package v1beta1 + +// This file contains a collection of methods that can be used from go-restful to +// generate Swagger API documentation for its models. Please read this PR for more +// information on the implementation: https://github.com/emicklei/go-restful/pull/215 +// +// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if +// they are on one line! For multiple line or blocks that you want to ignore use ---. +// Any context after a --- is ignored. +// +// Those methods can be generated by using hack/update-generated-swagger-docs.sh + +// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. +var map_Endpoint = map[string]string{ + "": "Endpoint represents a single logical \"backend\" implementing a service.", + "addresses": "addresses of this endpoint. The contents of this field are interpreted according to the corresponding EndpointSlice addressType field. Consumers must handle different types of addresses in the context of their own capabilities. This must contain at least one address but no more than 100.", + "conditions": "conditions contains information about the current status of the endpoint.", + "hostname": "hostname of this endpoint. This field may be used by consumers of endpoints to distinguish endpoints from each other (e.g. in DNS names). Multiple endpoints which use the same hostname should be considered fungible (e.g. multiple A values in DNS). Must pass DNS Label (RFC 1123) validation.", + "targetRef": "targetRef is a reference to a Kubernetes object that represents this endpoint.", + "topology": "topology contains arbitrary topology information associated with the endpoint. These key/value pairs must conform with the label format. https://kubernetes.io/docs/concepts/overview/working-with-objects/labels Topology may include a maximum of 16 key/value pairs. This includes, but is not limited to the following well known keys: * kubernetes.io/hostname: the value indicates the hostname of the node\n where the endpoint is located. This should match the corresponding\n node label.\n* topology.kubernetes.io/zone: the value indicates the zone where the\n endpoint is located. This should match the corresponding node label.\n* topology.kubernetes.io/region: the value indicates the region where the\n endpoint is located. This should match the corresponding node label.", +} + +func (Endpoint) SwaggerDoc() map[string]string { + return map_Endpoint +} + +var map_EndpointConditions = map[string]string{ + "": "EndpointConditions represents the current condition of an endpoint.", + "ready": "ready indicates that this endpoint is prepared to receive traffic, according to whatever system is managing the endpoint. A nil value indicates an unknown state. In most cases consumers should interpret this unknown state as ready.", +} + +func (EndpointConditions) SwaggerDoc() map[string]string { + return map_EndpointConditions +} + +var map_EndpointPort = map[string]string{ + "": "EndpointPort represents a Port used by an EndpointSlice", + "name": "The name of this port. All ports in an EndpointSlice must have a unique name. If the EndpointSlice is dervied from a Kubernetes service, this corresponds to the Service.ports[].name. Name must either be an empty string or pass DNS_LABEL validation: * must be no more than 63 characters long. * must consist of lower case alphanumeric characters or '-'. * must start and end with an alphanumeric character. Default is empty string.", + "protocol": "The IP protocol for this port. Must be UDP, TCP, or SCTP. Default is TCP.", + "port": "The port number of the endpoint. If this is not specified, ports are not restricted and must be interpreted in the context of the specific consumer.", + "appProtocol": "The application protocol for this port. This field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and http://www.iana.org/assignments/service-names). Non-standard protocols should use prefixed names. Default is empty string.", +} + +func (EndpointPort) SwaggerDoc() map[string]string { + return map_EndpointPort +} + +var map_EndpointSlice = map[string]string{ + "": "EndpointSlice represents a subset of the endpoints that implement a service. For a given service there may be multiple EndpointSlice objects, selected by labels, which must be joined to produce the full set of endpoints.", + "metadata": "Standard object's metadata.", + "addressType": "addressType specifies the type of address carried by this EndpointSlice. All addresses in this slice must be the same type. This field is immutable after creation. The following address types are currently supported: * IPv4: Represents an IPv4 Address. * IPv6: Represents an IPv6 Address. * FQDN: Represents a Fully Qualified Domain Name.", + "endpoints": "endpoints is a list of unique endpoints in this slice. Each slice may include a maximum of 1000 endpoints.", + "ports": "ports specifies the list of network ports exposed by each endpoint in this slice. Each port must have a unique name. When ports is empty, it indicates that there are no defined ports. When a port is defined with a nil port value, it indicates \"all ports\". Each slice may include a maximum of 100 ports.", +} + +func (EndpointSlice) SwaggerDoc() map[string]string { + return map_EndpointSlice +} + +var map_EndpointSliceList = map[string]string{ + "": "EndpointSliceList represents a list of endpoint slices", + "metadata": "Standard list metadata.", + "items": "List of endpoint slices", +} + +func (EndpointSliceList) SwaggerDoc() map[string]string { + return map_EndpointSliceList +} + +// AUTO-GENERATED FUNCTIONS END HERE diff --git a/staging/src/k8s.io/api/discovery/v1beta1/well_known_labels.go b/staging/src/k8s.io/api/discovery/v1beta1/well_known_labels.go new file mode 100644 index 00000000000..b0caa3c6e71 --- /dev/null +++ b/staging/src/k8s.io/api/discovery/v1beta1/well_known_labels.go @@ -0,0 +1,28 @@ +/* +Copyright 2019 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 ( + // LabelServiceName is used to indicate the name of a Kubernetes service. + LabelServiceName = "kubernetes.io/service-name" + // LabelManagedBy is used to indicate the controller or entity that manages + // an EndpointSlice. This label aims to enable different EndpointSlice + // objects to be managed by different controllers or entities within the + // same cluster. It is highly recommended to configure this label for all + // EndpointSlices. + LabelManagedBy = "endpointslice.kubernetes.io/managed-by" +) diff --git a/staging/src/k8s.io/api/discovery/v1beta1/zz_generated.deepcopy.go b/staging/src/k8s.io/api/discovery/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..8490ec73fb2 --- /dev/null +++ b/staging/src/k8s.io/api/discovery/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,195 @@ +// +build !ignore_autogenerated + +/* +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 deepcopy-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Endpoint) DeepCopyInto(out *Endpoint) { + *out = *in + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]string, len(*in)) + copy(*out, *in) + } + in.Conditions.DeepCopyInto(&out.Conditions) + if in.Hostname != nil { + in, out := &in.Hostname, &out.Hostname + *out = new(string) + **out = **in + } + if in.TargetRef != nil { + in, out := &in.TargetRef, &out.TargetRef + *out = new(v1.ObjectReference) + **out = **in + } + if in.Topology != nil { + in, out := &in.Topology, &out.Topology + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Endpoint. +func (in *Endpoint) DeepCopy() *Endpoint { + if in == nil { + return nil + } + out := new(Endpoint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointConditions) DeepCopyInto(out *EndpointConditions) { + *out = *in + if in.Ready != nil { + in, out := &in.Ready, &out.Ready + *out = new(bool) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointConditions. +func (in *EndpointConditions) DeepCopy() *EndpointConditions { + if in == nil { + return nil + } + out := new(EndpointConditions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointPort) DeepCopyInto(out *EndpointPort) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(v1.Protocol) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } + if in.AppProtocol != nil { + in, out := &in.AppProtocol, &out.AppProtocol + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointPort. +func (in *EndpointPort) DeepCopy() *EndpointPort { + if in == nil { + return nil + } + out := new(EndpointPort) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointSlice) DeepCopyInto(out *EndpointSlice) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Endpoints != nil { + in, out := &in.Endpoints, &out.Endpoints + *out = make([]Endpoint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Ports != nil { + in, out := &in.Ports, &out.Ports + *out = make([]EndpointPort, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSlice. +func (in *EndpointSlice) DeepCopy() *EndpointSlice { + if in == nil { + return nil + } + out := new(EndpointSlice) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EndpointSlice) 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 *EndpointSliceList) DeepCopyInto(out *EndpointSliceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EndpointSlice, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointSliceList. +func (in *EndpointSliceList) DeepCopy() *EndpointSliceList { + if in == nil { + return nil + } + out := new(EndpointSliceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EndpointSliceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/staging/src/k8s.io/client-go/BUILD b/staging/src/k8s.io/client-go/BUILD index 7a555102ec7..b1cecf96926 100644 --- a/staging/src/k8s.io/client-go/BUILD +++ b/staging/src/k8s.io/client-go/BUILD @@ -42,6 +42,7 @@ filegroup( "//staging/src/k8s.io/client-go/listers/coordination/v1beta1:all-srcs", "//staging/src/k8s.io/client-go/listers/core/v1:all-srcs", "//staging/src/k8s.io/client-go/listers/discovery/v1alpha1:all-srcs", + "//staging/src/k8s.io/client-go/listers/discovery/v1beta1:all-srcs", "//staging/src/k8s.io/client-go/listers/events/v1beta1:all-srcs", "//staging/src/k8s.io/client-go/listers/extensions/v1beta1:all-srcs", "//staging/src/k8s.io/client-go/listers/flowcontrol/v1alpha1:all-srcs", diff --git a/staging/src/k8s.io/client-go/informers/BUILD b/staging/src/k8s.io/client-go/informers/BUILD index 63f81148577..2eb50fb94df 100644 --- a/staging/src/k8s.io/client-go/informers/BUILD +++ b/staging/src/k8s.io/client-go/informers/BUILD @@ -27,6 +27,7 @@ go_library( "//staging/src/k8s.io/api/coordination/v1beta1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/api/events/v1beta1:go_default_library", "//staging/src/k8s.io/api/extensions/v1beta1:go_default_library", "//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library", diff --git a/staging/src/k8s.io/client-go/informers/discovery/BUILD b/staging/src/k8s.io/client-go/informers/discovery/BUILD index df3ac630f35..9a187d17dde 100644 --- a/staging/src/k8s.io/client-go/informers/discovery/BUILD +++ b/staging/src/k8s.io/client-go/informers/discovery/BUILD @@ -8,6 +8,7 @@ go_library( visibility = ["//visibility:public"], deps = [ "//staging/src/k8s.io/client-go/informers/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/client-go/informers/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/client-go/informers/internalinterfaces:go_default_library", ], ) @@ -24,6 +25,7 @@ filegroup( srcs = [ ":package-srcs", "//staging/src/k8s.io/client-go/informers/discovery/v1alpha1:all-srcs", + "//staging/src/k8s.io/client-go/informers/discovery/v1beta1:all-srcs", ], tags = ["automanaged"], visibility = ["//visibility:public"], diff --git a/staging/src/k8s.io/client-go/informers/discovery/interface.go b/staging/src/k8s.io/client-go/informers/discovery/interface.go index eb8062feec7..c0cae3314a3 100644 --- a/staging/src/k8s.io/client-go/informers/discovery/interface.go +++ b/staging/src/k8s.io/client-go/informers/discovery/interface.go @@ -20,6 +20,7 @@ package discovery import ( v1alpha1 "k8s.io/client-go/informers/discovery/v1alpha1" + v1beta1 "k8s.io/client-go/informers/discovery/v1beta1" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) @@ -27,6 +28,8 @@ import ( type Interface interface { // V1alpha1 provides access to shared informers for resources in V1alpha1. V1alpha1() v1alpha1.Interface + // V1beta1 provides access to shared informers for resources in V1beta1. + V1beta1() v1beta1.Interface } type group struct { @@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (g *group) V1alpha1() v1alpha1.Interface { return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) } + +// V1beta1 returns a new v1beta1.Interface. +func (g *group) V1beta1() v1beta1.Interface { + return v1beta1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/staging/src/k8s.io/client-go/informers/discovery/v1beta1/BUILD b/staging/src/k8s.io/client-go/informers/discovery/v1beta1/BUILD new file mode 100644 index 00000000000..ec7b58f8868 --- /dev/null +++ b/staging/src/k8s.io/client-go/informers/discovery/v1beta1/BUILD @@ -0,0 +1,36 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "endpointslice.go", + "interface.go", + ], + importmap = "k8s.io/kubernetes/vendor/k8s.io/client-go/informers/discovery/v1beta1", + importpath = "k8s.io/client-go/informers/discovery/v1beta1", + visibility = ["//visibility:public"], + deps = [ + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library", + "//staging/src/k8s.io/client-go/informers/internalinterfaces:go_default_library", + "//staging/src/k8s.io/client-go/kubernetes:go_default_library", + "//staging/src/k8s.io/client-go/listers/discovery/v1beta1:go_default_library", + "//staging/src/k8s.io/client-go/tools/cache:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/staging/src/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go b/staging/src/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go new file mode 100644 index 00000000000..f658866c2a7 --- /dev/null +++ b/staging/src/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go @@ -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 ( + time "time" + + discoveryv1beta1 "k8s.io/api/discovery/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/discovery/v1beta1" + cache "k8s.io/client-go/tools/cache" +) + +// EndpointSliceInformer provides access to a shared informer and lister for +// EndpointSlices. +type EndpointSliceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1beta1.EndpointSliceLister +} + +type endpointSliceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEndpointSliceInformer constructs a new informer for EndpointSlice 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 NewEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice 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 NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1beta1().EndpointSlices(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.DiscoveryV1beta1().EndpointSlices(namespace).Watch(options) + }, + }, + &discoveryv1beta1.EndpointSlice{}, + resyncPeriod, + indexers, + ) +} + +func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEndpointSliceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&discoveryv1beta1.EndpointSlice{}, f.defaultInformer) +} + +func (f *endpointSliceInformer) Lister() v1beta1.EndpointSliceLister { + return v1beta1.NewEndpointSliceLister(f.Informer().GetIndexer()) +} diff --git a/staging/src/k8s.io/client-go/informers/discovery/v1beta1/interface.go b/staging/src/k8s.io/client-go/informers/discovery/v1beta1/interface.go new file mode 100644 index 00000000000..4661646e013 --- /dev/null +++ b/staging/src/k8s.io/client-go/informers/discovery/v1beta1/interface.go @@ -0,0 +1,45 @@ +/* +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 ( + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // EndpointSlices returns a EndpointSliceInformer. + EndpointSlices() EndpointSliceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// EndpointSlices returns a EndpointSliceInformer. +func (v *version) EndpointSlices() EndpointSliceInformer { + return &endpointSliceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/staging/src/k8s.io/client-go/informers/generic.go b/staging/src/k8s.io/client-go/informers/generic.go index 554007e336b..8e6df2461a9 100644 --- a/staging/src/k8s.io/client-go/informers/generic.go +++ b/staging/src/k8s.io/client-go/informers/generic.go @@ -38,6 +38,7 @@ import ( coordinationv1beta1 "k8s.io/api/coordination/v1beta1" corev1 "k8s.io/api/core/v1" discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" eventsv1beta1 "k8s.io/api/events/v1beta1" extensionsv1beta1 "k8s.io/api/extensions/v1beta1" flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" @@ -208,6 +209,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case discoveryv1alpha1.SchemeGroupVersion.WithResource("endpointslices"): return &genericInformer{resource: resource.GroupResource(), informer: f.Discovery().V1alpha1().EndpointSlices().Informer()}, nil + // Group=discovery.k8s.io, Version=v1beta1 + case discoveryv1beta1.SchemeGroupVersion.WithResource("endpointslices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Discovery().V1beta1().EndpointSlices().Informer()}, nil + // Group=events.k8s.io, Version=v1beta1 case eventsv1beta1.SchemeGroupVersion.WithResource("events"): return &genericInformer{resource: resource.GroupResource(), informer: f.Events().V1beta1().Events().Informer()}, nil diff --git a/staging/src/k8s.io/client-go/kubernetes/BUILD b/staging/src/k8s.io/client-go/kubernetes/BUILD index 7222bcd3ffd..6858c78d879 100644 --- a/staging/src/k8s.io/client-go/kubernetes/BUILD +++ b/staging/src/k8s.io/client-go/kubernetes/BUILD @@ -33,6 +33,7 @@ go_library( "//staging/src/k8s.io/client-go/kubernetes/typed/coordination/v1beta1:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1:go_default_library", @@ -90,6 +91,7 @@ filegroup( "//staging/src/k8s.io/client-go/kubernetes/typed/coordination/v1beta1:all-srcs", "//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:all-srcs", "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1alpha1:all-srcs", + "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1:all-srcs", "//staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1:all-srcs", "//staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1:all-srcs", "//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1:all-srcs", diff --git a/staging/src/k8s.io/client-go/kubernetes/clientset.go b/staging/src/k8s.io/client-go/kubernetes/clientset.go index b7ae4f08166..cf98b05002e 100644 --- a/staging/src/k8s.io/client-go/kubernetes/clientset.go +++ b/staging/src/k8s.io/client-go/kubernetes/clientset.go @@ -43,6 +43,7 @@ import ( coordinationv1beta1 "k8s.io/client-go/kubernetes/typed/coordination/v1beta1" corev1 "k8s.io/client-go/kubernetes/typed/core/v1" discoveryv1alpha1 "k8s.io/client-go/kubernetes/typed/discovery/v1alpha1" + discoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1" eventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1" extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1" flowcontrolv1alpha1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1" @@ -88,6 +89,7 @@ type Interface interface { CoordinationV1() coordinationv1.CoordinationV1Interface CoreV1() corev1.CoreV1Interface DiscoveryV1alpha1() discoveryv1alpha1.DiscoveryV1alpha1Interface + DiscoveryV1beta1() discoveryv1beta1.DiscoveryV1beta1Interface EventsV1beta1() eventsv1beta1.EventsV1beta1Interface ExtensionsV1beta1() extensionsv1beta1.ExtensionsV1beta1Interface FlowcontrolV1alpha1() flowcontrolv1alpha1.FlowcontrolV1alpha1Interface @@ -133,6 +135,7 @@ type Clientset struct { coordinationV1 *coordinationv1.CoordinationV1Client coreV1 *corev1.CoreV1Client discoveryV1alpha1 *discoveryv1alpha1.DiscoveryV1alpha1Client + discoveryV1beta1 *discoveryv1beta1.DiscoveryV1beta1Client eventsV1beta1 *eventsv1beta1.EventsV1beta1Client extensionsV1beta1 *extensionsv1beta1.ExtensionsV1beta1Client flowcontrolV1alpha1 *flowcontrolv1alpha1.FlowcontrolV1alpha1Client @@ -258,6 +261,11 @@ func (c *Clientset) DiscoveryV1alpha1() discoveryv1alpha1.DiscoveryV1alpha1Inter return c.discoveryV1alpha1 } +// DiscoveryV1beta1 retrieves the DiscoveryV1beta1Client +func (c *Clientset) DiscoveryV1beta1() discoveryv1beta1.DiscoveryV1beta1Interface { + return c.discoveryV1beta1 +} + // EventsV1beta1 retrieves the EventsV1beta1Client func (c *Clientset) EventsV1beta1() eventsv1beta1.EventsV1beta1Interface { return c.eventsV1beta1 @@ -453,6 +461,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { if err != nil { return nil, err } + cs.discoveryV1beta1, err = discoveryv1beta1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.eventsV1beta1, err = eventsv1beta1.NewForConfig(&configShallowCopy) if err != nil { return nil, err @@ -558,6 +570,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { cs.coordinationV1 = coordinationv1.NewForConfigOrDie(c) cs.coreV1 = corev1.NewForConfigOrDie(c) cs.discoveryV1alpha1 = discoveryv1alpha1.NewForConfigOrDie(c) + cs.discoveryV1beta1 = discoveryv1beta1.NewForConfigOrDie(c) cs.eventsV1beta1 = eventsv1beta1.NewForConfigOrDie(c) cs.extensionsV1beta1 = extensionsv1beta1.NewForConfigOrDie(c) cs.flowcontrolV1alpha1 = flowcontrolv1alpha1.NewForConfigOrDie(c) @@ -605,6 +618,7 @@ func New(c rest.Interface) *Clientset { cs.coordinationV1 = coordinationv1.New(c) cs.coreV1 = corev1.New(c) cs.discoveryV1alpha1 = discoveryv1alpha1.New(c) + cs.discoveryV1beta1 = discoveryv1beta1.New(c) cs.eventsV1beta1 = eventsv1beta1.New(c) cs.extensionsV1beta1 = extensionsv1beta1.New(c) cs.flowcontrolV1alpha1 = flowcontrolv1alpha1.New(c) diff --git a/staging/src/k8s.io/client-go/kubernetes/fake/BUILD b/staging/src/k8s.io/client-go/kubernetes/fake/BUILD index 66c45f64d79..4753a9e10fa 100644 --- a/staging/src/k8s.io/client-go/kubernetes/fake/BUILD +++ b/staging/src/k8s.io/client-go/kubernetes/fake/BUILD @@ -32,6 +32,7 @@ go_library( "//staging/src/k8s.io/api/coordination/v1beta1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/api/events/v1beta1:go_default_library", "//staging/src/k8s.io/api/extensions/v1beta1:go_default_library", "//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library", @@ -101,6 +102,8 @@ go_library( "//staging/src/k8s.io/client-go/kubernetes/typed/core/v1/fake:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1alpha1:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1alpha1/fake:go_default_library", + "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1:go_default_library", + "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1/fake:go_default_library", "//staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1:go_default_library", diff --git a/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go b/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go index 2d906fa627c..ccb103cc3cd 100644 --- a/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go +++ b/staging/src/k8s.io/client-go/kubernetes/fake/clientset_generated.go @@ -66,6 +66,8 @@ import ( fakecorev1 "k8s.io/client-go/kubernetes/typed/core/v1/fake" discoveryv1alpha1 "k8s.io/client-go/kubernetes/typed/discovery/v1alpha1" fakediscoveryv1alpha1 "k8s.io/client-go/kubernetes/typed/discovery/v1alpha1/fake" + discoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1" + fakediscoveryv1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake" eventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1" fakeeventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1/fake" extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1" @@ -257,6 +259,11 @@ func (c *Clientset) DiscoveryV1alpha1() discoveryv1alpha1.DiscoveryV1alpha1Inter return &fakediscoveryv1alpha1.FakeDiscoveryV1alpha1{Fake: &c.Fake} } +// DiscoveryV1beta1 retrieves the DiscoveryV1beta1Client +func (c *Clientset) DiscoveryV1beta1() discoveryv1beta1.DiscoveryV1beta1Interface { + return &fakediscoveryv1beta1.FakeDiscoveryV1beta1{Fake: &c.Fake} +} + // EventsV1beta1 retrieves the EventsV1beta1Client func (c *Clientset) EventsV1beta1() eventsv1beta1.EventsV1beta1Interface { return &fakeeventsv1beta1.FakeEventsV1beta1{Fake: &c.Fake} diff --git a/staging/src/k8s.io/client-go/kubernetes/fake/register.go b/staging/src/k8s.io/client-go/kubernetes/fake/register.go index 33f962e6eea..e88b99891d1 100644 --- a/staging/src/k8s.io/client-go/kubernetes/fake/register.go +++ b/staging/src/k8s.io/client-go/kubernetes/fake/register.go @@ -40,6 +40,7 @@ import ( coordinationv1beta1 "k8s.io/api/coordination/v1beta1" corev1 "k8s.io/api/core/v1" discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" eventsv1beta1 "k8s.io/api/events/v1beta1" extensionsv1beta1 "k8s.io/api/extensions/v1beta1" flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" @@ -90,6 +91,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ coordinationv1.AddToScheme, corev1.AddToScheme, discoveryv1alpha1.AddToScheme, + discoveryv1beta1.AddToScheme, eventsv1beta1.AddToScheme, extensionsv1beta1.AddToScheme, flowcontrolv1alpha1.AddToScheme, diff --git a/staging/src/k8s.io/client-go/kubernetes/scheme/BUILD b/staging/src/k8s.io/client-go/kubernetes/scheme/BUILD index e08723c0a85..a78e6215750 100644 --- a/staging/src/k8s.io/client-go/kubernetes/scheme/BUILD +++ b/staging/src/k8s.io/client-go/kubernetes/scheme/BUILD @@ -31,6 +31,7 @@ go_library( "//staging/src/k8s.io/api/coordination/v1beta1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/api/events/v1beta1:go_default_library", "//staging/src/k8s.io/api/extensions/v1beta1:go_default_library", "//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library", diff --git a/staging/src/k8s.io/client-go/kubernetes/scheme/register.go b/staging/src/k8s.io/client-go/kubernetes/scheme/register.go index dcc049db1a2..4d8e8b7f780 100644 --- a/staging/src/k8s.io/client-go/kubernetes/scheme/register.go +++ b/staging/src/k8s.io/client-go/kubernetes/scheme/register.go @@ -40,6 +40,7 @@ import ( coordinationv1beta1 "k8s.io/api/coordination/v1beta1" corev1 "k8s.io/api/core/v1" discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" eventsv1beta1 "k8s.io/api/events/v1beta1" extensionsv1beta1 "k8s.io/api/extensions/v1beta1" flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" @@ -90,6 +91,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ coordinationv1.AddToScheme, corev1.AddToScheme, discoveryv1alpha1.AddToScheme, + discoveryv1beta1.AddToScheme, eventsv1beta1.AddToScheme, extensionsv1beta1.AddToScheme, flowcontrolv1alpha1.AddToScheme, diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/BUILD b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/BUILD new file mode 100644 index 00000000000..a197cd4c321 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/BUILD @@ -0,0 +1,39 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "discovery_client.go", + "doc.go", + "endpointslice.go", + "generated_expansion.go", + ], + importmap = "k8s.io/kubernetes/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1", + importpath = "k8s.io/client-go/kubernetes/typed/discovery/v1beta1", + visibility = ["//visibility:public"], + deps = [ + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library", + "//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library", + "//staging/src/k8s.io/client-go/rest:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [ + ":package-srcs", + "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake:all-srcs", + ], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/discovery_client.go b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/discovery_client.go new file mode 100644 index 00000000000..997239a9508 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/discovery_client.go @@ -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 client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + v1beta1 "k8s.io/api/discovery/v1beta1" + "k8s.io/client-go/kubernetes/scheme" + rest "k8s.io/client-go/rest" +) + +type DiscoveryV1beta1Interface interface { + RESTClient() rest.Interface + EndpointSlicesGetter +} + +// DiscoveryV1beta1Client is used to interact with features provided by the discovery.k8s.io group. +type DiscoveryV1beta1Client struct { + restClient rest.Interface +} + +func (c *DiscoveryV1beta1Client) EndpointSlices(namespace string) EndpointSliceInterface { + return newEndpointSlices(c, namespace) +} + +// NewForConfig creates a new DiscoveryV1beta1Client for the given config. +func NewForConfig(c *rest.Config) (*DiscoveryV1beta1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &DiscoveryV1beta1Client{client}, nil +} + +// NewForConfigOrDie creates a new DiscoveryV1beta1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *DiscoveryV1beta1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new DiscoveryV1beta1Client for the given RESTClient. +func New(c rest.Interface) *DiscoveryV1beta1Client { + return &DiscoveryV1beta1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1beta1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *DiscoveryV1beta1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/doc.go new file mode 100644 index 00000000000..771101956f3 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/doc.go @@ -0,0 +1,20 @@ +/* +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. + +// This package has the automatically generated typed clients. +package v1beta1 diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/endpointslice.go b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/endpointslice.go new file mode 100644 index 00000000000..bba656b8fd8 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/endpointslice.go @@ -0,0 +1,174 @@ +/* +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 ( + "time" + + v1beta1 "k8s.io/api/discovery/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + scheme "k8s.io/client-go/kubernetes/scheme" + rest "k8s.io/client-go/rest" +) + +// EndpointSlicesGetter has a method to return a EndpointSliceInterface. +// A group's client should implement this interface. +type EndpointSlicesGetter interface { + EndpointSlices(namespace string) EndpointSliceInterface +} + +// EndpointSliceInterface has methods to work with EndpointSlice resources. +type EndpointSliceInterface interface { + Create(*v1beta1.EndpointSlice) (*v1beta1.EndpointSlice, error) + Update(*v1beta1.EndpointSlice) (*v1beta1.EndpointSlice, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1beta1.EndpointSlice, error) + List(opts v1.ListOptions) (*v1beta1.EndpointSliceList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.EndpointSlice, err error) + EndpointSliceExpansion +} + +// endpointSlices implements EndpointSliceInterface +type endpointSlices struct { + client rest.Interface + ns string +} + +// newEndpointSlices returns a EndpointSlices +func newEndpointSlices(c *DiscoveryV1beta1Client, namespace string) *endpointSlices { + return &endpointSlices{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the endpointSlice, and returns the corresponding endpointSlice object, and an error if there is any. +func (c *endpointSlices) Get(name string, options v1.GetOptions) (result *v1beta1.EndpointSlice, err error) { + result = &v1beta1.EndpointSlice{} + err = c.client.Get(). + Namespace(c.ns). + Resource("endpointslices"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of EndpointSlices that match those selectors. +func (c *endpointSlices) List(opts v1.ListOptions) (result *v1beta1.EndpointSliceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1beta1.EndpointSliceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("endpointslices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested endpointSlices. +func (c *endpointSlices) Watch(opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("endpointslices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a endpointSlice and creates it. Returns the server's representation of the endpointSlice, and an error, if there is any. +func (c *endpointSlices) Create(endpointSlice *v1beta1.EndpointSlice) (result *v1beta1.EndpointSlice, err error) { + result = &v1beta1.EndpointSlice{} + err = c.client.Post(). + Namespace(c.ns). + Resource("endpointslices"). + Body(endpointSlice). + Do(). + Into(result) + return +} + +// Update takes the representation of a endpointSlice and updates it. Returns the server's representation of the endpointSlice, and an error, if there is any. +func (c *endpointSlices) Update(endpointSlice *v1beta1.EndpointSlice) (result *v1beta1.EndpointSlice, err error) { + result = &v1beta1.EndpointSlice{} + err = c.client.Put(). + Namespace(c.ns). + Resource("endpointslices"). + Name(endpointSlice.Name). + Body(endpointSlice). + Do(). + Into(result) + return +} + +// Delete takes name of the endpointSlice and deletes it. Returns an error if one occurs. +func (c *endpointSlices) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("endpointslices"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *endpointSlices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("endpointslices"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched endpointSlice. +func (c *endpointSlices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.EndpointSlice, err error) { + result = &v1beta1.EndpointSlice{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("endpointslices"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/BUILD b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/BUILD new file mode 100644 index 00000000000..d9a82c88e9b --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/BUILD @@ -0,0 +1,38 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "fake_discovery_client.go", + "fake_endpointslice.go", + ], + importmap = "k8s.io/kubernetes/vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake", + importpath = "k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake", + visibility = ["//visibility:public"], + deps = [ + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/types:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library", + "//staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1:go_default_library", + "//staging/src/k8s.io/client-go/rest:go_default_library", + "//staging/src/k8s.io/client-go/testing:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/doc.go b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/doc.go new file mode 100644 index 00000000000..16f44399065 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/doc.go @@ -0,0 +1,20 @@ +/* +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 has the automatically generated clients. +package fake diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_discovery_client.go b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_discovery_client.go new file mode 100644 index 00000000000..e285de64764 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_discovery_client.go @@ -0,0 +1,40 @@ +/* +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 ( + v1beta1 "k8s.io/client-go/kubernetes/typed/discovery/v1beta1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeDiscoveryV1beta1 struct { + *testing.Fake +} + +func (c *FakeDiscoveryV1beta1) EndpointSlices(namespace string) v1beta1.EndpointSliceInterface { + return &FakeEndpointSlices{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeDiscoveryV1beta1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_endpointslice.go b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_endpointslice.go new file mode 100644 index 00000000000..ba13afea414 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake/fake_endpointslice.go @@ -0,0 +1,128 @@ +/* +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 ( + v1beta1 "k8s.io/api/discovery/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeEndpointSlices implements EndpointSliceInterface +type FakeEndpointSlices struct { + Fake *FakeDiscoveryV1beta1 + ns string +} + +var endpointslicesResource = schema.GroupVersionResource{Group: "discovery.k8s.io", Version: "v1beta1", Resource: "endpointslices"} + +var endpointslicesKind = schema.GroupVersionKind{Group: "discovery.k8s.io", Version: "v1beta1", Kind: "EndpointSlice"} + +// Get takes name of the endpointSlice, and returns the corresponding endpointSlice object, and an error if there is any. +func (c *FakeEndpointSlices) Get(name string, options v1.GetOptions) (result *v1beta1.EndpointSlice, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(endpointslicesResource, c.ns, name), &v1beta1.EndpointSlice{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.EndpointSlice), err +} + +// List takes label and field selectors, and returns the list of EndpointSlices that match those selectors. +func (c *FakeEndpointSlices) List(opts v1.ListOptions) (result *v1beta1.EndpointSliceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(endpointslicesResource, endpointslicesKind, c.ns, opts), &v1beta1.EndpointSliceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1beta1.EndpointSliceList{ListMeta: obj.(*v1beta1.EndpointSliceList).ListMeta} + for _, item := range obj.(*v1beta1.EndpointSliceList).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 endpointSlices. +func (c *FakeEndpointSlices) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(endpointslicesResource, c.ns, opts)) + +} + +// Create takes the representation of a endpointSlice and creates it. Returns the server's representation of the endpointSlice, and an error, if there is any. +func (c *FakeEndpointSlices) Create(endpointSlice *v1beta1.EndpointSlice) (result *v1beta1.EndpointSlice, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(endpointslicesResource, c.ns, endpointSlice), &v1beta1.EndpointSlice{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.EndpointSlice), err +} + +// Update takes the representation of a endpointSlice and updates it. Returns the server's representation of the endpointSlice, and an error, if there is any. +func (c *FakeEndpointSlices) Update(endpointSlice *v1beta1.EndpointSlice) (result *v1beta1.EndpointSlice, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(endpointslicesResource, c.ns, endpointSlice), &v1beta1.EndpointSlice{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.EndpointSlice), err +} + +// Delete takes name of the endpointSlice and deletes it. Returns an error if one occurs. +func (c *FakeEndpointSlices) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(endpointslicesResource, c.ns, name), &v1beta1.EndpointSlice{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEndpointSlices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(endpointslicesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1beta1.EndpointSliceList{}) + return err +} + +// Patch applies the patch and returns the patched endpointSlice. +func (c *FakeEndpointSlices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.EndpointSlice, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(endpointslicesResource, c.ns, name, pt, data, subresources...), &v1beta1.EndpointSlice{}) + + if obj == nil { + return nil, err + } + return obj.(*v1beta1.EndpointSlice), err +} diff --git a/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/generated_expansion.go b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/generated_expansion.go new file mode 100644 index 00000000000..1e7769f2770 --- /dev/null +++ b/staging/src/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +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 + +type EndpointSliceExpansion interface{} diff --git a/staging/src/k8s.io/client-go/listers/discovery/v1beta1/BUILD b/staging/src/k8s.io/client-go/listers/discovery/v1beta1/BUILD new file mode 100644 index 00000000000..3b5ac4b82da --- /dev/null +++ b/staging/src/k8s.io/client-go/listers/discovery/v1beta1/BUILD @@ -0,0 +1,32 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "endpointslice.go", + "expansion_generated.go", + ], + importmap = "k8s.io/kubernetes/vendor/k8s.io/client-go/listers/discovery/v1beta1", + importpath = "k8s.io/client-go/listers/discovery/v1beta1", + visibility = ["//visibility:public"], + deps = [ + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library", + "//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library", + "//staging/src/k8s.io/client-go/tools/cache:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/staging/src/k8s.io/client-go/listers/discovery/v1beta1/endpointslice.go b/staging/src/k8s.io/client-go/listers/discovery/v1beta1/endpointslice.go new file mode 100644 index 00000000000..e7d1026ab72 --- /dev/null +++ b/staging/src/k8s.io/client-go/listers/discovery/v1beta1/endpointslice.go @@ -0,0 +1,94 @@ +/* +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/discovery/v1beta1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// EndpointSliceLister helps list EndpointSlices. +type EndpointSliceLister interface { + // List lists all EndpointSlices in the indexer. + List(selector labels.Selector) (ret []*v1beta1.EndpointSlice, err error) + // EndpointSlices returns an object that can list and get EndpointSlices. + EndpointSlices(namespace string) EndpointSliceNamespaceLister + EndpointSliceListerExpansion +} + +// endpointSliceLister implements the EndpointSliceLister interface. +type endpointSliceLister struct { + indexer cache.Indexer +} + +// NewEndpointSliceLister returns a new EndpointSliceLister. +func NewEndpointSliceLister(indexer cache.Indexer) EndpointSliceLister { + return &endpointSliceLister{indexer: indexer} +} + +// List lists all EndpointSlices in the indexer. +func (s *endpointSliceLister) List(selector labels.Selector) (ret []*v1beta1.EndpointSlice, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.EndpointSlice)) + }) + return ret, err +} + +// EndpointSlices returns an object that can list and get EndpointSlices. +func (s *endpointSliceLister) EndpointSlices(namespace string) EndpointSliceNamespaceLister { + return endpointSliceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EndpointSliceNamespaceLister helps list and get EndpointSlices. +type EndpointSliceNamespaceLister interface { + // List lists all EndpointSlices in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1beta1.EndpointSlice, err error) + // Get retrieves the EndpointSlice from the indexer for a given namespace and name. + Get(name string) (*v1beta1.EndpointSlice, error) + EndpointSliceNamespaceListerExpansion +} + +// endpointSliceNamespaceLister implements the EndpointSliceNamespaceLister +// interface. +type endpointSliceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all EndpointSlices in the indexer for a given namespace. +func (s endpointSliceNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.EndpointSlice, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1beta1.EndpointSlice)) + }) + return ret, err +} + +// Get retrieves the EndpointSlice from the indexer for a given namespace and name. +func (s endpointSliceNamespaceLister) Get(name string) (*v1beta1.EndpointSlice, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1beta1.Resource("endpointslice"), name) + } + return obj.(*v1beta1.EndpointSlice), nil +} diff --git a/staging/src/k8s.io/client-go/listers/discovery/v1beta1/expansion_generated.go b/staging/src/k8s.io/client-go/listers/discovery/v1beta1/expansion_generated.go new file mode 100644 index 00000000000..9619bbd8dd7 --- /dev/null +++ b/staging/src/k8s.io/client-go/listers/discovery/v1beta1/expansion_generated.go @@ -0,0 +1,27 @@ +/* +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 + +// EndpointSliceListerExpansion allows custom methods to be added to +// EndpointSliceLister. +type EndpointSliceListerExpansion interface{} + +// EndpointSliceNamespaceListerExpansion allows custom methods to be added to +// EndpointSliceNamespaceLister. +type EndpointSliceNamespaceListerExpansion interface{} diff --git a/staging/src/k8s.io/kubectl/pkg/describe/versioned/BUILD b/staging/src/k8s.io/kubectl/pkg/describe/versioned/BUILD index 9b09c0548a2..31ac79b8830 100644 --- a/staging/src/k8s.io/kubectl/pkg/describe/versioned/BUILD +++ b/staging/src/k8s.io/kubectl/pkg/describe/versioned/BUILD @@ -15,7 +15,7 @@ go_library( "//staging/src/k8s.io/api/certificates/v1beta1:go_default_library", "//staging/src/k8s.io/api/coordination/v1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/api/extensions/v1beta1:go_default_library", "//staging/src/k8s.io/api/networking/v1:go_default_library", "//staging/src/k8s.io/api/networking/v1beta1:go_default_library", @@ -66,7 +66,7 @@ go_test( "//staging/src/k8s.io/api/autoscaling/v2beta2:go_default_library", "//staging/src/k8s.io/api/coordination/v1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", - "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/api/networking/v1:go_default_library", "//staging/src/k8s.io/api/policy/v1beta1:go_default_library", "//staging/src/k8s.io/api/storage/v1:go_default_library", diff --git a/staging/src/k8s.io/kubectl/pkg/describe/versioned/describe.go b/staging/src/k8s.io/kubectl/pkg/describe/versioned/describe.go index 8155aa1f670..0370e0f7be5 100644 --- a/staging/src/k8s.io/kubectl/pkg/describe/versioned/describe.go +++ b/staging/src/k8s.io/kubectl/pkg/describe/versioned/describe.go @@ -41,7 +41,7 @@ import ( certificatesv1beta1 "k8s.io/api/certificates/v1beta1" coordinationv1 "k8s.io/api/coordination/v1" corev1 "k8s.io/api/core/v1" - discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" extensionsv1beta1 "k8s.io/api/extensions/v1beta1" networkingv1 "k8s.io/api/networking/v1" networkingv1beta1 "k8s.io/api/networking/v1beta1" @@ -171,7 +171,7 @@ func describerMap(clientConfig *rest.Config) (map[schema.GroupKind]describe.Desc {Group: corev1.GroupName, Kind: "Endpoints"}: &EndpointsDescriber{c}, {Group: corev1.GroupName, Kind: "ConfigMap"}: &ConfigMapDescriber{c}, {Group: corev1.GroupName, Kind: "PriorityClass"}: &PriorityClassDescriber{c}, - {Group: discoveryv1alpha1.GroupName, Kind: "EndpointSlice"}: &EndpointSliceDescriber{c}, + {Group: discoveryv1beta1.GroupName, Kind: "EndpointSlice"}: &EndpointSliceDescriber{c}, {Group: extensionsv1beta1.GroupName, Kind: "ReplicaSet"}: &ReplicaSetDescriber{c}, {Group: extensionsv1beta1.GroupName, Kind: "NetworkPolicy"}: &NetworkPolicyDescriber{c}, {Group: extensionsv1beta1.GroupName, Kind: "PodSecurityPolicy"}: &PodSecurityPolicyDescriber{c}, @@ -2621,7 +2621,7 @@ type EndpointSliceDescriber struct { } func (d *EndpointSliceDescriber) Describe(namespace, name string, describerSettings describe.DescriberSettings) (string, error) { - c := d.DiscoveryV1alpha1().EndpointSlices(namespace) + c := d.DiscoveryV1beta1().EndpointSlices(namespace) eps, err := c.Get(name, metav1.GetOptions{}) if err != nil { @@ -2636,7 +2636,7 @@ func (d *EndpointSliceDescriber) Describe(namespace, name string, describerSetti return describeEndpointSlice(eps, events) } -func describeEndpointSlice(eps *discoveryv1alpha1.EndpointSlice, events *corev1.EventList) (string, error) { +func describeEndpointSlice(eps *discoveryv1beta1.EndpointSlice, events *corev1.EventList) (string, error) { return tabbedString(func(out io.Writer) error { w := NewPrefixWriter(out) w.Write(LEVEL_0, "Name:\t%s\n", eps.Name) diff --git a/staging/src/k8s.io/kubectl/pkg/describe/versioned/describe_test.go b/staging/src/k8s.io/kubectl/pkg/describe/versioned/describe_test.go index 48c43f586ce..0b239ff3fd2 100644 --- a/staging/src/k8s.io/kubectl/pkg/describe/versioned/describe_test.go +++ b/staging/src/k8s.io/kubectl/pkg/describe/versioned/describe_test.go @@ -30,7 +30,7 @@ import ( autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" coordinationv1 "k8s.io/api/coordination/v1" corev1 "k8s.io/api/core/v1" - discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" networkingv1 "k8s.io/api/networking/v1" policyv1beta1 "k8s.io/api/policy/v1beta1" storagev1 "k8s.io/api/storage/v1" @@ -2582,7 +2582,7 @@ func TestDescribeEvents(t *testing.T) { }, events), }, "EndpointSliceDescriber": &EndpointSliceDescriber{ - fake.NewSimpleClientset(&discoveryv1alpha1.EndpointSlice{ + fake.NewSimpleClientset(&discoveryv1beta1.EndpointSlice{ ObjectMeta: metav1.ObjectMeta{ Name: "bar", Namespace: "foo", @@ -3519,16 +3519,16 @@ func TestDescribeEndpointSlice(t *testing.T) { protocolTCP := corev1.ProtocolTCP port80 := int32(80) - fake := fake.NewSimpleClientset(&discoveryv1alpha1.EndpointSlice{ + fake := fake.NewSimpleClientset(&discoveryv1beta1.EndpointSlice{ ObjectMeta: metav1.ObjectMeta{ Name: "foo.123", Namespace: "bar", }, - AddressType: discoveryv1alpha1.AddressTypeIPv4, - Endpoints: []discoveryv1alpha1.Endpoint{ + AddressType: discoveryv1beta1.AddressTypeIPv4, + Endpoints: []discoveryv1beta1.Endpoint{ { Addresses: []string{"1.2.3.4", "1.2.3.5"}, - Conditions: discoveryv1alpha1.EndpointConditions{Ready: utilpointer.BoolPtr(true)}, + Conditions: discoveryv1beta1.EndpointConditions{Ready: utilpointer.BoolPtr(true)}, TargetRef: &corev1.ObjectReference{Kind: "Pod", Name: "test-123"}, Topology: map[string]string{ "topology.kubernetes.io/zone": "us-central1-a", @@ -3536,7 +3536,7 @@ func TestDescribeEndpointSlice(t *testing.T) { }, }, { Addresses: []string{"1.2.3.6", "1.2.3.7"}, - Conditions: discoveryv1alpha1.EndpointConditions{Ready: utilpointer.BoolPtr(true)}, + Conditions: discoveryv1beta1.EndpointConditions{Ready: utilpointer.BoolPtr(true)}, TargetRef: &corev1.ObjectReference{Kind: "Pod", Name: "test-124"}, Topology: map[string]string{ "topology.kubernetes.io/zone": "us-central1-b", @@ -3544,7 +3544,7 @@ func TestDescribeEndpointSlice(t *testing.T) { }, }, }, - Ports: []discoveryv1alpha1.EndpointPort{ + Ports: []discoveryv1beta1.EndpointPort{ { Protocol: &protocolTCP, Port: &port80, diff --git a/test/cmd/core.sh b/test/cmd/core.sh index 53b4de3a9ec..de85ebf040f 100755 --- a/test/cmd/core.sh +++ b/test/cmd/core.sh @@ -1011,13 +1011,13 @@ __EOF__ kubectl run testmetadata --image=nginx --replicas=2 --port=80 --expose --service-overrides='{ "metadata": { "annotations": { "zone-context": "home" } } } ' # Check result kube::test::get_object_assert deployment "{{range.items}}{{$id_field}}:{{end}}" 'testmetadata:' - kube::test::get_object_assert 'service testmetadata' "{{.metadata.annotations}}" "map\[zone-context:home\]" + kube::test::get_object_assert 'service testmetadata' "{{.metadata.annotations}}" "map\[endpointslice.kubernetes.io/managed-by-setup:true zone-context:home\]" ### Expose deployment as a new service # Command kubectl expose deployment testmetadata --port=1000 --target-port=80 --type=NodePort --name=exposemetadata --overrides='{ "metadata": { "annotations": { "zone-context": "work" } } } ' # Check result - kube::test::get_object_assert 'service exposemetadata' "{{.metadata.annotations}}" "map\[zone-context:work\]" + kube::test::get_object_assert 'service exposemetadata' "{{.metadata.annotations}}" "map\[endpointslice.kubernetes.io/managed-by-setup:true zone-context:work\]" # Clean-Up # Command diff --git a/test/cmd/discovery.sh b/test/cmd/discovery.sh index 875a717e59e..258b03d6ebb 100755 --- a/test/cmd/discovery.sh +++ b/test/cmd/discovery.sh @@ -86,6 +86,9 @@ run_resource_aliasing_tests() { request="{{range.items}}{{range .metadata.labels}}{{.}}:{{end}}{{end}}" # all 4 cassandra's might not be in the request immediately... + # first option with :: suffix is for possible service.kubernetes.io/headless + # label with "" value + kube::test::get_object_assert "$object" "$request" 'cassandra:cassandra:cassandra:cassandra::' || \ kube::test::get_object_assert "$object" "$request" 'cassandra:cassandra:cassandra:cassandra:' || \ kube::test::get_object_assert "$object" "$request" 'cassandra:cassandra:cassandra:' || \ kube::test::get_object_assert "$object" "$request" 'cassandra:cassandra:' diff --git a/test/e2e/network/BUILD b/test/e2e/network/BUILD index fb4ef122c95..b54dcb25868 100644 --- a/test/e2e/network/BUILD +++ b/test/e2e/network/BUILD @@ -34,7 +34,6 @@ go_library( importpath = "k8s.io/kubernetes/test/e2e/network", deps = [ "//pkg/apis/core:go_default_library", - "//pkg/controller/endpoint:go_default_library", "//pkg/master/ports:go_default_library", "//staging/src/k8s.io/api/apps/v1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", diff --git a/test/e2e/network/service.go b/test/e2e/network/service.go index 489c938b31d..ab4403a575d 100644 --- a/test/e2e/network/service.go +++ b/test/e2e/network/service.go @@ -36,7 +36,6 @@ import ( "k8s.io/apimachinery/pkg/util/wait" clientset "k8s.io/client-go/kubernetes" cloudprovider "k8s.io/cloud-provider" - "k8s.io/kubernetes/pkg/controller/endpoint" "k8s.io/kubernetes/test/e2e/framework" e2edeploy "k8s.io/kubernetes/test/e2e/framework/deployment" e2eendpoints "k8s.io/kubernetes/test/e2e/framework/endpoints" @@ -1405,9 +1404,8 @@ var _ = SIGDescribe("Services", func() { service := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ - Name: t.ServiceName, - Namespace: t.Namespace, - Annotations: map[string]string{endpoint.TolerateUnreadyEndpointsAnnotation: "true"}, + Name: t.ServiceName, + Namespace: t.Namespace, }, Spec: v1.ServiceSpec{ Selector: t.Labels, @@ -1416,6 +1414,7 @@ var _ = SIGDescribe("Services", func() { Port: int32(port), TargetPort: intstr.FromInt(port), }}, + PublishNotReadyAddresses: true, }, } rcSpec := framework.RcByNameContainer(t.Name, 1, t.Image, t.Labels, v1.Container{ @@ -1475,7 +1474,7 @@ var _ = SIGDescribe("Services", func() { ginkgo.By("Update service to not tolerate unready services") _, err = e2eservice.UpdateService(f.ClientSet, t.Namespace, t.ServiceName, func(s *v1.Service) { - s.ObjectMeta.Annotations[endpoint.TolerateUnreadyEndpointsAnnotation] = "false" + s.Spec.PublishNotReadyAddresses = false }) framework.ExpectNoError(err) @@ -1495,7 +1494,7 @@ var _ = SIGDescribe("Services", func() { ginkgo.By("Update service to tolerate unready services again") _, err = e2eservice.UpdateService(f.ClientSet, t.Namespace, t.ServiceName, func(s *v1.Service) { - s.ObjectMeta.Annotations[endpoint.TolerateUnreadyEndpointsAnnotation] = "true" + s.Spec.PublishNotReadyAddresses = true }) framework.ExpectNoError(err) diff --git a/test/integration/apiserver/BUILD b/test/integration/apiserver/BUILD index 5230279ee22..1848a2899cf 100644 --- a/test/integration/apiserver/BUILD +++ b/test/integration/apiserver/BUILD @@ -34,6 +34,7 @@ go_test( "//staging/src/k8s.io/api/batch/v2alpha1:go_default_library", "//staging/src/k8s.io/api/core/v1:go_default_library", "//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library", + "//staging/src/k8s.io/api/discovery/v1beta1:go_default_library", "//staging/src/k8s.io/api/extensions/v1beta1:go_default_library", "//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library", "//staging/src/k8s.io/api/node/v1alpha1:go_default_library", diff --git a/test/integration/apiserver/print_test.go b/test/integration/apiserver/print_test.go index 343d4ab9b89..7e8721ac06a 100644 --- a/test/integration/apiserver/print_test.go +++ b/test/integration/apiserver/print_test.go @@ -31,6 +31,7 @@ import ( auditregv1alpha1 "k8s.io/api/auditregistration/v1alpha1" batchv2alpha1 "k8s.io/api/batch/v2alpha1" discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1" + discoveryv1beta1 "k8s.io/api/discovery/v1beta1" extensionsv1beta1 "k8s.io/api/extensions/v1beta1" flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" nodev1alpha1 "k8s.io/api/node/v1alpha1" @@ -150,6 +151,7 @@ func TestServerSidePrint(t *testing.T) { auditregv1alpha1.SchemeGroupVersion, batchv2alpha1.SchemeGroupVersion, discoveryv1alpha1.SchemeGroupVersion, + discoveryv1beta1.SchemeGroupVersion, rbacv1alpha1.SchemeGroupVersion, settingsv1alpha1.SchemeGroupVersion, schedulerapi.SchemeGroupVersion, diff --git a/test/integration/etcd/data.go b/test/integration/etcd/data.go index 197df20eb56..0e0f8dc73d6 100644 --- a/test/integration/etcd/data.go +++ b/test/integration/etcd/data.go @@ -237,10 +237,10 @@ func GetEtcdStorageDataForNamespace(namespace string) map[schema.GroupVersionRes }, // -- - // k8s.io/kubernetes/pkg/apis/discovery/v1alpha1 - gvr("discovery.k8s.io", "v1alpha1", "endpointslices"): { - Stub: `{"metadata": {"name": "slice1"}, "addressType": "IPv4", "protocol": "TCP", "ports": [], "endpoints": []}`, - ExpectedEtcdPath: "/registry/endpointslices/" + namespace + "/slice1", + // k8s.io/kubernetes/pkg/apis/discovery/v1beta1 + gvr("discovery.k8s.io", "v1beta1", "endpointslices"): { + Stub: `{"metadata": {"name": "slicev1beta1"}, "addressType": "IPv4", "protocol": "TCP", "ports": [], "endpoints": []}`, + ExpectedEtcdPath: "/registry/endpointslices/" + namespace + "/slicev1beta1", }, // -- diff --git a/vendor/modules.txt b/vendor/modules.txt index 36ba17b4c99..09825b2e315 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1111,6 +1111,7 @@ k8s.io/api/coordination/v1 k8s.io/api/coordination/v1beta1 k8s.io/api/core/v1 k8s.io/api/discovery/v1alpha1 +k8s.io/api/discovery/v1beta1 k8s.io/api/events/v1beta1 k8s.io/api/extensions/v1beta1 k8s.io/api/flowcontrol/v1alpha1 @@ -1424,6 +1425,7 @@ k8s.io/client-go/informers/core k8s.io/client-go/informers/core/v1 k8s.io/client-go/informers/discovery k8s.io/client-go/informers/discovery/v1alpha1 +k8s.io/client-go/informers/discovery/v1beta1 k8s.io/client-go/informers/events k8s.io/client-go/informers/events/v1beta1 k8s.io/client-go/informers/extensions @@ -1498,6 +1500,8 @@ k8s.io/client-go/kubernetes/typed/core/v1 k8s.io/client-go/kubernetes/typed/core/v1/fake k8s.io/client-go/kubernetes/typed/discovery/v1alpha1 k8s.io/client-go/kubernetes/typed/discovery/v1alpha1/fake +k8s.io/client-go/kubernetes/typed/discovery/v1beta1 +k8s.io/client-go/kubernetes/typed/discovery/v1beta1/fake k8s.io/client-go/kubernetes/typed/events/v1beta1 k8s.io/client-go/kubernetes/typed/events/v1beta1/fake k8s.io/client-go/kubernetes/typed/extensions/v1beta1 @@ -1551,6 +1555,7 @@ k8s.io/client-go/listers/coordination/v1 k8s.io/client-go/listers/coordination/v1beta1 k8s.io/client-go/listers/core/v1 k8s.io/client-go/listers/discovery/v1alpha1 +k8s.io/client-go/listers/discovery/v1beta1 k8s.io/client-go/listers/events/v1beta1 k8s.io/client-go/listers/extensions/v1beta1 k8s.io/client-go/listers/flowcontrol/v1alpha1