From a2575c439b87b94b89a7cfe7072b9420b74f7475 Mon Sep 17 00:00:00 2001 From: Harrison Date: Fri, 28 Feb 2025 16:11:29 -0500 Subject: [PATCH] bump rancher type updates (#744) --- docs.md | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- .../management.cattle.io/v3/cluster/Cluster.md | 2 +- .../management.cattle.io/v3/cluster/validator.go | 2 +- .../v3/cluster/validator_test.go | 12 ++++++------ .../management.cattle.io/v3/setting/validator.go | 2 +- .../v3/setting/validator_test.go | 12 ++++++------ .../provisioning.cattle.io/v1/cluster/Cluster.md | 2 +- .../provisioning.cattle.io/v1/cluster/validator.go | 2 +- .../v1/cluster/validator_test.go | 12 ++++++------ 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docs.md b/docs.md index de177f9a8..c71030676 100644 --- a/docs.md +++ b/docs.md @@ -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 @@ -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 diff --git a/go.mod b/go.mod index 4230ab7e6..89dfbeb7c 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 31548dce1..1ff8a70aa 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/pkg/resources/management.cattle.io/v3/cluster/Cluster.md b/pkg/resources/management.cattle.io/v3/cluster/Cluster.md index 079aabd69..40928bdb7 100644 --- a/pkg/resources/management.cattle.io/v3/cluster/Cluster.md +++ b/pkg/resources/management.cattle.io/v3/cluster/Cluster.md @@ -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 diff --git a/pkg/resources/management.cattle.io/v3/cluster/validator.go b/pkg/resources/management.cattle.io/v3/cluster/validator.go index 569b31d56..4b4e114fd 100644 --- a/pkg/resources/management.cattle.io/v3/cluster/validator.go +++ b/pkg/resources/management.cattle.io/v3/cluster/validator.go @@ -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 } diff --git a/pkg/resources/management.cattle.io/v3/cluster/validator_test.go b/pkg/resources/management.cattle.io/v3/cluster/validator_test.go index 8a276cbd8..4a521d968 100644 --- a/pkg/resources/management.cattle.io/v3/cluster/validator_test.go +++ b/pkg/resources/management.cattle.io/v3/cluster/validator_test.go @@ -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, }, }, }, @@ -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, }, }, }, @@ -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, }, }, }, diff --git a/pkg/resources/management.cattle.io/v3/setting/validator.go b/pkg/resources/management.cattle.io/v3/setting/validator.go index 832757085..c408c38a1 100644 --- a/pkg/resources/management.cattle.io/v3/setting/validator.go +++ b/pkg/resources/management.cattle.io/v3/setting/validator.go @@ -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'") } diff --git a/pkg/resources/management.cattle.io/v3/setting/validator_test.go b/pkg/resources/management.cattle.io/v3/setting/validator_test.go index 397448c6b..b35d59f4a 100644 --- a/pkg/resources/management.cattle.io/v3/setting/validator_test.go +++ b/pkg/resources/management.cattle.io/v3/setting/validator_test.go @@ -361,7 +361,7 @@ func (s *SettingSuite) TestValidateClusterAgentSchedulingPriorityClass() { newValue: ` { "value": 1356, - "preemption": "PreemptLowerPriority" + "preemptionPolicy": "PreemptLowerPriority" } `, }, @@ -371,7 +371,7 @@ func (s *SettingSuite) TestValidateClusterAgentSchedulingPriorityClass() { newValue: ` { "value": 10000000, - "preemption": "Never" + "preemptionPolicy": "Never" } `, }, @@ -381,7 +381,7 @@ func (s *SettingSuite) TestValidateClusterAgentSchedulingPriorityClass() { newValue: ` { "value": 1000, - "preemption": "Never" + "preemptionPolicy": "Never" } `, }, @@ -391,7 +391,7 @@ func (s *SettingSuite) TestValidateClusterAgentSchedulingPriorityClass() { newValue: ` { "value": -1000000001, - "preemption": "PreemptLowerPriority" + "preemptionPolicy": "PreemptLowerPriority" } `, }, @@ -401,7 +401,7 @@ func (s *SettingSuite) TestValidateClusterAgentSchedulingPriorityClass() { newValue: ` { "value": 1000000001, - "preemption": "PreemptLowerPriority" + "preemptionPolicy": "PreemptLowerPriority" } `, }, @@ -411,7 +411,7 @@ func (s *SettingSuite) TestValidateClusterAgentSchedulingPriorityClass() { newValue: ` { "value": 100000000, - "preemption": "invalid" + "preemptionPolicy": "invalid" } `, }, diff --git a/pkg/resources/provisioning.cattle.io/v1/cluster/Cluster.md b/pkg/resources/provisioning.cattle.io/v1/cluster/Cluster.md index ea114aa22..f741d61d1 100644 --- a/pkg/resources/provisioning.cattle.io/v1/cluster/Cluster.md +++ b/pkg/resources/provisioning.cattle.io/v1/cluster/Cluster.md @@ -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 diff --git a/pkg/resources/provisioning.cattle.io/v1/cluster/validator.go b/pkg/resources/provisioning.cattle.io/v1/cluster/validator.go index b22b6ad36..648951ad6 100644 --- a/pkg/resources/provisioning.cattle.io/v1/cluster/validator.go +++ b/pkg/resources/provisioning.cattle.io/v1/cluster/validator.go @@ -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 } diff --git a/pkg/resources/provisioning.cattle.io/v1/cluster/validator_test.go b/pkg/resources/provisioning.cattle.io/v1/cluster/validator_test.go index c0463ab0c..a8493cd28 100644 --- a/pkg/resources/provisioning.cattle.io/v1/cluster/validator_test.go +++ b/pkg/resources/provisioning.cattle.io/v1/cluster/validator_test.go @@ -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, }, }, }, @@ -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, }, }, }, @@ -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, }, }, },