Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set GOMAXPROCS. Print errors on stderr. #4605

Merged
merged 1 commit into from
Feb 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion cmd/kube-apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -27,6 +31,7 @@ import (
)

func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
s := server.NewAPIServer()
s.AddFlags(pflag.CommandLine)

Expand All @@ -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)
}
}
10 changes: 9 additions & 1 deletion cmd/kube-controller-manager/controller-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -29,6 +33,7 @@ import (
)

func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
s := controllermanager.NewCMServer()
s.AddFlags(pflag.CommandLine)

Expand All @@ -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)
}
}
10 changes: 9 additions & 1 deletion cmd/kube-proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -25,6 +29,7 @@ import (
)

func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
s := server.NewProxyServer()
s.AddFlags(pflag.CommandLine)

Expand All @@ -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)
}
}
2 changes: 2 additions & 0 deletions cmd/kubectl/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 9 additions & 1 deletion cmd/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -29,6 +33,7 @@ import (
)

func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
s := server.NewKubeletServer()
s.AddFlags(pflag.CommandLine)

Expand All @@ -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)
}
}
4 changes: 4 additions & 0 deletions cmd/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions pkg/hyperkube/hyperkube.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"io/ioutil"
"os"
"path"
"runtime"

"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/verflag"
Expand Down Expand Up @@ -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)
Expand Down