mirror of https://github.com/k3s-io/k3s
Enforce use of fixed size int types in the API
Changes 'int' to 'int32', enforced by import_known_versions_test Follow up to PR #53402pull/6/head
parent
1418f98452
commit
7950609b31
|
@ -144,7 +144,7 @@ func AddFlags(options *Options, fs *pflag.FlagSet) {
|
||||||
fs.StringVar(&options.config.ClusterCIDR, "cluster-cidr", options.config.ClusterCIDR, "The CIDR range of pods in the cluster. When configured, traffic sent to a Service cluster IP from outside this range will be masqueraded and traffic sent from pods to an external LoadBalancer IP will be directed to the respective cluster IP instead")
|
fs.StringVar(&options.config.ClusterCIDR, "cluster-cidr", options.config.ClusterCIDR, "The CIDR range of pods in the cluster. When configured, traffic sent to a Service cluster IP from outside this range will be masqueraded and traffic sent from pods to an external LoadBalancer IP will be directed to the respective cluster IP instead")
|
||||||
fs.StringVar(&options.config.ClientConnection.ContentType, "kube-api-content-type", options.config.ClientConnection.ContentType, "Content type of requests sent to apiserver.")
|
fs.StringVar(&options.config.ClientConnection.ContentType, "kube-api-content-type", options.config.ClientConnection.ContentType, "Content type of requests sent to apiserver.")
|
||||||
fs.Float32Var(&options.config.ClientConnection.QPS, "kube-api-qps", options.config.ClientConnection.QPS, "QPS to use while talking with kubernetes apiserver")
|
fs.Float32Var(&options.config.ClientConnection.QPS, "kube-api-qps", options.config.ClientConnection.QPS, "QPS to use while talking with kubernetes apiserver")
|
||||||
fs.IntVar(&options.config.ClientConnection.Burst, "kube-api-burst", options.config.ClientConnection.Burst, "Burst to use while talking with kubernetes apiserver")
|
fs.Int32Var(&options.config.ClientConnection.Burst, "kube-api-burst", options.config.ClientConnection.Burst, "Burst to use while talking with kubernetes apiserver")
|
||||||
fs.DurationVar(&options.config.UDPIdleTimeout.Duration, "udp-timeout", options.config.UDPIdleTimeout.Duration, "How long an idle UDP connection will be kept open (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxy-mode=userspace")
|
fs.DurationVar(&options.config.UDPIdleTimeout.Duration, "udp-timeout", options.config.UDPIdleTimeout.Duration, "How long an idle UDP connection will be kept open (e.g. '250ms', '2s'). Must be greater than 0. Only applicable for proxy-mode=userspace")
|
||||||
if options.config.Conntrack.Max == nil {
|
if options.config.Conntrack.Max == nil {
|
||||||
options.config.Conntrack.Max = utilpointer.Int32Ptr(0)
|
options.config.Conntrack.Max = utilpointer.Int32Ptr(0)
|
||||||
|
|
|
@ -33,7 +33,7 @@ type ClientConnectionConfiguration struct {
|
||||||
// cps controls the number of queries per second allowed for this connection.
|
// cps controls the number of queries per second allowed for this connection.
|
||||||
QPS float32
|
QPS float32
|
||||||
// burst allows extra queries to accumulate when a client is exceeding its rate.
|
// burst allows extra queries to accumulate when a client is exceeding its rate.
|
||||||
Burst int
|
Burst int32
|
||||||
}
|
}
|
||||||
|
|
||||||
// SchedulerPolicyConfigMapKey defines the key of the element in the
|
// SchedulerPolicyConfigMapKey defines the key of the element in the
|
||||||
|
@ -87,7 +87,7 @@ type KubeSchedulerConfiguration struct {
|
||||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||||
// corresponding to every RequiredDuringScheduling affinity rule.
|
// corresponding to every RequiredDuringScheduling affinity rule.
|
||||||
// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100.
|
// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100.
|
||||||
HardPodAffinitySymmetricWeight int
|
HardPodAffinitySymmetricWeight int32
|
||||||
|
|
||||||
// LeaderElection defines the configuration of leader election client.
|
// LeaderElection defines the configuration of leader election client.
|
||||||
LeaderElection KubeSchedulerLeaderElectionConfiguration
|
LeaderElection KubeSchedulerLeaderElectionConfiguration
|
||||||
|
|
|
@ -33,7 +33,7 @@ type ClientConnectionConfiguration struct {
|
||||||
// cps controls the number of queries per second allowed for this connection.
|
// cps controls the number of queries per second allowed for this connection.
|
||||||
QPS float32 `json:"qps"`
|
QPS float32 `json:"qps"`
|
||||||
// burst allows extra queries to accumulate when a client is exceeding its rate.
|
// burst allows extra queries to accumulate when a client is exceeding its rate.
|
||||||
Burst int `json:"burst"`
|
Burst int32 `json:"burst"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SchedulerPolicySource configures a means to obtain a scheduler Policy. One
|
// SchedulerPolicySource configures a means to obtain a scheduler Policy. One
|
||||||
|
@ -83,7 +83,7 @@ type KubeSchedulerConfiguration struct {
|
||||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||||
// corresponding to every RequiredDuringScheduling affinity rule.
|
// corresponding to every RequiredDuringScheduling affinity rule.
|
||||||
// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100.
|
// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100.
|
||||||
HardPodAffinitySymmetricWeight int `json:"hardPodAffinitySymmetricWeight"`
|
HardPodAffinitySymmetricWeight int32 `json:"hardPodAffinitySymmetricWeight"`
|
||||||
|
|
||||||
// LeaderElection defines the configuration of leader election client.
|
// LeaderElection defines the configuration of leader election client.
|
||||||
LeaderElection KubeSchedulerLeaderElectionConfiguration `json:"leaderElection"`
|
LeaderElection KubeSchedulerLeaderElectionConfiguration `json:"leaderElection"`
|
||||||
|
|
|
@ -4354,5 +4354,5 @@ const (
|
||||||
// corresponding to every RequiredDuringScheduling affinity rule.
|
// corresponding to every RequiredDuringScheduling affinity rule.
|
||||||
// When the --hard-pod-affinity-weight scheduler flag is not specified,
|
// When the --hard-pod-affinity-weight scheduler flag is not specified,
|
||||||
// DefaultHardPodAffinityWeight defines the weight of the implicit PreferredDuringScheduling affinity rule.
|
// DefaultHardPodAffinityWeight defines the weight of the implicit PreferredDuringScheduling affinity rule.
|
||||||
DefaultHardPodAffinitySymmetricWeight int = 1
|
DefaultHardPodAffinitySymmetricWeight int32 = 1
|
||||||
)
|
)
|
||||||
|
|
|
@ -879,9 +879,9 @@ type AllowedHostPath struct {
|
||||||
// for pods to use. It requires both the start and end to be defined.
|
// for pods to use. It requires both the start and end to be defined.
|
||||||
type HostPortRange struct {
|
type HostPortRange struct {
|
||||||
// Min is the start of the range, inclusive.
|
// Min is the start of the range, inclusive.
|
||||||
Min int
|
Min int32
|
||||||
// Max is the end of the range, inclusive.
|
// Max is the end of the range, inclusive.
|
||||||
Max int
|
Max int32
|
||||||
}
|
}
|
||||||
|
|
||||||
// AllowAllCapabilities can be used as a value for the PodSecurityPolicy.AllowAllCapabilities
|
// AllowAllCapabilities can be used as a value for the PodSecurityPolicy.AllowAllCapabilities
|
||||||
|
|
|
@ -761,8 +761,8 @@ func Convert_extensions_HTTPIngressRuleValue_To_v1beta1_HTTPIngressRuleValue(in
|
||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_v1beta1_HostPortRange_To_extensions_HostPortRange(in *v1beta1.HostPortRange, out *extensions.HostPortRange, s conversion.Scope) error {
|
func autoConvert_v1beta1_HostPortRange_To_extensions_HostPortRange(in *v1beta1.HostPortRange, out *extensions.HostPortRange, s conversion.Scope) error {
|
||||||
out.Min = int(in.Min)
|
out.Min = in.Min
|
||||||
out.Max = int(in.Max)
|
out.Max = in.Max
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -772,8 +772,8 @@ func Convert_v1beta1_HostPortRange_To_extensions_HostPortRange(in *v1beta1.HostP
|
||||||
}
|
}
|
||||||
|
|
||||||
func autoConvert_extensions_HostPortRange_To_v1beta1_HostPortRange(in *extensions.HostPortRange, out *v1beta1.HostPortRange, s conversion.Scope) error {
|
func autoConvert_extensions_HostPortRange_To_v1beta1_HostPortRange(in *extensions.HostPortRange, out *v1beta1.HostPortRange, s conversion.Scope) error {
|
||||||
out.Min = int32(in.Min)
|
out.Min = in.Min
|
||||||
out.Max = int32(in.Max)
|
out.Max = in.Max
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1051,17 +1051,7 @@ func autoConvert_v1beta1_PodSecurityPolicySpec_To_extensions_PodSecurityPolicySp
|
||||||
out.AllowedCapabilities = *(*[]core.Capability)(unsafe.Pointer(&in.AllowedCapabilities))
|
out.AllowedCapabilities = *(*[]core.Capability)(unsafe.Pointer(&in.AllowedCapabilities))
|
||||||
out.Volumes = *(*[]extensions.FSType)(unsafe.Pointer(&in.Volumes))
|
out.Volumes = *(*[]extensions.FSType)(unsafe.Pointer(&in.Volumes))
|
||||||
out.HostNetwork = in.HostNetwork
|
out.HostNetwork = in.HostNetwork
|
||||||
if in.HostPorts != nil {
|
out.HostPorts = *(*[]extensions.HostPortRange)(unsafe.Pointer(&in.HostPorts))
|
||||||
in, out := &in.HostPorts, &out.HostPorts
|
|
||||||
*out = make([]extensions.HostPortRange, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
if err := Convert_v1beta1_HostPortRange_To_extensions_HostPortRange(&(*in)[i], &(*out)[i], s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
out.HostPorts = nil
|
|
||||||
}
|
|
||||||
out.HostPID = in.HostPID
|
out.HostPID = in.HostPID
|
||||||
out.HostIPC = in.HostIPC
|
out.HostIPC = in.HostIPC
|
||||||
if err := Convert_v1beta1_SELinuxStrategyOptions_To_extensions_SELinuxStrategyOptions(&in.SELinux, &out.SELinux, s); err != nil {
|
if err := Convert_v1beta1_SELinuxStrategyOptions_To_extensions_SELinuxStrategyOptions(&in.SELinux, &out.SELinux, s); err != nil {
|
||||||
|
@ -1097,17 +1087,7 @@ func autoConvert_extensions_PodSecurityPolicySpec_To_v1beta1_PodSecurityPolicySp
|
||||||
out.AllowedCapabilities = *(*[]v1.Capability)(unsafe.Pointer(&in.AllowedCapabilities))
|
out.AllowedCapabilities = *(*[]v1.Capability)(unsafe.Pointer(&in.AllowedCapabilities))
|
||||||
out.Volumes = *(*[]v1beta1.FSType)(unsafe.Pointer(&in.Volumes))
|
out.Volumes = *(*[]v1beta1.FSType)(unsafe.Pointer(&in.Volumes))
|
||||||
out.HostNetwork = in.HostNetwork
|
out.HostNetwork = in.HostNetwork
|
||||||
if in.HostPorts != nil {
|
out.HostPorts = *(*[]v1beta1.HostPortRange)(unsafe.Pointer(&in.HostPorts))
|
||||||
in, out := &in.HostPorts, &out.HostPorts
|
|
||||||
*out = make([]v1beta1.HostPortRange, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
if err := Convert_extensions_HostPortRange_To_v1beta1_HostPortRange(&(*in)[i], &(*out)[i], s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
out.HostPorts = nil
|
|
||||||
}
|
|
||||||
out.HostPID = in.HostPID
|
out.HostPID = in.HostPID
|
||||||
out.HostIPC = in.HostIPC
|
out.HostIPC = in.HostIPC
|
||||||
if err := Convert_extensions_SELinuxStrategyOptions_To_v1beta1_SELinuxStrategyOptions(&in.SELinux, &out.SELinux, s); err != nil {
|
if err := Convert_extensions_SELinuxStrategyOptions_To_v1beta1_SELinuxStrategyOptions(&in.SELinux, &out.SELinux, s); err != nil {
|
||||||
|
|
|
@ -99,7 +99,7 @@ func ensureNoTags(t *testing.T, gvk schema.GroupVersionKind, tp reflect.Type, pa
|
||||||
case reflect.Map, reflect.Slice, reflect.Ptr:
|
case reflect.Map, reflect.Slice, reflect.Ptr:
|
||||||
ensureNoTags(t, gvk, tp.Elem(), parents)
|
ensureNoTags(t, gvk, tp.Elem(), parents)
|
||||||
|
|
||||||
case reflect.String, reflect.Bool, reflect.Float32, reflect.Int, reflect.Int32, reflect.Int64, reflect.Uint8, reflect.Uintptr, reflect.Uint32, reflect.Uint64, reflect.Interface:
|
case reflect.String, reflect.Bool, reflect.Float32, reflect.Int32, reflect.Int64, reflect.Uint8, reflect.Uintptr, reflect.Uint32, reflect.Uint64, reflect.Interface:
|
||||||
// no-op
|
// no-op
|
||||||
|
|
||||||
case reflect.Struct:
|
case reflect.Struct:
|
||||||
|
|
|
@ -37,7 +37,7 @@ type ClientConnectionConfiguration struct {
|
||||||
// qps controls the number of queries per second allowed for this connection.
|
// qps controls the number of queries per second allowed for this connection.
|
||||||
QPS float32
|
QPS float32
|
||||||
// burst allows extra queries to accumulate when a client is exceeding its rate.
|
// burst allows extra queries to accumulate when a client is exceeding its rate.
|
||||||
Burst int
|
Burst int32
|
||||||
}
|
}
|
||||||
|
|
||||||
// KubeProxyIPTablesConfiguration contains iptables-related configuration
|
// KubeProxyIPTablesConfiguration contains iptables-related configuration
|
||||||
|
|
|
@ -54,7 +54,7 @@ func autoConvert_v1alpha1_ClientConnectionConfiguration_To_kubeproxyconfig_Clien
|
||||||
out.AcceptContentTypes = in.AcceptContentTypes
|
out.AcceptContentTypes = in.AcceptContentTypes
|
||||||
out.ContentType = in.ContentType
|
out.ContentType = in.ContentType
|
||||||
out.QPS = in.QPS
|
out.QPS = in.QPS
|
||||||
out.Burst = in.Burst
|
out.Burst = int32(in.Burst)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ func autoConvert_kubeproxyconfig_ClientConnectionConfiguration_To_v1alpha1_Clien
|
||||||
out.AcceptContentTypes = in.AcceptContentTypes
|
out.AcceptContentTypes = in.AcceptContentTypes
|
||||||
out.ContentType = in.ContentType
|
out.ContentType = in.ContentType
|
||||||
out.QPS = in.QPS
|
out.QPS = in.QPS
|
||||||
out.Burst = in.Burst
|
out.Burst = int(in.Burst)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,7 +307,7 @@ func (s *simpleProvider) ValidateContainerSecurityContext(pod *api.Pod, containe
|
||||||
func (s *simpleProvider) hasInvalidHostPort(container *api.Container, fldPath *field.Path) field.ErrorList {
|
func (s *simpleProvider) hasInvalidHostPort(container *api.Container, fldPath *field.Path) field.ErrorList {
|
||||||
allErrs := field.ErrorList{}
|
allErrs := field.ErrorList{}
|
||||||
for _, cp := range container.Ports {
|
for _, cp := range container.Ports {
|
||||||
if cp.HostPort > 0 && !s.isValidHostPort(int(cp.HostPort)) {
|
if cp.HostPort > 0 && !s.isValidHostPort(cp.HostPort) {
|
||||||
detail := fmt.Sprintf("Host port %d is not allowed to be used. Allowed ports: [%s]", cp.HostPort, hostPortRangesToString(s.psp.Spec.HostPorts))
|
detail := fmt.Sprintf("Host port %d is not allowed to be used. Allowed ports: [%s]", cp.HostPort, hostPortRangesToString(s.psp.Spec.HostPorts))
|
||||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("hostPort"), cp.HostPort, detail))
|
allErrs = append(allErrs, field.Invalid(fldPath.Child("hostPort"), cp.HostPort, detail))
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ func (s *simpleProvider) hasInvalidHostPort(container *api.Container, fldPath *f
|
||||||
}
|
}
|
||||||
|
|
||||||
// isValidHostPort returns true if the port falls in any range allowed by the PSP.
|
// isValidHostPort returns true if the port falls in any range allowed by the PSP.
|
||||||
func (s *simpleProvider) isValidHostPort(port int) bool {
|
func (s *simpleProvider) isValidHostPort(port int32) bool {
|
||||||
for _, hostPortRange := range s.psp.Spec.HostPorts {
|
for _, hostPortRange := range s.psp.Spec.HostPorts {
|
||||||
if port >= hostPortRange.Min && port <= hostPortRange.Max {
|
if port >= hostPortRange.Min && port <= hostPortRange.Max {
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -122,11 +122,11 @@ func AddFlags(options *Options, fs *pflag.FlagSet) {
|
||||||
fs.StringVar(&options.config.ClientConnection.KubeConfigFile, "kubeconfig", options.config.ClientConnection.KubeConfigFile, "Path to kubeconfig file with authorization and master location information.")
|
fs.StringVar(&options.config.ClientConnection.KubeConfigFile, "kubeconfig", options.config.ClientConnection.KubeConfigFile, "Path to kubeconfig file with authorization and master location information.")
|
||||||
fs.StringVar(&options.config.ClientConnection.ContentType, "kube-api-content-type", options.config.ClientConnection.ContentType, "Content type of requests sent to apiserver.")
|
fs.StringVar(&options.config.ClientConnection.ContentType, "kube-api-content-type", options.config.ClientConnection.ContentType, "Content type of requests sent to apiserver.")
|
||||||
fs.Float32Var(&options.config.ClientConnection.QPS, "kube-api-qps", options.config.ClientConnection.QPS, "QPS to use while talking with kubernetes apiserver")
|
fs.Float32Var(&options.config.ClientConnection.QPS, "kube-api-qps", options.config.ClientConnection.QPS, "QPS to use while talking with kubernetes apiserver")
|
||||||
fs.IntVar(&options.config.ClientConnection.Burst, "kube-api-burst", options.config.ClientConnection.Burst, "Burst to use while talking with kubernetes apiserver")
|
fs.Int32Var(&options.config.ClientConnection.Burst, "kube-api-burst", options.config.ClientConnection.Burst, "Burst to use while talking with kubernetes apiserver")
|
||||||
fs.StringVar(&options.config.SchedulerName, "scheduler-name", options.config.SchedulerName, "Name of the scheduler, used to select which pods will be processed by this scheduler, based on pod's \"spec.SchedulerName\".")
|
fs.StringVar(&options.config.SchedulerName, "scheduler-name", options.config.SchedulerName, "Name of the scheduler, used to select which pods will be processed by this scheduler, based on pod's \"spec.SchedulerName\".")
|
||||||
fs.StringVar(&options.config.LeaderElection.LockObjectNamespace, "lock-object-namespace", options.config.LeaderElection.LockObjectNamespace, "Define the namespace of the lock object.")
|
fs.StringVar(&options.config.LeaderElection.LockObjectNamespace, "lock-object-namespace", options.config.LeaderElection.LockObjectNamespace, "Define the namespace of the lock object.")
|
||||||
fs.StringVar(&options.config.LeaderElection.LockObjectName, "lock-object-name", options.config.LeaderElection.LockObjectName, "Define the name of the lock object.")
|
fs.StringVar(&options.config.LeaderElection.LockObjectName, "lock-object-name", options.config.LeaderElection.LockObjectName, "Define the name of the lock object.")
|
||||||
fs.IntVar(&options.config.HardPodAffinitySymmetricWeight, "hard-pod-affinity-symmetric-weight", options.config.HardPodAffinitySymmetricWeight,
|
fs.Int32Var(&options.config.HardPodAffinitySymmetricWeight, "hard-pod-affinity-symmetric-weight", options.config.HardPodAffinitySymmetricWeight,
|
||||||
"RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule corresponding "+
|
"RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule corresponding "+
|
||||||
"to every RequiredDuringScheduling affinity rule. --hard-pod-affinity-symmetric-weight represents the weight of implicit PreferredDuringScheduling affinity rule.")
|
"to every RequiredDuringScheduling affinity rule. --hard-pod-affinity-symmetric-weight represents the weight of implicit PreferredDuringScheduling affinity rule.")
|
||||||
fs.MarkDeprecated("hard-pod-affinity-symmetric-weight", "This option was moved to the policy configuration file")
|
fs.MarkDeprecated("hard-pod-affinity-symmetric-weight", "This option was moved to the policy configuration file")
|
||||||
|
@ -358,7 +358,7 @@ type SchedulerServer struct {
|
||||||
InformerFactory informers.SharedInformerFactory
|
InformerFactory informers.SharedInformerFactory
|
||||||
PodInformer coreinformers.PodInformer
|
PodInformer coreinformers.PodInformer
|
||||||
AlgorithmSource componentconfig.SchedulerAlgorithmSource
|
AlgorithmSource componentconfig.SchedulerAlgorithmSource
|
||||||
HardPodAffinitySymmetricWeight int
|
HardPodAffinitySymmetricWeight int32
|
||||||
EventClient v1core.EventsGetter
|
EventClient v1core.EventsGetter
|
||||||
Recorder record.EventRecorder
|
Recorder record.EventRecorder
|
||||||
Broadcaster record.EventBroadcaster
|
Broadcaster record.EventBroadcaster
|
||||||
|
|
|
@ -37,14 +37,14 @@ type InterPodAffinity struct {
|
||||||
info predicates.NodeInfo
|
info predicates.NodeInfo
|
||||||
nodeLister algorithm.NodeLister
|
nodeLister algorithm.NodeLister
|
||||||
podLister algorithm.PodLister
|
podLister algorithm.PodLister
|
||||||
hardPodAffinityWeight int
|
hardPodAffinityWeight int32
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewInterPodAffinityPriority(
|
func NewInterPodAffinityPriority(
|
||||||
info predicates.NodeInfo,
|
info predicates.NodeInfo,
|
||||||
nodeLister algorithm.NodeLister,
|
nodeLister algorithm.NodeLister,
|
||||||
podLister algorithm.PodLister,
|
podLister algorithm.PodLister,
|
||||||
hardPodAffinityWeight int) algorithm.PriorityFunction {
|
hardPodAffinityWeight int32) algorithm.PriorityFunction {
|
||||||
interPodAffinity := &InterPodAffinity{
|
interPodAffinity := &InterPodAffinity{
|
||||||
info: info,
|
info: info,
|
||||||
nodeLister: nodeLister,
|
nodeLister: nodeLister,
|
||||||
|
|
|
@ -561,7 +561,7 @@ func TestHardPodAffinitySymmetricWeight(t *testing.T) {
|
||||||
pod *v1.Pod
|
pod *v1.Pod
|
||||||
pods []*v1.Pod
|
pods []*v1.Pod
|
||||||
nodes []*v1.Node
|
nodes []*v1.Node
|
||||||
hardPodAffinityWeight int
|
hardPodAffinityWeight int32
|
||||||
expectedList schedulerapi.HostPriorityList
|
expectedList schedulerapi.HostPriorityList
|
||||||
test string
|
test string
|
||||||
}{
|
}{
|
||||||
|
|
|
@ -46,7 +46,7 @@ type Policy struct {
|
||||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||||
// corresponding to every RequiredDuringScheduling affinity rule.
|
// corresponding to every RequiredDuringScheduling affinity rule.
|
||||||
// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 1-100.
|
// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 1-100.
|
||||||
HardPodAffinitySymmetricWeight int
|
HardPodAffinitySymmetricWeight int32
|
||||||
}
|
}
|
||||||
|
|
||||||
type PredicatePolicy struct {
|
type PredicatePolicy struct {
|
||||||
|
|
|
@ -113,7 +113,7 @@ type configFactory struct {
|
||||||
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
|
||||||
// corresponding to every RequiredDuringScheduling affinity rule.
|
// corresponding to every RequiredDuringScheduling affinity rule.
|
||||||
// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100.
|
// HardPodAffinitySymmetricWeight represents the weight of implicit PreferredDuringScheduling affinity rule, in the range 0-100.
|
||||||
hardPodAffinitySymmetricWeight int
|
hardPodAffinitySymmetricWeight int32
|
||||||
|
|
||||||
// Equivalence class cache
|
// Equivalence class cache
|
||||||
equivalencePodCache *core.EquivalenceCache
|
equivalencePodCache *core.EquivalenceCache
|
||||||
|
@ -136,7 +136,7 @@ func NewConfigFactory(
|
||||||
statefulSetInformer appsinformers.StatefulSetInformer,
|
statefulSetInformer appsinformers.StatefulSetInformer,
|
||||||
serviceInformer coreinformers.ServiceInformer,
|
serviceInformer coreinformers.ServiceInformer,
|
||||||
pdbInformer policyinformers.PodDisruptionBudgetInformer,
|
pdbInformer policyinformers.PodDisruptionBudgetInformer,
|
||||||
hardPodAffinitySymmetricWeight int,
|
hardPodAffinitySymmetricWeight int32,
|
||||||
enableEquivalenceClassCache bool,
|
enableEquivalenceClassCache bool,
|
||||||
) scheduler.Configurator {
|
) scheduler.Configurator {
|
||||||
stopEverything := make(chan struct{})
|
stopEverything := make(chan struct{})
|
||||||
|
@ -434,7 +434,7 @@ func (c *configFactory) GetNodeLister() corelisters.NodeLister {
|
||||||
return c.nodeLister
|
return c.nodeLister
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *configFactory) GetHardPodAffinitySymmetricWeight() int {
|
func (c *configFactory) GetHardPodAffinitySymmetricWeight() int32 {
|
||||||
return c.hardPodAffinitySymmetricWeight
|
return c.hardPodAffinitySymmetricWeight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -408,7 +408,7 @@ func TestInvalidFactoryArgs(t *testing.T) {
|
||||||
client := clientset.NewForConfigOrDie(&restclient.Config{Host: server.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &legacyscheme.Registry.GroupOrDie(v1.GroupName).GroupVersion}})
|
client := clientset.NewForConfigOrDie(&restclient.Config{Host: server.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &legacyscheme.Registry.GroupOrDie(v1.GroupName).GroupVersion}})
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
hardPodAffinitySymmetricWeight int
|
hardPodAffinitySymmetricWeight int32
|
||||||
expectErr string
|
expectErr string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,7 @@ type PluginFactoryArgs struct {
|
||||||
NodeInfo predicates.NodeInfo
|
NodeInfo predicates.NodeInfo
|
||||||
PVInfo predicates.PersistentVolumeInfo
|
PVInfo predicates.PersistentVolumeInfo
|
||||||
PVCInfo predicates.PersistentVolumeClaimInfo
|
PVCInfo predicates.PersistentVolumeClaimInfo
|
||||||
HardPodAffinitySymmetricWeight int
|
HardPodAffinitySymmetricWeight int32
|
||||||
}
|
}
|
||||||
|
|
||||||
// MetadataProducerFactory produces MetadataProducer from the given args.
|
// MetadataProducerFactory produces MetadataProducer from the given args.
|
||||||
|
|
|
@ -77,7 +77,7 @@ type Configurator interface {
|
||||||
GetPriorityMetadataProducer() (algorithm.MetadataProducer, error)
|
GetPriorityMetadataProducer() (algorithm.MetadataProducer, error)
|
||||||
GetPredicateMetadataProducer() (algorithm.PredicateMetadataProducer, error)
|
GetPredicateMetadataProducer() (algorithm.PredicateMetadataProducer, error)
|
||||||
GetPredicates(predicateKeys sets.String) (map[string]algorithm.FitPredicate, error)
|
GetPredicates(predicateKeys sets.String) (map[string]algorithm.FitPredicate, error)
|
||||||
GetHardPodAffinitySymmetricWeight() int
|
GetHardPodAffinitySymmetricWeight() int32
|
||||||
GetSchedulerName() string
|
GetSchedulerName() string
|
||||||
MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue core.SchedulingQueue) func(pod *v1.Pod, err error)
|
MakeDefaultErrorFunc(backoff *util.PodBackoff, podQueue core.SchedulingQueue) func(pod *v1.Pod, err error)
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ func (fc *FakeConfigurator) GetPredicates(predicateKeys sets.String) (map[string
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetHardPodAffinitySymmetricWeight is not implemented yet.
|
// GetHardPodAffinitySymmetricWeight is not implemented yet.
|
||||||
func (fc *FakeConfigurator) GetHardPodAffinitySymmetricWeight() int {
|
func (fc *FakeConfigurator) GetHardPodAffinitySymmetricWeight() int32 {
|
||||||
panic("not implemented")
|
panic("not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4924,7 +4924,7 @@ const (
|
||||||
// corresponding to every RequiredDuringScheduling affinity rule.
|
// corresponding to every RequiredDuringScheduling affinity rule.
|
||||||
// When the --hard-pod-affinity-weight scheduler flag is not specified,
|
// When the --hard-pod-affinity-weight scheduler flag is not specified,
|
||||||
// DefaultHardPodAffinityWeight defines the weight of the implicit PreferredDuringScheduling affinity rule.
|
// DefaultHardPodAffinityWeight defines the weight of the implicit PreferredDuringScheduling affinity rule.
|
||||||
DefaultHardPodAffinitySymmetricWeight int = 1
|
DefaultHardPodAffinitySymmetricWeight int32 = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
// Sysctl defines a kernel parameter to be set
|
// Sysctl defines a kernel parameter to be set
|
||||||
|
|
Loading…
Reference in New Issue