Implement simple endpoint slice batching

This commit is contained in:
Maciej Borsz
2020-03-02 21:00:06 +01:00
parent b6b494b448
commit 49b11b5431
11 changed files with 426 additions and 10 deletions

View File

@@ -9,6 +9,7 @@ go_library(
],
importpath = "k8s.io/kubernetes/pkg/controller/endpointslice/config",
visibility = ["//visibility:public"],
deps = ["//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library"],
)
filegroup(

View File

@@ -16,6 +16,10 @@ limitations under the License.
package config
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EndpointSliceControllerConfiguration contains elements describing
// EndpointSliceController.
type EndpointSliceControllerConfiguration struct {
@@ -28,4 +32,11 @@ type EndpointSliceControllerConfiguration struct {
// added to an EndpointSlice. More endpoints per slice will result in fewer
// and larger endpoint slices, but larger resources.
MaxEndpointsPerSlice int32
// EndpointUpdatesBatchPeriod can be used to batch endpoint updates.
// All updates of endpoint triggered by pod change will be delayed by up to
// 'EndpointUpdatesBatchPeriod'. If other pods in the same endpoint change
// in that period, they will be batched to a single endpoint update.
// Default 0 value means that each pod update triggers an endpoint update.
EndpointUpdatesBatchPeriod metav1.Duration
}

View File

@@ -61,12 +61,14 @@ func RegisterConversions(s *runtime.Scheme) error {
func autoConvert_v1alpha1_EndpointSliceControllerConfiguration_To_config_EndpointSliceControllerConfiguration(in *v1alpha1.EndpointSliceControllerConfiguration, out *config.EndpointSliceControllerConfiguration, s conversion.Scope) error {
out.ConcurrentServiceEndpointSyncs = in.ConcurrentServiceEndpointSyncs
out.MaxEndpointsPerSlice = in.MaxEndpointsPerSlice
out.EndpointUpdatesBatchPeriod = in.EndpointUpdatesBatchPeriod
return nil
}
func autoConvert_config_EndpointSliceControllerConfiguration_To_v1alpha1_EndpointSliceControllerConfiguration(in *config.EndpointSliceControllerConfiguration, out *v1alpha1.EndpointSliceControllerConfiguration, s conversion.Scope) error {
out.ConcurrentServiceEndpointSyncs = in.ConcurrentServiceEndpointSyncs
out.MaxEndpointsPerSlice = in.MaxEndpointsPerSlice
out.EndpointUpdatesBatchPeriod = in.EndpointUpdatesBatchPeriod
return nil
}

View File

@@ -23,6 +23,7 @@ package config
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *EndpointSliceControllerConfiguration) DeepCopyInto(out *EndpointSliceControllerConfiguration) {
*out = *in
out.EndpointUpdatesBatchPeriod = in.EndpointUpdatesBatchPeriod
return
}