Merge pull request #111845 from ialidzhikov/cleanup/pkg-scheduler

pkg/scheduler: Replace deprecated func usage from the `k8s.io/utils/pointer` pkg
This commit is contained in:
Kubernetes Prow Robot 2022-08-23 20:08:15 -07:00 committed by GitHub
commit 34aa4c39e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 198 additions and 198 deletions

View File

@ -1109,7 +1109,7 @@ func TestCodecsEncodePluginConfig(t *testing.T) {
Name: "InterPodAffinity", Name: "InterPodAffinity",
Args: runtime.RawExtension{ Args: runtime.RawExtension{
Object: &v1beta2.InterPodAffinityArgs{ Object: &v1beta2.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(5), HardPodAffinityWeight: pointer.Int32(5),
}, },
}, },
}, },
@ -1117,7 +1117,7 @@ func TestCodecsEncodePluginConfig(t *testing.T) {
Name: "VolumeBinding", Name: "VolumeBinding",
Args: runtime.RawExtension{ Args: runtime.RawExtension{
Object: &v1beta2.VolumeBindingArgs{ Object: &v1beta2.VolumeBindingArgs{
BindTimeoutSeconds: pointer.Int64Ptr(300), BindTimeoutSeconds: pointer.Int64(300),
Shape: []v1beta2.UtilizationShapePoint{ Shape: []v1beta2.UtilizationShapePoint{
{ {
Utilization: 0, Utilization: 0,
@ -1330,7 +1330,7 @@ profiles:
Name: "InterPodAffinity", Name: "InterPodAffinity",
Args: runtime.RawExtension{ Args: runtime.RawExtension{
Object: &v1beta3.InterPodAffinityArgs{ Object: &v1beta3.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(5), HardPodAffinityWeight: pointer.Int32(5),
}, },
}, },
}, },
@ -1338,7 +1338,7 @@ profiles:
Name: "VolumeBinding", Name: "VolumeBinding",
Args: runtime.RawExtension{ Args: runtime.RawExtension{
Object: &v1beta2.VolumeBindingArgs{ Object: &v1beta2.VolumeBindingArgs{
BindTimeoutSeconds: pointer.Int64Ptr(300), BindTimeoutSeconds: pointer.Int64(300),
Shape: []v1beta2.UtilizationShapePoint{ Shape: []v1beta2.UtilizationShapePoint{
{ {
Utilization: 0, Utilization: 0,
@ -1549,7 +1549,7 @@ profiles:
Name: "InterPodAffinity", Name: "InterPodAffinity",
Args: runtime.RawExtension{ Args: runtime.RawExtension{
Object: &v1.InterPodAffinityArgs{ Object: &v1.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(5), HardPodAffinityWeight: pointer.Int32(5),
}, },
}, },
}, },
@ -1557,7 +1557,7 @@ profiles:
Name: "VolumeBinding", Name: "VolumeBinding",
Args: runtime.RawExtension{ Args: runtime.RawExtension{
Object: &v1.VolumeBindingArgs{ Object: &v1.VolumeBindingArgs{
BindTimeoutSeconds: pointer.Int64Ptr(300), BindTimeoutSeconds: pointer.Int64(300),
Shape: []v1.UtilizationShapePoint{ Shape: []v1.UtilizationShapePoint{
{ {
Utilization: 0, Utilization: 0,

View File

@ -79,16 +79,16 @@ func getDefaultPlugins() *v1beta2.Plugins {
}, },
Score: v1beta2.PluginSet{ Score: v1beta2.PluginSet{
Enabled: []v1beta2.Plugin{ Enabled: []v1beta2.Plugin{
{Name: names.NodeResourcesBalancedAllocation, Weight: pointer.Int32Ptr(1)}, {Name: names.NodeResourcesBalancedAllocation, Weight: pointer.Int32(1)},
{Name: names.ImageLocality, Weight: pointer.Int32Ptr(1)}, {Name: names.ImageLocality, Weight: pointer.Int32(1)},
{Name: names.InterPodAffinity, Weight: pointer.Int32Ptr(1)}, {Name: names.InterPodAffinity, Weight: pointer.Int32(1)},
{Name: names.NodeResourcesFit, Weight: pointer.Int32Ptr(1)}, {Name: names.NodeResourcesFit, Weight: pointer.Int32(1)},
{Name: names.NodeAffinity, Weight: pointer.Int32Ptr(1)}, {Name: names.NodeAffinity, Weight: pointer.Int32(1)},
// Weight is doubled because: // Weight is doubled because:
// - This is a score coming from user preference. // - This is a score coming from user preference.
// - It makes its signal comparable to NodeResourcesFit.LeastAllocated. // - It makes its signal comparable to NodeResourcesFit.LeastAllocated.
{Name: names.PodTopologySpread, Weight: pointer.Int32Ptr(2)}, {Name: names.PodTopologySpread, Weight: pointer.Int32(2)},
{Name: names.TaintToleration, Weight: pointer.Int32Ptr(1)}, {Name: names.TaintToleration, Weight: pointer.Int32(1)},
}, },
}, },
Reserve: v1beta2.PluginSet{ Reserve: v1beta2.PluginSet{
@ -114,7 +114,7 @@ func getDefaultPlugins() *v1beta2.Plugins {
func applyFeatureGates(config *v1beta2.Plugins) { func applyFeatureGates(config *v1beta2.Plugins) {
if utilfeature.DefaultFeatureGate.Enabled(features.VolumeCapacityPriority) { if utilfeature.DefaultFeatureGate.Enabled(features.VolumeCapacityPriority) {
config.Score.Enabled = append(config.Score.Enabled, v1beta2.Plugin{Name: names.VolumeBinding, Weight: pointer.Int32Ptr(1)}) config.Score.Enabled = append(config.Score.Enabled, v1beta2.Plugin{Name: names.VolumeBinding, Weight: pointer.Int32(1)})
} }
} }

View File

@ -87,13 +87,13 @@ func TestApplyFeatureGates(t *testing.T) {
}, },
Score: v1beta2.PluginSet{ Score: v1beta2.PluginSet{
Enabled: []v1beta2.Plugin{ Enabled: []v1beta2.Plugin{
{Name: names.NodeResourcesBalancedAllocation, Weight: pointer.Int32Ptr(1)}, {Name: names.NodeResourcesBalancedAllocation, Weight: pointer.Int32(1)},
{Name: names.ImageLocality, Weight: pointer.Int32Ptr(1)}, {Name: names.ImageLocality, Weight: pointer.Int32(1)},
{Name: names.InterPodAffinity, Weight: pointer.Int32Ptr(1)}, {Name: names.InterPodAffinity, Weight: pointer.Int32(1)},
{Name: names.NodeResourcesFit, Weight: pointer.Int32Ptr(1)}, {Name: names.NodeResourcesFit, Weight: pointer.Int32(1)},
{Name: names.NodeAffinity, Weight: pointer.Int32Ptr(1)}, {Name: names.NodeAffinity, Weight: pointer.Int32(1)},
{Name: names.PodTopologySpread, Weight: pointer.Int32Ptr(2)}, {Name: names.PodTopologySpread, Weight: pointer.Int32(2)},
{Name: names.TaintToleration, Weight: pointer.Int32Ptr(1)}, {Name: names.TaintToleration, Weight: pointer.Int32(1)},
}, },
}, },
Reserve: v1beta2.PluginSet{ Reserve: v1beta2.PluginSet{
@ -281,8 +281,8 @@ func TestMergePlugins(t *testing.T) {
customPlugins: &v1beta2.Plugins{ customPlugins: &v1beta2.Plugins{
Filter: v1beta2.PluginSet{ Filter: v1beta2.PluginSet{
Enabled: []v1beta2.Plugin{ Enabled: []v1beta2.Plugin{
{Name: "Plugin1", Weight: pointer.Int32Ptr(2)}, {Name: "Plugin1", Weight: pointer.Int32(2)},
{Name: "Plugin3", Weight: pointer.Int32Ptr(3)}, {Name: "Plugin3", Weight: pointer.Int32(3)},
}, },
}, },
}, },
@ -298,9 +298,9 @@ func TestMergePlugins(t *testing.T) {
expectedPlugins: &v1beta2.Plugins{ expectedPlugins: &v1beta2.Plugins{
Filter: v1beta2.PluginSet{ Filter: v1beta2.PluginSet{
Enabled: []v1beta2.Plugin{ Enabled: []v1beta2.Plugin{
{Name: "Plugin1", Weight: pointer.Int32Ptr(2)}, {Name: "Plugin1", Weight: pointer.Int32(2)},
{Name: "Plugin2"}, {Name: "Plugin2"},
{Name: "Plugin3", Weight: pointer.Int32Ptr(3)}, {Name: "Plugin3", Weight: pointer.Int32(3)},
}, },
}, },
}, },
@ -310,8 +310,8 @@ func TestMergePlugins(t *testing.T) {
customPlugins: &v1beta2.Plugins{ customPlugins: &v1beta2.Plugins{
Filter: v1beta2.PluginSet{ Filter: v1beta2.PluginSet{
Enabled: []v1beta2.Plugin{ Enabled: []v1beta2.Plugin{
{Name: "Plugin2", Weight: pointer.Int32Ptr(2)}, {Name: "Plugin2", Weight: pointer.Int32(2)},
{Name: "Plugin1", Weight: pointer.Int32Ptr(1)}, {Name: "Plugin1", Weight: pointer.Int32(1)},
}, },
}, },
}, },
@ -327,8 +327,8 @@ func TestMergePlugins(t *testing.T) {
expectedPlugins: &v1beta2.Plugins{ expectedPlugins: &v1beta2.Plugins{
Filter: v1beta2.PluginSet{ Filter: v1beta2.PluginSet{
Enabled: []v1beta2.Plugin{ Enabled: []v1beta2.Plugin{
{Name: "Plugin1", Weight: pointer.Int32Ptr(1)}, {Name: "Plugin1", Weight: pointer.Int32(1)},
{Name: "Plugin2", Weight: pointer.Int32Ptr(2)}, {Name: "Plugin2", Weight: pointer.Int32(2)},
{Name: "Plugin3"}, {Name: "Plugin3"},
}, },
}, },
@ -340,9 +340,9 @@ func TestMergePlugins(t *testing.T) {
Filter: v1beta2.PluginSet{ Filter: v1beta2.PluginSet{
Enabled: []v1beta2.Plugin{ Enabled: []v1beta2.Plugin{
{Name: "Plugin1"}, {Name: "Plugin1"},
{Name: "Plugin2", Weight: pointer.Int32Ptr(2)}, {Name: "Plugin2", Weight: pointer.Int32(2)},
{Name: "Plugin3"}, {Name: "Plugin3"},
{Name: "Plugin2", Weight: pointer.Int32Ptr(4)}, {Name: "Plugin2", Weight: pointer.Int32(4)},
}, },
}, },
}, },
@ -359,9 +359,9 @@ func TestMergePlugins(t *testing.T) {
Filter: v1beta2.PluginSet{ Filter: v1beta2.PluginSet{
Enabled: []v1beta2.Plugin{ Enabled: []v1beta2.Plugin{
{Name: "Plugin1"}, {Name: "Plugin1"},
{Name: "Plugin2", Weight: pointer.Int32Ptr(4)}, {Name: "Plugin2", Weight: pointer.Int32(4)},
{Name: "Plugin3"}, {Name: "Plugin3"},
{Name: "Plugin2", Weight: pointer.Int32Ptr(2)}, {Name: "Plugin2", Weight: pointer.Int32(2)},
}, },
}, },
}, },

View File

@ -102,7 +102,7 @@ func setDefaults_KubeSchedulerProfile(prof *v1beta2.KubeSchedulerProfile) {
// SetDefaults_KubeSchedulerConfiguration sets additional defaults // SetDefaults_KubeSchedulerConfiguration sets additional defaults
func SetDefaults_KubeSchedulerConfiguration(obj *v1beta2.KubeSchedulerConfiguration) { func SetDefaults_KubeSchedulerConfiguration(obj *v1beta2.KubeSchedulerConfiguration) {
if obj.Parallelism == nil { if obj.Parallelism == nil {
obj.Parallelism = pointer.Int32Ptr(16) obj.Parallelism = pointer.Int32(16)
} }
if len(obj.Profiles) == 0 { if len(obj.Profiles) == 0 {
@ -111,7 +111,7 @@ func SetDefaults_KubeSchedulerConfiguration(obj *v1beta2.KubeSchedulerConfigurat
// Only apply a default scheduler name when there is a single profile. // Only apply a default scheduler name when there is a single profile.
// Validation will ensure that every profile has a non-empty unique name. // Validation will ensure that every profile has a non-empty unique name.
if len(obj.Profiles) == 1 && obj.Profiles[0].SchedulerName == nil { 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. // Add the default set of plugins and apply the configuration.
@ -121,7 +121,7 @@ func SetDefaults_KubeSchedulerConfiguration(obj *v1beta2.KubeSchedulerConfigurat
} }
if obj.PercentageOfNodesToScore == nil { if obj.PercentageOfNodesToScore == nil {
obj.PercentageOfNodesToScore = pointer.Int32Ptr(config.DefaultPercentageOfNodesToScore) obj.PercentageOfNodesToScore = pointer.Int32(config.DefaultPercentageOfNodesToScore)
} }
if len(obj.LeaderElection.ResourceLock) == 0 { if len(obj.LeaderElection.ResourceLock) == 0 {
@ -161,33 +161,33 @@ func SetDefaults_KubeSchedulerConfiguration(obj *v1beta2.KubeSchedulerConfigurat
// Enable profiling by default in the scheduler // Enable profiling by default in the scheduler
if obj.EnableProfiling == nil { if obj.EnableProfiling == nil {
obj.EnableProfiling = pointer.BoolPtr(true) obj.EnableProfiling = pointer.Bool(true)
} }
// Enable contention profiling by default if profiling is enabled // Enable contention profiling by default if profiling is enabled
if *obj.EnableProfiling && obj.EnableContentionProfiling == nil { if *obj.EnableProfiling && obj.EnableContentionProfiling == nil {
obj.EnableContentionProfiling = pointer.BoolPtr(true) obj.EnableContentionProfiling = pointer.Bool(true)
} }
} }
func SetDefaults_DefaultPreemptionArgs(obj *v1beta2.DefaultPreemptionArgs) { func SetDefaults_DefaultPreemptionArgs(obj *v1beta2.DefaultPreemptionArgs) {
if obj.MinCandidateNodesPercentage == nil { if obj.MinCandidateNodesPercentage == nil {
obj.MinCandidateNodesPercentage = pointer.Int32Ptr(10) obj.MinCandidateNodesPercentage = pointer.Int32(10)
} }
if obj.MinCandidateNodesAbsolute == nil { if obj.MinCandidateNodesAbsolute == nil {
obj.MinCandidateNodesAbsolute = pointer.Int32Ptr(100) obj.MinCandidateNodesAbsolute = pointer.Int32(100)
} }
} }
func SetDefaults_InterPodAffinityArgs(obj *v1beta2.InterPodAffinityArgs) { func SetDefaults_InterPodAffinityArgs(obj *v1beta2.InterPodAffinityArgs) {
if obj.HardPodAffinityWeight == nil { if obj.HardPodAffinityWeight == nil {
obj.HardPodAffinityWeight = pointer.Int32Ptr(1) obj.HardPodAffinityWeight = pointer.Int32(1)
} }
} }
func SetDefaults_VolumeBindingArgs(obj *v1beta2.VolumeBindingArgs) { func SetDefaults_VolumeBindingArgs(obj *v1beta2.VolumeBindingArgs) {
if obj.BindTimeoutSeconds == nil { if obj.BindTimeoutSeconds == nil {
obj.BindTimeoutSeconds = pointer.Int64Ptr(600) obj.BindTimeoutSeconds = pointer.Int64(600)
} }
if len(obj.Shape) == 0 && feature.DefaultFeatureGate.Enabled(features.VolumeCapacityPriority) { if len(obj.Shape) == 0 && feature.DefaultFeatureGate.Enabled(features.VolumeCapacityPriority) {
obj.Shape = []v1beta2.UtilizationShapePoint{ obj.Shape = []v1beta2.UtilizationShapePoint{

View File

@ -45,8 +45,8 @@ var pluginConfigs = []v1beta2.PluginConfig{
Kind: "DefaultPreemptionArgs", Kind: "DefaultPreemptionArgs",
APIVersion: "kubescheduler.config.k8s.io/v1beta2", APIVersion: "kubescheduler.config.k8s.io/v1beta2",
}, },
MinCandidateNodesPercentage: pointer.Int32Ptr(10), MinCandidateNodesPercentage: pointer.Int32(10),
MinCandidateNodesAbsolute: pointer.Int32Ptr(100), MinCandidateNodesAbsolute: pointer.Int32(100),
}}, }},
}, },
{ {
@ -57,7 +57,7 @@ var pluginConfigs = []v1beta2.PluginConfig{
Kind: "InterPodAffinityArgs", Kind: "InterPodAffinityArgs",
APIVersion: "kubescheduler.config.k8s.io/v1beta2", APIVersion: "kubescheduler.config.k8s.io/v1beta2",
}, },
HardPodAffinityWeight: pointer.Int32Ptr(1), HardPodAffinityWeight: pointer.Int32(1),
}}, }},
}, },
{ {
@ -109,7 +109,7 @@ var pluginConfigs = []v1beta2.PluginConfig{
Kind: "VolumeBindingArgs", Kind: "VolumeBindingArgs",
APIVersion: "kubescheduler.config.k8s.io/v1beta2", APIVersion: "kubescheduler.config.k8s.io/v1beta2",
}, },
BindTimeoutSeconds: pointer.Int64Ptr(600), BindTimeoutSeconds: pointer.Int64(600),
}}, }},
}, },
} }
@ -125,13 +125,13 @@ func TestSchedulerDefaults(t *testing.T) {
name: "empty config", name: "empty config",
config: &v1beta2.KubeSchedulerConfiguration{}, config: &v1beta2.KubeSchedulerConfiguration{},
expected: &v1beta2.KubeSchedulerConfiguration{ expected: &v1beta2.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(16), Parallelism: pointer.Int32(16),
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
EnableProfiling: &enable, EnableProfiling: &enable,
EnableContentionProfiling: &enable, EnableContentionProfiling: &enable,
}, },
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{ LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
LeaderElect: pointer.BoolPtr(true), LeaderElect: pointer.Bool(true),
LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
@ -144,14 +144,14 @@ func TestSchedulerDefaults(t *testing.T) {
Burst: 100, Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf", ContentType: "application/vnd.kubernetes.protobuf",
}, },
PercentageOfNodesToScore: pointer.Int32Ptr(0), PercentageOfNodesToScore: pointer.Int32(0),
PodInitialBackoffSeconds: pointer.Int64Ptr(1), PodInitialBackoffSeconds: pointer.Int64(1),
PodMaxBackoffSeconds: pointer.Int64Ptr(10), PodMaxBackoffSeconds: pointer.Int64(10),
Profiles: []v1beta2.KubeSchedulerProfile{ Profiles: []v1beta2.KubeSchedulerProfile{
{ {
Plugins: getDefaultPlugins(), Plugins: getDefaultPlugins(),
PluginConfig: pluginConfigs, PluginConfig: pluginConfigs,
SchedulerName: pointer.StringPtr("default-scheduler"), SchedulerName: pointer.String("default-scheduler"),
}, },
}, },
}, },
@ -162,13 +162,13 @@ func TestSchedulerDefaults(t *testing.T) {
Profiles: []v1beta2.KubeSchedulerProfile{{}}, Profiles: []v1beta2.KubeSchedulerProfile{{}},
}, },
expected: &v1beta2.KubeSchedulerConfiguration{ expected: &v1beta2.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(16), Parallelism: pointer.Int32(16),
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
EnableProfiling: &enable, EnableProfiling: &enable,
EnableContentionProfiling: &enable, EnableContentionProfiling: &enable,
}, },
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{ LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
LeaderElect: pointer.BoolPtr(true), LeaderElect: pointer.Bool(true),
LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
@ -181,12 +181,12 @@ func TestSchedulerDefaults(t *testing.T) {
Burst: 100, Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf", ContentType: "application/vnd.kubernetes.protobuf",
}, },
PercentageOfNodesToScore: pointer.Int32Ptr(0), PercentageOfNodesToScore: pointer.Int32(0),
PodInitialBackoffSeconds: pointer.Int64Ptr(1), PodInitialBackoffSeconds: pointer.Int64(1),
PodMaxBackoffSeconds: pointer.Int64Ptr(10), PodMaxBackoffSeconds: pointer.Int64(10),
Profiles: []v1beta2.KubeSchedulerProfile{ Profiles: []v1beta2.KubeSchedulerProfile{
{ {
SchedulerName: pointer.StringPtr("default-scheduler"), SchedulerName: pointer.String("default-scheduler"),
Plugins: getDefaultPlugins(), Plugins: getDefaultPlugins(),
PluginConfig: pluginConfigs}, PluginConfig: pluginConfigs},
}, },
@ -195,7 +195,7 @@ func TestSchedulerDefaults(t *testing.T) {
{ {
name: "two profiles", name: "two profiles",
config: &v1beta2.KubeSchedulerConfiguration{ config: &v1beta2.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(16), Parallelism: pointer.Int32(16),
Profiles: []v1beta2.KubeSchedulerProfile{ Profiles: []v1beta2.KubeSchedulerProfile{
{ {
PluginConfig: []v1beta2.PluginConfig{ PluginConfig: []v1beta2.PluginConfig{
@ -203,7 +203,7 @@ func TestSchedulerDefaults(t *testing.T) {
}, },
}, },
{ {
SchedulerName: pointer.StringPtr("custom-scheduler"), SchedulerName: pointer.String("custom-scheduler"),
Plugins: &v1beta2.Plugins{ Plugins: &v1beta2.Plugins{
Bind: v1beta2.PluginSet{ Bind: v1beta2.PluginSet{
Enabled: []v1beta2.Plugin{ Enabled: []v1beta2.Plugin{
@ -218,13 +218,13 @@ func TestSchedulerDefaults(t *testing.T) {
}, },
}, },
expected: &v1beta2.KubeSchedulerConfiguration{ expected: &v1beta2.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(16), Parallelism: pointer.Int32(16),
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
EnableProfiling: &enable, EnableProfiling: &enable,
EnableContentionProfiling: &enable, EnableContentionProfiling: &enable,
}, },
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{ LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
LeaderElect: pointer.BoolPtr(true), LeaderElect: pointer.Bool(true),
LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
@ -237,9 +237,9 @@ func TestSchedulerDefaults(t *testing.T) {
Burst: 100, Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf", ContentType: "application/vnd.kubernetes.protobuf",
}, },
PercentageOfNodesToScore: pointer.Int32Ptr(0), PercentageOfNodesToScore: pointer.Int32(0),
PodInitialBackoffSeconds: pointer.Int64Ptr(1), PodInitialBackoffSeconds: pointer.Int64(1),
PodMaxBackoffSeconds: pointer.Int64Ptr(10), PodMaxBackoffSeconds: pointer.Int64(10),
Profiles: []v1beta2.KubeSchedulerProfile{ Profiles: []v1beta2.KubeSchedulerProfile{
{ {
Plugins: getDefaultPlugins(), Plugins: getDefaultPlugins(),
@ -253,8 +253,8 @@ func TestSchedulerDefaults(t *testing.T) {
Kind: "DefaultPreemptionArgs", Kind: "DefaultPreemptionArgs",
APIVersion: "kubescheduler.config.k8s.io/v1beta2", APIVersion: "kubescheduler.config.k8s.io/v1beta2",
}, },
MinCandidateNodesPercentage: pointer.Int32Ptr(10), MinCandidateNodesPercentage: pointer.Int32(10),
MinCandidateNodesAbsolute: pointer.Int32Ptr(100), MinCandidateNodesAbsolute: pointer.Int32(100),
}}, }},
}, },
{ {
@ -265,7 +265,7 @@ func TestSchedulerDefaults(t *testing.T) {
Kind: "InterPodAffinityArgs", Kind: "InterPodAffinityArgs",
APIVersion: "kubescheduler.config.k8s.io/v1beta2", APIVersion: "kubescheduler.config.k8s.io/v1beta2",
}, },
HardPodAffinityWeight: pointer.Int32Ptr(1), HardPodAffinityWeight: pointer.Int32(1),
}}, }},
}, },
{ {
@ -317,13 +317,13 @@ func TestSchedulerDefaults(t *testing.T) {
Kind: "VolumeBindingArgs", Kind: "VolumeBindingArgs",
APIVersion: "kubescheduler.config.k8s.io/v1beta2", APIVersion: "kubescheduler.config.k8s.io/v1beta2",
}, },
BindTimeoutSeconds: pointer.Int64Ptr(600), BindTimeoutSeconds: pointer.Int64(600),
}}, }},
}, },
}, },
}, },
{ {
SchedulerName: pointer.StringPtr("custom-scheduler"), SchedulerName: pointer.String("custom-scheduler"),
Plugins: &v1beta2.Plugins{ Plugins: &v1beta2.Plugins{
QueueSort: v1beta2.PluginSet{ QueueSort: v1beta2.PluginSet{
Enabled: []v1beta2.Plugin{ Enabled: []v1beta2.Plugin{
@ -375,13 +375,13 @@ func TestSchedulerDefaults(t *testing.T) {
}, },
Score: v1beta2.PluginSet{ Score: v1beta2.PluginSet{
Enabled: []v1beta2.Plugin{ Enabled: []v1beta2.Plugin{
{Name: names.NodeResourcesBalancedAllocation, Weight: pointer.Int32Ptr(1)}, {Name: names.NodeResourcesBalancedAllocation, Weight: pointer.Int32(1)},
{Name: names.ImageLocality, Weight: pointer.Int32Ptr(1)}, {Name: names.ImageLocality, Weight: pointer.Int32(1)},
{Name: names.InterPodAffinity, Weight: pointer.Int32Ptr(1)}, {Name: names.InterPodAffinity, Weight: pointer.Int32(1)},
{Name: names.NodeResourcesFit, Weight: pointer.Int32Ptr(1)}, {Name: names.NodeResourcesFit, Weight: pointer.Int32(1)},
{Name: names.NodeAffinity, Weight: pointer.Int32Ptr(1)}, {Name: names.NodeAffinity, Weight: pointer.Int32(1)},
{Name: names.PodTopologySpread, Weight: pointer.Int32Ptr(2)}, {Name: names.PodTopologySpread, Weight: pointer.Int32(2)},
{Name: names.TaintToleration, Weight: pointer.Int32Ptr(1)}, {Name: names.TaintToleration, Weight: pointer.Int32(1)},
}, },
}, },
Reserve: v1beta2.PluginSet{ Reserve: v1beta2.PluginSet{
@ -408,16 +408,16 @@ func TestSchedulerDefaults(t *testing.T) {
{ {
name: "set non default parallelism", name: "set non default parallelism",
config: &v1beta2.KubeSchedulerConfiguration{ config: &v1beta2.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(8), Parallelism: pointer.Int32(8),
}, },
expected: &v1beta2.KubeSchedulerConfiguration{ expected: &v1beta2.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(8), Parallelism: pointer.Int32(8),
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
EnableProfiling: &enable, EnableProfiling: &enable,
EnableContentionProfiling: &enable, EnableContentionProfiling: &enable,
}, },
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{ LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
LeaderElect: pointer.BoolPtr(true), LeaderElect: pointer.Bool(true),
LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
@ -430,14 +430,14 @@ func TestSchedulerDefaults(t *testing.T) {
Burst: 100, Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf", ContentType: "application/vnd.kubernetes.protobuf",
}, },
PercentageOfNodesToScore: pointer.Int32Ptr(0), PercentageOfNodesToScore: pointer.Int32(0),
PodInitialBackoffSeconds: pointer.Int64Ptr(1), PodInitialBackoffSeconds: pointer.Int64(1),
PodMaxBackoffSeconds: pointer.Int64Ptr(10), PodMaxBackoffSeconds: pointer.Int64(10),
Profiles: []v1beta2.KubeSchedulerProfile{ Profiles: []v1beta2.KubeSchedulerProfile{
{ {
Plugins: getDefaultPlugins(), Plugins: getDefaultPlugins(),
PluginConfig: pluginConfigs, PluginConfig: pluginConfigs,
SchedulerName: pointer.StringPtr("default-scheduler"), SchedulerName: pointer.String("default-scheduler"),
}, },
}, },
}, },
@ -464,43 +464,43 @@ func TestPluginArgsDefaults(t *testing.T) {
name: "DefaultPreemptionArgs empty", name: "DefaultPreemptionArgs empty",
in: &v1beta2.DefaultPreemptionArgs{}, in: &v1beta2.DefaultPreemptionArgs{},
want: &v1beta2.DefaultPreemptionArgs{ want: &v1beta2.DefaultPreemptionArgs{
MinCandidateNodesPercentage: pointer.Int32Ptr(10), MinCandidateNodesPercentage: pointer.Int32(10),
MinCandidateNodesAbsolute: pointer.Int32Ptr(100), MinCandidateNodesAbsolute: pointer.Int32(100),
}, },
}, },
{ {
name: "DefaultPreemptionArgs with value", name: "DefaultPreemptionArgs with value",
in: &v1beta2.DefaultPreemptionArgs{ in: &v1beta2.DefaultPreemptionArgs{
MinCandidateNodesPercentage: pointer.Int32Ptr(50), MinCandidateNodesPercentage: pointer.Int32(50),
}, },
want: &v1beta2.DefaultPreemptionArgs{ want: &v1beta2.DefaultPreemptionArgs{
MinCandidateNodesPercentage: pointer.Int32Ptr(50), MinCandidateNodesPercentage: pointer.Int32(50),
MinCandidateNodesAbsolute: pointer.Int32Ptr(100), MinCandidateNodesAbsolute: pointer.Int32(100),
}, },
}, },
{ {
name: "InterPodAffinityArgs empty", name: "InterPodAffinityArgs empty",
in: &v1beta2.InterPodAffinityArgs{}, in: &v1beta2.InterPodAffinityArgs{},
want: &v1beta2.InterPodAffinityArgs{ want: &v1beta2.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(1), HardPodAffinityWeight: pointer.Int32(1),
}, },
}, },
{ {
name: "InterPodAffinityArgs explicit 0", name: "InterPodAffinityArgs explicit 0",
in: &v1beta2.InterPodAffinityArgs{ in: &v1beta2.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(0), HardPodAffinityWeight: pointer.Int32(0),
}, },
want: &v1beta2.InterPodAffinityArgs{ want: &v1beta2.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(0), HardPodAffinityWeight: pointer.Int32(0),
}, },
}, },
{ {
name: "InterPodAffinityArgs with value", name: "InterPodAffinityArgs with value",
in: &v1beta2.InterPodAffinityArgs{ in: &v1beta2.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(5), HardPodAffinityWeight: pointer.Int32(5),
}, },
want: &v1beta2.InterPodAffinityArgs{ want: &v1beta2.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(5), HardPodAffinityWeight: pointer.Int32(5),
}, },
}, },
{ {
@ -617,7 +617,7 @@ func TestPluginArgsDefaults(t *testing.T) {
}, },
in: &v1beta2.VolumeBindingArgs{}, in: &v1beta2.VolumeBindingArgs{},
want: &v1beta2.VolumeBindingArgs{ want: &v1beta2.VolumeBindingArgs{
BindTimeoutSeconds: pointer.Int64Ptr(600), BindTimeoutSeconds: pointer.Int64(600),
}, },
}, },
{ {
@ -627,7 +627,7 @@ func TestPluginArgsDefaults(t *testing.T) {
}, },
in: &v1beta2.VolumeBindingArgs{}, in: &v1beta2.VolumeBindingArgs{},
want: &v1beta2.VolumeBindingArgs{ want: &v1beta2.VolumeBindingArgs{
BindTimeoutSeconds: pointer.Int64Ptr(600), BindTimeoutSeconds: pointer.Int64(600),
Shape: []v1beta2.UtilizationShapePoint{ Shape: []v1beta2.UtilizationShapePoint{
{Utilization: 0, Score: 0}, {Utilization: 0, Score: 0},
{Utilization: 100, Score: 10}, {Utilization: 100, Score: 10},

View File

@ -240,8 +240,8 @@ func TestMergePlugins(t *testing.T) {
customPlugins: &v1beta3.Plugins{ customPlugins: &v1beta3.Plugins{
Filter: v1beta3.PluginSet{ Filter: v1beta3.PluginSet{
Enabled: []v1beta3.Plugin{ Enabled: []v1beta3.Plugin{
{Name: "Plugin1", Weight: pointer.Int32Ptr(2)}, {Name: "Plugin1", Weight: pointer.Int32(2)},
{Name: "Plugin3", Weight: pointer.Int32Ptr(3)}, {Name: "Plugin3", Weight: pointer.Int32(3)},
}, },
}, },
}, },
@ -257,9 +257,9 @@ func TestMergePlugins(t *testing.T) {
expectedPlugins: &v1beta3.Plugins{ expectedPlugins: &v1beta3.Plugins{
Filter: v1beta3.PluginSet{ Filter: v1beta3.PluginSet{
Enabled: []v1beta3.Plugin{ Enabled: []v1beta3.Plugin{
{Name: "Plugin1", Weight: pointer.Int32Ptr(2)}, {Name: "Plugin1", Weight: pointer.Int32(2)},
{Name: "Plugin2"}, {Name: "Plugin2"},
{Name: "Plugin3", Weight: pointer.Int32Ptr(3)}, {Name: "Plugin3", Weight: pointer.Int32(3)},
}, },
}, },
}, },
@ -269,8 +269,8 @@ func TestMergePlugins(t *testing.T) {
customPlugins: &v1beta3.Plugins{ customPlugins: &v1beta3.Plugins{
Filter: v1beta3.PluginSet{ Filter: v1beta3.PluginSet{
Enabled: []v1beta3.Plugin{ Enabled: []v1beta3.Plugin{
{Name: "Plugin2", Weight: pointer.Int32Ptr(2)}, {Name: "Plugin2", Weight: pointer.Int32(2)},
{Name: "Plugin1", Weight: pointer.Int32Ptr(1)}, {Name: "Plugin1", Weight: pointer.Int32(1)},
}, },
}, },
}, },
@ -286,8 +286,8 @@ func TestMergePlugins(t *testing.T) {
expectedPlugins: &v1beta3.Plugins{ expectedPlugins: &v1beta3.Plugins{
Filter: v1beta3.PluginSet{ Filter: v1beta3.PluginSet{
Enabled: []v1beta3.Plugin{ Enabled: []v1beta3.Plugin{
{Name: "Plugin1", Weight: pointer.Int32Ptr(1)}, {Name: "Plugin1", Weight: pointer.Int32(1)},
{Name: "Plugin2", Weight: pointer.Int32Ptr(2)}, {Name: "Plugin2", Weight: pointer.Int32(2)},
{Name: "Plugin3"}, {Name: "Plugin3"},
}, },
}, },
@ -299,9 +299,9 @@ func TestMergePlugins(t *testing.T) {
Filter: v1beta3.PluginSet{ Filter: v1beta3.PluginSet{
Enabled: []v1beta3.Plugin{ Enabled: []v1beta3.Plugin{
{Name: "Plugin1"}, {Name: "Plugin1"},
{Name: "Plugin2", Weight: pointer.Int32Ptr(2)}, {Name: "Plugin2", Weight: pointer.Int32(2)},
{Name: "Plugin3"}, {Name: "Plugin3"},
{Name: "Plugin2", Weight: pointer.Int32Ptr(4)}, {Name: "Plugin2", Weight: pointer.Int32(4)},
}, },
}, },
}, },
@ -318,9 +318,9 @@ func TestMergePlugins(t *testing.T) {
Filter: v1beta3.PluginSet{ Filter: v1beta3.PluginSet{
Enabled: []v1beta3.Plugin{ Enabled: []v1beta3.Plugin{
{Name: "Plugin1"}, {Name: "Plugin1"},
{Name: "Plugin2", Weight: pointer.Int32Ptr(4)}, {Name: "Plugin2", Weight: pointer.Int32(4)},
{Name: "Plugin3"}, {Name: "Plugin3"},
{Name: "Plugin2", Weight: pointer.Int32Ptr(2)}, {Name: "Plugin2", Weight: pointer.Int32(2)},
}, },
}, },
}, },

View File

@ -102,7 +102,7 @@ func setDefaults_KubeSchedulerProfile(prof *v1beta3.KubeSchedulerProfile) {
// SetDefaults_KubeSchedulerConfiguration sets additional defaults // SetDefaults_KubeSchedulerConfiguration sets additional defaults
func SetDefaults_KubeSchedulerConfiguration(obj *v1beta3.KubeSchedulerConfiguration) { func SetDefaults_KubeSchedulerConfiguration(obj *v1beta3.KubeSchedulerConfiguration) {
if obj.Parallelism == nil { if obj.Parallelism == nil {
obj.Parallelism = pointer.Int32Ptr(16) obj.Parallelism = pointer.Int32(16)
} }
if len(obj.Profiles) == 0 { if len(obj.Profiles) == 0 {
@ -111,7 +111,7 @@ func SetDefaults_KubeSchedulerConfiguration(obj *v1beta3.KubeSchedulerConfigurat
// Only apply a default scheduler name when there is a single profile. // Only apply a default scheduler name when there is a single profile.
// Validation will ensure that every profile has a non-empty unique name. // Validation will ensure that every profile has a non-empty unique name.
if len(obj.Profiles) == 1 && obj.Profiles[0].SchedulerName == nil { 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. // Add the default set of plugins and apply the configuration.
@ -162,33 +162,33 @@ func SetDefaults_KubeSchedulerConfiguration(obj *v1beta3.KubeSchedulerConfigurat
// Enable profiling by default in the scheduler // Enable profiling by default in the scheduler
if obj.EnableProfiling == nil { if obj.EnableProfiling == nil {
obj.EnableProfiling = pointer.BoolPtr(true) obj.EnableProfiling = pointer.Bool(true)
} }
// Enable contention profiling by default if profiling is enabled // Enable contention profiling by default if profiling is enabled
if *obj.EnableProfiling && obj.EnableContentionProfiling == nil { if *obj.EnableProfiling && obj.EnableContentionProfiling == nil {
obj.EnableContentionProfiling = pointer.BoolPtr(true) obj.EnableContentionProfiling = pointer.Bool(true)
} }
} }
func SetDefaults_DefaultPreemptionArgs(obj *v1beta3.DefaultPreemptionArgs) { func SetDefaults_DefaultPreemptionArgs(obj *v1beta3.DefaultPreemptionArgs) {
if obj.MinCandidateNodesPercentage == nil { if obj.MinCandidateNodesPercentage == nil {
obj.MinCandidateNodesPercentage = pointer.Int32Ptr(10) obj.MinCandidateNodesPercentage = pointer.Int32(10)
} }
if obj.MinCandidateNodesAbsolute == nil { if obj.MinCandidateNodesAbsolute == nil {
obj.MinCandidateNodesAbsolute = pointer.Int32Ptr(100) obj.MinCandidateNodesAbsolute = pointer.Int32(100)
} }
} }
func SetDefaults_InterPodAffinityArgs(obj *v1beta3.InterPodAffinityArgs) { func SetDefaults_InterPodAffinityArgs(obj *v1beta3.InterPodAffinityArgs) {
if obj.HardPodAffinityWeight == nil { if obj.HardPodAffinityWeight == nil {
obj.HardPodAffinityWeight = pointer.Int32Ptr(1) obj.HardPodAffinityWeight = pointer.Int32(1)
} }
} }
func SetDefaults_VolumeBindingArgs(obj *v1beta3.VolumeBindingArgs) { func SetDefaults_VolumeBindingArgs(obj *v1beta3.VolumeBindingArgs) {
if obj.BindTimeoutSeconds == nil { if obj.BindTimeoutSeconds == nil {
obj.BindTimeoutSeconds = pointer.Int64Ptr(600) obj.BindTimeoutSeconds = pointer.Int64(600)
} }
if len(obj.Shape) == 0 && feature.DefaultFeatureGate.Enabled(features.VolumeCapacityPriority) { if len(obj.Shape) == 0 && feature.DefaultFeatureGate.Enabled(features.VolumeCapacityPriority) {
obj.Shape = []v1beta3.UtilizationShapePoint{ obj.Shape = []v1beta3.UtilizationShapePoint{

View File

@ -45,8 +45,8 @@ var pluginConfigs = []v1beta3.PluginConfig{
Kind: "DefaultPreemptionArgs", Kind: "DefaultPreemptionArgs",
APIVersion: "kubescheduler.config.k8s.io/v1beta3", APIVersion: "kubescheduler.config.k8s.io/v1beta3",
}, },
MinCandidateNodesPercentage: pointer.Int32Ptr(10), MinCandidateNodesPercentage: pointer.Int32(10),
MinCandidateNodesAbsolute: pointer.Int32Ptr(100), MinCandidateNodesAbsolute: pointer.Int32(100),
}}, }},
}, },
{ {
@ -57,7 +57,7 @@ var pluginConfigs = []v1beta3.PluginConfig{
Kind: "InterPodAffinityArgs", Kind: "InterPodAffinityArgs",
APIVersion: "kubescheduler.config.k8s.io/v1beta3", APIVersion: "kubescheduler.config.k8s.io/v1beta3",
}, },
HardPodAffinityWeight: pointer.Int32Ptr(1), HardPodAffinityWeight: pointer.Int32(1),
}}, }},
}, },
{ {
@ -109,7 +109,7 @@ var pluginConfigs = []v1beta3.PluginConfig{
Kind: "VolumeBindingArgs", Kind: "VolumeBindingArgs",
APIVersion: "kubescheduler.config.k8s.io/v1beta3", APIVersion: "kubescheduler.config.k8s.io/v1beta3",
}, },
BindTimeoutSeconds: pointer.Int64Ptr(600), BindTimeoutSeconds: pointer.Int64(600),
}}, }},
}, },
} }
@ -125,13 +125,13 @@ func TestSchedulerDefaults(t *testing.T) {
name: "empty config", name: "empty config",
config: &v1beta3.KubeSchedulerConfiguration{}, config: &v1beta3.KubeSchedulerConfiguration{},
expected: &v1beta3.KubeSchedulerConfiguration{ expected: &v1beta3.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(16), Parallelism: pointer.Int32(16),
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
EnableProfiling: &enable, EnableProfiling: &enable,
EnableContentionProfiling: &enable, EnableContentionProfiling: &enable,
}, },
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{ LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
LeaderElect: pointer.BoolPtr(true), LeaderElect: pointer.Bool(true),
LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
@ -144,14 +144,14 @@ func TestSchedulerDefaults(t *testing.T) {
Burst: 100, Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf", ContentType: "application/vnd.kubernetes.protobuf",
}, },
PercentageOfNodesToScore: pointer.Int32Ptr(0), PercentageOfNodesToScore: pointer.Int32(0),
PodInitialBackoffSeconds: pointer.Int64Ptr(1), PodInitialBackoffSeconds: pointer.Int64(1),
PodMaxBackoffSeconds: pointer.Int64Ptr(10), PodMaxBackoffSeconds: pointer.Int64(10),
Profiles: []v1beta3.KubeSchedulerProfile{ Profiles: []v1beta3.KubeSchedulerProfile{
{ {
Plugins: getDefaultPlugins(), Plugins: getDefaultPlugins(),
PluginConfig: pluginConfigs, PluginConfig: pluginConfigs,
SchedulerName: pointer.StringPtr("default-scheduler"), SchedulerName: pointer.String("default-scheduler"),
}, },
}, },
}, },
@ -162,13 +162,13 @@ func TestSchedulerDefaults(t *testing.T) {
Profiles: []v1beta3.KubeSchedulerProfile{{}}, Profiles: []v1beta3.KubeSchedulerProfile{{}},
}, },
expected: &v1beta3.KubeSchedulerConfiguration{ expected: &v1beta3.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(16), Parallelism: pointer.Int32(16),
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
EnableProfiling: &enable, EnableProfiling: &enable,
EnableContentionProfiling: &enable, EnableContentionProfiling: &enable,
}, },
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{ LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
LeaderElect: pointer.BoolPtr(true), LeaderElect: pointer.Bool(true),
LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
@ -181,12 +181,12 @@ func TestSchedulerDefaults(t *testing.T) {
Burst: 100, Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf", ContentType: "application/vnd.kubernetes.protobuf",
}, },
PercentageOfNodesToScore: pointer.Int32Ptr(0), PercentageOfNodesToScore: pointer.Int32(0),
PodInitialBackoffSeconds: pointer.Int64Ptr(1), PodInitialBackoffSeconds: pointer.Int64(1),
PodMaxBackoffSeconds: pointer.Int64Ptr(10), PodMaxBackoffSeconds: pointer.Int64(10),
Profiles: []v1beta3.KubeSchedulerProfile{ Profiles: []v1beta3.KubeSchedulerProfile{
{ {
SchedulerName: pointer.StringPtr("default-scheduler"), SchedulerName: pointer.String("default-scheduler"),
Plugins: getDefaultPlugins(), Plugins: getDefaultPlugins(),
PluginConfig: pluginConfigs}, PluginConfig: pluginConfigs},
}, },
@ -195,7 +195,7 @@ func TestSchedulerDefaults(t *testing.T) {
{ {
name: "two profiles", name: "two profiles",
config: &v1beta3.KubeSchedulerConfiguration{ config: &v1beta3.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(16), Parallelism: pointer.Int32(16),
Profiles: []v1beta3.KubeSchedulerProfile{ Profiles: []v1beta3.KubeSchedulerProfile{
{ {
PluginConfig: []v1beta3.PluginConfig{ PluginConfig: []v1beta3.PluginConfig{
@ -203,7 +203,7 @@ func TestSchedulerDefaults(t *testing.T) {
}, },
}, },
{ {
SchedulerName: pointer.StringPtr("custom-scheduler"), SchedulerName: pointer.String("custom-scheduler"),
Plugins: &v1beta3.Plugins{ Plugins: &v1beta3.Plugins{
Bind: v1beta3.PluginSet{ Bind: v1beta3.PluginSet{
Enabled: []v1beta3.Plugin{ Enabled: []v1beta3.Plugin{
@ -218,13 +218,13 @@ func TestSchedulerDefaults(t *testing.T) {
}, },
}, },
expected: &v1beta3.KubeSchedulerConfiguration{ expected: &v1beta3.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(16), Parallelism: pointer.Int32(16),
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
EnableProfiling: &enable, EnableProfiling: &enable,
EnableContentionProfiling: &enable, EnableContentionProfiling: &enable,
}, },
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{ LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
LeaderElect: pointer.BoolPtr(true), LeaderElect: pointer.Bool(true),
LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
@ -237,9 +237,9 @@ func TestSchedulerDefaults(t *testing.T) {
Burst: 100, Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf", ContentType: "application/vnd.kubernetes.protobuf",
}, },
PercentageOfNodesToScore: pointer.Int32Ptr(0), PercentageOfNodesToScore: pointer.Int32(0),
PodInitialBackoffSeconds: pointer.Int64Ptr(1), PodInitialBackoffSeconds: pointer.Int64(1),
PodMaxBackoffSeconds: pointer.Int64Ptr(10), PodMaxBackoffSeconds: pointer.Int64(10),
Profiles: []v1beta3.KubeSchedulerProfile{ Profiles: []v1beta3.KubeSchedulerProfile{
{ {
Plugins: getDefaultPlugins(), Plugins: getDefaultPlugins(),
@ -253,8 +253,8 @@ func TestSchedulerDefaults(t *testing.T) {
Kind: "DefaultPreemptionArgs", Kind: "DefaultPreemptionArgs",
APIVersion: "kubescheduler.config.k8s.io/v1beta3", APIVersion: "kubescheduler.config.k8s.io/v1beta3",
}, },
MinCandidateNodesPercentage: pointer.Int32Ptr(10), MinCandidateNodesPercentage: pointer.Int32(10),
MinCandidateNodesAbsolute: pointer.Int32Ptr(100), MinCandidateNodesAbsolute: pointer.Int32(100),
}}, }},
}, },
{ {
@ -265,7 +265,7 @@ func TestSchedulerDefaults(t *testing.T) {
Kind: "InterPodAffinityArgs", Kind: "InterPodAffinityArgs",
APIVersion: "kubescheduler.config.k8s.io/v1beta3", APIVersion: "kubescheduler.config.k8s.io/v1beta3",
}, },
HardPodAffinityWeight: pointer.Int32Ptr(1), HardPodAffinityWeight: pointer.Int32(1),
}}, }},
}, },
{ {
@ -317,13 +317,13 @@ func TestSchedulerDefaults(t *testing.T) {
Kind: "VolumeBindingArgs", Kind: "VolumeBindingArgs",
APIVersion: "kubescheduler.config.k8s.io/v1beta3", APIVersion: "kubescheduler.config.k8s.io/v1beta3",
}, },
BindTimeoutSeconds: pointer.Int64Ptr(600), BindTimeoutSeconds: pointer.Int64(600),
}}, }},
}, },
}, },
}, },
{ {
SchedulerName: pointer.StringPtr("custom-scheduler"), SchedulerName: pointer.String("custom-scheduler"),
Plugins: &v1beta3.Plugins{ Plugins: &v1beta3.Plugins{
MultiPoint: v1beta3.PluginSet{ MultiPoint: v1beta3.PluginSet{
Enabled: []v1beta3.Plugin{ Enabled: []v1beta3.Plugin{
@ -366,16 +366,16 @@ func TestSchedulerDefaults(t *testing.T) {
{ {
name: "Prallelism with no port", name: "Prallelism with no port",
config: &v1beta3.KubeSchedulerConfiguration{ config: &v1beta3.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(16), Parallelism: pointer.Int32(16),
}, },
expected: &v1beta3.KubeSchedulerConfiguration{ expected: &v1beta3.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(16), Parallelism: pointer.Int32(16),
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
EnableProfiling: &enable, EnableProfiling: &enable,
EnableContentionProfiling: &enable, EnableContentionProfiling: &enable,
}, },
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{ LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
LeaderElect: pointer.BoolPtr(true), LeaderElect: pointer.Bool(true),
LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
@ -388,14 +388,14 @@ func TestSchedulerDefaults(t *testing.T) {
Burst: 100, Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf", ContentType: "application/vnd.kubernetes.protobuf",
}, },
PercentageOfNodesToScore: pointer.Int32Ptr(0), PercentageOfNodesToScore: pointer.Int32(0),
PodInitialBackoffSeconds: pointer.Int64Ptr(1), PodInitialBackoffSeconds: pointer.Int64(1),
PodMaxBackoffSeconds: pointer.Int64Ptr(10), PodMaxBackoffSeconds: pointer.Int64(10),
Profiles: []v1beta3.KubeSchedulerProfile{ Profiles: []v1beta3.KubeSchedulerProfile{
{ {
Plugins: getDefaultPlugins(), Plugins: getDefaultPlugins(),
PluginConfig: pluginConfigs, PluginConfig: pluginConfigs,
SchedulerName: pointer.StringPtr("default-scheduler"), SchedulerName: pointer.String("default-scheduler"),
}, },
}, },
}, },
@ -403,16 +403,16 @@ func TestSchedulerDefaults(t *testing.T) {
{ {
name: "set non default parallelism", name: "set non default parallelism",
config: &v1beta3.KubeSchedulerConfiguration{ config: &v1beta3.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(8), Parallelism: pointer.Int32(8),
}, },
expected: &v1beta3.KubeSchedulerConfiguration{ expected: &v1beta3.KubeSchedulerConfiguration{
Parallelism: pointer.Int32Ptr(8), Parallelism: pointer.Int32(8),
DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{ DebuggingConfiguration: componentbaseconfig.DebuggingConfiguration{
EnableProfiling: &enable, EnableProfiling: &enable,
EnableContentionProfiling: &enable, EnableContentionProfiling: &enable,
}, },
LeaderElection: componentbaseconfig.LeaderElectionConfiguration{ LeaderElection: componentbaseconfig.LeaderElectionConfiguration{
LeaderElect: pointer.BoolPtr(true), LeaderElect: pointer.Bool(true),
LeaseDuration: metav1.Duration{Duration: 15 * time.Second}, LeaseDuration: metav1.Duration{Duration: 15 * time.Second},
RenewDeadline: metav1.Duration{Duration: 10 * time.Second}, RenewDeadline: metav1.Duration{Duration: 10 * time.Second},
RetryPeriod: metav1.Duration{Duration: 2 * time.Second}, RetryPeriod: metav1.Duration{Duration: 2 * time.Second},
@ -425,14 +425,14 @@ func TestSchedulerDefaults(t *testing.T) {
Burst: 100, Burst: 100,
ContentType: "application/vnd.kubernetes.protobuf", ContentType: "application/vnd.kubernetes.protobuf",
}, },
PercentageOfNodesToScore: pointer.Int32Ptr(0), PercentageOfNodesToScore: pointer.Int32(0),
PodInitialBackoffSeconds: pointer.Int64Ptr(1), PodInitialBackoffSeconds: pointer.Int64(1),
PodMaxBackoffSeconds: pointer.Int64Ptr(10), PodMaxBackoffSeconds: pointer.Int64(10),
Profiles: []v1beta3.KubeSchedulerProfile{ Profiles: []v1beta3.KubeSchedulerProfile{
{ {
Plugins: getDefaultPlugins(), Plugins: getDefaultPlugins(),
PluginConfig: pluginConfigs, PluginConfig: pluginConfigs,
SchedulerName: pointer.StringPtr("default-scheduler"), SchedulerName: pointer.String("default-scheduler"),
}, },
}, },
}, },
@ -459,43 +459,43 @@ func TestPluginArgsDefaults(t *testing.T) {
name: "DefaultPreemptionArgs empty", name: "DefaultPreemptionArgs empty",
in: &v1beta3.DefaultPreemptionArgs{}, in: &v1beta3.DefaultPreemptionArgs{},
want: &v1beta3.DefaultPreemptionArgs{ want: &v1beta3.DefaultPreemptionArgs{
MinCandidateNodesPercentage: pointer.Int32Ptr(10), MinCandidateNodesPercentage: pointer.Int32(10),
MinCandidateNodesAbsolute: pointer.Int32Ptr(100), MinCandidateNodesAbsolute: pointer.Int32(100),
}, },
}, },
{ {
name: "DefaultPreemptionArgs with value", name: "DefaultPreemptionArgs with value",
in: &v1beta3.DefaultPreemptionArgs{ in: &v1beta3.DefaultPreemptionArgs{
MinCandidateNodesPercentage: pointer.Int32Ptr(50), MinCandidateNodesPercentage: pointer.Int32(50),
}, },
want: &v1beta3.DefaultPreemptionArgs{ want: &v1beta3.DefaultPreemptionArgs{
MinCandidateNodesPercentage: pointer.Int32Ptr(50), MinCandidateNodesPercentage: pointer.Int32(50),
MinCandidateNodesAbsolute: pointer.Int32Ptr(100), MinCandidateNodesAbsolute: pointer.Int32(100),
}, },
}, },
{ {
name: "InterPodAffinityArgs empty", name: "InterPodAffinityArgs empty",
in: &v1beta3.InterPodAffinityArgs{}, in: &v1beta3.InterPodAffinityArgs{},
want: &v1beta3.InterPodAffinityArgs{ want: &v1beta3.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(1), HardPodAffinityWeight: pointer.Int32(1),
}, },
}, },
{ {
name: "InterPodAffinityArgs explicit 0", name: "InterPodAffinityArgs explicit 0",
in: &v1beta3.InterPodAffinityArgs{ in: &v1beta3.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(0), HardPodAffinityWeight: pointer.Int32(0),
}, },
want: &v1beta3.InterPodAffinityArgs{ want: &v1beta3.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(0), HardPodAffinityWeight: pointer.Int32(0),
}, },
}, },
{ {
name: "InterPodAffinityArgs with value", name: "InterPodAffinityArgs with value",
in: &v1beta3.InterPodAffinityArgs{ in: &v1beta3.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(5), HardPodAffinityWeight: pointer.Int32(5),
}, },
want: &v1beta3.InterPodAffinityArgs{ want: &v1beta3.InterPodAffinityArgs{
HardPodAffinityWeight: pointer.Int32Ptr(5), HardPodAffinityWeight: pointer.Int32(5),
}, },
}, },
{ {
@ -612,7 +612,7 @@ func TestPluginArgsDefaults(t *testing.T) {
}, },
in: &v1beta3.VolumeBindingArgs{}, in: &v1beta3.VolumeBindingArgs{},
want: &v1beta3.VolumeBindingArgs{ want: &v1beta3.VolumeBindingArgs{
BindTimeoutSeconds: pointer.Int64Ptr(600), BindTimeoutSeconds: pointer.Int64(600),
}, },
}, },
{ {
@ -622,7 +622,7 @@ func TestPluginArgsDefaults(t *testing.T) {
}, },
in: &v1beta3.VolumeBindingArgs{}, in: &v1beta3.VolumeBindingArgs{},
want: &v1beta3.VolumeBindingArgs{ want: &v1beta3.VolumeBindingArgs{
BindTimeoutSeconds: pointer.Int64Ptr(600), BindTimeoutSeconds: pointer.Int64(600),
Shape: []v1beta3.UtilizationShapePoint{ Shape: []v1beta3.UtilizationShapePoint{
{Utilization: 0, Score: 0}, {Utilization: 0, Score: 0},
{Utilization: 100, Score: 10}, {Utilization: 100, Score: 10},

View File

@ -35,7 +35,7 @@ import (
fakeframework "k8s.io/kubernetes/pkg/scheduler/framework/fake" fakeframework "k8s.io/kubernetes/pkg/scheduler/framework/fake"
st "k8s.io/kubernetes/pkg/scheduler/testing" st "k8s.io/kubernetes/pkg/scheduler/testing"
volumeutil "k8s.io/kubernetes/pkg/volume/util" volumeutil "k8s.io/kubernetes/pkg/volume/util"
utilpointer "k8s.io/utils/pointer" "k8s.io/utils/pointer"
) )
const ( const (
@ -636,7 +636,7 @@ func getNodeWithPodAndVolumeLimits(limitSource string, pods []*v1.Pod, limit int
} }
if addLimits { if addLimits {
driver.Allocatable = &storagev1.VolumeNodeResources{ driver.Allocatable = &storagev1.VolumeNodeResources{
Count: utilpointer.Int32Ptr(int32(limit)), Count: pointer.Int32(int32(limit)),
} }
} }
csiNode.Spec.Drivers = append(csiNode.Spec.Drivers, driver) csiNode.Spec.Drivers = append(csiNode.Spec.Drivers, driver)

View File

@ -31,7 +31,7 @@ import (
fakeframework "k8s.io/kubernetes/pkg/scheduler/framework/fake" fakeframework "k8s.io/kubernetes/pkg/scheduler/framework/fake"
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature" "k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
st "k8s.io/kubernetes/pkg/scheduler/testing" st "k8s.io/kubernetes/pkg/scheduler/testing"
utilpointer "k8s.io/utils/pointer" "k8s.io/utils/pointer"
) )
var ( var (
@ -792,14 +792,14 @@ func getFakePVCLister(filterName string) fakeframework.PersistentVolumeClaimList
ObjectMeta: metav1.ObjectMeta{Name: "unboundPVCWithDefaultSCPod"}, ObjectMeta: metav1.ObjectMeta{Name: "unboundPVCWithDefaultSCPod"},
Spec: v1.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
VolumeName: "", VolumeName: "",
StorageClassName: utilpointer.StringPtr("standard-sc"), StorageClassName: pointer.String("standard-sc"),
}, },
}, },
{ {
ObjectMeta: metav1.ObjectMeta{Name: "unboundPVCWithInvalidSCPod"}, ObjectMeta: metav1.ObjectMeta{Name: "unboundPVCWithInvalidSCPod"},
Spec: v1.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
VolumeName: "", VolumeName: "",
StorageClassName: utilpointer.StringPtr("invalid-sc"), StorageClassName: pointer.String("invalid-sc"),
}, },
}, },
} }

View File

@ -86,8 +86,8 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
}, },
IgnoredNodes: sets.NewString(), IgnoredNodes: sets.NewString(),
TopologyPairToPodCounts: map[topologyPair]*int64{ TopologyPairToPodCounts: map[topologyPair]*int64{
{key: "zone", value: "zone1"}: pointer.Int64Ptr(0), {key: "zone", value: "zone1"}: pointer.Int64(0),
{key: "zone", value: "zone2"}: pointer.Int64Ptr(0), {key: "zone", value: "zone2"}: pointer.Int64(0),
}, },
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2), topologyNormalizingWeight(3)}, TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2), topologyNormalizingWeight(3)},
}, },
@ -127,7 +127,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
}, },
IgnoredNodes: sets.NewString("node-x"), IgnoredNodes: sets.NewString("node-x"),
TopologyPairToPodCounts: map[topologyPair]*int64{ TopologyPairToPodCounts: map[topologyPair]*int64{
{key: "zone", value: "zone1"}: pointer.Int64Ptr(0), {key: "zone", value: "zone1"}: pointer.Int64(0),
}, },
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(1), topologyNormalizingWeight(2)}, TopologyNormalizingWeight: []float64{topologyNormalizingWeight(1), topologyNormalizingWeight(2)},
}, },
@ -169,8 +169,8 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
}, },
IgnoredNodes: sets.NewString(), IgnoredNodes: sets.NewString(),
TopologyPairToPodCounts: map[topologyPair]*int64{ TopologyPairToPodCounts: map[topologyPair]*int64{
{key: v1.LabelTopologyZone, value: "mars"}: pointer.Int64Ptr(0), {key: v1.LabelTopologyZone, value: "mars"}: pointer.Int64(0),
{key: v1.LabelTopologyZone, value: ""}: pointer.Int64Ptr(0), {key: v1.LabelTopologyZone, value: ""}: pointer.Int64(0),
}, },
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(4), topologyNormalizingWeight(2)}, TopologyNormalizingWeight: []float64{topologyNormalizingWeight(4), topologyNormalizingWeight(2)},
}, },
@ -220,7 +220,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
}, },
IgnoredNodes: sets.NewString(), IgnoredNodes: sets.NewString(),
TopologyPairToPodCounts: map[topologyPair]*int64{ TopologyPairToPodCounts: map[topologyPair]*int64{
{key: "planet", value: "mars"}: pointer.Int64Ptr(0), {key: "planet", value: "mars"}: pointer.Int64(0),
}, },
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(1), topologyNormalizingWeight(1)}, TopologyNormalizingWeight: []float64{topologyNormalizingWeight(1), topologyNormalizingWeight(1)},
}, },
@ -284,7 +284,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
}, },
IgnoredNodes: sets.NewString(), IgnoredNodes: sets.NewString(),
TopologyPairToPodCounts: map[topologyPair]*int64{ TopologyPairToPodCounts: map[topologyPair]*int64{
{"planet", "mars"}: pointer.Int64Ptr(0), {"planet", "mars"}: pointer.Int64(0),
}, },
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(1)}, TopologyNormalizingWeight: []float64{topologyNormalizingWeight(1)},
}, },
@ -316,8 +316,8 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
}, },
IgnoredNodes: sets.NewString(), IgnoredNodes: sets.NewString(),
TopologyPairToPodCounts: map[topologyPair]*int64{ TopologyPairToPodCounts: map[topologyPair]*int64{
{key: "zone", value: "zone1"}: pointer.Int64Ptr(0), {key: "zone", value: "zone1"}: pointer.Int64(0),
{key: "zone", value: "zone2"}: pointer.Int64Ptr(0), {key: "zone", value: "zone2"}: pointer.Int64(0),
}, },
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)}, TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)},
}, },
@ -350,8 +350,8 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
}, },
IgnoredNodes: sets.NewString(), IgnoredNodes: sets.NewString(),
TopologyPairToPodCounts: map[topologyPair]*int64{ TopologyPairToPodCounts: map[topologyPair]*int64{
{key: "zone", value: "zone1"}: pointer.Int64Ptr(0), {key: "zone", value: "zone1"}: pointer.Int64(0),
{key: "zone", value: "zone2"}: pointer.Int64Ptr(0), {key: "zone", value: "zone2"}: pointer.Int64(0),
}, },
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)}, TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)},
}, },
@ -384,8 +384,8 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
}, },
IgnoredNodes: sets.NewString(), IgnoredNodes: sets.NewString(),
TopologyPairToPodCounts: map[topologyPair]*int64{ TopologyPairToPodCounts: map[topologyPair]*int64{
{key: "zone", value: "zone1"}: pointer.Int64Ptr(0), {key: "zone", value: "zone1"}: pointer.Int64(0),
{key: "zone", value: "zone2"}: pointer.Int64Ptr(0), {key: "zone", value: "zone2"}: pointer.Int64(0),
}, },
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)}, TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)},
}, },
@ -418,8 +418,8 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
}, },
IgnoredNodes: sets.NewString(), IgnoredNodes: sets.NewString(),
TopologyPairToPodCounts: map[topologyPair]*int64{ TopologyPairToPodCounts: map[topologyPair]*int64{
{key: "zone", value: "zone1"}: pointer.Int64Ptr(0), {key: "zone", value: "zone1"}: pointer.Int64(0),
{key: "zone", value: "zone2"}: pointer.Int64Ptr(0), {key: "zone", value: "zone2"}: pointer.Int64(0),
}, },
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)}, TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)},
}, },
@ -451,8 +451,8 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
}, },
IgnoredNodes: sets.NewString(), IgnoredNodes: sets.NewString(),
TopologyPairToPodCounts: map[topologyPair]*int64{ TopologyPairToPodCounts: map[topologyPair]*int64{
{key: "zone", value: "zone1"}: pointer.Int64Ptr(0), {key: "zone", value: "zone1"}: pointer.Int64(0),
{key: "zone", value: "zone2"}: pointer.Int64Ptr(0), {key: "zone", value: "zone2"}: pointer.Int64(0),
}, },
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)}, TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)},
}, },
@ -484,8 +484,8 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
}, },
IgnoredNodes: sets.NewString(), IgnoredNodes: sets.NewString(),
TopologyPairToPodCounts: map[topologyPair]*int64{ TopologyPairToPodCounts: map[topologyPair]*int64{
{key: "zone", value: "zone1"}: pointer.Int64Ptr(0), {key: "zone", value: "zone1"}: pointer.Int64(0),
{key: "zone", value: "zone2"}: pointer.Int64Ptr(0), {key: "zone", value: "zone2"}: pointer.Int64(0),
}, },
TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)}, TopologyNormalizingWeight: []float64{topologyNormalizingWeight(2)},
}, },

View File

@ -50,7 +50,7 @@ func controllerRef(name string, gvk schema.GroupVersionKind) []metav1.OwnerRefer
APIVersion: gvk.GroupVersion().String(), APIVersion: gvk.GroupVersion().String(),
Kind: gvk.Kind, Kind: gvk.Kind,
Name: name, Name: name,
Controller: pointer.BoolPtr(true), Controller: pointer.Bool(true),
}, },
} }
} }

View File

@ -115,7 +115,7 @@ func makePVC(name string, storageClassName string) pvcBuilder {
Namespace: v1.NamespaceDefault, Namespace: v1.NamespaceDefault,
}, },
Spec: v1.PersistentVolumeClaimSpec{ Spec: v1.PersistentVolumeClaimSpec{
StorageClassName: pointer.StringPtr(storageClassName), StorageClassName: pointer.String(storageClassName),
}, },
}} }}
} }

View File

@ -1922,7 +1922,7 @@ func TestSchedulerSchedulePod(t *testing.T) {
nodes: []string{"node1", "node2", "node3"}, nodes: []string{"node1", "node2", "node3"},
pod: st.MakePod().Name("test-prefilter").UID("test-prefilter").Obj(), pod: st.MakePod().Name("test-prefilter").UID("test-prefilter").Obj(),
wantNodes: sets.NewString("node2"), wantNodes: sets.NewString("node2"),
wantEvaluatedNodes: pointer.Int32Ptr(1), wantEvaluatedNodes: pointer.Int32(1),
}, },
{ {
name: "test prefilter plugin returning non-intersecting nodes", name: "test prefilter plugin returning non-intersecting nodes",

View File

@ -230,7 +230,7 @@ func (p *PodWrapper) OwnerReference(name string, gvk schema.GroupVersionKind) *P
APIVersion: gvk.GroupVersion().String(), APIVersion: gvk.GroupVersion().String(),
Kind: gvk.Kind, Kind: gvk.Kind,
Name: name, Name: name,
Controller: pointer.BoolPtr(true), Controller: pointer.Bool(true),
}, },
} }
return p return p