Closed medyagh closed 3 years ago
Interesting!
This is because one part of the code includes hyperthreads, and another part does not...
cpu.Counts(false)
https://godoc.org/github.com/shirou/gopsutil/cpu#Counts
len(cpu.Info())
https://godoc.org/github.com/shirou/gopsutil/cpu#Info
Kubeadm is not very specific, if it requires 2 threads/vCPUs or 2 hardware cores/"things".
"2 CPUs or more"
Most likely that "false" should be flipped to "true" ?
Seems like the behaviour changed, between cpu and v3/cpu:
package main
import (
"fmt"
"github.com/shirou/gopsutil/cpu"
)
func main() {
physical, _ := cpu.Counts(false)
fmt.Printf("Physical: %d\n", physical)
logical, _ := cpu.Counts(true)
fmt.Printf("Logical: %d\n", logical)
}
This reports 8/8 on quad core, but with v3 it now reports 4/8.
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 39 bits physical, 48 bits virtual
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
...
See https://github.com/shirou/gopsutil/commit/770026217560bdd8b941da6326c702d28a44c361
interesting that when we not using --force minikube exits on Travis and says it only has 1 Cpus
but when user uses --force it is reporting 2 local cpus
the confusing part is, if it really has 1 cpus, then why we are reporting 2 cpus later ?
here is the setup script on travis
https://github.com/GoogleContainerTools/kaniko/blob/5f4e2f136633d241444129517a4e75ebf44065c7/scripts/minikube-setup.sh#L30