Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graduate EndpointSlice API to GA #99662

Merged
merged 1 commit into from Mar 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1,729 changes: 1,493 additions & 236 deletions api/openapi-spec/swagger.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/kube-apiserver/app/aggregator.go
Expand Up @@ -281,8 +281,8 @@ var apiVersionPriorities = map[schema.GroupVersion]priority{
{Group: "node.k8s.io", Version: "v1"}: {group: 16300, version: 15},
{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: "v1"}: {group: 16200, version: 15},
{Group: "discovery.k8s.io", Version: "v1beta1"}: {group: 16200, version: 12},
{Group: "discovery.k8s.io", Version: "v1alpha1"}: {group: 16200, version: 9},
{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1"}: {group: 16100, version: 12},
{Group: "flowcontrol.apiserver.k8s.io", Version: "v1alpha1"}: {group: 16100, version: 9},
{Group: "internal.apiserver.k8s.io", Version: "v1alpha1"}: {group: 16000, version: 9},
Expand Down
2 changes: 1 addition & 1 deletion hack/lib/init.sh
Expand Up @@ -84,7 +84,7 @@ certificates.k8s.io/v1 \
certificates.k8s.io/v1beta1 \
coordination.k8s.io/v1beta1 \
coordination.k8s.io/v1 \
discovery.k8s.io/v1alpha1 \
discovery.k8s.io/v1 \
discovery.k8s.io/v1beta1 \
extensions/v1beta1 \
events.k8s.io/v1 \
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/testing/defaulting_test.go
Expand Up @@ -91,8 +91,8 @@ func TestDefaulting(t *testing.T) {
{Group: "batch", Version: "v2alpha1", Kind: "JobTemplate"}: {},
{Group: "certificates.k8s.io", Version: "v1beta1", Kind: "CertificateSigningRequest"}: {},
{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: "v1", Kind: "EndpointSlice"}: {},
{Group: "discovery.k8s.io", Version: "v1", Kind: "EndpointSliceList"}: {},
{Group: "discovery.k8s.io", Version: "v1beta1", Kind: "EndpointSlice"}: {},
{Group: "discovery.k8s.io", Version: "v1beta1", Kind: "EndpointSliceList"}: {},
{Group: "extensions", Version: "v1beta1", Kind: "DaemonSet"}: {},
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/discovery/install/install.go
Expand Up @@ -23,7 +23,7 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/apis/discovery"
"k8s.io/kubernetes/pkg/apis/discovery/v1alpha1"
v1 "k8s.io/kubernetes/pkg/apis/discovery/v1"
"k8s.io/kubernetes/pkg/apis/discovery/v1beta1"
)

Expand All @@ -34,7 +34,7 @@ func init() {
// Install registers the API group and adds types to a scheme
func Install(scheme *runtime.Scheme) {
utilruntime.Must(discovery.AddToScheme(scheme))
utilruntime.Must(v1alpha1.AddToScheme(scheme))
utilruntime.Must(v1beta1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion, v1alpha1.SchemeGroupVersion))
utilruntime.Must(v1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion, v1.SchemeGroupVersion))
}
21 changes: 7 additions & 14 deletions pkg/apis/discovery/types.go
Expand Up @@ -87,26 +87,19 @@ type Endpoint struct {
// endpoint.
// +optional
TargetRef *api.ObjectReference
// 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.
// This field is deprecated and will be removed in future api versions.
// deprecatedTopology is deprecated and only retained for round-trip
// compatibility with v1beta1 Topology field. When v1beta1 is removed, this
// should be removed, too.
// +optional
Topology map[string]string
DeprecatedTopology map[string]string
// nodeName represents the name of the Node hosting this endpoint. This can
// be used to determine endpoints local to a Node. This field can be enabled
// with the EndpointSliceNodeName feature gate.
// +optional
NodeName *string
// zone is the name of the Zone this endpoint exists in.
// +optional
Zone *string
}

// EndpointConditions represents the current condition of an endpoint.
Expand Down
@@ -1,5 +1,5 @@
/*
Copyright 2019 The Kubernetes Authors.
Copyright 2021 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.
Expand All @@ -14,11 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1

import (
v1 "k8s.io/api/core/v1"
discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1"
discoveryv1 "k8s.io/api/discovery/v1"
"k8s.io/apimachinery/pkg/runtime"
)

Expand All @@ -31,7 +31,7 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}

func SetDefaults_EndpointPort(obj *discoveryv1alpha1.EndpointPort) {
func SetDefaults_EndpointPort(obj *discoveryv1.EndpointPort) {
if obj.Name == nil {
obj.Name = &defaultPortName
}
Expand Down
@@ -1,5 +1,5 @@
/*
Copyright 2019 The Kubernetes Authors.
Copyright 2021 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.
Expand All @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1_test
package v1_test

import (
"testing"

"github.com/google/go-cmp/cmp"
v1 "k8s.io/api/core/v1"
discovery "k8s.io/api/discovery/v1alpha1"
discovery "k8s.io/api/discovery/v1"
apiequality "k8s.io/apimachinery/pkg/api/equality"
"k8s.io/kubernetes/pkg/api/legacyscheme"
_ "k8s.io/kubernetes/pkg/apis/discovery/install"
Expand Down
@@ -1,5 +1,5 @@
/*
Copyright 2019 The Kubernetes Authors.
Copyright 2021 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.
Expand All @@ -15,8 +15,8 @@ limitations under the License.
*/

// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/discovery
// +k8s:conversion-gen-external-types=k8s.io/api/discovery/v1alpha1
// +k8s:conversion-gen-external-types=k8s.io/api/discovery/v1
// +k8s:defaulter-gen=TypeMeta
// +k8s:defaulter-gen-input=../../../../vendor/k8s.io/api/discovery/v1alpha1
// +k8s:defaulter-gen-input=../../../../vendor/k8s.io/api/discovery/v1

package v1alpha1 // import "k8s.io/kubernetes/pkg/apis/discovery/v1alpha1"
package v1 // import "k8s.io/kubernetes/pkg/apis/discovery/v1"
@@ -1,5 +1,5 @@
/*
Copyright 2019 The Kubernetes Authors.
Copyright 2021 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.
Expand All @@ -14,26 +14,26 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1

import (
discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1"
discoveryv1 "k8s.io/api/discovery/v1"
"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: "v1alpha1"}
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}

// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}

var (
localSchemeBuilder = &discoveryv1alpha1.SchemeBuilder
localSchemeBuilder = &discoveryv1.SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
)

Expand Down