From 9c787714aab27c83f6db2968e9e810e7fab803cc Mon Sep 17 00:00:00 2001 From: Rob Scott Date: Fri, 5 Mar 2021 12:05:05 -0800 Subject: [PATCH] Adding Hints to EndpointSlice API Kubernetes-commit: 11f0944dbc70089e005f55b43d6507503a0491c5 --- applyconfigurations/discovery/v1/endpoint.go | 9 ++++ .../discovery/v1/endpointhints.go | 44 +++++++++++++++++++ applyconfigurations/discovery/v1/forzone.go | 39 ++++++++++++++++ .../discovery/v1beta1/endpoint.go | 9 ++++ .../discovery/v1beta1/endpointhints.go | 44 +++++++++++++++++++ .../discovery/v1beta1/forzone.go | 39 ++++++++++++++++ applyconfigurations/utils.go | 8 ++++ 7 files changed, 192 insertions(+) create mode 100644 applyconfigurations/discovery/v1/endpointhints.go create mode 100644 applyconfigurations/discovery/v1/forzone.go create mode 100644 applyconfigurations/discovery/v1beta1/endpointhints.go create mode 100644 applyconfigurations/discovery/v1beta1/forzone.go diff --git a/applyconfigurations/discovery/v1/endpoint.go b/applyconfigurations/discovery/v1/endpoint.go index 99303266..d8c2359a 100644 --- a/applyconfigurations/discovery/v1/endpoint.go +++ b/applyconfigurations/discovery/v1/endpoint.go @@ -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 +} diff --git a/applyconfigurations/discovery/v1/endpointhints.go b/applyconfigurations/discovery/v1/endpointhints.go new file mode 100644 index 00000000..6eb9f21a --- /dev/null +++ b/applyconfigurations/discovery/v1/endpointhints.go @@ -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 +} diff --git a/applyconfigurations/discovery/v1/forzone.go b/applyconfigurations/discovery/v1/forzone.go new file mode 100644 index 00000000..192a5ad2 --- /dev/null +++ b/applyconfigurations/discovery/v1/forzone.go @@ -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 +} diff --git a/applyconfigurations/discovery/v1beta1/endpoint.go b/applyconfigurations/discovery/v1beta1/endpoint.go index f3dfd2ab..724c2d00 100644 --- a/applyconfigurations/discovery/v1beta1/endpoint.go +++ b/applyconfigurations/discovery/v1beta1/endpoint.go @@ -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 +} diff --git a/applyconfigurations/discovery/v1beta1/endpointhints.go b/applyconfigurations/discovery/v1beta1/endpointhints.go new file mode 100644 index 00000000..41d80206 --- /dev/null +++ b/applyconfigurations/discovery/v1beta1/endpointhints.go @@ -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 +} diff --git a/applyconfigurations/discovery/v1beta1/forzone.go b/applyconfigurations/discovery/v1beta1/forzone.go new file mode 100644 index 00000000..4d1455ed --- /dev/null +++ b/applyconfigurations/discovery/v1beta1/forzone.go @@ -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 +} diff --git a/applyconfigurations/utils.go b/applyconfigurations/utils.go index de94fe27..1aef170e 100644 --- a/applyconfigurations/utils.go +++ b/applyconfigurations/utils.go @@ -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"):