diff --git a/Gopkg.lock b/Gopkg.lock index 5c1e21a2..6cb461ad 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -233,6 +233,7 @@ input-imports = [ "github.com/go-openapi/spec", "k8s.io/api/core/v1", + "k8s.io/apimachinery/pkg/api/resource", "k8s.io/kube-openapi/pkg/common", ] solver-name = "gps-cdcl" diff --git a/api/v1/openapi_generated.go b/api/v1/openapi_generated.go index b489babf..cf7dc50d 100644 --- a/api/v1/openapi_generated.go +++ b/api/v1/openapi_generated.go @@ -30,6 +30,8 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ "kmodules.xyz/offshoot-api/api/v1.ContainerRuntimeSettings": schema_kmodulesxyz_offshoot_api_api_v1_ContainerRuntimeSettings(ref), + "kmodules.xyz/offshoot-api/api/v1.IONiceSettings": schema_kmodulesxyz_offshoot_api_api_v1_IONiceSettings(ref), + "kmodules.xyz/offshoot-api/api/v1.NiceSettings": schema_kmodulesxyz_offshoot_api_api_v1_NiceSettings(ref), "kmodules.xyz/offshoot-api/api/v1.ObjectMeta": schema_kmodulesxyz_offshoot_api_api_v1_ObjectMeta(ref), "kmodules.xyz/offshoot-api/api/v1.PodRuntimeSettings": schema_kmodulesxyz_offshoot_api_api_v1_PodRuntimeSettings(ref), "kmodules.xyz/offshoot-api/api/v1.PodSpec": schema_kmodulesxyz_offshoot_api_api_v1_PodSpec(ref), @@ -76,11 +78,67 @@ func schema_kmodulesxyz_offshoot_api_api_v1_ContainerRuntimeSettings(ref common. Ref: ref("k8s.io/api/core/v1.SecurityContext"), }, }, + "nice": { + SchemaProps: spec.SchemaProps{ + Description: "Settings to configure `nice` to throttle the load on cpu. More info: http://kennystechtalk.blogspot.com/2015/04/throttling-cpu-usage-with-linux-cgroups.html More info: https://oakbytes.wordpress.com/2012/06/06/linux-scheduler-cfs-and-nice/", + Ref: ref("kmodules.xyz/offshoot-api/api/v1.NiceSettings"), + }, + }, + "ionice": { + SchemaProps: spec.SchemaProps{ + Description: "Settings to configure `ionice` to throttle the load on disk. More info: http://kennystechtalk.blogspot.com/2015/04/throttling-cpu-usage-with-linux-cgroups.html More info: https://oakbytes.wordpress.com/2012/06/06/linux-scheduler-cfs-and-nice/", + Ref: ref("kmodules.xyz/offshoot-api/api/v1.IONiceSettings"), + }, + }, }, }, }, Dependencies: []string{ - "k8s.io/api/core/v1.Lifecycle", "k8s.io/api/core/v1.Probe", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.SecurityContext"}, + "k8s.io/api/core/v1.Lifecycle", "k8s.io/api/core/v1.Probe", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.SecurityContext", "kmodules.xyz/offshoot-api/api/v1.IONiceSettings", "kmodules.xyz/offshoot-api/api/v1.NiceSettings"}, + } +} + +func schema_kmodulesxyz_offshoot_api_api_v1_IONiceSettings(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "https://linux.die.net/man/1/ionice", + Properties: map[string]spec.Schema{ + "class": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int32", + }, + }, + "classData": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{}, + } +} + +func schema_kmodulesxyz_offshoot_api_api_v1_NiceSettings(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "https://linux.die.net/man/1/nice", + Properties: map[string]spec.Schema{ + "adjustment": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{}, } } diff --git a/api/v1/runtime_settings_types.go b/api/v1/runtime_settings_types.go index 5ab0ad31..cf8bb638 100644 --- a/api/v1/runtime_settings_types.go +++ b/api/v1/runtime_settings_types.go @@ -111,4 +111,25 @@ type ContainerRuntimeSettings struct { // More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ // +optional SecurityContext *core.SecurityContext `json:"securityContext,omitempty"` + // Settings to configure `nice` to throttle the load on cpu. + // More info: http://kennystechtalk.blogspot.com/2015/04/throttling-cpu-usage-with-linux-cgroups.html + // More info: https://oakbytes.wordpress.com/2012/06/06/linux-scheduler-cfs-and-nice/ + // +optional + Nice *NiceSettings `json:"nice,omitempty"` + // Settings to configure `ionice` to throttle the load on disk. + // More info: http://kennystechtalk.blogspot.com/2015/04/throttling-cpu-usage-with-linux-cgroups.html + // More info: https://oakbytes.wordpress.com/2012/06/06/linux-scheduler-cfs-and-nice/ + // +optional + IONice *IONiceSettings `json:"ionice,omitempty"` +} + +// https://linux.die.net/man/1/nice +type NiceSettings struct { + Adjustment *int32 `json:"adjustment,omitempty"` +} + +// https://linux.die.net/man/1/ionice +type IONiceSettings struct { + Class *int32 `json:"class,omitempty"` + ClassData *int32 `json:"classData,omitempty"` } diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 08a3acda..28ffbca0 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -48,6 +48,16 @@ func (in *ContainerRuntimeSettings) DeepCopyInto(out *ContainerRuntimeSettings) *out = new(corev1.SecurityContext) (*in).DeepCopyInto(*out) } + if in.Nice != nil { + in, out := &in.Nice, &out.Nice + *out = new(NiceSettings) + (*in).DeepCopyInto(*out) + } + if in.IONice != nil { + in, out := &in.IONice, &out.IONice + *out = new(IONiceSettings) + (*in).DeepCopyInto(*out) + } return } @@ -61,6 +71,53 @@ func (in *ContainerRuntimeSettings) DeepCopy() *ContainerRuntimeSettings { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IONiceSettings) DeepCopyInto(out *IONiceSettings) { + *out = *in + if in.Class != nil { + in, out := &in.Class, &out.Class + *out = new(int32) + **out = **in + } + if in.ClassData != nil { + in, out := &in.ClassData, &out.ClassData + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IONiceSettings. +func (in *IONiceSettings) DeepCopy() *IONiceSettings { + if in == nil { + return nil + } + out := new(IONiceSettings) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NiceSettings) DeepCopyInto(out *NiceSettings) { + *out = *in + if in.Adjustment != nil { + in, out := &in.Adjustment, &out.Adjustment + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NiceSettings. +func (in *NiceSettings) DeepCopy() *NiceSettings { + if in == nil { + return nil + } + out := new(NiceSettings) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ObjectMeta) DeepCopyInto(out *ObjectMeta) { *out = *in