From 8a69ff15287dc9dd0a713f9554bc0d425906fb6d Mon Sep 17 00:00:00 2001 From: Jan Chaloupka Date: Wed, 24 Jan 2024 10:44:39 +0100 Subject: [PATCH] config.openshift.io/v1/scheduler: allow profile customizations for DRA --- ...0_10_config-operator_01_scheduler.crd.yaml | 8 +++++ config/v1/types_scheduling.go | 18 +++++++++++ config/v1/zz_generated.deepcopy.go | 23 +++++++++++++- .../v1/zz_generated.swagger_doc_generated.go | 18 ++++++++--- .../generated_openapi/zz_generated.openapi.go | 31 ++++++++++++++++++- openapi/openapi.json | 18 +++++++++++ 6 files changed, 110 insertions(+), 6 deletions(-) diff --git a/config/v1/0000_10_config-operator_01_scheduler.crd.yaml b/config/v1/0000_10_config-operator_01_scheduler.crd.yaml index f161bc43223..f7e1aa5c725 100644 --- a/config/v1/0000_10_config-operator_01_scheduler.crd.yaml +++ b/config/v1/0000_10_config-operator_01_scheduler.crd.yaml @@ -59,6 +59,14 @@ spec: - LowNodeUtilization - HighNodeUtilization - NoScoring + profileCustomizations: + description: ProfileCustomizations contains various parameters for modifying the default behavior of certain profiles + type: object + properties: + experimentalDynamicResourceAllocation: + description: experimentalDynamicResourceAllocation enables/disables dynamic resource allocation feature. + type: string + default: Disabled status: description: status holds observed values from the cluster. They may not be overridden. type: object diff --git a/config/v1/types_scheduling.go b/config/v1/types_scheduling.go index 7367f414f91..7cf77d13518 100644 --- a/config/v1/types_scheduling.go +++ b/config/v1/types_scheduling.go @@ -42,6 +42,8 @@ type SchedulerSpec struct { // Defaults to "LowNodeUtilization" // +optional Profile SchedulerProfile `json:"profile,omitempty"` + // ProfileCustomizations contains various parameters for modifying the default behavior of certain profiles + ProfileCustomizations *ProfileCustomizations `json:"profileCustomizations,omitempty"` // defaultNodeSelector helps set the cluster-wide default node selector to // restrict pod placement to specific nodes. This is applied to the pods // created in all namespaces and creates an intersection with any existing @@ -93,6 +95,22 @@ var ( NoScoring SchedulerProfile = "NoScoring" ) +// ProfileCustomizations contains various parameters for modifying the default behavior of certain profiles +type ProfileCustomizations struct { + // experimentalDynamicResourceAllocation enables/disables dynamic resource allocation feature. + // +kubebuilder:default=Disabled + ExperimentalDynamicResourceAllocation DRAEnablement `json:"experimentalDynamicResourceAllocation"` +} + +type DRAEnablement string + +var ( + // DRAEnablementEnabled enables dynamic resource allocation feature + DRAEnablementEnabled DRAEnablement = "Enabled" + // DRAEnablementDisabled disables dynamic resource allocation feature + DRAEnablementDisabled DRAEnablement = "Disabled" +) + type SchedulerStatus struct { } diff --git a/config/v1/zz_generated.deepcopy.go b/config/v1/zz_generated.deepcopy.go index d4705556ad9..630447e6141 100644 --- a/config/v1/zz_generated.deepcopy.go +++ b/config/v1/zz_generated.deepcopy.go @@ -4826,6 +4826,22 @@ func (in *PrefixedClaimMapping) DeepCopy() *PrefixedClaimMapping { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProfileCustomizations) DeepCopyInto(out *ProfileCustomizations) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProfileCustomizations. +func (in *ProfileCustomizations) DeepCopy() *ProfileCustomizations { + if in == nil { + return nil + } + out := new(ProfileCustomizations) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Project) DeepCopyInto(out *Project) { *out = *in @@ -5220,7 +5236,7 @@ func (in *Scheduler) DeepCopyInto(out *Scheduler) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec + in.Spec.DeepCopyInto(&out.Spec) out.Status = in.Status return } @@ -5280,6 +5296,11 @@ func (in *SchedulerList) DeepCopyObject() runtime.Object { func (in *SchedulerSpec) DeepCopyInto(out *SchedulerSpec) { *out = *in out.Policy = in.Policy + if in.ProfileCustomizations != nil { + in, out := &in.ProfileCustomizations, &out.ProfileCustomizations + *out = new(ProfileCustomizations) + **out = **in + } return } diff --git a/config/v1/zz_generated.swagger_doc_generated.go b/config/v1/zz_generated.swagger_doc_generated.go index 270fa0acf9b..a21dd3896fe 100644 --- a/config/v1/zz_generated.swagger_doc_generated.go +++ b/config/v1/zz_generated.swagger_doc_generated.go @@ -2435,6 +2435,15 @@ func (ProxyStatus) SwaggerDoc() map[string]string { return map_ProxyStatus } +var map_ProfileCustomizations = map[string]string{ + "": "ProfileCustomizations contains various parameters for modifying the default behavior of certain profiles", + "experimentalDRAEnabled": "experimentalDRAEnabled enables DynamicResources scheduling plugin for dynamic resource allocation feature.", +} + +func (ProfileCustomizations) SwaggerDoc() map[string]string { + return map_ProfileCustomizations +} + var map_Scheduler = map[string]string{ "": "Scheduler holds cluster-wide config information to run the Kubernetes Scheduler and influence its placement decisions. The canonical name for this config is `cluster`.\n\nCompatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).", "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", @@ -2456,10 +2465,11 @@ func (SchedulerList) SwaggerDoc() map[string]string { } var map_SchedulerSpec = map[string]string{ - "policy": "DEPRECATED: the scheduler Policy API has been deprecated and will be removed in a future release. policy is a reference to a ConfigMap containing scheduler policy which has user specified predicates and priorities. If this ConfigMap is not available scheduler will default to use DefaultAlgorithmProvider. The namespace for this configmap is openshift-config.", - "profile": "profile sets which scheduling profile should be set in order to configure scheduling decisions for new pods.\n\nValid values are \"LowNodeUtilization\", \"HighNodeUtilization\", \"NoScoring\" Defaults to \"LowNodeUtilization\"", - "defaultNodeSelector": "defaultNodeSelector helps set the cluster-wide default node selector to restrict pod placement to specific nodes. This is applied to the pods created in all namespaces and creates an intersection with any existing nodeSelectors already set on a pod, additionally constraining that pod's selector. For example, defaultNodeSelector: \"type=user-node,region=east\" would set nodeSelector field in pod spec to \"type=user-node,region=east\" to all pods created in all namespaces. Namespaces having project-wide node selectors won't be impacted even if this field is set. This adds an annotation section to the namespace. For example, if a new namespace is created with node-selector='type=user-node,region=east', the annotation openshift.io/node-selector: type=user-node,region=east gets added to the project. When the openshift.io/node-selector annotation is set on the project the value is used in preference to the value we are setting for defaultNodeSelector field. For instance, openshift.io/node-selector: \"type=user-node,region=west\" means that the default of \"type=user-node,region=east\" set in defaultNodeSelector would not be applied.", - "mastersSchedulable": "MastersSchedulable allows masters nodes to be schedulable. When this flag is turned on, all the master nodes in the cluster will be made schedulable, so that workload pods can run on them. The default value for this field is false, meaning none of the master nodes are schedulable. Important Note: Once the workload pods start running on the master nodes, extreme care must be taken to ensure that cluster-critical control plane components are not impacted. Please turn on this field after doing due diligence.", + "policy": "DEPRECATED: the scheduler Policy API has been deprecated and will be removed in a future release. policy is a reference to a ConfigMap containing scheduler policy which has user specified predicates and priorities. If this ConfigMap is not available scheduler will default to use DefaultAlgorithmProvider. The namespace for this configmap is openshift-config.", + "profile": "profile sets which scheduling profile should be set in order to configure scheduling decisions for new pods.\n\nValid values are \"LowNodeUtilization\", \"HighNodeUtilization\", \"NoScoring\" Defaults to \"LowNodeUtilization\"", + "profileCustomizations": "ProfileCustomizations contains various parameters for modifying the default behavior of certain profiles", + "defaultNodeSelector": "defaultNodeSelector helps set the cluster-wide default node selector to restrict pod placement to specific nodes. This is applied to the pods created in all namespaces and creates an intersection with any existing nodeSelectors already set on a pod, additionally constraining that pod's selector. For example, defaultNodeSelector: \"type=user-node,region=east\" would set nodeSelector field in pod spec to \"type=user-node,region=east\" to all pods created in all namespaces. Namespaces having project-wide node selectors won't be impacted even if this field is set. This adds an annotation section to the namespace. For example, if a new namespace is created with node-selector='type=user-node,region=east', the annotation openshift.io/node-selector: type=user-node,region=east gets added to the project. When the openshift.io/node-selector annotation is set on the project the value is used in preference to the value we are setting for defaultNodeSelector field. For instance, openshift.io/node-selector: \"type=user-node,region=west\" means that the default of \"type=user-node,region=east\" set in defaultNodeSelector would not be applied.", + "mastersSchedulable": "MastersSchedulable allows masters nodes to be schedulable. When this flag is turned on, all the master nodes in the cluster will be made schedulable, so that workload pods can run on them. The default value for this field is false, meaning none of the master nodes are schedulable. Important Note: Once the workload pods start running on the master nodes, extreme care must be taken to ensure that cluster-critical control plane components are not impacted. Please turn on this field after doing due diligence.", } func (SchedulerSpec) SwaggerDoc() map[string]string { diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index b42c27c454d..6fd4f30d5ef 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -343,6 +343,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/openshift/api/config/v1.PowerVSPlatformStatus": schema_openshift_api_config_v1_PowerVSPlatformStatus(ref), "github.com/openshift/api/config/v1.PowerVSServiceEndpoint": schema_openshift_api_config_v1_PowerVSServiceEndpoint(ref), "github.com/openshift/api/config/v1.PrefixedClaimMapping": schema_openshift_api_config_v1_PrefixedClaimMapping(ref), + "github.com/openshift/api/config/v1.ProfileCustomizations": schema_openshift_api_config_v1_ProfileCustomizations(ref), "github.com/openshift/api/config/v1.Project": schema_openshift_api_config_v1_Project(ref), "github.com/openshift/api/config/v1.ProjectList": schema_openshift_api_config_v1_ProjectList(ref), "github.com/openshift/api/config/v1.ProjectSpec": schema_openshift_api_config_v1_ProjectSpec(ref), @@ -17333,6 +17334,28 @@ func schema_openshift_api_config_v1_PrefixedClaimMapping(ref common.ReferenceCal } } +func schema_openshift_api_config_v1_ProfileCustomizations(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ProfileCustomizations contains various parameters for modifying the default behavior of certain profiles", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "experimentalDynamicResourceAllocation": { + SchemaProps: spec.SchemaProps{ + Description: "experimentalDynamicResourceAllocation enables/disables dynamic resource allocation feature.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"experimentalDynamicResourceAllocation"}, + }, + }, + } +} + func schema_openshift_api_config_v1_Project(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -18240,6 +18263,12 @@ func schema_openshift_api_config_v1_SchedulerSpec(ref common.ReferenceCallback) Format: "", }, }, + "profileCustomizations": { + SchemaProps: spec.SchemaProps{ + Description: "ProfileCustomizations contains various parameters for modifying the default behavior of certain profiles", + Ref: ref("github.com/openshift/api/config/v1.ProfileCustomizations"), + }, + }, "defaultNodeSelector": { SchemaProps: spec.SchemaProps{ Description: "defaultNodeSelector helps set the cluster-wide default node selector to restrict pod placement to specific nodes. This is applied to the pods created in all namespaces and creates an intersection with any existing nodeSelectors already set on a pod, additionally constraining that pod's selector. For example, defaultNodeSelector: \"type=user-node,region=east\" would set nodeSelector field in pod spec to \"type=user-node,region=east\" to all pods created in all namespaces. Namespaces having project-wide node selectors won't be impacted even if this field is set. This adds an annotation section to the namespace. For example, if a new namespace is created with node-selector='type=user-node,region=east', the annotation openshift.io/node-selector: type=user-node,region=east gets added to the project. When the openshift.io/node-selector annotation is set on the project the value is used in preference to the value we are setting for defaultNodeSelector field. For instance, openshift.io/node-selector: \"type=user-node,region=west\" means that the default of \"type=user-node,region=east\" set in defaultNodeSelector would not be applied.", @@ -18259,7 +18288,7 @@ func schema_openshift_api_config_v1_SchedulerSpec(ref common.ReferenceCallback) }, }, Dependencies: []string{ - "github.com/openshift/api/config/v1.ConfigMapNameReference"}, + "github.com/openshift/api/config/v1.ConfigMapNameReference", "github.com/openshift/api/config/v1.ProfileCustomizations"}, } } diff --git a/openapi/openapi.json b/openapi/openapi.json index a9e90467587..adaaa26d99f 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -9375,6 +9375,20 @@ } } }, + "com.github.openshift.api.config.v1.ProfileCustomizations": { + "description": "ProfileCustomizations contains various parameters for modifying the default behavior of certain profiles", + "type": "object", + "required": [ + "experimentalDynamicResourceAllocation" + ], + "properties": { + "experimentalDynamicResourceAllocation": { + "description": "experimentalDynamicResourceAllocation enables/disables dynamic resource allocation feature.", + "type": "string", + "default": "" + } + } + }, "com.github.openshift.api.config.v1.Project": { "description": "Project holds cluster-wide information about Project. The canonical name is `cluster`\n\nCompatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).", "type": "object", @@ -9916,6 +9930,10 @@ "profile": { "description": "profile sets which scheduling profile should be set in order to configure scheduling decisions for new pods.\n\nValid values are \"LowNodeUtilization\", \"HighNodeUtilization\", \"NoScoring\" Defaults to \"LowNodeUtilization\"", "type": "string" + }, + "profileCustomizations": { + "description": "ProfileCustomizations contains various parameters for modifying the default behavior of certain profiles", + "$ref": "#/definitions/com.github.openshift.api.config.v1.ProfileCustomizations" } } },