Skip to content

Commit

Permalink
Move reusable files (images, binaries, certs) to /data
Browse files Browse the repository at this point in the history
  • Loading branch information
tstromberg committed Aug 9, 2019
1 parent 35e473a commit 2f1a11d
Show file tree
Hide file tree
Showing 15 changed files with 222 additions and 185 deletions.
4 changes: 2 additions & 2 deletions pkg/drivers/none/none.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const driverName = constants.DriverNone

// cleanupPaths are paths to be removed by cleanup, and are used by both kubeadm and minikube.
var cleanupPaths = []string{
"/data/minikube",
"/etc/kubernetes/manifests",
constants.GuestEphemeralDir,
constants.GuestManifestsDir,
"/var/lib/minikube",
}

Expand Down
74 changes: 37 additions & 37 deletions pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,247 +70,247 @@ var Addons = map[string]*Addon{
"addon-manager": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/addon-manager.yaml.tmpl",
"/etc/kubernetes/manifests/",
constants.GuestManifestsDir,
"addon-manager.yaml.tmpl",
"0640",
true),
}, true, "addon-manager"),
"dashboard": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/dashboard/dashboard-dp.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"dashboard-dp.yaml",
"0640",
true),
MustBinAsset(
"deploy/addons/dashboard/dashboard-svc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"dashboard-svc.yaml",
"0640",
false),
}, false, "dashboard"),
"default-storageclass": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/storageclass/storageclass.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"storageclass.yaml",
"0640",
false),
}, true, "default-storageclass"),
"storage-provisioner": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/storage-provisioner/storage-provisioner.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"storage-provisioner.yaml",
"0640",
true),
}, true, "storage-provisioner"),
"storage-provisioner-gluster": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/storage-provisioner-gluster/storage-gluster-ns.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"storage-gluster-ns.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/storage-provisioner-gluster/glusterfs-daemonset.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"glusterfs-daemonset.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/storage-provisioner-gluster/heketi-deployment.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"heketi-deployment.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/storage-provisioner-gluster/storage-provisioner-glusterfile.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"storage-privisioner-glusterfile.yaml",
"0640",
false),
}, false, "storage-provisioner-gluster"),
"heapster": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/heapster/influx-grafana-rc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"influxGrafana-rc.yaml",
"0640",
true),
MustBinAsset(
"deploy/addons/heapster/grafana-svc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"grafana-svc.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/heapster/influxdb-svc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"influxdb-svc.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/heapster/heapster-rc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"heapster-rc.yaml",
"0640",
true),
MustBinAsset(
"deploy/addons/heapster/heapster-svc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"heapster-svc.yaml",
"0640",
false),
}, false, "heapster"),
"efk": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/efk/elasticsearch-rc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"elasticsearch-rc.yaml",
"0640",
true),
MustBinAsset(
"deploy/addons/efk/elasticsearch-svc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"elasticsearch-svc.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/efk/fluentd-es-rc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"fluentd-es-rc.yaml",
"0640",
true),
MustBinAsset(
"deploy/addons/efk/fluentd-es-configmap.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"fluentd-es-configmap.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/efk/kibana-rc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"kibana-rc.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/efk/kibana-svc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"kibana-svc.yaml",
"0640",
false),
}, false, "efk"),
"ingress": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/ingress/ingress-configmap.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"ingress-configmap.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/ingress/ingress-rbac.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"ingress-rbac.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/ingress/ingress-dp.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"ingress-dp.yaml",
"0640",
true),
}, false, "ingress"),
"metrics-server": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/metrics-server/metrics-apiservice.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"metrics-apiservice.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/metrics-server/metrics-server-deployment.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"metrics-server-deployment.yaml",
"0640",
true),
MustBinAsset(
"deploy/addons/metrics-server/metrics-server-service.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"metrics-server-service.yaml",
"0640",
false),
}, false, "metrics-server"),
"registry": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/registry/registry-rc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"registry-rc.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/registry/registry-svc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"registry-svc.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/registry/registry-proxy.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"registry-proxy.yaml",
"0640",
false),
}, false, "registry"),
"registry-creds": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/registry-creds/registry-creds-rc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"registry-creds-rc.yaml",
"0640",
false),
}, false, "registry-creds"),
"freshpod": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/freshpod/freshpod-rc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"freshpod-rc.yaml",
"0640",
true),
}, false, "freshpod"),
"nvidia-driver-installer": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/gpu/nvidia-driver-installer.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"nvidia-driver-installer.yaml",
"0640",
true),
}, false, "nvidia-driver-installer"),
"nvidia-gpu-device-plugin": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/gpu/nvidia-gpu-device-plugin.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"nvidia-gpu-device-plugin.yaml",
"0640",
true),
}, false, "nvidia-gpu-device-plugin"),
"logviewer": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/logviewer/logviewer-dp-and-svc.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"logviewer-dp-and-svc.yaml",
"0640",
false),
MustBinAsset(
"deploy/addons/logviewer/logviewer-rbac.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"logviewer-rbac.yaml",
"0640",
false),
}, false, "logviewer"),
"gvisor": NewAddon([]*BinAsset{
MustBinAsset(
"deploy/addons/gvisor/gvisor-pod.yaml.tmpl",
constants.AddonsPath,
constants.GuestAddonsDir,
"gvisor-pod.yaml",
"0640",
true),
Expand All @@ -332,7 +332,7 @@ var Addons = map[string]*Addon{
// AddMinikubeDirAssets adds all addons and files to the list
// of files to be copied to the vm.
func AddMinikubeDirAssets(assets *[]CopyableFile) error {
if err := addMinikubeDirToAssets(constants.MakeMiniPath("addons"), constants.AddonsPath, assets); err != nil {
if err := addMinikubeDirToAssets(constants.MakeMiniPath("addons"), constants.GuestAddonsDir, assets); err != nil {
return errors.Wrap(err, "adding addons folder to assets")
}
if err := addMinikubeDirToAssets(constants.MakeMiniPath("files"), "", assets); err != nil {
Expand Down
8 changes: 4 additions & 4 deletions pkg/minikube/assets/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ func TestAddMinikubeDirAssets(t *testing.T) {
}{
{
relativePath: "/dir1/file1.txt",
expectedPath: constants.AddonsPath,
expectedPath: constants.GuestAddonsDir,
},
{
relativePath: "/dir1/file2.txt",
expectedPath: constants.AddonsPath,
expectedPath: constants.GuestAddonsDir,
},
{
relativePath: "/dir2/file1.txt",
expectedPath: constants.AddonsPath,
expectedPath: constants.GuestAddonsDir,
},
},
vmPath: constants.AddonsPath,
vmPath: constants.GuestAddonsDir,
},
{
description: "absolute path assets",
Expand Down
10 changes: 6 additions & 4 deletions pkg/minikube/assets/vm_assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"io"
"os"
"path"
"path/filepath"

"github.com/golang/glog"
"github.com/pkg/errors"
Expand Down Expand Up @@ -78,14 +79,15 @@ func NewMemoryAssetTarget(d []byte, targetPath, permissions string) *MemoryAsset
}

// NewFileAsset creates a new FileAsset
func NewFileAsset(path, targetDir, targetName, permissions string) (*FileAsset, error) {
f, err := os.Open(path)
func NewFileAsset(src, targetDir, targetName, permissions string) (*FileAsset, error) {
glog.Infof("NewFileAsset: %s -> %s", src, filepath.Join(targetDir, targetName))
f, err := os.Open(src)
if err != nil {
return nil, errors.Wrapf(err, "Error opening file asset: %s", path)
return nil, errors.Wrapf(err, "Error opening file asset: %s", src)
}
return &FileAsset{
BaseAsset: BaseAsset{
AssetName: path,
AssetName: src,
TargetDir: targetDir,
TargetName: targetName,
Permissions: permissions,
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/bootstrapper/bootstrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const (
func GetCachedBinaryList(bootstrapper string) []string {
switch bootstrapper {
case BootstrapperTypeKubeadm:
return constants.GetKubeadmCachedBinaries()
return constants.KubeadmBinaries
default:
return []string{}
}
Expand Down
Loading

0 comments on commit 2f1a11d

Please sign in to comment.