@@ -28,7 +28,7 @@ import (
28
28
"k8s.io/kubernetes/pkg/cluster/ports"
29
29
"k8s.io/kubernetes/pkg/kubelet/qos"
30
30
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
31
- utilpointer "k8s.io/utils/pointer "
31
+ "k8s.io/utils/ptr "
32
32
)
33
33
34
34
const (
@@ -54,7 +54,7 @@ func addDefaultingFuncs(scheme *kruntime.Scheme) error {
54
54
55
55
func SetDefaults_KubeletConfiguration (obj * kubeletconfigv1beta1.KubeletConfiguration ) {
56
56
if obj .EnableServer == nil {
57
- obj .EnableServer = utilpointer . Bool (true )
57
+ obj .EnableServer = ptr . To (true )
58
58
}
59
59
if obj .SyncFrequency == zeroDuration {
60
60
obj .SyncFrequency = metav1.Duration {Duration : 1 * time .Minute }
@@ -72,10 +72,10 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
72
72
obj .Port = ports .KubeletPort
73
73
}
74
74
if obj .Authentication .Anonymous .Enabled == nil {
75
- obj .Authentication .Anonymous .Enabled = utilpointer . Bool (false )
75
+ obj .Authentication .Anonymous .Enabled = ptr . To (false )
76
76
}
77
77
if obj .Authentication .Webhook .Enabled == nil {
78
- obj .Authentication .Webhook .Enabled = utilpointer . Bool (true )
78
+ obj .Authentication .Webhook .Enabled = ptr . To (true )
79
79
}
80
80
if obj .Authentication .Webhook .CacheTTL == zeroDuration {
81
81
obj .Authentication .Webhook .CacheTTL = metav1.Duration {Duration : 2 * time .Minute }
@@ -90,28 +90,28 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
90
90
obj .Authorization .Webhook .CacheUnauthorizedTTL = metav1.Duration {Duration : 30 * time .Second }
91
91
}
92
92
if obj .RegistryPullQPS == nil {
93
- obj .RegistryPullQPS = utilpointer . Int32 (5 )
93
+ obj .RegistryPullQPS = ptr. To [ int32 ] (5 )
94
94
}
95
95
if obj .RegistryBurst == 0 {
96
96
obj .RegistryBurst = 10
97
97
}
98
98
if obj .EventRecordQPS == nil {
99
- obj .EventRecordQPS = utilpointer . Int32 (50 )
99
+ obj .EventRecordQPS = ptr. To [ int32 ] (50 )
100
100
}
101
101
if obj .EventBurst == 0 {
102
102
obj .EventBurst = 100
103
103
}
104
104
if obj .EnableDebuggingHandlers == nil {
105
- obj .EnableDebuggingHandlers = utilpointer . Bool (true )
105
+ obj .EnableDebuggingHandlers = ptr . To (true )
106
106
}
107
107
if obj .HealthzPort == nil {
108
- obj .HealthzPort = utilpointer . Int32 (10248 )
108
+ obj .HealthzPort = ptr. To [ int32 ] (10248 )
109
109
}
110
110
if obj .HealthzBindAddress == "" {
111
111
obj .HealthzBindAddress = "127.0.0.1"
112
112
}
113
113
if obj .OOMScoreAdj == nil {
114
- obj .OOMScoreAdj = utilpointer . Int32 (int32 (qos .KubeletOOMScoreAdj ))
114
+ obj .OOMScoreAdj = ptr . To (int32 (qos .KubeletOOMScoreAdj ))
115
115
}
116
116
if obj .StreamingConnectionIdleTimeout == zeroDuration {
117
117
obj .StreamingConnectionIdleTimeout = metav1.Duration {Duration : 4 * time .Hour }
@@ -137,16 +137,16 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
137
137
}
138
138
if obj .ImageGCHighThresholdPercent == nil {
139
139
// default is below docker's default dm.min_free_space of 90%
140
- obj .ImageGCHighThresholdPercent = utilpointer . Int32 (85 )
140
+ obj .ImageGCHighThresholdPercent = ptr. To [ int32 ] (85 )
141
141
}
142
142
if obj .ImageGCLowThresholdPercent == nil {
143
- obj .ImageGCLowThresholdPercent = utilpointer . Int32 (80 )
143
+ obj .ImageGCLowThresholdPercent = ptr. To [ int32 ] (80 )
144
144
}
145
145
if obj .VolumeStatsAggPeriod == zeroDuration {
146
146
obj .VolumeStatsAggPeriod = metav1.Duration {Duration : time .Minute }
147
147
}
148
148
if obj .CgroupsPerQOS == nil {
149
- obj .CgroupsPerQOS = utilpointer . Bool (true )
149
+ obj .CgroupsPerQOS = ptr . To (true )
150
150
}
151
151
if obj .CgroupDriver == "" {
152
152
obj .CgroupDriver = "cgroupfs"
@@ -178,20 +178,20 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
178
178
}
179
179
// default nil or negative value to -1 (implies node allocatable pid limit)
180
180
if obj .PodPidsLimit == nil || * obj .PodPidsLimit < int64 (0 ) {
181
- obj .PodPidsLimit = utilpointer . Int64 (- 1 )
181
+ obj .PodPidsLimit = ptr. To [ int64 ] (- 1 )
182
182
}
183
183
184
184
if obj .ResolverConfig == nil {
185
- obj .ResolverConfig = utilpointer . String (kubetypes .ResolvConfDefault )
185
+ obj .ResolverConfig = ptr . To (kubetypes .ResolvConfDefault )
186
186
}
187
187
if obj .CPUCFSQuota == nil {
188
- obj .CPUCFSQuota = utilpointer . Bool (true )
188
+ obj .CPUCFSQuota = ptr . To (true )
189
189
}
190
190
if obj .CPUCFSQuotaPeriod == nil {
191
191
obj .CPUCFSQuotaPeriod = & metav1.Duration {Duration : 100 * time .Millisecond }
192
192
}
193
193
if obj .NodeStatusMaxImages == nil {
194
- obj .NodeStatusMaxImages = utilpointer . Int32 (50 )
194
+ obj .NodeStatusMaxImages = ptr. To [ int32 ] (50 )
195
195
}
196
196
if obj .MaxOpenFiles == 0 {
197
197
obj .MaxOpenFiles = 1000000
@@ -200,7 +200,7 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
200
200
obj .ContentType = "application/vnd.kubernetes.protobuf"
201
201
}
202
202
if obj .KubeAPIQPS == nil {
203
- obj .KubeAPIQPS = utilpointer . Int32 (50 )
203
+ obj .KubeAPIQPS = ptr. To [ int32 ] (50 )
204
204
}
205
205
if obj .KubeAPIBurst == 0 {
206
206
obj .KubeAPIBurst = 100
@@ -210,37 +210,37 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
210
210
// is not set, and false when MaxParallelImagePulls is set.
211
211
// This is to save users from having to set both configs.
212
212
if obj .MaxParallelImagePulls == nil || * obj .MaxParallelImagePulls < 2 {
213
- obj .SerializeImagePulls = utilpointer . Bool (true )
213
+ obj .SerializeImagePulls = ptr . To (true )
214
214
} else {
215
- obj .SerializeImagePulls = utilpointer . Bool (false )
215
+ obj .SerializeImagePulls = ptr . To (false )
216
216
}
217
217
}
218
218
if obj .EvictionPressureTransitionPeriod == zeroDuration {
219
219
obj .EvictionPressureTransitionPeriod = metav1.Duration {Duration : 5 * time .Minute }
220
220
}
221
221
if obj .EnableControllerAttachDetach == nil {
222
- obj .EnableControllerAttachDetach = utilpointer . Bool (true )
222
+ obj .EnableControllerAttachDetach = ptr . To (true )
223
223
}
224
224
if obj .MakeIPTablesUtilChains == nil {
225
- obj .MakeIPTablesUtilChains = utilpointer . Bool (true )
225
+ obj .MakeIPTablesUtilChains = ptr . To (true )
226
226
}
227
227
if obj .IPTablesMasqueradeBit == nil {
228
- obj .IPTablesMasqueradeBit = utilpointer . Int32 (DefaultIPTablesMasqueradeBit )
228
+ obj .IPTablesMasqueradeBit = ptr. To [ int32 ] (DefaultIPTablesMasqueradeBit )
229
229
}
230
230
if obj .IPTablesDropBit == nil {
231
- obj .IPTablesDropBit = utilpointer . Int32 (DefaultIPTablesDropBit )
231
+ obj .IPTablesDropBit = ptr. To [ int32 ] (DefaultIPTablesDropBit )
232
232
}
233
233
if obj .FailSwapOn == nil {
234
- obj .FailSwapOn = utilpointer . Bool (true )
234
+ obj .FailSwapOn = ptr . To (true )
235
235
}
236
236
if obj .ContainerLogMaxSize == "" {
237
237
obj .ContainerLogMaxSize = "10Mi"
238
238
}
239
239
if obj .ContainerLogMaxFiles == nil {
240
- obj .ContainerLogMaxFiles = utilpointer . Int32 (5 )
240
+ obj .ContainerLogMaxFiles = ptr. To [ int32 ] (5 )
241
241
}
242
242
if obj .ContainerLogMaxWorkers == nil {
243
- obj .ContainerLogMaxWorkers = utilpointer . Int32 (1 )
243
+ obj .ContainerLogMaxWorkers = ptr. To [ int32 ] (1 )
244
244
}
245
245
if obj .ContainerLogMonitorInterval == nil {
246
246
obj .ContainerLogMonitorInterval = & metav1.Duration {Duration : 10 * time .Second }
@@ -257,28 +257,28 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
257
257
// Use the Default LoggingConfiguration option
258
258
logsapi .SetRecommendedLoggingConfiguration (& obj .Logging )
259
259
if obj .EnableSystemLogHandler == nil {
260
- obj .EnableSystemLogHandler = utilpointer . Bool (true )
260
+ obj .EnableSystemLogHandler = ptr . To (true )
261
261
}
262
262
if obj .EnableProfilingHandler == nil {
263
- obj .EnableProfilingHandler = utilpointer . Bool (true )
263
+ obj .EnableProfilingHandler = ptr . To (true )
264
264
}
265
265
if obj .EnableDebugFlagsHandler == nil {
266
- obj .EnableDebugFlagsHandler = utilpointer . Bool (true )
266
+ obj .EnableDebugFlagsHandler = ptr . To (true )
267
267
}
268
268
if obj .SeccompDefault == nil {
269
- obj .SeccompDefault = utilpointer . Bool (false )
269
+ obj .SeccompDefault = ptr . To (false )
270
270
}
271
271
if obj .FailCgroupV1 == nil {
272
- obj .FailCgroupV1 = utilpointer . Bool (false )
272
+ obj .FailCgroupV1 = ptr . To (false )
273
273
}
274
274
if obj .MemoryThrottlingFactor == nil {
275
- obj .MemoryThrottlingFactor = utilpointer . Float64 (DefaultMemoryThrottlingFactor )
275
+ obj .MemoryThrottlingFactor = ptr . To (DefaultMemoryThrottlingFactor )
276
276
}
277
277
if obj .RegisterNode == nil {
278
- obj .RegisterNode = utilpointer . Bool (true )
278
+ obj .RegisterNode = ptr . To (true )
279
279
}
280
280
if obj .LocalStorageCapacityIsolation == nil {
281
- obj .LocalStorageCapacityIsolation = utilpointer . Bool (true )
281
+ obj .LocalStorageCapacityIsolation = ptr . To (true )
282
282
}
283
283
if obj .ContainerRuntimeEndpoint == "" {
284
284
obj .ContainerRuntimeEndpoint = "unix:///run/containerd/containerd.sock"
0 commit comments