1 /* 2 Copyright 2019 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package v1alpha1 18 19 import ( 20 kubectrlmgrconfigv1alpha1 "k8s.io/kube-controller-manager/config/v1alpha1" 21 ) 22 23 // RecommendedDefaultEndpointSliceControllerConfiguration defaults a pointer to 24 // a EndpointSliceControllerConfiguration struct. This will set the recommended 25 // default values, but they may be subject to change between API versions. This 26 // function is intentionally not registered in the scheme as a "normal" 27 // `SetDefaults_Foo` function to allow consumers of this type to set whatever 28 // defaults for their embedded configs. Forcing consumers to use these defaults 29 // would be problematic as defaulting in the scheme is done as part of the 30 // conversion, and there would be no easy way to opt-out. Instead, if you want 31 // to use this defaulting method run it in your wrapper struct of this type in 32 // its `SetDefaults_` method. 33 func RecommendedDefaultEndpointSliceControllerConfiguration(obj *kubectrlmgrconfigv1alpha1.EndpointSliceControllerConfiguration) { 34 if obj.ConcurrentServiceEndpointSyncs == 0 { 35 obj.ConcurrentServiceEndpointSyncs = 5 36 } 37 38 if obj.MaxEndpointsPerSlice == 0 { 39 obj.MaxEndpointsPerSlice = 100 40 } 41 } 42