mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 02:41:25 +00:00
Merge pull request #113265 from yuanchen8911/pointer
Replace deprecated pointer conversions in scheduler
This commit is contained in:
commit
9ac6c0480a
@ -240,8 +240,8 @@ func TestMergePlugins(t *testing.T) {
|
|||||||
customPlugins: &v1.Plugins{
|
customPlugins: &v1.Plugins{
|
||||||
Filter: v1.PluginSet{
|
Filter: v1.PluginSet{
|
||||||
Enabled: []v1.Plugin{
|
Enabled: []v1.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: &v1.Plugins{
|
expectedPlugins: &v1.Plugins{
|
||||||
Filter: v1.PluginSet{
|
Filter: v1.PluginSet{
|
||||||
Enabled: []v1.Plugin{
|
Enabled: []v1.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: &v1.Plugins{
|
customPlugins: &v1.Plugins{
|
||||||
Filter: v1.PluginSet{
|
Filter: v1.PluginSet{
|
||||||
Enabled: []v1.Plugin{
|
Enabled: []v1.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: &v1.Plugins{
|
expectedPlugins: &v1.Plugins{
|
||||||
Filter: v1.PluginSet{
|
Filter: v1.PluginSet{
|
||||||
Enabled: []v1.Plugin{
|
Enabled: []v1.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: v1.PluginSet{
|
Filter: v1.PluginSet{
|
||||||
Enabled: []v1.Plugin{
|
Enabled: []v1.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: v1.PluginSet{
|
Filter: v1.PluginSet{
|
||||||
Enabled: []v1.Plugin{
|
Enabled: []v1.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)},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -102,7 +102,7 @@ func setDefaults_KubeSchedulerProfile(prof *configv1.KubeSchedulerProfile) {
|
|||||||
// SetDefaults_KubeSchedulerConfiguration sets additional defaults
|
// SetDefaults_KubeSchedulerConfiguration sets additional defaults
|
||||||
func SetDefaults_KubeSchedulerConfiguration(obj *configv1.KubeSchedulerConfiguration) {
|
func SetDefaults_KubeSchedulerConfiguration(obj *configv1.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 *configv1.KubeSchedulerConfigura
|
|||||||
// 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.
|
||||||
@ -172,22 +172,22 @@ func SetDefaults_KubeSchedulerConfiguration(obj *configv1.KubeSchedulerConfigura
|
|||||||
|
|
||||||
func SetDefaults_DefaultPreemptionArgs(obj *configv1.DefaultPreemptionArgs) {
|
func SetDefaults_DefaultPreemptionArgs(obj *configv1.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 *configv1.InterPodAffinityArgs) {
|
func SetDefaults_InterPodAffinityArgs(obj *configv1.InterPodAffinityArgs) {
|
||||||
if obj.HardPodAffinityWeight == nil {
|
if obj.HardPodAffinityWeight == nil {
|
||||||
obj.HardPodAffinityWeight = pointer.Int32Ptr(1)
|
obj.HardPodAffinityWeight = pointer.Int32(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetDefaults_VolumeBindingArgs(obj *configv1.VolumeBindingArgs) {
|
func SetDefaults_VolumeBindingArgs(obj *configv1.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 = []configv1.UtilizationShapePoint{
|
obj.Shape = []configv1.UtilizationShapePoint{
|
||||||
|
@ -46,8 +46,8 @@ var pluginConfigs = []configv1.PluginConfig{
|
|||||||
Kind: "DefaultPreemptionArgs",
|
Kind: "DefaultPreemptionArgs",
|
||||||
APIVersion: "kubescheduler.config.k8s.io/v1",
|
APIVersion: "kubescheduler.config.k8s.io/v1",
|
||||||
},
|
},
|
||||||
MinCandidateNodesPercentage: pointer.Int32Ptr(10),
|
MinCandidateNodesPercentage: pointer.Int32(10),
|
||||||
MinCandidateNodesAbsolute: pointer.Int32Ptr(100),
|
MinCandidateNodesAbsolute: pointer.Int32(100),
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ var pluginConfigs = []configv1.PluginConfig{
|
|||||||
Kind: "InterPodAffinityArgs",
|
Kind: "InterPodAffinityArgs",
|
||||||
APIVersion: "kubescheduler.config.k8s.io/v1",
|
APIVersion: "kubescheduler.config.k8s.io/v1",
|
||||||
},
|
},
|
||||||
HardPodAffinityWeight: pointer.Int32Ptr(1),
|
HardPodAffinityWeight: pointer.Int32(1),
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -110,7 +110,7 @@ var pluginConfigs = []configv1.PluginConfig{
|
|||||||
Kind: "VolumeBindingArgs",
|
Kind: "VolumeBindingArgs",
|
||||||
APIVersion: "kubescheduler.config.k8s.io/v1",
|
APIVersion: "kubescheduler.config.k8s.io/v1",
|
||||||
},
|
},
|
||||||
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
BindTimeoutSeconds: pointer.Int64(600),
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -126,13 +126,13 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
name: "empty config",
|
name: "empty config",
|
||||||
config: &configv1.KubeSchedulerConfiguration{},
|
config: &configv1.KubeSchedulerConfiguration{},
|
||||||
expected: &configv1.KubeSchedulerConfiguration{
|
expected: &configv1.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},
|
||||||
@ -146,13 +146,13 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: pointer.Int32(config.DefaultPercentageOfNodesToScore),
|
PercentageOfNodesToScore: pointer.Int32(config.DefaultPercentageOfNodesToScore),
|
||||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
PodInitialBackoffSeconds: pointer.Int64(1),
|
||||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
PodMaxBackoffSeconds: pointer.Int64(10),
|
||||||
Profiles: []configv1.KubeSchedulerProfile{
|
Profiles: []configv1.KubeSchedulerProfile{
|
||||||
{
|
{
|
||||||
Plugins: getDefaultPlugins(),
|
Plugins: getDefaultPlugins(),
|
||||||
PluginConfig: pluginConfigs,
|
PluginConfig: pluginConfigs,
|
||||||
SchedulerName: pointer.StringPtr("default-scheduler"),
|
SchedulerName: pointer.String("default-scheduler"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -163,13 +163,13 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
Profiles: []configv1.KubeSchedulerProfile{{}},
|
Profiles: []configv1.KubeSchedulerProfile{{}},
|
||||||
},
|
},
|
||||||
expected: &configv1.KubeSchedulerConfiguration{
|
expected: &configv1.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},
|
||||||
@ -183,11 +183,11 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: pointer.Int32(config.DefaultPercentageOfNodesToScore),
|
PercentageOfNodesToScore: pointer.Int32(config.DefaultPercentageOfNodesToScore),
|
||||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
PodInitialBackoffSeconds: pointer.Int64(1),
|
||||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
PodMaxBackoffSeconds: pointer.Int64(10),
|
||||||
Profiles: []configv1.KubeSchedulerProfile{
|
Profiles: []configv1.KubeSchedulerProfile{
|
||||||
{
|
{
|
||||||
SchedulerName: pointer.StringPtr("default-scheduler"),
|
SchedulerName: pointer.String("default-scheduler"),
|
||||||
Plugins: getDefaultPlugins(),
|
Plugins: getDefaultPlugins(),
|
||||||
PluginConfig: pluginConfigs},
|
PluginConfig: pluginConfigs},
|
||||||
},
|
},
|
||||||
@ -196,7 +196,7 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "two profiles",
|
name: "two profiles",
|
||||||
config: &configv1.KubeSchedulerConfiguration{
|
config: &configv1.KubeSchedulerConfiguration{
|
||||||
Parallelism: pointer.Int32Ptr(16),
|
Parallelism: pointer.Int32(16),
|
||||||
Profiles: []configv1.KubeSchedulerProfile{
|
Profiles: []configv1.KubeSchedulerProfile{
|
||||||
{
|
{
|
||||||
PluginConfig: []configv1.PluginConfig{
|
PluginConfig: []configv1.PluginConfig{
|
||||||
@ -204,7 +204,7 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
SchedulerName: pointer.StringPtr("custom-scheduler"),
|
SchedulerName: pointer.String("custom-scheduler"),
|
||||||
Plugins: &configv1.Plugins{
|
Plugins: &configv1.Plugins{
|
||||||
Bind: configv1.PluginSet{
|
Bind: configv1.PluginSet{
|
||||||
Enabled: []configv1.Plugin{
|
Enabled: []configv1.Plugin{
|
||||||
@ -219,13 +219,13 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: &configv1.KubeSchedulerConfiguration{
|
expected: &configv1.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},
|
||||||
@ -239,8 +239,8 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: pointer.Int32(config.DefaultPercentageOfNodesToScore),
|
PercentageOfNodesToScore: pointer.Int32(config.DefaultPercentageOfNodesToScore),
|
||||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
PodInitialBackoffSeconds: pointer.Int64(1),
|
||||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
PodMaxBackoffSeconds: pointer.Int64(10),
|
||||||
Profiles: []configv1.KubeSchedulerProfile{
|
Profiles: []configv1.KubeSchedulerProfile{
|
||||||
{
|
{
|
||||||
Plugins: getDefaultPlugins(),
|
Plugins: getDefaultPlugins(),
|
||||||
@ -254,8 +254,8 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
Kind: "DefaultPreemptionArgs",
|
Kind: "DefaultPreemptionArgs",
|
||||||
APIVersion: "kubescheduler.config.k8s.io/v1",
|
APIVersion: "kubescheduler.config.k8s.io/v1",
|
||||||
},
|
},
|
||||||
MinCandidateNodesPercentage: pointer.Int32Ptr(10),
|
MinCandidateNodesPercentage: pointer.Int32(10),
|
||||||
MinCandidateNodesAbsolute: pointer.Int32Ptr(100),
|
MinCandidateNodesAbsolute: pointer.Int32(100),
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -266,7 +266,7 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
Kind: "InterPodAffinityArgs",
|
Kind: "InterPodAffinityArgs",
|
||||||
APIVersion: "kubescheduler.config.k8s.io/v1",
|
APIVersion: "kubescheduler.config.k8s.io/v1",
|
||||||
},
|
},
|
||||||
HardPodAffinityWeight: pointer.Int32Ptr(1),
|
HardPodAffinityWeight: pointer.Int32(1),
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -318,13 +318,13 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
Kind: "VolumeBindingArgs",
|
Kind: "VolumeBindingArgs",
|
||||||
APIVersion: "kubescheduler.config.k8s.io/v1",
|
APIVersion: "kubescheduler.config.k8s.io/v1",
|
||||||
},
|
},
|
||||||
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
BindTimeoutSeconds: pointer.Int64(600),
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
SchedulerName: pointer.StringPtr("custom-scheduler"),
|
SchedulerName: pointer.String("custom-scheduler"),
|
||||||
Plugins: &configv1.Plugins{
|
Plugins: &configv1.Plugins{
|
||||||
MultiPoint: configv1.PluginSet{
|
MultiPoint: configv1.PluginSet{
|
||||||
Enabled: []configv1.Plugin{
|
Enabled: []configv1.Plugin{
|
||||||
@ -367,16 +367,16 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "Prallelism with no port",
|
name: "Prallelism with no port",
|
||||||
config: &configv1.KubeSchedulerConfiguration{
|
config: &configv1.KubeSchedulerConfiguration{
|
||||||
Parallelism: pointer.Int32Ptr(16),
|
Parallelism: pointer.Int32(16),
|
||||||
},
|
},
|
||||||
expected: &configv1.KubeSchedulerConfiguration{
|
expected: &configv1.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},
|
||||||
@ -390,13 +390,13 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: pointer.Int32(config.DefaultPercentageOfNodesToScore),
|
PercentageOfNodesToScore: pointer.Int32(config.DefaultPercentageOfNodesToScore),
|
||||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
PodInitialBackoffSeconds: pointer.Int64(1),
|
||||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
PodMaxBackoffSeconds: pointer.Int64(10),
|
||||||
Profiles: []configv1.KubeSchedulerProfile{
|
Profiles: []configv1.KubeSchedulerProfile{
|
||||||
{
|
{
|
||||||
Plugins: getDefaultPlugins(),
|
Plugins: getDefaultPlugins(),
|
||||||
PluginConfig: pluginConfigs,
|
PluginConfig: pluginConfigs,
|
||||||
SchedulerName: pointer.StringPtr("default-scheduler"),
|
SchedulerName: pointer.String("default-scheduler"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -404,16 +404,16 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "set non default parallelism",
|
name: "set non default parallelism",
|
||||||
config: &configv1.KubeSchedulerConfiguration{
|
config: &configv1.KubeSchedulerConfiguration{
|
||||||
Parallelism: pointer.Int32Ptr(8),
|
Parallelism: pointer.Int32(8),
|
||||||
},
|
},
|
||||||
expected: &configv1.KubeSchedulerConfiguration{
|
expected: &configv1.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},
|
||||||
@ -427,13 +427,13 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: pointer.Int32(config.DefaultPercentageOfNodesToScore),
|
PercentageOfNodesToScore: pointer.Int32(config.DefaultPercentageOfNodesToScore),
|
||||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
PodInitialBackoffSeconds: pointer.Int64(1),
|
||||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
PodMaxBackoffSeconds: pointer.Int64(10),
|
||||||
Profiles: []configv1.KubeSchedulerProfile{
|
Profiles: []configv1.KubeSchedulerProfile{
|
||||||
{
|
{
|
||||||
Plugins: getDefaultPlugins(),
|
Plugins: getDefaultPlugins(),
|
||||||
PluginConfig: pluginConfigs,
|
PluginConfig: pluginConfigs,
|
||||||
SchedulerName: pointer.StringPtr("default-scheduler"),
|
SchedulerName: pointer.String("default-scheduler"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -441,16 +441,16 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "set non default global percentageOfNodesToScore",
|
name: "set non default global percentageOfNodesToScore",
|
||||||
config: &configv1.KubeSchedulerConfiguration{
|
config: &configv1.KubeSchedulerConfiguration{
|
||||||
PercentageOfNodesToScore: pointer.Int32Ptr(50),
|
PercentageOfNodesToScore: pointer.Int32(50),
|
||||||
},
|
},
|
||||||
expected: &configv1.KubeSchedulerConfiguration{
|
expected: &configv1.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},
|
||||||
@ -463,14 +463,14 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
Burst: 100,
|
Burst: 100,
|
||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: pointer.Int32Ptr(50),
|
PercentageOfNodesToScore: pointer.Int32(50),
|
||||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
PodInitialBackoffSeconds: pointer.Int64(1),
|
||||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
PodMaxBackoffSeconds: pointer.Int64(10),
|
||||||
Profiles: []configv1.KubeSchedulerProfile{
|
Profiles: []configv1.KubeSchedulerProfile{
|
||||||
{
|
{
|
||||||
Plugins: getDefaultPlugins(),
|
Plugins: getDefaultPlugins(),
|
||||||
PluginConfig: pluginConfigs,
|
PluginConfig: pluginConfigs,
|
||||||
SchedulerName: pointer.StringPtr("default-scheduler"),
|
SchedulerName: pointer.String("default-scheduler"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -480,18 +480,18 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
config: &configv1.KubeSchedulerConfiguration{
|
config: &configv1.KubeSchedulerConfiguration{
|
||||||
Profiles: []configv1.KubeSchedulerProfile{
|
Profiles: []configv1.KubeSchedulerProfile{
|
||||||
{
|
{
|
||||||
PercentageOfNodesToScore: pointer.Int32Ptr(50),
|
PercentageOfNodesToScore: pointer.Int32(50),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: &configv1.KubeSchedulerConfiguration{
|
expected: &configv1.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},
|
||||||
@ -505,14 +505,14 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: pointer.Int32(config.DefaultPercentageOfNodesToScore),
|
PercentageOfNodesToScore: pointer.Int32(config.DefaultPercentageOfNodesToScore),
|
||||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
PodInitialBackoffSeconds: pointer.Int64(1),
|
||||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
PodMaxBackoffSeconds: pointer.Int64(10),
|
||||||
Profiles: []configv1.KubeSchedulerProfile{
|
Profiles: []configv1.KubeSchedulerProfile{
|
||||||
{
|
{
|
||||||
Plugins: getDefaultPlugins(),
|
Plugins: getDefaultPlugins(),
|
||||||
PluginConfig: pluginConfigs,
|
PluginConfig: pluginConfigs,
|
||||||
SchedulerName: pointer.StringPtr("default-scheduler"),
|
SchedulerName: pointer.String("default-scheduler"),
|
||||||
PercentageOfNodesToScore: pointer.Int32Ptr(50),
|
PercentageOfNodesToScore: pointer.Int32(50),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -520,21 +520,21 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "set non default global and profile percentageOfNodesToScore",
|
name: "set non default global and profile percentageOfNodesToScore",
|
||||||
config: &configv1.KubeSchedulerConfiguration{
|
config: &configv1.KubeSchedulerConfiguration{
|
||||||
PercentageOfNodesToScore: pointer.Int32Ptr(10),
|
PercentageOfNodesToScore: pointer.Int32(10),
|
||||||
Profiles: []configv1.KubeSchedulerProfile{
|
Profiles: []configv1.KubeSchedulerProfile{
|
||||||
{
|
{
|
||||||
PercentageOfNodesToScore: pointer.Int32Ptr(50),
|
PercentageOfNodesToScore: pointer.Int32(50),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: &configv1.KubeSchedulerConfiguration{
|
expected: &configv1.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},
|
||||||
@ -547,15 +547,15 @@ func TestSchedulerDefaults(t *testing.T) {
|
|||||||
Burst: 100,
|
Burst: 100,
|
||||||
ContentType: "application/vnd.kubernetes.protobuf",
|
ContentType: "application/vnd.kubernetes.protobuf",
|
||||||
},
|
},
|
||||||
PercentageOfNodesToScore: pointer.Int32Ptr(10),
|
PercentageOfNodesToScore: pointer.Int32(10),
|
||||||
PodInitialBackoffSeconds: pointer.Int64Ptr(1),
|
PodInitialBackoffSeconds: pointer.Int64(1),
|
||||||
PodMaxBackoffSeconds: pointer.Int64Ptr(10),
|
PodMaxBackoffSeconds: pointer.Int64(10),
|
||||||
Profiles: []configv1.KubeSchedulerProfile{
|
Profiles: []configv1.KubeSchedulerProfile{
|
||||||
{
|
{
|
||||||
Plugins: getDefaultPlugins(),
|
Plugins: getDefaultPlugins(),
|
||||||
PluginConfig: pluginConfigs,
|
PluginConfig: pluginConfigs,
|
||||||
SchedulerName: pointer.StringPtr("default-scheduler"),
|
SchedulerName: pointer.String("default-scheduler"),
|
||||||
PercentageOfNodesToScore: pointer.Int32Ptr(50),
|
PercentageOfNodesToScore: pointer.Int32(50),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -582,43 +582,43 @@ func TestPluginArgsDefaults(t *testing.T) {
|
|||||||
name: "DefaultPreemptionArgs empty",
|
name: "DefaultPreemptionArgs empty",
|
||||||
in: &configv1.DefaultPreemptionArgs{},
|
in: &configv1.DefaultPreemptionArgs{},
|
||||||
want: &configv1.DefaultPreemptionArgs{
|
want: &configv1.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: &configv1.DefaultPreemptionArgs{
|
in: &configv1.DefaultPreemptionArgs{
|
||||||
MinCandidateNodesPercentage: pointer.Int32Ptr(50),
|
MinCandidateNodesPercentage: pointer.Int32(50),
|
||||||
},
|
},
|
||||||
want: &configv1.DefaultPreemptionArgs{
|
want: &configv1.DefaultPreemptionArgs{
|
||||||
MinCandidateNodesPercentage: pointer.Int32Ptr(50),
|
MinCandidateNodesPercentage: pointer.Int32(50),
|
||||||
MinCandidateNodesAbsolute: pointer.Int32Ptr(100),
|
MinCandidateNodesAbsolute: pointer.Int32(100),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "InterPodAffinityArgs empty",
|
name: "InterPodAffinityArgs empty",
|
||||||
in: &configv1.InterPodAffinityArgs{},
|
in: &configv1.InterPodAffinityArgs{},
|
||||||
want: &configv1.InterPodAffinityArgs{
|
want: &configv1.InterPodAffinityArgs{
|
||||||
HardPodAffinityWeight: pointer.Int32Ptr(1),
|
HardPodAffinityWeight: pointer.Int32(1),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "InterPodAffinityArgs explicit 0",
|
name: "InterPodAffinityArgs explicit 0",
|
||||||
in: &configv1.InterPodAffinityArgs{
|
in: &configv1.InterPodAffinityArgs{
|
||||||
HardPodAffinityWeight: pointer.Int32Ptr(0),
|
HardPodAffinityWeight: pointer.Int32(0),
|
||||||
},
|
},
|
||||||
want: &configv1.InterPodAffinityArgs{
|
want: &configv1.InterPodAffinityArgs{
|
||||||
HardPodAffinityWeight: pointer.Int32Ptr(0),
|
HardPodAffinityWeight: pointer.Int32(0),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "InterPodAffinityArgs with value",
|
name: "InterPodAffinityArgs with value",
|
||||||
in: &configv1.InterPodAffinityArgs{
|
in: &configv1.InterPodAffinityArgs{
|
||||||
HardPodAffinityWeight: pointer.Int32Ptr(5),
|
HardPodAffinityWeight: pointer.Int32(5),
|
||||||
},
|
},
|
||||||
want: &configv1.InterPodAffinityArgs{
|
want: &configv1.InterPodAffinityArgs{
|
||||||
HardPodAffinityWeight: pointer.Int32Ptr(5),
|
HardPodAffinityWeight: pointer.Int32(5),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -735,7 +735,7 @@ func TestPluginArgsDefaults(t *testing.T) {
|
|||||||
},
|
},
|
||||||
in: &configv1.VolumeBindingArgs{},
|
in: &configv1.VolumeBindingArgs{},
|
||||||
want: &configv1.VolumeBindingArgs{
|
want: &configv1.VolumeBindingArgs{
|
||||||
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
BindTimeoutSeconds: pointer.Int64(600),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -745,7 +745,7 @@ func TestPluginArgsDefaults(t *testing.T) {
|
|||||||
},
|
},
|
||||||
in: &configv1.VolumeBindingArgs{},
|
in: &configv1.VolumeBindingArgs{},
|
||||||
want: &configv1.VolumeBindingArgs{
|
want: &configv1.VolumeBindingArgs{
|
||||||
BindTimeoutSeconds: pointer.Int64Ptr(600),
|
BindTimeoutSeconds: pointer.Int64(600),
|
||||||
Shape: []configv1.UtilizationShapePoint{
|
Shape: []configv1.UtilizationShapePoint{
|
||||||
{Utilization: 0, Score: 0},
|
{Utilization: 0, Score: 0},
|
||||||
{Utilization: 100, Score: 10},
|
{Utilization: 100, Score: 10},
|
||||||
|
Loading…
Reference in New Issue
Block a user