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
6af07172
Commit
6af07172
authored
Jul 30, 2014
by
Daniel Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #714 from filbranden/version_fixes
Version fixes
parents
76e2cd70
de405ac1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
63 additions
and
13 deletions
+63
-13
apiserver.go
cmd/apiserver/apiserver.go
+3
-0
controller-manager.go
cmd/controller-manager/controller-manager.go
+3
-0
kubecfg.go
cmd/kubecfg/kubecfg.go
+1
-5
kubelet.go
cmd/kubelet/kubelet.go
+3
-0
proxy.go
cmd/proxy/proxy.go
+3
-0
test-cmd.sh
hack/test-cmd.sh
+1
-1
version-gen.sh
hack/version-gen.sh
+24
-6
template.go.tmpl
pkg/version/template.go.tmpl
+1
-1
version.go
pkg/version/version.go
+24
-0
No files found.
cmd/apiserver/apiserver.go
View file @
6af07172
...
@@ -29,6 +29,7 @@ import (
...
@@ -29,6 +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"
"github.com/golang/glog"
"github.com/golang/glog"
)
)
...
@@ -54,6 +55,8 @@ func main() {
...
@@ -54,6 +55,8 @@ func main() {
util
.
InitLogs
()
util
.
InitLogs
()
defer
util
.
FlushLogs
()
defer
util
.
FlushLogs
()
version
.
PrintAndExitIfRequested
()
if
len
(
machineList
)
==
0
{
if
len
(
machineList
)
==
0
{
glog
.
Fatal
(
"No machines specified!"
)
glog
.
Fatal
(
"No machines specified!"
)
}
}
...
...
cmd/controller-manager/controller-manager.go
View file @
6af07172
...
@@ -28,6 +28,7 @@ import (
...
@@ -28,6 +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"
"github.com/coreos/go-etcd/etcd"
"github.com/coreos/go-etcd/etcd"
"github.com/golang/glog"
"github.com/golang/glog"
)
)
...
@@ -46,6 +47,8 @@ func main() {
...
@@ -46,6 +47,8 @@ func main() {
util
.
InitLogs
()
util
.
InitLogs
()
defer
util
.
FlushLogs
()
defer
util
.
FlushLogs
()
version
.
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 @
6af07172
...
@@ -37,7 +37,6 @@ import (
...
@@ -37,7 +37,6 @@ import (
)
)
var
(
var
(
versionFlag
=
flag
.
Bool
(
"V"
,
false
,
"Print the version number."
)
serverVersion
=
flag
.
Bool
(
"server_version"
,
false
,
"Print the server's version number."
)
serverVersion
=
flag
.
Bool
(
"server_version"
,
false
,
"Print the server's version number."
)
preventSkew
=
flag
.
Bool
(
"expect_version_match"
,
false
,
"Fail if server's version doesn't match own version."
)
preventSkew
=
flag
.
Bool
(
"expect_version_match"
,
false
,
"Fail if server's version doesn't match own version."
)
httpServer
=
flag
.
String
(
"h"
,
""
,
"The host to connect to."
)
httpServer
=
flag
.
String
(
"h"
,
""
,
"The host to connect to."
)
...
@@ -107,10 +106,7 @@ func main() {
...
@@ -107,10 +106,7 @@ func main() {
util
.
InitLogs
()
util
.
InitLogs
()
defer
util
.
FlushLogs
()
defer
util
.
FlushLogs
()
if
*
versionFlag
{
version
.
PrintAndExitIfRequested
()
fmt
.
Printf
(
"Version: %#v
\n
"
,
version
.
Get
())
os
.
Exit
(
0
)
}
secure
:=
true
secure
:=
true
var
masterServer
string
var
masterServer
string
...
...
cmd/kubelet/kubelet.go
View file @
6af07172
...
@@ -35,6 +35,7 @@ import (
...
@@ -35,6 +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"
"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"
...
@@ -95,6 +96,8 @@ func main() {
...
@@ -95,6 +96,8 @@ func main() {
defer
util
.
FlushLogs
()
defer
util
.
FlushLogs
()
rand
.
Seed
(
time
.
Now
()
.
UTC
()
.
UnixNano
())
rand
.
Seed
(
time
.
Now
()
.
UTC
()
.
UnixNano
())
version
.
PrintAndExitIfRequested
()
etcd
.
SetLogger
(
util
.
NewLogger
(
"etcd "
))
etcd
.
SetLogger
(
util
.
NewLogger
(
"etcd "
))
dockerClient
,
err
:=
docker
.
NewClient
(
getDockerEndpoint
())
dockerClient
,
err
:=
docker
.
NewClient
(
getDockerEndpoint
())
...
...
cmd/proxy/proxy.go
View file @
6af07172
...
@@ -22,6 +22,7 @@ import (
...
@@ -22,6 +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"
"github.com/coreos/go-etcd/etcd"
"github.com/coreos/go-etcd/etcd"
"github.com/golang/glog"
"github.com/golang/glog"
)
)
...
@@ -40,6 +41,8 @@ func main() {
...
@@ -40,6 +41,8 @@ func main() {
util
.
InitLogs
()
util
.
InitLogs
()
defer
util
.
FlushLogs
()
defer
util
.
FlushLogs
()
version
.
PrintAndExitIfRequested
()
// Set up logger for etcd client
// Set up logger for etcd client
etcd
.
SetLogger
(
util
.
NewLogger
(
"etcd "
))
etcd
.
SetLogger
(
util
.
NewLogger
(
"etcd "
))
...
...
hack/test-cmd.sh
View file @
6af07172
...
@@ -82,7 +82,7 @@ wait_for_url "http://localhost:4001/version" "etcd: "
...
@@ -82,7 +82,7 @@ wait_for_url "http://localhost:4001/version" "etcd: "
# Check kubecfg
# Check kubecfg
out
=
$(${
GO_OUT
}
/kubecfg
-
V
)
out
=
$(${
GO_OUT
}
/kubecfg
-
version
)
echo
kubecfg:
$out
echo
kubecfg:
$out
# Start kubelet
# Start kubelet
...
...
hack/version-gen.sh
View file @
6af07172
...
@@ -14,10 +14,28 @@
...
@@ -14,10 +14,28 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
set
-o
errexit
set
-o
nounset
set
-o
pipefail
topdir
=
$(
dirname
"
$0
"
)
/..
cd
"
${
topdir
}
"
# TODO: when we start making tags, switch to git describe?
# TODO: when we start making tags, switch to git describe?
desc
=
$(
git rev-list
--abbrev-commit
--max-count
=
1 HEAD
)
if
git_commit
=
$(
git rev-parse
--short
"HEAD^{commit}"
2>/dev/null
)
;
then
tab
=
$'
\t
'
# Remove any invalid characters that might confuse "sed".
script
=
"22s/.*/
${
tab
}
commitFromGit =
\`
${
desc
}
\`
/"
git_commit
=
${
git_commit
//[^a-f0-9]/
}
infile
=
"
$(
dirname
$0
)
/../pkg/version/template.go"
outfile
=
"
$(
dirname
$0
)
/../pkg/version/autogenerated.go"
# Check if the tree is dirty.
sed
"
${
script
}
"
"
${
infile
}
"
>
"
${
outfile
}
"
if
!
dirty_tree
=
$(
git status
--porcelain
)
||
[[
-n
"
${
dirty_tree
}
"
]]
;
then
git_commit
=
"
${
git_commit
}
-dirty"
fi
else
git_commit
=
"(none)"
echo
"WARNING: unable to find git commit, falling back to commitFromGit =
\`
${
git_commit
}
\`
"
>
&2
fi
# TODO: Instead of using an autogenerated file, we could pass this variable
# to the source through Go's -X ldflag.
sed
"s/@@GIT_COMMIT@@/
${
git_commit
}
/g"
\
pkg/version/template.go.tmpl
>
pkg/version/autogenerated.go
pkg/version/template.go
→
pkg/version/template.go
.tmpl
View file @
6af07172
...
@@ -19,5 +19,5 @@ package version
...
@@ -19,5 +19,5 @@ package version
//
This
file
is
the
template
for
the
machine
-
edited
autogenerated
.
go
.
//
This
file
is
the
template
for
the
machine
-
edited
autogenerated
.
go
.
//
Do
not
modify
this
file
without
also
modifying
hack
/
version
-
gen
.
sh
.
//
Do
not
modify
this
file
without
also
modifying
hack
/
version
-
gen
.
sh
.
var
(
var
(
placeholder
interface
{}
commitFromGit
=
`@@
GIT_COMMIT
@@`
)
)
pkg/version/version.go
View file @
6af07172
...
@@ -16,6 +16,16 @@ limitations under the License.
...
@@ -16,6 +16,16 @@ limitations under the License.
package
version
package
version
import
(
"flag"
"fmt"
"os"
)
var
(
versionFlag
=
flag
.
Bool
(
"version"
,
false
,
"Print version information and quit"
)
)
// Info contains versioning information.
// Info contains versioning information.
// TODO: Add []string of api versions supported? It's still unclear
// TODO: Add []string of api versions supported? It's still unclear
// how we'll want to distribute that information.
// how we'll want to distribute that information.
...
@@ -34,3 +44,17 @@ func Get() Info {
...
@@ -34,3 +44,17 @@ func Get() Info {
GitCommit
:
commitFromGit
,
GitCommit
:
commitFromGit
,
}
}
}
}
// String returns info as a human-friendly version string.
func
(
info
Info
)
String
()
string
{
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