Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
547d22f6
M
minikube
项目概览
Chu Peng 楚鹏
/
minikube
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
minikube
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
547d22f6
编写于
9月 19, 2017
作者:
M
Matt Rickard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up unused files, add tar rules
上级
93f6eb23
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
11 addition
and
185 deletion
+11
-185
Makefile
Makefile
+9
-2
pkg/drivers/kvm/kvm.go
pkg/drivers/kvm/kvm.go
+2
-2
pkg/drivers/kvm/storage.go
pkg/drivers/kvm/storage.go
+0
-115
pkg/minikube/drivers/hyperkit/disk.go
pkg/minikube/drivers/hyperkit/disk.go
+0
-66
未找到文件。
Makefile
浏览文件 @
547d22f6
...
...
@@ -213,13 +213,16 @@ out/minikube_$(DEB_VERSION).deb: out/minikube-linux-amd64
rm
-rf
out/minikube_
$(DEB_VERSION)
.SECONDEXPANSION
:
TAR_TARGETS_linux
:=
out/minikube-linux-amd64
TAR_TARGETS_linux
:=
out/minikube-linux-amd64
out/docker-machine-driver-kvm2
TAR_TARGETS_darwin
:=
out/minikube-darwin-amd64
TAR_TARGETS_windows
:=
out/minikube-windows-amd64.exe
TAR_TARGETS_ALL
:=
$(
shell
find deploy/addons
-type
f
)
out/minikube-%-amd64.tar.gz
:
$$(TAR_TARGETS_$$*) $(TAR_TARGETS_ALL)
tar
-cvf
$@
$^
.PHONY
:
cross-tars
cross-tars
:
out/minikube-windows-amd64.tar.gz out/minikube-linux-amd64.tar.gz out/minikube-darwin-amd64.tar.gz
out/minikube-installer.exe
:
out/minikube-windows-amd64.exe
rm
-rf
out/windows_tmp
cp
-r
installers/windows/ out/windows_tmp
...
...
@@ -296,7 +299,7 @@ out/docker-machine-driver-kvm2: $(KVM_DRIVER_FILES)
go build
\
-installsuffix
"static"
\
-ldflags
"-X k8s.io/minikube/pkg/drivers/kvm/version.VERSION=
$(VERSION)
"
\
-tags
libvirt.1.
2.2
\
-tags
libvirt.1.
3.1
\
-o
$(BUILD_DIR)
/docker-machine-driver-kvm2
\
k8s.io/minikube/cmd/drivers/kvm
chmod
+X
$@
...
...
@@ -304,3 +307,7 @@ out/docker-machine-driver-kvm2: $(KVM_DRIVER_FILES)
.PHONY
:
install-kvm
install-kvm
:
out/docker-machine-driver-kvm2
cp
out/docker-machine-driver-kvm2
$(GOBIN)
/docker-machine-driver-kvm2
.PHONY
:
release-kvm-driver
release-kvm-driver
:
install-kvm
gsutil
cp
$(GOBIN)
/docker-machine-driver-kvm2 gs://minikube/drivers/kvm/
$(VERSION)
/
pkg/drivers/kvm/kvm.go
浏览文件 @
547d22f6
...
...
@@ -153,7 +153,7 @@ func (d *Driver) GetIP() (string, error) {
return
""
,
errors
.
Wrap
(
err
,
"machine in unknown state"
)
}
if
s
!=
state
.
Running
{
return
""
,
errors
.
New
(
"host is not running
.
"
)
return
""
,
errors
.
New
(
"host is not running"
)
}
ip
,
err
:=
d
.
lookupIP
()
if
err
!=
nil
{
...
...
@@ -168,7 +168,7 @@ func (d *Driver) GetSSHHostname() (string, error) {
}
func
(
d
*
Driver
)
DriverName
()
string
{
return
"kvm"
return
"kvm
2
"
}
func
(
d
*
Driver
)
Kill
()
error
{
...
...
pkg/drivers/kvm/storage.go
已删除
100644 → 0
浏览文件 @
93f6eb23
/*
Copyright 2016 The Kubernetes Authors 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
kvm
import
(
"archive/tar"
"bytes"
"fmt"
"io"
"io/ioutil"
"math"
"os"
"github.com/docker/machine/libmachine/ssh"
"github.com/pkg/errors"
)
func
createRawDiskImage
(
dest
string
,
size
int
)
error
{
f
,
err
:=
os
.
OpenFile
(
dest
,
os
.
O_CREATE
|
os
.
O_EXCL
|
os
.
O_WRONLY
,
0644
)
if
err
!=
nil
{
if
os
.
IsExist
(
err
)
{
return
nil
}
return
errors
.
Wrap
(
err
,
"opening file for raw disk image"
)
}
f
.
Close
()
if
err
:=
os
.
Truncate
(
dest
,
int64
(
float64
(
size
)
*
math
.
Pow10
(
6
)));
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"writing sparse file"
)
}
return
nil
}
func
(
d
*
Driver
)
buildDiskImage
()
error
{
diskPath
:=
d
.
ResolveStorePath
(
fmt
.
Sprintf
(
"%s.img"
,
d
.
MachineName
))
if
err
:=
createRawDiskImage
(
diskPath
,
d
.
DiskSize
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"creating raw disk image"
)
}
tarBuf
,
err
:=
d
.
generateCertBundle
()
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"generating cert bundle"
)
}
f
,
err
:=
os
.
OpenFile
(
d
.
DiskPath
,
os
.
O_WRONLY
,
0644
)
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"opening raw disk image to write cert bundle"
)
}
defer
f
.
Close
()
f
.
Seek
(
0
,
io
.
SeekStart
)
_
,
err
=
f
.
Write
(
tarBuf
.
Bytes
())
if
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"wrting cert bundle to disk image"
)
}
return
nil
}
func
(
d
*
Driver
)
generateCertBundle
()
(
*
bytes
.
Buffer
,
error
)
{
magicString
:=
"boot2docker, please format-me"
if
err
:=
ssh
.
GenerateSSHKey
(
d
.
GetSSHKeyPath
());
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"generating ssh key"
)
}
buf
:=
new
(
bytes
.
Buffer
)
tw
:=
tar
.
NewWriter
(
buf
)
file
:=
&
tar
.
Header
{
Name
:
magicString
,
Size
:
int64
(
len
(
magicString
))}
if
err
:=
tw
.
WriteHeader
(
file
);
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"writing magic string header to tar"
)
}
if
_
,
err
:=
tw
.
Write
([]
byte
(
magicString
));
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"writing magic string to tar"
)
}
// .ssh/key.pub => authorized_keys
file
=
&
tar
.
Header
{
Name
:
".ssh"
,
Typeflag
:
tar
.
TypeDir
,
Mode
:
0700
}
if
err
:=
tw
.
WriteHeader
(
file
);
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"writing .ssh header to tar"
)
}
pubKey
,
err
:=
ioutil
.
ReadFile
(
d
.
publicSSHKeyPath
())
if
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"reading ssh pub key for tar"
)
}
file
=
&
tar
.
Header
{
Name
:
".ssh/authorized_keys"
,
Size
:
int64
(
len
(
pubKey
)),
Mode
:
0644
}
if
err
:=
tw
.
WriteHeader
(
file
);
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"writing header for authorized_keys to tar"
)
}
if
_
,
err
:=
tw
.
Write
([]
byte
(
pubKey
));
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"writing pub key to tar"
)
}
if
err
:=
tw
.
Close
();
err
!=
nil
{
return
nil
,
errors
.
Wrap
(
err
,
"closing tar writer"
)
}
return
buf
,
nil
}
func
(
d
*
Driver
)
publicSSHKeyPath
()
string
{
return
d
.
GetSSHKeyPath
()
+
".pub"
}
pkg/minikube/drivers/hyperkit/disk.go
已删除
100644 → 0
浏览文件 @
93f6eb23
/*
Copyright 2016 The Kubernetes Authors 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
hyperkit
import
(
"io"
"io/ioutil"
"os"
"path/filepath"
"syscall"
"github.com/cloudflare/cfssl/log"
"github.com/docker/machine/libmachine/mcnutils"
"github.com/pkg/errors"
)
func
createDiskImage
(
sshKeyPath
,
diskPath
string
,
diskSizeMb
int
)
error
{
tarBuf
,
err
:=
mcnutils
.
MakeDiskImage
(
sshKeyPath
)
if
err
!=
nil
{
return
err
}
file
,
err
:=
os
.
OpenFile
(
diskPath
,
os
.
O_CREATE
|
os
.
O_EXCL
|
os
.
O_WRONLY
,
0644
)
if
err
!=
nil
{
return
err
}
defer
file
.
Close
()
file
.
Seek
(
0
,
io
.
SeekStart
)
if
_
,
err
:=
file
.
Write
(
tarBuf
.
Bytes
());
err
!=
nil
{
return
err
}
file
.
Close
()
if
err
:=
os
.
Truncate
(
diskPath
,
int64
(
diskSizeMb
*
1000000
));
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"creating disk"
)
}
return
nil
}
func
fixPermissions
(
path
string
)
error
{
os
.
Chown
(
path
,
syscall
.
Getuid
(),
syscall
.
Getegid
())
files
,
_
:=
ioutil
.
ReadDir
(
path
)
for
_
,
f
:=
range
files
{
fp
:=
filepath
.
Join
(
path
,
f
.
Name
())
log
.
Debugf
(
fp
)
if
err
:=
os
.
Chown
(
fp
,
syscall
.
Getuid
(),
syscall
.
Getegid
());
err
!=
nil
{
return
err
}
}
return
nil
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录