Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated pointer conversions in scheduler #113265

Merged
merged 1 commit into from Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 12 additions & 12 deletions pkg/scheduler/apis/config/v1/default_plugins_test.go
Expand Up @@ -240,8 +240,8 @@ func TestMergePlugins(t *testing.T) {
customPlugins: &v1.Plugins{
Filter: v1.PluginSet{
Enabled: []v1.Plugin{
{Name: "Plugin1", Weight: pointer.Int32Ptr(2)},
{Name: "Plugin3", Weight: pointer.Int32Ptr(3)},
{Name: "Plugin1", Weight: pointer.Int32(2)},
{Name: "Plugin3", Weight: pointer.Int32(3)},
},
},
},
Expand All @@ -257,9 +257,9 @@ func TestMergePlugins(t *testing.T) {
expectedPlugins: &v1.Plugins{
Filter: v1.PluginSet{
Enabled: []v1.Plugin{
{Name: "Plugin1", Weight: pointer.Int32Ptr(2)},
{Name: "Plugin1", Weight: pointer.Int32(2)},
{Name: "Plugin2"},
{Name: "Plugin3", Weight: pointer.Int32Ptr(3)},
{Name: "Plugin3", Weight: pointer.Int32(3)},
},
},
},
Expand All @@ -269,8 +269,8 @@ func TestMergePlugins(t *testing.T) {
customPlugins: &v1.Plugins{
Filter: v1.PluginSet{
Enabled: []v1.Plugin{
{Name: "Plugin2", Weight: pointer.Int32Ptr(2)},
{Name: "Plugin1", Weight: pointer.Int32Ptr(1)},
{Name: "Plugin2", Weight: pointer.Int32(2)},
{Name: "Plugin1", Weight: pointer.Int32(1)},
},
},
},
Expand All @@ -286,8 +286,8 @@ func TestMergePlugins(t *testing.T) {
expectedPlugins: &v1.Plugins{
Filter: v1.PluginSet{
Enabled: []v1.Plugin{
{Name: "Plugin1", Weight: pointer.Int32Ptr(1)},
{Name: "Plugin2", Weight: pointer.Int32Ptr(2)},
{Name: "Plugin1", Weight: pointer.Int32(1)},
{Name: "Plugin2", Weight: pointer.Int32(2)},
{Name: "Plugin3"},
},
},
Expand All @@ -299,9 +299,9 @@ func TestMergePlugins(t *testing.T) {
Filter: v1.PluginSet{
Enabled: []v1.Plugin{
{Name: "Plugin1"},
{Name: "Plugin2", Weight: pointer.Int32Ptr(2)},
{Name: "Plugin2", Weight: pointer.Int32(2)},
{Name: "Plugin3"},
{Name: "Plugin2", Weight: pointer.Int32Ptr(4)},
{Name: "Plugin2", Weight: pointer.Int32(4)},
},
},
},
Expand All @@ -318,9 +318,9 @@ func TestMergePlugins(t *testing.T) {
Filter: v1.PluginSet{
Enabled: []v1.Plugin{
{Name: "Plugin1"},
{Name: "Plugin2", Weight: pointer.Int32Ptr(4)},
{Name: "Plugin2", Weight: pointer.Int32(4)},
{Name: "Plugin3"},
{Name: "Plugin2", Weight: pointer.Int32Ptr(2)},
{Name: "Plugin2", Weight: pointer.Int32(2)},
},
},
},
Expand Down
12 changes: 6 additions & 6 deletions pkg/scheduler/apis/config/v1/defaults.go
Expand Up @@ -102,7 +102,7 @@ func setDefaults_KubeSchedulerProfile(prof *configv1.KubeSchedulerProfile) {
// SetDefaults_KubeSchedulerConfiguration sets additional defaults
func SetDefaults_KubeSchedulerConfiguration(obj *configv1.KubeSchedulerConfiguration) {
if obj.Parallelism == nil {
obj.Parallelism = pointer.Int32Ptr(16)
obj.Parallelism = pointer.Int32(16)
}

if len(obj.Profiles) == 0 {
Expand All @@ -111,7 +111,7 @@ func SetDefaults_KubeSchedulerConfiguration(obj *configv1.KubeSchedulerConfigura
// Only apply a default scheduler name when there is a single profile.
// Validation will ensure that every profile has a non-empty unique name.
if len(obj.Profiles) == 1 && obj.Profiles[0].SchedulerName == nil {
obj.Profiles[0].SchedulerName = pointer.StringPtr(v1.DefaultSchedulerName)
obj.Profiles[0].SchedulerName = pointer.String(v1.DefaultSchedulerName)
}

// Add the default set of plugins and apply the configuration.
Expand Down Expand Up @@ -172,22 +172,22 @@ func SetDefaults_KubeSchedulerConfiguration(obj *configv1.KubeSchedulerConfigura

func SetDefaults_DefaultPreemptionArgs(obj *configv1.DefaultPreemptionArgs) {
if obj.MinCandidateNodesPercentage == nil {
obj.MinCandidateNodesPercentage = pointer.Int32Ptr(10)
obj.MinCandidateNodesPercentage = pointer.Int32(10)
}
if obj.MinCandidateNodesAbsolute == nil {
obj.MinCandidateNodesAbsolute = pointer.Int32Ptr(100)
obj.MinCandidateNodesAbsolute = pointer.Int32(100)
}
}

func SetDefaults_InterPodAffinityArgs(obj *configv1.InterPodAffinityArgs) {
if obj.HardPodAffinityWeight == nil {
obj.HardPodAffinityWeight = pointer.Int32Ptr(1)
obj.HardPodAffinityWeight = pointer.Int32(1)
}
}

func SetDefaults_VolumeBindingArgs(obj *configv1.VolumeBindingArgs) {
if obj.BindTimeoutSeconds == nil {
obj.BindTimeoutSeconds = pointer.Int64Ptr(600)
obj.BindTimeoutSeconds = pointer.Int64(600)
}
if len(obj.Shape) == 0 && feature.DefaultFeatureGate.Enabled(features.VolumeCapacityPriority) {
obj.Shape = []configv1.UtilizationShapePoint{
Expand Down