Skip to content

Commit

Permalink
bump rancher type updates (#744)
Browse files Browse the repository at this point in the history
  • Loading branch information
HarrisonWAffel authored Feb 28, 2025
1 parent c1e5a0f commit a2575c4
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ The `SchedulingCustomization` subfield of the `DeploymentCustomization` field de
The `schedulingCustomization.PriorityClass` field contains two attributes

+ `value`: This must be an integer value equal to or between negative 1 billion and 1 billion.
+ `preemption`: This must be a string value which indicates the desired preemption behavior, its value can be either `PreemptLowerPriority` or `Never`. Any other value must be rejected.
+ `preemptionPolicy`: This must be a string value which indicates the desired preemption behavior, its value can be either `PreemptLowerPriority` or `Never`. Any other value must be rejected.

The `schedulingCustomization.PodDisruptionBudget` field contains two attributes

Expand Down Expand Up @@ -563,7 +563,7 @@ The `SchedulingCustomization` subfield of the `DeploymentCustomization` field de
The `schedulingCustomization.PriorityClass` field contains two attributes

+ `value`: This must be an integer value equal to or between negative 1 billion and 1 billion.
+ `preemption`: This must be a string value which indicates the desired preemption behavior, its value can be either `PreemptLowerPriority` or `Never`. Any other value must be rejected.
+ `preemptionPolicy`: This must be a string value which indicates the desired preemption behavior, its value can be either `PreemptLowerPriority` or `Never`. Any other value must be rejected.

The `schedulingCustomization.PodDisruptionBudget` field contains two attributes

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require (
github.com/gorilla/mux v1.8.1
github.com/rancher/dynamiclistener v0.6.1
github.com/rancher/lasso v0.2.1
github.com/rancher/rancher/pkg/apis v0.0.0-20250224123908-bff2809d433c
github.com/rancher/rancher/pkg/apis v0.0.0-20250227174106-7829dbe62d7f
github.com/rancher/rke v1.8.0-rc.2
github.com/rancher/wrangler/v3 v3.2.0-rc.3
github.com/robfig/cron v1.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ github.com/rancher/lasso v0.2.1 h1:SZTqMVQn8cAOqvwGBd1/EYOIJ/MGN+UfJrOWvHd4jHU=
github.com/rancher/lasso v0.2.1/go.mod h1:KSV3jBXfdXqdCuMm2uC8kKB9q/wuDYb3h0eHZoRjShM=
github.com/rancher/norman v0.5.2 h1:rwUKZ0QeVKJEtznhRdNQUMJtKjSoLYbFuPQGXm6xTxw=
github.com/rancher/norman v0.5.2/go.mod h1:lDO9ylAYBwch9FiYyuuWlYd7+IxgRgh0ioDJBweC7t4=
github.com/rancher/rancher/pkg/apis v0.0.0-20250224123908-bff2809d433c h1:YDXIfx64B4xD4SqEbfVnXMzaFXh6/n/xqmxooQXLENA=
github.com/rancher/rancher/pkg/apis v0.0.0-20250224123908-bff2809d433c/go.mod h1:3QHwbdrEA5XWWJbEW8+byOzktsucQ5GRIWmf7+A59ZE=
github.com/rancher/rancher/pkg/apis v0.0.0-20250227174106-7829dbe62d7f h1:M7wGsM4hfTpYvIcIKA3r0aMwbvByWcHaU+IP19T93GU=
github.com/rancher/rancher/pkg/apis v0.0.0-20250227174106-7829dbe62d7f/go.mod h1:3QHwbdrEA5XWWJbEW8+byOzktsucQ5GRIWmf7+A59ZE=
github.com/rancher/rke v1.7.2 h1:+2fcl0gCjRHzf1ev9C9ptQ1pjYbDngC1Qv8V/0ki/dk=
github.com/rancher/rke v1.7.2/go.mod h1:+x++Mvl0A3jIzNLiu8nkraqZXiHg6VPWv0Xl4iQCg+A=
github.com/rancher/wrangler/v3 v3.2.0-rc.3 h1:MySHWLxLLrGrM2sq5YYp7Ol1kQqYt9lvIzjGR50UZ+c=
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/management.cattle.io/v3/cluster/Cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The `SchedulingCustomization` subfield of the `DeploymentCustomization` field de
The `schedulingCustomization.PriorityClass` field contains two attributes

+ `value`: This must be an integer value equal to or between negative 1 billion and 1 billion.
+ `preemption`: This must be a string value which indicates the desired preemption behavior, its value can be either `PreemptLowerPriority` or `Never`. Any other value must be rejected.
+ `preemptionPolicy`: This must be a string value which indicates the desired preemption behavior, its value can be either `PreemptLowerPriority` or `Never`. Any other value must be rejected.

The `schedulingCustomization.PodDisruptionBudget` field contains two attributes

Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/management.cattle.io/v3/cluster/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func (a *admitter) validatePriorityClass(oldCluster, newCluster *apisv3.Cluster,
return admission.ResponseBadRequest(fmt.Sprintf("the '%s' feature must be enabled in order to configure a Priority Class or Pod Disruption Budget", common.SchedulingCustomizationFeatureName)), nil
}

if newPC.Preemption != nil && *newPC.Preemption != corev1.PreemptNever && *newPC.Preemption != corev1.PreemptLowerPriority && *newPC.Preemption != "" {
if newPC.PreemptionPolicy != nil && *newPC.PreemptionPolicy != corev1.PreemptNever && *newPC.PreemptionPolicy != corev1.PreemptLowerPriority && *newPC.PreemptionPolicy != "" {
return admission.ResponseBadRequest("Priority Class Preemption value must be 'Never', 'PreemptLowerPriority', or empty"), nil
}

Expand Down
12 changes: 6 additions & 6 deletions pkg/resources/management.cattle.io/v3/cluster/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1110,8 +1110,8 @@ func Test_validateAgentSchedulingCustomizationPriorityClass(t *testing.T) {
ClusterAgentDeploymentCustomization: &v3.AgentDeploymentCustomization{
SchedulingCustomization: &v3.AgentSchedulingCustomization{
PriorityClass: &v3.PriorityClassSpec{
Value: 123456,
Preemption: &preemptionNever,
Value: 123456,
PreemptionPolicy: &preemptionNever,
},
},
},
Expand Down Expand Up @@ -1165,8 +1165,8 @@ func Test_validateAgentSchedulingCustomizationPriorityClass(t *testing.T) {
ClusterAgentDeploymentCustomization: &v3.AgentDeploymentCustomization{
SchedulingCustomization: &v3.AgentSchedulingCustomization{
PriorityClass: &v3.PriorityClassSpec{
Value: 24321,
Preemption: &preemptionInvalid,
Value: 24321,
PreemptionPolicy: &preemptionInvalid,
},
},
},
Expand All @@ -1184,8 +1184,8 @@ func Test_validateAgentSchedulingCustomizationPriorityClass(t *testing.T) {
ClusterAgentDeploymentCustomization: &v3.AgentDeploymentCustomization{
SchedulingCustomization: &v3.AgentSchedulingCustomization{
PriorityClass: &v3.PriorityClassSpec{
Value: 24321,
Preemption: &preemptionInvalid,
Value: 24321,
PreemptionPolicy: &preemptionInvalid,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/management.cattle.io/v3/setting/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ func (a *admitter) validateClusterAgentPriorityClass(newSetting *v3.Setting) err
return fmt.Errorf("value must be less than 1 billion and greater than negative 1 billion")
}

if pc.Preemption != nil && *pc.Preemption != corev1.PreemptNever && *pc.Preemption != corev1.PreemptLowerPriority && *pc.Preemption != "" {
if pc.PreemptionPolicy != nil && *pc.PreemptionPolicy != corev1.PreemptNever && *pc.PreemptionPolicy != corev1.PreemptLowerPriority && *pc.PreemptionPolicy != "" {
return fmt.Errorf("preemption policy must be set to either 'Never' or 'PreemptLowerPriority'")
}

Expand Down
12 changes: 6 additions & 6 deletions pkg/resources/management.cattle.io/v3/setting/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ func (s *SettingSuite) TestValidateClusterAgentSchedulingPriorityClass() {
newValue: `
{
"value": 1356,
"preemption": "PreemptLowerPriority"
"preemptionPolicy": "PreemptLowerPriority"
}
`,
},
Expand All @@ -371,7 +371,7 @@ func (s *SettingSuite) TestValidateClusterAgentSchedulingPriorityClass() {
newValue: `
{
"value": 10000000,
"preemption": "Never"
"preemptionPolicy": "Never"
}
`,
},
Expand All @@ -381,7 +381,7 @@ func (s *SettingSuite) TestValidateClusterAgentSchedulingPriorityClass() {
newValue: `
{
"value": 1000,
"preemption": "Never"
"preemptionPolicy": "Never"
}
`,
},
Expand All @@ -391,7 +391,7 @@ func (s *SettingSuite) TestValidateClusterAgentSchedulingPriorityClass() {
newValue: `
{
"value": -1000000001,
"preemption": "PreemptLowerPriority"
"preemptionPolicy": "PreemptLowerPriority"
}
`,
},
Expand All @@ -401,7 +401,7 @@ func (s *SettingSuite) TestValidateClusterAgentSchedulingPriorityClass() {
newValue: `
{
"value": 1000000001,
"preemption": "PreemptLowerPriority"
"preemptionPolicy": "PreemptLowerPriority"
}
`,
},
Expand All @@ -411,7 +411,7 @@ func (s *SettingSuite) TestValidateClusterAgentSchedulingPriorityClass() {
newValue: `
{
"value": 100000000,
"preemption": "invalid"
"preemptionPolicy": "invalid"
}
`,
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/provisioning.cattle.io/v1/cluster/Cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The `SchedulingCustomization` subfield of the `DeploymentCustomization` field de
The `schedulingCustomization.PriorityClass` field contains two attributes

+ `value`: This must be an integer value equal to or between negative 1 billion and 1 billion.
+ `preemption`: This must be a string value which indicates the desired preemption behavior, its value can be either `PreemptLowerPriority` or `Never`. Any other value must be rejected.
+ `preemptionPolicy`: This must be a string value which indicates the desired preemption behavior, its value can be either `PreemptLowerPriority` or `Never`. Any other value must be rejected.

The `schedulingCustomization.PodDisruptionBudget` field contains two attributes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ func (p *provisioningAdmitter) validatePriorityClass(oldCluster, cluster *v1.Clu
return admission.ResponseBadRequest(fmt.Sprintf("the '%s' feature must be enabled in order to configure a Priority Class or Pod Disruption Budget", common.SchedulingCustomizationFeatureName)), nil
}

if newPC.Preemption != nil && *newPC.Preemption != k8sv1.PreemptNever && *newPC.Preemption != k8sv1.PreemptLowerPriority && *newPC.Preemption != "" {
if newPC.PreemptionPolicy != nil && *newPC.PreemptionPolicy != k8sv1.PreemptNever && *newPC.PreemptionPolicy != k8sv1.PreemptLowerPriority && *newPC.PreemptionPolicy != "" {
return admission.ResponseBadRequest("Priority Class Preemption value must be 'Never', 'PreemptLowerPriority', or omitted"), nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@ func Test_validateAgentSchedulingCustomizationPriorityClass(t *testing.T) {
ClusterAgentDeploymentCustomization: &v1.AgentDeploymentCustomization{
SchedulingCustomization: &v1.AgentSchedulingCustomization{
PriorityClass: &v1.PriorityClassSpec{
Value: 123456,
Preemption: &preemptionNever,
Value: 123456,
PreemptionPolicy: &preemptionNever,
},
},
},
Expand Down Expand Up @@ -1607,8 +1607,8 @@ func Test_validateAgentSchedulingCustomizationPriorityClass(t *testing.T) {
ClusterAgentDeploymentCustomization: &v1.AgentDeploymentCustomization{
SchedulingCustomization: &v1.AgentSchedulingCustomization{
PriorityClass: &v1.PriorityClassSpec{
Value: 24321,
Preemption: &preemptionInvalid,
Value: 24321,
PreemptionPolicy: &preemptionInvalid,
},
},
},
Expand All @@ -1624,8 +1624,8 @@ func Test_validateAgentSchedulingCustomizationPriorityClass(t *testing.T) {
ClusterAgentDeploymentCustomization: &v1.AgentDeploymentCustomization{
SchedulingCustomization: &v1.AgentSchedulingCustomization{
PriorityClass: &v1.PriorityClassSpec{
Value: 24321,
Preemption: &preemptionInvalid,
Value: 24321,
PreemptionPolicy: &preemptionInvalid,
},
},
},
Expand Down

0 comments on commit a2575c4

Please sign in to comment.