mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Fix 32bit build
This commit is contained in:
parent
9f5ebef3d8
commit
e5b988393d
@ -22,6 +22,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"math"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -50,8 +51,8 @@ var (
|
|||||||
minionRegexp = flag.String("minion_regexp", "", "If non empty, and -cloud_provider is specified, a regular expression for matching minion VMs.")
|
minionRegexp = flag.String("minion_regexp", "", "If non empty, and -cloud_provider is specified, a regular expression for matching minion VMs.")
|
||||||
machineList util.StringList
|
machineList util.StringList
|
||||||
// TODO: Discover these by pinging the host machines, and rip out these flags.
|
// TODO: Discover these by pinging the host machines, and rip out these flags.
|
||||||
nodeMilliCPU = flag.Int("node_milli_cpu", 1000, "The amount of MilliCPU provisioned on each node")
|
nodeMilliCPU = flag.Int64("node_milli_cpu", 1000, "The amount of MilliCPU provisioned on each node")
|
||||||
nodeMemory = flag.Int("node_memory", 3*1024*1024*1024, "The amount of memory (in bytes) provisioned on each node")
|
nodeMemory = flag.Int64("node_memory", 3*1024*1024*1024, "The amount of memory (in bytes) provisioned on each node")
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -89,6 +90,18 @@ func main() {
|
|||||||
glog.Fatalf("Invalid API configuration: %v", err)
|
glog.Fatalf("Invalid API configuration: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if int64(int(*nodeMilliCPU)) != *nodeMilliCPU {
|
||||||
|
glog.Warningf("node_milli_cpu is too big for platform. Clamping: %d -> %d",
|
||||||
|
*nodeMilliCPU, math.MaxInt32)
|
||||||
|
*nodeMilliCPU = math.MaxInt32
|
||||||
|
}
|
||||||
|
|
||||||
|
if int64(int(*nodeMemory)) != *nodeMemory {
|
||||||
|
glog.Warningf("node_memory is too big for platform. Clamping: %d -> %d",
|
||||||
|
*nodeMemory, math.MaxInt32)
|
||||||
|
*nodeMemory = math.MaxInt32
|
||||||
|
}
|
||||||
|
|
||||||
go http.ListenAndServe(net.JoinHostPort(address.String(), strconv.Itoa(*port)), nil)
|
go http.ListenAndServe(net.JoinHostPort(address.String(), strconv.Itoa(*port)), nil)
|
||||||
|
|
||||||
endpoints := service.NewEndpointController(kubeClient)
|
endpoints := service.NewEndpointController(kubeClient)
|
||||||
@ -100,8 +113,8 @@ func main() {
|
|||||||
cloud := cloudprovider.InitCloudProvider(*cloudProvider, *cloudConfigFile)
|
cloud := cloudprovider.InitCloudProvider(*cloudProvider, *cloudConfigFile)
|
||||||
nodeResources := &api.NodeResources{
|
nodeResources := &api.NodeResources{
|
||||||
Capacity: api.ResourceList{
|
Capacity: api.ResourceList{
|
||||||
resources.CPU: util.NewIntOrStringFromInt(*nodeMilliCPU),
|
resources.CPU: util.NewIntOrStringFromInt(int(*nodeMilliCPU)),
|
||||||
resources.Memory: util.NewIntOrStringFromInt(*nodeMemory),
|
resources.Memory: util.NewIntOrStringFromInt(int(*nodeMemory)),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
minionController := minionControllerPkg.NewMinionController(cloud, *minionRegexp, machineList, nodeResources, kubeClient)
|
minionController := minionControllerPkg.NewMinionController(cloud, *minionRegexp, machineList, nodeResources, kubeClient)
|
||||||
|
@ -18,6 +18,7 @@ package standalone
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@ -112,9 +113,18 @@ func RunScheduler(cl *client.Client) {
|
|||||||
|
|
||||||
// RunControllerManager starts a controller
|
// RunControllerManager starts a controller
|
||||||
func RunControllerManager(machineList []string, cl *client.Client, nodeMilliCPU, nodeMemory int64) {
|
func RunControllerManager(machineList []string, cl *client.Client, nodeMilliCPU, nodeMemory int64) {
|
||||||
if int64(int(nodeMilliCPU)) != nodeMilliCPU || int64(int(nodeMemory)) != nodeMemory {
|
if int64(int(nodeMilliCPU)) != nodeMilliCPU {
|
||||||
glog.Fatalf("Overflow, nodeCPU or nodeMemory too large for the platform")
|
glog.Warningf("node_milli_cpu is too big for platform. Clamping: %d -> %d",
|
||||||
|
nodeMilliCPU, math.MaxInt32)
|
||||||
|
nodeMilliCPU = math.MaxInt32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if int64(int(nodeMemory)) != nodeMemory {
|
||||||
|
glog.Warningf("node_memory is too big for platform. Clamping: %d -> %d",
|
||||||
|
nodeMemory, math.MaxInt32)
|
||||||
|
nodeMemory = math.MaxInt32
|
||||||
|
}
|
||||||
|
|
||||||
nodeResources := &api.NodeResources{
|
nodeResources := &api.NodeResources{
|
||||||
Capacity: api.ResourceList{
|
Capacity: api.ResourceList{
|
||||||
resources.CPU: util.NewIntOrStringFromInt(int(nodeMilliCPU)),
|
resources.CPU: util.NewIntOrStringFromInt(int(nodeMilliCPU)),
|
||||||
|
Loading…
Reference in New Issue
Block a user