mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 19:47:56 +00:00
Fix AutoUpdateAnnotationKey, NominalConcurrencyShares
Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>
This commit is contained in:
parent
3d3240c8b4
commit
a9d8cace1f
@ -33,5 +33,16 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
|||||||
obj.LendablePercent = &i
|
obj.LendablePercent = &i
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
func(obj *flowcontrol.ExemptPriorityLevelConfiguration, c fuzz.Continue) {
|
||||||
|
c.FuzzNoCustom(obj) // fuzz self without calling this function again
|
||||||
|
if obj.NominalConcurrencyShares == nil {
|
||||||
|
i := int32(0)
|
||||||
|
obj.NominalConcurrencyShares = &i
|
||||||
|
}
|
||||||
|
if obj.LendablePercent == nil {
|
||||||
|
i := int32(0)
|
||||||
|
obj.LendablePercent = &i
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@ type ExemptPriorityLevelConfiguration struct {
|
|||||||
// at the expense of every other priority level.
|
// at the expense of every other priority level.
|
||||||
// This field has a default value of zero.
|
// This field has a default value of zero.
|
||||||
// +optional
|
// +optional
|
||||||
NominalConcurrencyShares int32
|
NominalConcurrencyShares *int32
|
||||||
// `lendablePercent` prescribes the fraction of the level's NominalCL that
|
// `lendablePercent` prescribes the fraction of the level's NominalCL that
|
||||||
// can be borrowed by other priority levels. This value of this
|
// can be borrowed by other priority levels. This value of this
|
||||||
// field must be between 0 and 100, inclusive, and it defaults to 0.
|
// field must be between 0 and 100, inclusive, and it defaults to 0.
|
||||||
|
@ -40,6 +40,17 @@ func SetDefaults_FlowSchemaSpec(spec *v1alpha1.FlowSchemaSpec) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetDefaults_ExemptPriorityLevelConfiguration(eplc *v1alpha1.ExemptPriorityLevelConfiguration) {
|
||||||
|
if eplc.NominalConcurrencyShares == nil {
|
||||||
|
eplc.NominalConcurrencyShares = new(int32)
|
||||||
|
*eplc.NominalConcurrencyShares = 0
|
||||||
|
}
|
||||||
|
if eplc.LendablePercent == nil {
|
||||||
|
eplc.LendablePercent = new(int32)
|
||||||
|
*eplc.LendablePercent = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func SetDefaults_LimitedPriorityLevelConfiguration(lplc *v1alpha1.LimitedPriorityLevelConfiguration) {
|
func SetDefaults_LimitedPriorityLevelConfiguration(lplc *v1alpha1.LimitedPriorityLevelConfiguration) {
|
||||||
if lplc.AssuredConcurrencyShares == 0 {
|
if lplc.AssuredConcurrencyShares == 0 {
|
||||||
lplc.AssuredConcurrencyShares = PriorityLevelConfigurationDefaultAssuredConcurrencyShares
|
lplc.AssuredConcurrencyShares = PriorityLevelConfigurationDefaultAssuredConcurrencyShares
|
||||||
|
@ -33,6 +33,24 @@ func TestDefaultWithPriorityLevelConfiguration(t *testing.T) {
|
|||||||
original runtime.Object
|
original runtime.Object
|
||||||
expected runtime.Object
|
expected runtime.Object
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
name: "Defaulting for Exempt",
|
||||||
|
original: &flowcontrolv1alpha1.PriorityLevelConfiguration{
|
||||||
|
Spec: flowcontrolv1alpha1.PriorityLevelConfigurationSpec{
|
||||||
|
Type: flowcontrolv1alpha1.PriorityLevelEnablementExempt,
|
||||||
|
Exempt: &flowcontrolv1alpha1.ExemptPriorityLevelConfiguration{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expected: &flowcontrolv1alpha1.PriorityLevelConfiguration{
|
||||||
|
Spec: flowcontrolv1alpha1.PriorityLevelConfigurationSpec{
|
||||||
|
Type: flowcontrolv1alpha1.PriorityLevelEnablementExempt,
|
||||||
|
Exempt: &flowcontrolv1alpha1.ExemptPriorityLevelConfiguration{
|
||||||
|
NominalConcurrencyShares: pointer.Int32(0),
|
||||||
|
LendablePercent: pointer.Int32(0),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "LendablePercent is not specified, should default to zero",
|
name: "LendablePercent is not specified, should default to zero",
|
||||||
original: &flowcontrolv1alpha1.PriorityLevelConfiguration{
|
original: &flowcontrolv1alpha1.PriorityLevelConfiguration{
|
||||||
|
@ -40,6 +40,17 @@ func SetDefaults_FlowSchemaSpec(spec *v1beta1.FlowSchemaSpec) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetDefaults_ExemptPriorityLevelConfiguration(eplc *v1beta1.ExemptPriorityLevelConfiguration) {
|
||||||
|
if eplc.NominalConcurrencyShares == nil {
|
||||||
|
eplc.NominalConcurrencyShares = new(int32)
|
||||||
|
*eplc.NominalConcurrencyShares = 0
|
||||||
|
}
|
||||||
|
if eplc.LendablePercent == nil {
|
||||||
|
eplc.LendablePercent = new(int32)
|
||||||
|
*eplc.LendablePercent = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func SetDefaults_LimitedPriorityLevelConfiguration(lplc *v1beta1.LimitedPriorityLevelConfiguration) {
|
func SetDefaults_LimitedPriorityLevelConfiguration(lplc *v1beta1.LimitedPriorityLevelConfiguration) {
|
||||||
if lplc.AssuredConcurrencyShares == 0 {
|
if lplc.AssuredConcurrencyShares == 0 {
|
||||||
lplc.AssuredConcurrencyShares = PriorityLevelConfigurationDefaultAssuredConcurrencyShares
|
lplc.AssuredConcurrencyShares = PriorityLevelConfigurationDefaultAssuredConcurrencyShares
|
||||||
|
@ -33,6 +33,24 @@ func TestDefaultWithPriorityLevelConfiguration(t *testing.T) {
|
|||||||
original runtime.Object
|
original runtime.Object
|
||||||
expected runtime.Object
|
expected runtime.Object
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
name: "Defaulting for Exempt",
|
||||||
|
original: &flowcontrolv1beta1.PriorityLevelConfiguration{
|
||||||
|
Spec: flowcontrolv1beta1.PriorityLevelConfigurationSpec{
|
||||||
|
Type: flowcontrolv1beta1.PriorityLevelEnablementExempt,
|
||||||
|
Exempt: &flowcontrolv1beta1.ExemptPriorityLevelConfiguration{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expected: &flowcontrolv1beta1.PriorityLevelConfiguration{
|
||||||
|
Spec: flowcontrolv1beta1.PriorityLevelConfigurationSpec{
|
||||||
|
Type: flowcontrolv1beta1.PriorityLevelEnablementExempt,
|
||||||
|
Exempt: &flowcontrolv1beta1.ExemptPriorityLevelConfiguration{
|
||||||
|
NominalConcurrencyShares: pointer.Int32(0),
|
||||||
|
LendablePercent: pointer.Int32(0),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "LendablePercent is not specified, should default to zero",
|
name: "LendablePercent is not specified, should default to zero",
|
||||||
original: &flowcontrolv1beta1.PriorityLevelConfiguration{
|
original: &flowcontrolv1beta1.PriorityLevelConfiguration{
|
||||||
|
@ -40,6 +40,17 @@ func SetDefaults_FlowSchemaSpec(spec *v1beta2.FlowSchemaSpec) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetDefaults_ExemptPriorityLevelConfiguration(eplc *v1beta2.ExemptPriorityLevelConfiguration) {
|
||||||
|
if eplc.NominalConcurrencyShares == nil {
|
||||||
|
eplc.NominalConcurrencyShares = new(int32)
|
||||||
|
*eplc.NominalConcurrencyShares = 0
|
||||||
|
}
|
||||||
|
if eplc.LendablePercent == nil {
|
||||||
|
eplc.LendablePercent = new(int32)
|
||||||
|
*eplc.LendablePercent = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func SetDefaults_LimitedPriorityLevelConfiguration(lplc *v1beta2.LimitedPriorityLevelConfiguration) {
|
func SetDefaults_LimitedPriorityLevelConfiguration(lplc *v1beta2.LimitedPriorityLevelConfiguration) {
|
||||||
if lplc.AssuredConcurrencyShares == 0 {
|
if lplc.AssuredConcurrencyShares == 0 {
|
||||||
lplc.AssuredConcurrencyShares = PriorityLevelConfigurationDefaultAssuredConcurrencyShares
|
lplc.AssuredConcurrencyShares = PriorityLevelConfigurationDefaultAssuredConcurrencyShares
|
||||||
|
@ -33,6 +33,24 @@ func TestDefaultWithPriorityLevelConfiguration(t *testing.T) {
|
|||||||
original runtime.Object
|
original runtime.Object
|
||||||
expected runtime.Object
|
expected runtime.Object
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
name: "Defaulting for Exempt",
|
||||||
|
original: &flowcontrolv1beta2.PriorityLevelConfiguration{
|
||||||
|
Spec: flowcontrolv1beta2.PriorityLevelConfigurationSpec{
|
||||||
|
Type: flowcontrolv1beta2.PriorityLevelEnablementExempt,
|
||||||
|
Exempt: &flowcontrolv1beta2.ExemptPriorityLevelConfiguration{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expected: &flowcontrolv1beta2.PriorityLevelConfiguration{
|
||||||
|
Spec: flowcontrolv1beta2.PriorityLevelConfigurationSpec{
|
||||||
|
Type: flowcontrolv1beta2.PriorityLevelEnablementExempt,
|
||||||
|
Exempt: &flowcontrolv1beta2.ExemptPriorityLevelConfiguration{
|
||||||
|
NominalConcurrencyShares: pointer.Int32(0),
|
||||||
|
LendablePercent: pointer.Int32(0),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "LendablePercent is not specified, should default to zero",
|
name: "LendablePercent is not specified, should default to zero",
|
||||||
original: &flowcontrolv1beta2.PriorityLevelConfiguration{
|
original: &flowcontrolv1beta2.PriorityLevelConfiguration{
|
||||||
|
@ -40,6 +40,17 @@ func SetDefaults_FlowSchemaSpec(spec *v1beta3.FlowSchemaSpec) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetDefaults_ExemptPriorityLevelConfiguration(eplc *v1beta3.ExemptPriorityLevelConfiguration) {
|
||||||
|
if eplc.NominalConcurrencyShares == nil {
|
||||||
|
eplc.NominalConcurrencyShares = new(int32)
|
||||||
|
*eplc.NominalConcurrencyShares = 0
|
||||||
|
}
|
||||||
|
if eplc.LendablePercent == nil {
|
||||||
|
eplc.LendablePercent = new(int32)
|
||||||
|
*eplc.LendablePercent = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func SetDefaults_LimitedPriorityLevelConfiguration(lplc *v1beta3.LimitedPriorityLevelConfiguration) {
|
func SetDefaults_LimitedPriorityLevelConfiguration(lplc *v1beta3.LimitedPriorityLevelConfiguration) {
|
||||||
if lplc.NominalConcurrencyShares == 0 {
|
if lplc.NominalConcurrencyShares == 0 {
|
||||||
lplc.NominalConcurrencyShares = PriorityLevelConfigurationDefaultNominalConcurrencyShares
|
lplc.NominalConcurrencyShares = PriorityLevelConfigurationDefaultNominalConcurrencyShares
|
||||||
|
@ -34,7 +34,25 @@ func TestDefaultWithPriorityLevelConfiguration(t *testing.T) {
|
|||||||
expected runtime.Object
|
expected runtime.Object
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "LendablePercent is not specified, should default to zero",
|
name: "Defaulting for Exempt",
|
||||||
|
original: &flowcontrolv1beta3.PriorityLevelConfiguration{
|
||||||
|
Spec: flowcontrolv1beta3.PriorityLevelConfigurationSpec{
|
||||||
|
Type: flowcontrolv1beta3.PriorityLevelEnablementExempt,
|
||||||
|
Exempt: &flowcontrolv1beta3.ExemptPriorityLevelConfiguration{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expected: &flowcontrolv1beta3.PriorityLevelConfiguration{
|
||||||
|
Spec: flowcontrolv1beta3.PriorityLevelConfigurationSpec{
|
||||||
|
Type: flowcontrolv1beta3.PriorityLevelEnablementExempt,
|
||||||
|
Exempt: &flowcontrolv1beta3.ExemptPriorityLevelConfiguration{
|
||||||
|
NominalConcurrencyShares: pointer.Int32(0),
|
||||||
|
LendablePercent: pointer.Int32(0),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "LendablePercent is not specified in Limited, should default to zero",
|
||||||
original: &flowcontrolv1beta3.PriorityLevelConfiguration{
|
original: &flowcontrolv1beta3.PriorityLevelConfiguration{
|
||||||
Spec: flowcontrolv1beta3.PriorityLevelConfigurationSpec{
|
Spec: flowcontrolv1beta3.PriorityLevelConfigurationSpec{
|
||||||
Type: flowcontrolv1beta3.PriorityLevelEnablementLimited,
|
Type: flowcontrolv1beta3.PriorityLevelEnablementLimited,
|
||||||
|
@ -497,7 +497,7 @@ type ExemptPriorityLevelConfiguration struct {
|
|||||||
// at the expense of every other priority level.
|
// at the expense of every other priority level.
|
||||||
// This field has a default value of zero.
|
// This field has a default value of zero.
|
||||||
// +optional
|
// +optional
|
||||||
NominalConcurrencyShares int32 `json:"nominalConcurrencyShares" protobuf:"varint,1,opt,name=nominalConcurrencyShares"`
|
NominalConcurrencyShares *int32 `json:"nominalConcurrencyShares,omitempty" protobuf:"varint,1,opt,name=nominalConcurrencyShares"`
|
||||||
// `lendablePercent` prescribes the fraction of the level's NominalCL that
|
// `lendablePercent` prescribes the fraction of the level's NominalCL that
|
||||||
// can be borrowed by other priority levels. This value of this
|
// can be borrowed by other priority levels. This value of this
|
||||||
// field must be between 0 and 100, inclusive, and it defaults to 0.
|
// field must be between 0 and 100, inclusive, and it defaults to 0.
|
||||||
|
@ -77,7 +77,9 @@ const (
|
|||||||
// is a boolean false or has an invalid boolean representation
|
// is a boolean false or has an invalid boolean representation
|
||||||
// (if the cluster operator sets it to 'false' it will be stomped)
|
// (if the cluster operator sets it to 'false' it will be stomped)
|
||||||
// - any changes to the spec made by the cluster operator will be
|
// - any changes to the spec made by the cluster operator will be
|
||||||
// stomped.
|
// stomped, except for changes to the `nominalConcurrencyShares`
|
||||||
|
// and `lendablePercent` fields of the PriorityLevelConfiguration
|
||||||
|
// named "exempt".
|
||||||
//
|
//
|
||||||
// The kube-apiserver will apply updates on the suggested configuration if:
|
// The kube-apiserver will apply updates on the suggested configuration if:
|
||||||
// - the cluster operator has enabled auto-update by setting the annotation
|
// - the cluster operator has enabled auto-update by setting the annotation
|
||||||
@ -533,7 +535,7 @@ type ExemptPriorityLevelConfiguration struct {
|
|||||||
// at the expense of every other priority level.
|
// at the expense of every other priority level.
|
||||||
// This field has a default value of zero.
|
// This field has a default value of zero.
|
||||||
// +optional
|
// +optional
|
||||||
NominalConcurrencyShares int32 `json:"nominalConcurrencyShares" protobuf:"varint,1,opt,name=nominalConcurrencyShares"`
|
NominalConcurrencyShares *int32 `json:"nominalConcurrencyShares,omitempty" protobuf:"varint,1,opt,name=nominalConcurrencyShares"`
|
||||||
// `lendablePercent` prescribes the fraction of the level's NominalCL that
|
// `lendablePercent` prescribes the fraction of the level's NominalCL that
|
||||||
// can be borrowed by other priority levels. This value of this
|
// can be borrowed by other priority levels. This value of this
|
||||||
// field must be between 0 and 100, inclusive, and it defaults to 0.
|
// field must be between 0 and 100, inclusive, and it defaults to 0.
|
||||||
|
@ -77,7 +77,9 @@ const (
|
|||||||
// is a boolean false or has an invalid boolean representation
|
// is a boolean false or has an invalid boolean representation
|
||||||
// (if the cluster operator sets it to 'false' it will be stomped)
|
// (if the cluster operator sets it to 'false' it will be stomped)
|
||||||
// - any changes to the spec made by the cluster operator will be
|
// - any changes to the spec made by the cluster operator will be
|
||||||
// stomped.
|
// stomped, except for changes to the `nominalConcurrencyShares`
|
||||||
|
// and `lendablePercent` fields of the PriorityLevelConfiguration
|
||||||
|
// named "exempt".
|
||||||
//
|
//
|
||||||
// The kube-apiserver will apply updates on the suggested configuration if:
|
// The kube-apiserver will apply updates on the suggested configuration if:
|
||||||
// - the cluster operator has enabled auto-update by setting the annotation
|
// - the cluster operator has enabled auto-update by setting the annotation
|
||||||
@ -533,7 +535,7 @@ type ExemptPriorityLevelConfiguration struct {
|
|||||||
// at the expense of every other priority level.
|
// at the expense of every other priority level.
|
||||||
// This field has a default value of zero.
|
// This field has a default value of zero.
|
||||||
// +optional
|
// +optional
|
||||||
NominalConcurrencyShares int32 `json:"nominalConcurrencyShares" protobuf:"varint,1,opt,name=nominalConcurrencyShares"`
|
NominalConcurrencyShares *int32 `json:"nominalConcurrencyShares,omitempty" protobuf:"varint,1,opt,name=nominalConcurrencyShares"`
|
||||||
// `lendablePercent` prescribes the fraction of the level's NominalCL that
|
// `lendablePercent` prescribes the fraction of the level's NominalCL that
|
||||||
// can be borrowed by other priority levels. This value of this
|
// can be borrowed by other priority levels. This value of this
|
||||||
// field must be between 0 and 100, inclusive, and it defaults to 0.
|
// field must be between 0 and 100, inclusive, and it defaults to 0.
|
||||||
|
@ -77,7 +77,9 @@ const (
|
|||||||
// is a boolean false or has an invalid boolean representation
|
// is a boolean false or has an invalid boolean representation
|
||||||
// (if the cluster operator sets it to 'false' it will be stomped)
|
// (if the cluster operator sets it to 'false' it will be stomped)
|
||||||
// - any changes to the spec made by the cluster operator will be
|
// - any changes to the spec made by the cluster operator will be
|
||||||
// stomped.
|
// stomped, except for changes to the `nominalConcurrencyShares`
|
||||||
|
// and `lendablePercent` fields of the PriorityLevelConfiguration
|
||||||
|
// named "exempt".
|
||||||
//
|
//
|
||||||
// The kube-apiserver will apply updates on the suggested configuration if:
|
// The kube-apiserver will apply updates on the suggested configuration if:
|
||||||
// - the cluster operator has enabled auto-update by setting the annotation
|
// - the cluster operator has enabled auto-update by setting the annotation
|
||||||
@ -531,7 +533,7 @@ type ExemptPriorityLevelConfiguration struct {
|
|||||||
// at the expense of every other priority level.
|
// at the expense of every other priority level.
|
||||||
// This field has a default value of zero.
|
// This field has a default value of zero.
|
||||||
// +optional
|
// +optional
|
||||||
NominalConcurrencyShares int32 `json:"nominalConcurrencyShares" protobuf:"varint,1,opt,name=nominalConcurrencyShares"`
|
NominalConcurrencyShares *int32 `json:"nominalConcurrencyShares,omitempty" protobuf:"varint,1,opt,name=nominalConcurrencyShares"`
|
||||||
// `lendablePercent` prescribes the fraction of the level's NominalCL that
|
// `lendablePercent` prescribes the fraction of the level's NominalCL that
|
||||||
// can be borrowed by other priority levels. This value of this
|
// can be borrowed by other priority levels. This value of this
|
||||||
// field must be between 0 and 100, inclusive, and it defaults to 0.
|
// field must be between 0 and 100, inclusive, and it defaults to 0.
|
||||||
|
Loading…
Reference in New Issue
Block a user