From 5fdb95ecbfa6b8e66aba68d251467e20ba65b429 Mon Sep 17 00:00:00 2001 From: Talor Itzhak Date: Thu, 20 Aug 2026 13:15:07 +0300 Subject: [PATCH] apis: add missing fields to apis v1 PerformanceProfile API should support a full v1 <-> v2 support without data loss. The fact we're having missing fields on v1 means that a conversion from v2 to v1 will result in missing data. Adding those fields in order to fulfill the gap: Fields in v2 but missing from v1: 1. Shared *CPUSet 2. OvsDpdk *CPUSet 3. KernelPageSize *KernelPageSize 4. MixedCpus *bool The added fields has the exact same defaults behaviors, types, default values, and all of them are optional, so they'll be fully backward-compatible. Signed-off-by: Talor Itzhak --- .../performanceprofile/performance_profile.md | 2 +- manifests/20-performance-profile.crd.yaml | 38 +++++++++++++++---- .../v1/performanceprofile_types.go | 27 ++++++++++++- .../v1/zz_generated.deepcopy.go | 20 ++++++++++ 4 files changed, 77 insertions(+), 10 deletions(-) diff --git a/docs/performanceprofile/performance_profile.md b/docs/performanceprofile/performance_profile.md index 52fd2c2066..39ae271a8d 100644 --- a/docs/performanceprofile/performance_profile.md +++ b/docs/performanceprofile/performance_profile.md @@ -3,7 +3,7 @@ This document documents the PerformanceProfile API introduced by the Performance controller. -> This document is generated from code comments on the `PerformanceProfile` struct. +> This document is generated from code comments on the `PerformanceProfile` struct. > When contributing a change to this document please do so by changing those code comments. ## Table of Contents diff --git a/manifests/20-performance-profile.crd.yaml b/manifests/20-performance-profile.crd.yaml index ebb0f80460..e14ef8c08e 100644 --- a/manifests/20-performance-profile.crd.yaml +++ b/manifests/20-performance-profile.crd.yaml @@ -95,9 +95,22 @@ spec: offlined: description: Offline defines a set of CPUs that will be unused and set offline type: string + ovsDpdk: + description: |- + OvsDpdk defines a set of CPUs dedicated for OVS-DPDK PMD (Poll Mode Driver) + threads, fully isolated from the operating system and Kubernetes scheduling. + WorkloadPartitioning or --strict-cpu-reservation kubelet CPUManager policy + option is a prerequisite for this feature. + type: string reserved: description: Reserved defines a set of CPUs that will not be used for any container workloads initiated by kubelet. type: string + shared: + description: |- + Shared defines a set of CPUs that will be shared among guaranteed workloads + that needs additional cpus which are not exclusive, + alongside the isolated, exclusive resources that are being used already by those workloads. + type: string globallyDisableIrqLoadBalancing: description: |- GloballyDisableIrqLoadBalancing toggles whether IRQ load balancing will be disabled for the Isolated CPU set. @@ -153,6 +166,10 @@ spec: size: description: Size defines huge page size, maps to the 'hugepagesz' kernel boot parameter. type: string + kernelPageSize: + description: KernelPageSize defines the kernel page size. 4k is the default, 64k is only supported on aarch64 + type: string + default: 4k machineConfigLabel: description: |- MachineConfigLabel defines the label to add to the MachineConfigs the operator creates. It has to be @@ -234,10 +251,15 @@ spec: HighPowerConsumption defines if the node should be configured in high power consumption mode. The flag will affect the power consumption but will improve the CPUs latency. type: boolean + mixedCpus: + description: |- + MixedCpus enables the mixed-cpu-node-plugin on the node. + Defaults to false. + type: boolean perPodPowerManagement: description: |- PerPodPowerManagement defines if the node should be configured in per pod power management. - PerPodPowerManagement and HighPowerConsumption hints can not be enabled together. + PerPodPowerManagement and HighPowerConsumption hints can not be enabled together. Defaults to false. type: boolean realTime: description: RealTime defines if the node should be configured for the real time workload. Defaults to true. @@ -509,13 +531,6 @@ spec: offloads the complexity of cpu load balancing to the application. Defaults to "true" type: boolean - ovsDpdk: - description: |- - OvsDpdk defines a set of CPUs reserved for OVS-DPDK PMD (Poll Mode Driver) - threads, fully isolated from the operating system and Kubernetes scheduling. - WorkloadPartitioning or --strict-cpu-reservation kubelet CPUManager policy - option are a prerequisite for this feature. - type: string isolated: description: |- Isolated defines a set of CPUs that will be used to give to application threads the most execution time possible, @@ -528,6 +543,13 @@ spec: offlined: description: Offline defines a set of CPUs that will be unused and set offline type: string + ovsDpdk: + description: |- + OvsDpdk defines a set of CPUs dedicated for OVS-DPDK PMD (Poll Mode Driver) + threads, fully isolated from the operating system and Kubernetes scheduling. + WorkloadPartitioning or --strict-cpu-reservation kubelet CPUManager policy + option is a prerequisite for this feature. + type: string reserved: description: Reserved defines a set of CPUs that will not be used for any container workloads initiated by kubelet. type: string diff --git a/pkg/apis/performanceprofile/v1/performanceprofile_types.go b/pkg/apis/performanceprofile/v1/performanceprofile_types.go index cd0ea9b931..9dc58ccc1b 100644 --- a/pkg/apis/performanceprofile/v1/performanceprofile_types.go +++ b/pkg/apis/performanceprofile/v1/performanceprofile_types.go @@ -61,6 +61,10 @@ type PerformanceProfileSpec struct { NodeSelector map[string]string `json:"nodeSelector"` // RealTimeKernel defines a set of real time kernel related parameters. RT kernel won't be installed when not set. RealTimeKernel *RealTimeKernel `json:"realTimeKernel,omitempty"` + // KernelPageSize defines the kernel page size. 4k is the default, 64k is only supported on aarch64 + // +default="4k" + // +optional + KernelPageSize *KernelPageSize `json:"kernelPageSize,omitempty"` // Additional kernel arguments. // +optional AdditionalKernelArgs []string `json:"additionalKernelArgs,omitempty"` @@ -109,6 +113,17 @@ type CPU struct { // Offline defines a set of CPUs that will be unused and set offline // +optional Offlined *CPUSet `json:"offlined,omitempty"` + // Shared defines a set of CPUs that will be shared among guaranteed workloads + // that needs additional cpus which are not exclusive, + // alongside the isolated, exclusive resources that are being used already by those workloads. + // +optional + Shared *CPUSet `json:"shared,omitempty"` + // OvsDpdk defines a set of CPUs dedicated for OVS-DPDK PMD (Poll Mode Driver) + // threads, fully isolated from the operating system and Kubernetes scheduling. + // WorkloadPartitioning or --strict-cpu-reservation kubelet CPUManager policy + // option is a prerequisite for this feature. + // +optional + OvsDpdk *CPUSet `json:"ovsDpdk,omitempty"` } // CPUfrequency defines cpu frequencies for isolated and reserved cpus @@ -122,6 +137,12 @@ type HardwareTuning struct { ReservedCpuFreq *CPUfrequency `json:"reservedCpuFreq,omitempty"` } +// KernelPageSize defines the size of the kernel pages. +// The allowed values for this depend on CPU architecture +// For x86/amd64, the only valid value is 4k. +// For aarch64, the valid values are 4k, 64k. +type KernelPageSize string + // HugePageSize defines size of huge pages, can be 2M or 1G. type HugePageSize string @@ -195,8 +216,12 @@ type WorkloadHints struct { RealTime *bool `json:"realTime,omitempty"` // +optional // PerPodPowerManagement defines if the node should be configured in per pod power management. - // PerPodPowerManagement and HighPowerConsumption hints can not be enabled together. + // PerPodPowerManagement and HighPowerConsumption hints can not be enabled together. Defaults to false. PerPodPowerManagement *bool `json:"perPodPowerManagement,omitempty"` + // +optional + // MixedCpus enables the mixed-cpu-node-plugin on the node. + // Defaults to false. + MixedCpus *bool `json:"mixedCpus,omitempty"` } // PerformanceProfileStatus defines the observed state of PerformanceProfile. diff --git a/pkg/apis/performanceprofile/v1/zz_generated.deepcopy.go b/pkg/apis/performanceprofile/v1/zz_generated.deepcopy.go index 6730007972..450df08161 100644 --- a/pkg/apis/performanceprofile/v1/zz_generated.deepcopy.go +++ b/pkg/apis/performanceprofile/v1/zz_generated.deepcopy.go @@ -48,6 +48,16 @@ func (in *CPU) DeepCopyInto(out *CPU) { *out = new(CPUSet) **out = **in } + if in.Shared != nil { + in, out := &in.Shared, &out.Shared + *out = new(CPUSet) + **out = **in + } + if in.OvsDpdk != nil { + in, out := &in.OvsDpdk, &out.OvsDpdk + *out = new(CPUSet) + **out = **in + } return } @@ -321,6 +331,11 @@ func (in *PerformanceProfileSpec) DeepCopyInto(out *PerformanceProfileSpec) { *out = new(RealTimeKernel) (*in).DeepCopyInto(*out) } + if in.KernelPageSize != nil { + in, out := &in.KernelPageSize, &out.KernelPageSize + *out = new(KernelPageSize) + **out = **in + } if in.AdditionalKernelArgs != nil { in, out := &in.AdditionalKernelArgs, &out.AdditionalKernelArgs *out = make([]string, len(*in)) @@ -431,6 +446,11 @@ func (in *WorkloadHints) DeepCopyInto(out *WorkloadHints) { *out = new(bool) **out = **in } + if in.MixedCpus != nil { + in, out := &in.MixedCpus, &out.MixedCpus + *out = new(bool) + **out = **in + } return }