Skip to content

Commit 4b87ef9

Browse files
authored
Merge pull request #2973 from nawazkh/managednodepools_OS_config
feat: add linux OS custom configuration
2 parents 255f3e2 + b82ab4b commit 4b87ef9

16 files changed

+1151
-0
lines changed

api/v1alpha3/azuremanagedmachinepool_conversion.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ func (src *AzureManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error {
5050
dst.Spec.ScaleSetPriority = restored.Spec.ScaleSetPriority
5151
dst.Spec.AdditionalTags = restored.Spec.AdditionalTags
5252
dst.Spec.KubeletDiskType = restored.Spec.KubeletDiskType
53+
dst.Spec.LinuxOSConfig = restored.Spec.LinuxOSConfig
54+
5355
if restored.Spec.KubeletConfig != nil {
5456
dst.Spec.KubeletConfig = restored.Spec.KubeletConfig
5557
}

api/v1alpha3/zz_generated.conversion.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha4/azuremanagedmachinepool_conversion.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ func (src *AzureManagedMachinePool) ConvertTo(dstRaw conversion.Hub) error {
5050
dst.Spec.ScaleSetPriority = restored.Spec.ScaleSetPriority
5151
dst.Spec.AdditionalTags = restored.Spec.AdditionalTags
5252
dst.Spec.KubeletDiskType = restored.Spec.KubeletDiskType
53+
dst.Spec.LinuxOSConfig = restored.Spec.LinuxOSConfig
54+
5355
if restored.Spec.KubeletConfig != nil {
5456
dst.Spec.KubeletConfig = restored.Spec.KubeletConfig
5557
}

api/v1alpha4/zz_generated.conversion.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta1/azuremanagedmachinepool_types.go

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,26 @@ const (
7373
TopologyManagerPolicySingleNumaNode TopologyManagerPolicy = "single-numa-node"
7474
)
7575

76+
// TransparentHugePageOption enumerates the values for various modes of Transparent Hugepages.
77+
type TransparentHugePageOption string
78+
79+
const (
80+
// TransparentHugePageOptionAlways ...
81+
TransparentHugePageOptionAlways TransparentHugePageOption = "always"
82+
83+
// TransparentHugePageOptionMadvise ...
84+
TransparentHugePageOptionMadvise TransparentHugePageOption = "madvise"
85+
86+
// TransparentHugePageOptionNever ...
87+
TransparentHugePageOptionNever TransparentHugePageOption = "never"
88+
89+
// TransparentHugePageOptionDefer ...
90+
TransparentHugePageOptionDefer TransparentHugePageOption = "defer"
91+
92+
// TransparentHugePageOptionDeferMadvise ...
93+
TransparentHugePageOptionDeferMadvise TransparentHugePageOption = "defer+madvise"
94+
)
95+
7696
// KubeletConfig defines the set of kubelet configurations for nodes in pools.
7797
type KubeletConfig struct {
7898
// CPUManagerPolicy - CPU Manager policy to use.
@@ -118,6 +138,237 @@ type KubeletConfig struct {
118138
PodMaxPids *int32 `json:"podMaxPids,omitempty"`
119139
}
120140

141+
// SysctlConfig specifies the settings for Linux agent nodes.
142+
type SysctlConfig struct {
143+
// FsAioMaxNr specifies the maximum number of system-wide asynchronous io requests.
144+
// Maps to fs.aio-max-nr.
145+
// +kubebuilder:validation:Minimum=65536
146+
// +kubebuilder:validation:Maximum=6553500
147+
// +optional
148+
FsAioMaxNr *int32 `json:"fsAioMaxNr,omitempty"`
149+
150+
// FsFileMax specifies the max number of file-handles that the Linux kernel will allocate, by increasing increases the maximum number of open files permitted.
151+
// Maps to fs.file-max.
152+
// +kubebuilder:validation:Minimum=8192
153+
// +kubebuilder:validation:Maximum=12000500
154+
// +optional
155+
FsFileMax *int32 `json:"fsFileMax,omitempty"`
156+
157+
// FsInotifyMaxUserWatches specifies the number of file watches allowed by the system. Each watch is roughly 90 bytes on a 32-bit kernel, and roughly 160 bytes on a 64-bit kernel.
158+
// Maps to fs.inotify.max_user_watches.
159+
// +kubebuilder:validation:Minimum=781250
160+
// +kubebuilder:validation:Maximum=2097152
161+
// +optional
162+
FsInotifyMaxUserWatches *int32 `json:"fsInotifyMaxUserWatches,omitempty"`
163+
164+
// FsNrOpen specifies the maximum number of file-handles a process can allocate.
165+
// Maps to fs.nr_open.
166+
// +kubebuilder:validation:Minimum=8192
167+
// +kubebuilder:validation:Maximum=20000500
168+
// +optional
169+
FsNrOpen *int32 `json:"fsNrOpen,omitempty"`
170+
171+
// KernelThreadsMax specifies the maximum number of all threads that can be created.
172+
// Maps to kernel.threads-max.
173+
// +kubebuilder:validation:Minimum=20
174+
// +kubebuilder:validation:Maximum=513785
175+
// +optional
176+
KernelThreadsMax *int32 `json:"kernelThreadsMax,omitempty"`
177+
178+
// NetCoreNetdevMaxBacklog specifies maximum number of packets, queued on the INPUT side, when the interface receives packets faster than kernel can process them.
179+
// Maps to net.core.netdev_max_backlog.
180+
// +kubebuilder:validation:Minimum=1000
181+
// +kubebuilder:validation:Maximum=3240000
182+
// +optional
183+
NetCoreNetdevMaxBacklog *int32 `json:"netCoreNetdevMaxBacklog,omitempty"`
184+
185+
// NetCoreOptmemMax specifies the maximum ancillary buffer size (option memory buffer) allowed per socket.
186+
// Socket option memory is used in a few cases to store extra structures relating to usage of the socket.
187+
// Maps to net.core.optmem_max.
188+
// +kubebuilder:validation:Minimum=20480
189+
// +kubebuilder:validation:Maximum=4194304
190+
// +optional
191+
NetCoreOptmemMax *int32 `json:"netCoreOptmemMax,omitempty"`
192+
193+
// NetCoreRmemDefault specifies the default receive socket buffer size in bytes.
194+
// Maps to net.core.rmem_default.
195+
// +kubebuilder:validation:Minimum=212992
196+
// +kubebuilder:validation:Maximum=134217728
197+
// +optional
198+
NetCoreRmemDefault *int32 `json:"netCoreRmemDefault,omitempty"`
199+
200+
// NetCoreRmemMax specifies the maximum receive socket buffer size in bytes.
201+
// Maps to net.core.rmem_max.
202+
// +kubebuilder:validation:Minimum=212992
203+
// +kubebuilder:validation:Maximum=134217728
204+
// +optional
205+
NetCoreRmemMax *int32 `json:"netCoreRmemMax,omitempty"`
206+
207+
// NetCoreSomaxconn specifies maximum number of connection requests that can be queued for any given listening socket.
208+
// An upper limit for the value of the backlog parameter passed to the listen(2)(https://man7.org/linux/man-pages/man2/listen.2.html) function.
209+
// If the backlog argument is greater than the somaxconn, then it's silently truncated to this limit.
210+
// Maps to net.core.somaxconn.
211+
// +kubebuilder:validation:Minimum=4096
212+
// +kubebuilder:validation:Maximum=3240000
213+
// +optional
214+
NetCoreSomaxconn *int32 `json:"netCoreSomaxconn,omitempty"`
215+
216+
// NetCoreWmemDefault specifies the default send socket buffer size in bytes.
217+
// Maps to net.core.wmem_default.
218+
// +kubebuilder:validation:Minimum=212992
219+
// +kubebuilder:validation:Maximum=134217728
220+
// +optional
221+
NetCoreWmemDefault *int32 `json:"netCoreWmemDefault,omitempty"`
222+
223+
// NetCoreWmemMax specifies the maximum send socket buffer size in bytes.
224+
// Maps to net.core.wmem_max.
225+
// +kubebuilder:validation:Minimum=212992
226+
// +kubebuilder:validation:Maximum=134217728
227+
// +optional
228+
NetCoreWmemMax *int32 `json:"netCoreWmemMax,omitempty"`
229+
230+
// NetIpv4IPLocalPortRange is used by TCP and UDP traffic to choose the local port on the agent node.
231+
// PortRange should be specified in the format "first last".
232+
// First, being an integer, must be between [1024 - 60999].
233+
// Last, being an integer, must be between [32768 - 65000].
234+
// Maps to net.ipv4.ip_local_port_range.
235+
// +optional
236+
NetIpv4IPLocalPortRange *string `json:"netIpv4IPLocalPortRange,omitempty"`
237+
238+
// NetIpv4NeighDefaultGcThresh1 specifies the minimum number of entries that may be in the ARP cache.
239+
// Garbage collection won't be triggered if the number of entries is below this setting.
240+
// Maps to net.ipv4.neigh.default.gc_thresh1.
241+
// +kubebuilder:validation:Minimum=128
242+
// +kubebuilder:validation:Maximum=80000
243+
// +optional
244+
NetIpv4NeighDefaultGcThresh1 *int32 `json:"netIpv4NeighDefaultGcThresh1,omitempty"`
245+
246+
// NetIpv4NeighDefaultGcThresh2 specifies soft maximum number of entries that may be in the ARP cache.
247+
// ARP garbage collection will be triggered about 5 seconds after reaching this soft maximum.
248+
// Maps to net.ipv4.neigh.default.gc_thresh2.
249+
// +kubebuilder:validation:Minimum=512
250+
// +kubebuilder:validation:Maximum=90000
251+
// +optional
252+
NetIpv4NeighDefaultGcThresh2 *int32 `json:"netIpv4NeighDefaultGcThresh2,omitempty"`
253+
254+
// NetIpv4NeighDefaultGcThresh3 specified hard maximum number of entries in the ARP cache.
255+
// Maps to net.ipv4.neigh.default.gc_thresh3.
256+
// +kubebuilder:validation:Minimum=1024
257+
// +kubebuilder:validation:Maximum=100000
258+
// +optional
259+
NetIpv4NeighDefaultGcThresh3 *int32 `json:"netIpv4NeighDefaultGcThresh3,omitempty"`
260+
261+
// NetIpv4TCPFinTimeout specifies the length of time an orphaned connection will remain in the FIN_WAIT_2 state before it's aborted at the local end.
262+
// Maps to net.ipv4.tcp_fin_timeout.
263+
// +kubebuilder:validation:Minimum=5
264+
// +kubebuilder:validation:Maximum=120
265+
// +optional
266+
NetIpv4TCPFinTimeout *int32 `json:"netIpv4TCPFinTimeout,omitempty"`
267+
268+
// NetIpv4TCPKeepaliveProbes specifies the number of keepalive probes TCP sends out, until it decides the connection is broken.
269+
// Maps to net.ipv4.tcp_keepalive_probes.
270+
// +kubebuilder:validation:Minimum=1
271+
// +kubebuilder:validation:Maximum=15
272+
// +optional
273+
NetIpv4TCPKeepaliveProbes *int32 `json:"netIpv4TCPKeepaliveProbes,omitempty"`
274+
275+
// NetIpv4TCPKeepaliveTime specifies the rate at which TCP sends out a keepalive message when keepalive is enabled.
276+
// Maps to net.ipv4.tcp_keepalive_time.
277+
// +kubebuilder:validation:Minimum=30
278+
// +kubebuilder:validation:Maximum=432000
279+
// +optional
280+
NetIpv4TCPKeepaliveTime *int32 `json:"netIpv4TCPKeepaliveTime,omitempty"`
281+
282+
// NetIpv4TCPMaxSynBacklog specifies the maximum number of queued connection requests that have still not received an acknowledgment from the connecting client.
283+
// If this number is exceeded, the kernel will begin dropping requests.
284+
// Maps to net.ipv4.tcp_max_syn_backlog.
285+
// +kubebuilder:validation:Minimum=128
286+
// +kubebuilder:validation:Maximum=3240000
287+
// +optional
288+
NetIpv4TCPMaxSynBacklog *int32 `json:"netIpv4TCPMaxSynBacklog,omitempty"`
289+
290+
// NetIpv4TCPMaxTwBuckets specifies maximal number of timewait sockets held by system simultaneously.
291+
// If this number is exceeded, time-wait socket is immediately destroyed and warning is printed.
292+
// Maps to net.ipv4.tcp_max_tw_buckets.
293+
// +kubebuilder:validation:Minimum=8000
294+
// +kubebuilder:validation:Maximum=1440000
295+
// +optional
296+
NetIpv4TCPMaxTwBuckets *int32 `json:"netIpv4TCPMaxTwBuckets,omitempty"`
297+
298+
// NetIpv4TCPTwReuse is used to allow to reuse TIME-WAIT sockets for new connections when it's safe from protocol viewpoint.
299+
// Maps to net.ipv4.tcp_tw_reuse.
300+
// +optional
301+
NetIpv4TCPTwReuse *bool `json:"netIpv4TCPTwReuse,omitempty"`
302+
303+
// NetIpv4TCPkeepaliveIntvl specifies the frequency of the probes sent out.
304+
// Multiplied by tcpKeepaliveprobes, it makes up the time to kill a connection that isn't responding, after probes started.
305+
// Maps to net.ipv4.tcp_keepalive_intvl.
306+
// +kubebuilder:validation:Minimum=1
307+
// +kubebuilder:validation:Maximum=75
308+
// +optional
309+
NetIpv4TCPkeepaliveIntvl *int32 `json:"netIpv4TCPkeepaliveIntvl,omitempty"`
310+
311+
// NetNetfilterNfConntrackBuckets specifies the size of hash table used by nf_conntrack module to record the established connection record of the TCP protocol.
312+
// Maps to net.netfilter.nf_conntrack_buckets.
313+
// +kubebuilder:validation:Minimum=65536
314+
// +kubebuilder:validation:Maximum=147456
315+
// +optional
316+
NetNetfilterNfConntrackBuckets *int32 `json:"netNetfilterNfConntrackBuckets,omitempty"`
317+
318+
// NetNetfilterNfConntrackMax specifies the maximum number of connections supported by the nf_conntrack module or the size of connection tracking table.
319+
// Maps to net.netfilter.nf_conntrack_max.
320+
// +kubebuilder:validation:Minimum=131072
321+
// +kubebuilder:validation:Maximum=1048576
322+
// +optional
323+
NetNetfilterNfConntrackMax *int32 `json:"netNetfilterNfConntrackMax,omitempty"`
324+
325+
// VMMaxMapCount specifies the maximum number of memory map areas a process may have.
326+
// Maps to vm.max_map_count.
327+
// +kubebuilder:validation:Minimum=65530
328+
// +kubebuilder:validation:Maximum=262144
329+
// +optional
330+
VMMaxMapCount *int32 `json:"vmMaxMapCount,omitempty"`
331+
332+
// VMSwappiness specifies aggressiveness of the kernel in swapping memory pages.
333+
// Higher values will increase aggressiveness, lower values decrease the amount of swap.
334+
// Maps to vm.swappiness.
335+
// +kubebuilder:validation:Minimum=0
336+
// +kubebuilder:validation:Maximum=100
337+
// +optional
338+
VMSwappiness *int32 `json:"vmSwappiness,omitempty"`
339+
340+
// VMVfsCachePressure specifies the percentage value that controls tendency of the kernel to reclaim the memory, which is used for caching of directory and inode objects.
341+
// Maps to vm.vfs_cache_pressure.
342+
// +kubebuilder:validation:Minimum=1
343+
// +kubebuilder:validation:Maximum=500
344+
// +optional
345+
VMVfsCachePressure *int32 `json:"vmVfsCachePressure,omitempty"`
346+
}
347+
348+
// LinuxOSConfig specifies the custom Linux OS settings and configurations.
349+
type LinuxOSConfig struct {
350+
// SwapFileSizeMB specifies size in MB of a swap file will be created on the agent nodes from this node pool.
351+
// Max value of SwapFileSizeMB should be the size of temporary disk(/dev/sdb). Refer: https://learn.microsoft.com/en-us/azure/virtual-machines/managed-disks-overview#temporary-disk
352+
// +kubebuilder:validation:Minimum=1
353+
// +optional
354+
SwapFileSizeMB *int32 `json:"swapFileSizeMB,omitempty"`
355+
356+
// Sysctl specifies the settings for Linux agent nodes.
357+
// +optional
358+
Sysctls *SysctlConfig `json:"sysctls,omitempty"`
359+
360+
// TransparentHugePageDefrag specifies whether the kernel should make aggressive use of memory compaction to make more hugepages available.
361+
// Refer to https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge for more details.
362+
// +kubebuilder:validation:Enum=always;defer;defer+madvise;madvise;never
363+
// +optional
364+
TransparentHugePageDefrag *TransparentHugePageOption `json:"transparentHugePageDefrag,omitempty"`
365+
366+
// TransparentHugePageEnabled specifies various modes of Transparent Hugepages. Refer to https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge for more details.
367+
// +kubebuilder:validation:Enum=always;madvise;never
368+
// +optional
369+
TransparentHugePageEnabled *TransparentHugePageOption `json:"transparentHugePageEnabled,omitempty"`
370+
}
371+
121372
// AzureManagedMachinePoolSpec defines the desired state of AzureManagedMachinePool.
122373
type AzureManagedMachinePoolSpec struct {
123374

@@ -203,6 +454,10 @@ type AzureManagedMachinePoolSpec struct {
203454
// +kubebuilder:validation:Enum=OS;Temporary
204455
// +optional
205456
KubeletDiskType *KubeletDiskType `json:"kubeletDiskType,omitempty"`
457+
458+
// LinuxOSConfig specifies the custom Linux OS settings and configurations.
459+
// +optional
460+
LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"`
206461
}
207462

208463
// ManagedMachinePoolScaling specifies scaling options.

0 commit comments

Comments
 (0)