Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
ee9cec86
Commit
ee9cec86
authored
Aug 01, 2014
by
erictune
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #731 from yugui/fix/flag-panic
Extract "pkg/version".PrintAndExitIfRequested() to its own package
parents
fdfdafa2
331fd0d9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
24 deletions
+49
-24
apiserver.go
cmd/apiserver/apiserver.go
+2
-2
controller-manager.go
cmd/controller-manager/controller-manager.go
+2
-2
kubecfg.go
cmd/kubecfg/kubecfg.go
+2
-1
kubelet.go
cmd/kubelet/kubelet.go
+2
-2
proxy.go
cmd/proxy/proxy.go
+2
-2
flag.go
pkg/version/flag/flag.go
+39
-0
version.go
pkg/version/version.go
+0
-15
No files found.
cmd/apiserver/apiserver.go
View file @
ee9cec86
...
@@ -29,7 +29,7 @@ import (
...
@@ -29,7 +29,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
"github.com/GoogleCloudPlatform/kubernetes/pkg/cloudprovider"
"github.com/GoogleCloudPlatform/kubernetes/pkg/master"
"github.com/GoogleCloudPlatform/kubernetes/pkg/master"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version
"
verflag
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/flag
"
"github.com/golang/glog"
"github.com/golang/glog"
)
)
...
@@ -67,7 +67,7 @@ func main() {
...
@@ -67,7 +67,7 @@ func main() {
util
.
InitLogs
()
util
.
InitLogs
()
defer
util
.
FlushLogs
()
defer
util
.
FlushLogs
()
ver
sion
.
PrintAndExitIfRequested
()
ver
flag
.
PrintAndExitIfRequested
()
verifyMinionFlags
()
verifyMinionFlags
()
var
cloud
cloudprovider
.
Interface
var
cloud
cloudprovider
.
Interface
...
...
cmd/controller-manager/controller-manager.go
View file @
ee9cec86
...
@@ -28,7 +28,7 @@ import (
...
@@ -28,7 +28,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/controller"
"github.com/GoogleCloudPlatform/kubernetes/pkg/controller"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version
"
verflag
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/flag
"
"github.com/coreos/go-etcd/etcd"
"github.com/coreos/go-etcd/etcd"
"github.com/golang/glog"
"github.com/golang/glog"
)
)
...
@@ -47,7 +47,7 @@ func main() {
...
@@ -47,7 +47,7 @@ func main() {
util
.
InitLogs
()
util
.
InitLogs
()
defer
util
.
FlushLogs
()
defer
util
.
FlushLogs
()
ver
sion
.
PrintAndExitIfRequested
()
ver
flag
.
PrintAndExitIfRequested
()
if
len
(
etcdServerList
)
==
0
||
len
(
*
master
)
==
0
{
if
len
(
etcdServerList
)
==
0
||
len
(
*
master
)
==
0
{
glog
.
Fatal
(
"usage: controller-manager -etcd_servers <servers> -master <master>"
)
glog
.
Fatal
(
"usage: controller-manager -etcd_servers <servers> -master <master>"
)
...
...
cmd/kubecfg/kubecfg.go
View file @
ee9cec86
...
@@ -33,6 +33,7 @@ import (
...
@@ -33,6 +33,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubecfg"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubecfg"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
verflag
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/flag"
"github.com/golang/glog"
"github.com/golang/glog"
)
)
...
@@ -106,7 +107,7 @@ func main() {
...
@@ -106,7 +107,7 @@ func main() {
util
.
InitLogs
()
util
.
InitLogs
()
defer
util
.
FlushLogs
()
defer
util
.
FlushLogs
()
ver
sion
.
PrintAndExitIfRequested
()
ver
flag
.
PrintAndExitIfRequested
()
secure
:=
true
secure
:=
true
var
masterServer
string
var
masterServer
string
...
...
cmd/kubelet/kubelet.go
View file @
ee9cec86
...
@@ -35,7 +35,7 @@ import (
...
@@ -35,7 +35,7 @@ import (
kconfig
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/config"
kconfig
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/config"
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version
"
verflag
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/flag
"
"github.com/coreos/go-etcd/etcd"
"github.com/coreos/go-etcd/etcd"
"github.com/fsouza/go-dockerclient"
"github.com/fsouza/go-dockerclient"
"github.com/golang/glog"
"github.com/golang/glog"
...
@@ -96,7 +96,7 @@ func main() {
...
@@ -96,7 +96,7 @@ func main() {
defer
util
.
FlushLogs
()
defer
util
.
FlushLogs
()
rand
.
Seed
(
time
.
Now
()
.
UTC
()
.
UnixNano
())
rand
.
Seed
(
time
.
Now
()
.
UTC
()
.
UnixNano
())
ver
sion
.
PrintAndExitIfRequested
()
ver
flag
.
PrintAndExitIfRequested
()
etcd
.
SetLogger
(
util
.
NewLogger
(
"etcd "
))
etcd
.
SetLogger
(
util
.
NewLogger
(
"etcd "
))
...
...
cmd/proxy/proxy.go
View file @
ee9cec86
...
@@ -22,7 +22,7 @@ import (
...
@@ -22,7 +22,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/proxy"
"github.com/GoogleCloudPlatform/kubernetes/pkg/proxy"
"github.com/GoogleCloudPlatform/kubernetes/pkg/proxy/config"
"github.com/GoogleCloudPlatform/kubernetes/pkg/proxy/config"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version
"
verflag
"github.com/GoogleCloudPlatform/kubernetes/pkg/version/flag
"
"github.com/coreos/go-etcd/etcd"
"github.com/coreos/go-etcd/etcd"
"github.com/golang/glog"
"github.com/golang/glog"
)
)
...
@@ -41,7 +41,7 @@ func main() {
...
@@ -41,7 +41,7 @@ func main() {
util
.
InitLogs
()
util
.
InitLogs
()
defer
util
.
FlushLogs
()
defer
util
.
FlushLogs
()
ver
sion
.
PrintAndExitIfRequested
()
ver
flag
.
PrintAndExitIfRequested
()
// Set up logger for etcd client
// Set up logger for etcd client
etcd
.
SetLogger
(
util
.
NewLogger
(
"etcd "
))
etcd
.
SetLogger
(
util
.
NewLogger
(
"etcd "
))
...
...
pkg/version/flag/flag.go
0 → 100644
View file @
ee9cec86
/*
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package flag defines utility functions to handle command line flags related to version of Kubernetes.
package
flag
import
(
"flag"
"fmt"
"os"
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
)
var
(
versionFlag
=
flag
.
Bool
(
"version"
,
false
,
"Print version information and quit"
)
)
// PrintAndExitIfRequested will check if the -version flag was passed
// and, if so, print the version and exit.
func
PrintAndExitIfRequested
()
{
if
*
versionFlag
{
fmt
.
Printf
(
"Kubernetes %s
\n
"
,
version
.
Get
())
os
.
Exit
(
0
)
}
}
pkg/version/version.go
View file @
ee9cec86
...
@@ -17,13 +17,7 @@ limitations under the License.
...
@@ -17,13 +17,7 @@ limitations under the License.
package
version
package
version
import
(
import
(
"flag"
"fmt"
"fmt"
"os"
)
var
(
versionFlag
=
flag
.
Bool
(
"version"
,
false
,
"Print version information and quit"
)
)
)
// Info contains versioning information.
// Info contains versioning information.
...
@@ -49,12 +43,3 @@ func Get() Info {
...
@@ -49,12 +43,3 @@ func Get() Info {
func
(
info
Info
)
String
()
string
{
func
(
info
Info
)
String
()
string
{
return
fmt
.
Sprintf
(
"version %s.%s, build %s"
,
info
.
Major
,
info
.
Minor
,
info
.
GitCommit
)
return
fmt
.
Sprintf
(
"version %s.%s, build %s"
,
info
.
Major
,
info
.
Minor
,
info
.
GitCommit
)
}
}
// PrintAndExitIfRequested will check if the -version flag was passed
// and, if so, print the version and exit.
func
PrintAndExitIfRequested
()
{
if
*
versionFlag
{
fmt
.
Printf
(
"Kubernetes %s
\n
"
,
Get
())
os
.
Exit
(
0
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment