Merge pull request #99522 from robscott/topology-hints

Adding support for Topology Aware Hints

Kubernetes-commit: 207c75c6f7f25b1661e2063b7db6fc1a10bb58aa
This commit is contained in:
Kubernetes Publisher 2021-03-09 09:19:12 -08:00
commit 814c68cfbc
10 changed files with 196 additions and 4 deletions

2
Godeps/Godeps.json generated
View File

@ -476,7 +476,7 @@
},
{
"ImportPath": "k8s.io/api",
"Rev": "a61f0c601351"
"Rev": "93f222f3e873"
},
{
"ImportPath": "k8s.io/apimachinery",

View File

@ -32,6 +32,7 @@ type EndpointApplyConfiguration struct {
DeprecatedTopology map[string]string `json:"deprecatedTopology,omitempty"`
NodeName *string `json:"nodeName,omitempty"`
Zone *string `json:"zone,omitempty"`
Hints *EndpointHintsApplyConfiguration `json:"hints,omitempty"`
}
// EndpointApplyConfiguration constructs an declarative configuration of the Endpoint type for use with
@ -103,3 +104,11 @@ func (b *EndpointApplyConfiguration) WithZone(value string) *EndpointApplyConfig
b.Zone = &value
return b
}
// WithHints sets the Hints field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Hints field is set to the value of the last call.
func (b *EndpointApplyConfiguration) WithHints(value *EndpointHintsApplyConfiguration) *EndpointApplyConfiguration {
b.Hints = value
return b
}

View File

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

View File

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

View File

@ -31,6 +31,7 @@ type EndpointApplyConfiguration struct {
TargetRef *v1.ObjectReferenceApplyConfiguration `json:"targetRef,omitempty"`
Topology map[string]string `json:"topology,omitempty"`
NodeName *string `json:"nodeName,omitempty"`
Hints *EndpointHintsApplyConfiguration `json:"hints,omitempty"`
}
// EndpointApplyConfiguration constructs an declarative configuration of the Endpoint type for use with
@ -94,3 +95,11 @@ func (b *EndpointApplyConfiguration) WithNodeName(value string) *EndpointApplyCo
b.NodeName = &value
return b
}
// WithHints sets the Hints field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Hints field is set to the value of the last call.
func (b *EndpointApplyConfiguration) WithHints(value *EndpointHintsApplyConfiguration) *EndpointApplyConfiguration {
b.Hints = value
return b
}

View File

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

View File

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

View File

@ -777,20 +777,28 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &applyconfigurationsdiscoveryv1.EndpointApplyConfiguration{}
case discoveryv1.SchemeGroupVersion.WithKind("EndpointConditions"):
return &applyconfigurationsdiscoveryv1.EndpointConditionsApplyConfiguration{}
case discoveryv1.SchemeGroupVersion.WithKind("EndpointHints"):
return &applyconfigurationsdiscoveryv1.EndpointHintsApplyConfiguration{}
case discoveryv1.SchemeGroupVersion.WithKind("EndpointPort"):
return &applyconfigurationsdiscoveryv1.EndpointPortApplyConfiguration{}
case discoveryv1.SchemeGroupVersion.WithKind("EndpointSlice"):
return &applyconfigurationsdiscoveryv1.EndpointSliceApplyConfiguration{}
case discoveryv1.SchemeGroupVersion.WithKind("ForZone"):
return &applyconfigurationsdiscoveryv1.ForZoneApplyConfiguration{}
// Group=discovery.k8s.io, Version=v1beta1
case discoveryv1beta1.SchemeGroupVersion.WithKind("Endpoint"):
return &applyconfigurationsdiscoveryv1beta1.EndpointApplyConfiguration{}
case discoveryv1beta1.SchemeGroupVersion.WithKind("EndpointConditions"):
return &applyconfigurationsdiscoveryv1beta1.EndpointConditionsApplyConfiguration{}
case discoveryv1beta1.SchemeGroupVersion.WithKind("EndpointHints"):
return &applyconfigurationsdiscoveryv1beta1.EndpointHintsApplyConfiguration{}
case discoveryv1beta1.SchemeGroupVersion.WithKind("EndpointPort"):
return &applyconfigurationsdiscoveryv1beta1.EndpointPortApplyConfiguration{}
case discoveryv1beta1.SchemeGroupVersion.WithKind("EndpointSlice"):
return &applyconfigurationsdiscoveryv1beta1.EndpointSliceApplyConfiguration{}
case discoveryv1beta1.SchemeGroupVersion.WithKind("ForZone"):
return &applyconfigurationsdiscoveryv1beta1.ForZoneApplyConfiguration{}
// Group=events.k8s.io, Version=v1
case eventsv1.SchemeGroupVersion.WithKind("Event"):

4
go.mod
View File

@ -27,7 +27,7 @@ require (
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
k8s.io/api v0.0.0-20210309104524-a61f0c601351
k8s.io/api v0.0.0-20210309183657-93f222f3e873
k8s.io/apimachinery v0.0.0-20210309143504-98d3ae9509fd
k8s.io/klog/v2 v2.5.0
k8s.io/utils v0.0.0-20201110183641-67b214c5f920
@ -35,6 +35,6 @@ require (
)
replace (
k8s.io/api => k8s.io/api v0.0.0-20210309104524-a61f0c601351
k8s.io/api => k8s.io/api v0.0.0-20210309183657-93f222f3e873
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20210309143504-98d3ae9509fd
)

2
go.sum
View File

@ -431,7 +431,7 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20210309104524-a61f0c601351/go.mod h1:JvvTgB3AvDyONXbbMsVhQMb75g5NbLgOEgdedrBqLVw=
k8s.io/api v0.0.0-20210309183657-93f222f3e873/go.mod h1:GaQBrNBX/kVemZnEjirdvAMBUP37vK/+KKDue5z5bps=
k8s.io/apimachinery v0.0.0-20210309143504-98d3ae9509fd/go.mod h1:ZaN7d/yx5I8h2mk8Nu08sdLigsmkt4flkTxCTc9LElI=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=