Set GOMAXPROCS. Print errors on stderr.

pull/6/head
Daniel Smith 2015-02-19 10:30:31 -08:00
parent 1b5d14423c
commit fcddefa184
7 changed files with 45 additions and 4 deletions

View File

@ -19,6 +19,10 @@ limitations under the License.
package main
import (
"fmt"
"os"
"runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/master/server"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/verflag"
@ -27,6 +31,7 @@ import (
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
s := server.NewAPIServer()
s.AddFlags(pflag.CommandLine)
@ -36,5 +41,8 @@ func main() {
verflag.PrintAndExitIfRequested()
s.Run(pflag.CommandLine.Args())
if err := s.Run(pflag.CommandLine.Args()); err != nil {
fmt.Fprint(os.Stderr, err.Error)
os.Exit(1)
}
}

View File

@ -21,6 +21,10 @@ limitations under the License.
package main
import (
"fmt"
"os"
"runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/controllermanager"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/verflag"
@ -29,6 +33,7 @@ import (
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
s := controllermanager.NewCMServer()
s.AddFlags(pflag.CommandLine)
@ -38,5 +43,8 @@ func main() {
verflag.PrintAndExitIfRequested()
s.Run(pflag.CommandLine.Args())
if err := s.Run(pflag.CommandLine.Args()); err != nil {
fmt.Fprint(os.Stderr, err.Error)
os.Exit(1)
}
}

View File

@ -17,6 +17,10 @@ limitations under the License.
package main
import (
"fmt"
"os"
"runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/proxy/server"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/verflag"
@ -25,6 +29,7 @@ import (
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
s := server.NewProxyServer()
s.AddFlags(pflag.CommandLine)
@ -34,5 +39,8 @@ func main() {
verflag.PrintAndExitIfRequested()
s.Run(pflag.CommandLine.Args())
if err := s.Run(pflag.CommandLine.Args()); err != nil {
fmt.Fprint(os.Stderr, err.Error)
os.Exit(1)
}
}

View File

@ -18,11 +18,13 @@ package main
import (
"os"
"runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd"
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
cmd := cmd.NewFactory(nil).NewKubectlCommand(os.Stdout)
if err := cmd.Execute(); err != nil {
os.Exit(1)

View File

@ -21,6 +21,10 @@ limitations under the License.
package main
import (
"fmt"
"os"
"runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/server"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/verflag"
@ -29,6 +33,7 @@ import (
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
s := server.NewKubeletServer()
s.AddFlags(pflag.CommandLine)
@ -38,5 +43,8 @@ func main() {
verflag.PrintAndExitIfRequested()
s.Run(pflag.CommandLine.Args())
if err := s.Run(pflag.CommandLine.Args()); err != nil {
fmt.Fprint(os.Stderr, err.Error)
os.Exit(1)
}
}

View File

@ -18,12 +18,14 @@ limitations under the License.
// Expects an etcd server is available, or on the path somewhere.
// Does *not* currently setup the Kubernetes network model, that must be done ahead of time.
// TODO: Setup the k8s network bridge as part of setup.
// TODO: combine this with the hypercube thingy.
package main
import (
"fmt"
"net"
"net/http"
"runtime"
"time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
@ -152,6 +154,8 @@ func newApiClient(addr net.IP, port int) *client.Client {
}
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
util.InitFlags()
util.InitLogs()
defer util.FlushLogs()

View File

@ -24,6 +24,7 @@ import (
"io/ioutil"
"os"
"path"
"runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/verflag"
@ -177,8 +178,10 @@ func (hk *HyperKube) Run(args []string) error {
// RunToExit will run the hyperkube and then call os.Exit with an appropriate exit code.
func (hk *HyperKube) RunToExit(args []string) {
runtime.GOMAXPROCS(runtime.NumCPU())
err := hk.Run(args)
if err != nil {
fmt.Fprint(os.Stderr, err.Error())
os.Exit(1)
}
os.Exit(0)