Save addons in subdirectories, separated by namespace

This way we can pass the correct --namespace flag into 'kubectl apply'
such that it works with '--prune' for kubectl >=v.17.0
pull/6376/head
Priya Wadhwa 2020-01-21 12:46:44 -08:00
parent e3bd383d64
commit 180b23f2c8
2 changed files with 96 additions and 76 deletions

View File

@ -17,6 +17,8 @@ limitations under the License.
package addons package addons
import ( import (
"fmt"
"io/ioutil"
"os" "os"
"os/exec" "os/exec"
"path" "path"
@ -24,10 +26,12 @@ import (
"github.com/blang/semver" "github.com/blang/semver"
"github.com/golang/glog" "github.com/golang/glog"
"github.com/pkg/errors" "github.com/pkg/errors"
"k8s.io/minikube/pkg/minikube/assets"
"k8s.io/minikube/pkg/minikube/bootstrapper/bsutil" "k8s.io/minikube/pkg/minikube/bootstrapper/bsutil"
"k8s.io/minikube/pkg/minikube/command" "k8s.io/minikube/pkg/minikube/command"
"k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants" "k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/vmpath"
) )
var ( var (
@ -58,18 +62,32 @@ var kubectlPruneWhitelist = []string{
// reconcile runs kubectl apply -f on the addons directory // reconcile runs kubectl apply -f on the addons directory
// to reconcile addons state in all running profiles // to reconcile addons state in all running profiles
func reconcile(cmd command.Runner, profile string) error { func reconcile(cmd command.Runner, profile string) error {
c, err := kubectlCommand(profile) // Walk through all subdirs in /etc/kubernetes/addons and reconcile addons
dirs, err := ioutil.ReadDir(vmpath.GuestAddonsDir)
if err != nil { if err != nil {
return err return err
} }
if _, err := cmd.RunCmd(c); err != nil {
glog.Warningf("reconciling addons failed: %v", err) for _, d := range dirs {
return err if !d.IsDir() {
continue
}
namespace := d.Name()
glog.Infof("Reconciling addons in namespace %s", namespace)
c, err := kubectlCommand(profile, namespace)
if err != nil {
return err
}
if _, err := cmd.RunCmd(c); err != nil {
glog.Warningf("reconciling addons failed: %v", err)
return err
}
} }
return nil return nil
} }
func kubectlCommand(profile string) (*exec.Cmd, error) { func kubectlCommand(profile, namespace string) (*exec.Cmd, error) {
v, err := k8sVersion(profile) v, err := k8sVersion(profile)
if err != nil { if err != nil {
return nil, err return nil, err
@ -78,7 +96,7 @@ func kubectlCommand(profile string) (*exec.Cmd, error) {
// prune will delete any existing objects with the label specified by "-l" which don't appear in /etc/kubernetes/addons // prune will delete any existing objects with the label specified by "-l" which don't appear in /etc/kubernetes/addons
// this is how we delete disabled addons // this is how we delete disabled addons
args := []string{"KUBECONFIG=/var/lib/minikube/kubeconfig", kubectlBinary, "apply", "-f", "/etc/kubernetes/addons", "-l", "kubernetes.io/cluster-service!=true,addonmanager.kubernetes.io/mode=Reconcile", "--prune=true"} args := []string{"KUBECONFIG=/var/lib/minikube/kubeconfig", kubectlBinary, "apply", "-f", assets.TargetDirForAddon(namespace), "-l", "kubernetes.io/cluster-service!=true,addonmanager.kubernetes.io/mode=Reconcile", "--prune=true"}
for _, k := range kubectlPruneWhitelist { for _, k := range kubectlPruneWhitelist {
args = append(args, []string{"--prune-whitelist", k}...) args = append(args, []string{"--prune-whitelist", k}...)
} }
@ -89,7 +107,7 @@ func kubectlCommand(profile string) (*exec.Cmd, error) {
return nil, errors.Wrap(err, "appending namespace flag") return nil, errors.Wrap(err, "appending namespace flag")
} }
if ok { if ok {
args = append(args, "--namespace=kube-system") args = append(args, fmt.Sprintf("--namespace=%s", namespace))
} }
cmd := exec.Command("sudo", args...) cmd := exec.Command("sudo", args...)

View File

@ -1,12 +1,9 @@
/* /*
Copyright 2016 The Kubernetes Authors All rights reserved. Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -40,7 +37,7 @@ type Addon struct {
} }
// NewAddon creates a new Addon // NewAddon creates a new Addon
func NewAddon(assets []*BinAsset, enabled bool, addonName string) *Addon { func NewAddon(assets []*BinAsset, enabled bool, addonName, namespace string) *Addon {
a := &Addon{ a := &Addon{
Assets: assets, Assets: assets,
enabled: enabled, enabled: enabled,
@ -71,235 +68,235 @@ var Addons = map[string]*Addon{
"addon-manager": NewAddon([]*BinAsset{ "addon-manager": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/addon-manager.yaml.tmpl", "deploy/addons/addon-manager.yaml.tmpl",
vmpath.GuestManifestsDir, TargetDirForAddon("kube-system"),
"addon-manager.yaml.tmpl", "addon-manager.yaml.tmpl",
"0640", "0640",
true), true),
}, false, "addon-manager"), }, false, "addon-manager", "kube-system"),
"dashboard": NewAddon([]*BinAsset{ "dashboard": NewAddon([]*BinAsset{
MustBinAsset("deploy/addons/dashboard/dashboard-clusterrole.yaml", vmpath.GuestAddonsDir, "dashboard-clusterrole.yaml", "0640", false), MustBinAsset("deploy/addons/dashboard/dashboard-clusterrole.yaml", TargetDirForAddon("kubernetes-dashboard"), "dashboard-clusterrole.yaml", "0640", false),
MustBinAsset("deploy/addons/dashboard/dashboard-clusterrolebinding.yaml", vmpath.GuestAddonsDir, "dashboard-clusterrolebinding.yaml", "0640", false), MustBinAsset("deploy/addons/dashboard/dashboard-clusterrolebinding.yaml", TargetDirForAddon("kubernetes-dashboard"), "dashboard-clusterrolebinding.yaml", "0640", false),
MustBinAsset("deploy/addons/dashboard/dashboard-configmap.yaml", vmpath.GuestAddonsDir, "dashboard-configmap.yaml", "0640", false), MustBinAsset("deploy/addons/dashboard/dashboard-configmap.yaml", TargetDirForAddon("kubernetes-dashboard"), "dashboard-configmap.yaml", "0640", false),
MustBinAsset("deploy/addons/dashboard/dashboard-dp.yaml", vmpath.GuestAddonsDir, "dashboard-dp.yaml", "0640", false), MustBinAsset("deploy/addons/dashboard/dashboard-dp.yaml", TargetDirForAddon("kubernetes-dashboard"), "dashboard-dp.yaml", "0640", false),
MustBinAsset("deploy/addons/dashboard/dashboard-ns.yaml", vmpath.GuestAddonsDir, "dashboard-ns.yaml", "0640", false), MustBinAsset("deploy/addons/dashboard/dashboard-ns.yaml", TargetDirForAddon("kubernetes-dashboard"), "dashboard-ns.yaml", "0640", false),
MustBinAsset("deploy/addons/dashboard/dashboard-role.yaml", vmpath.GuestAddonsDir, "dashboard-role.yaml", "0640", false), MustBinAsset("deploy/addons/dashboard/dashboard-role.yaml", TargetDirForAddon("kubernetes-dashboard"), "dashboard-role.yaml", "0640", false),
MustBinAsset("deploy/addons/dashboard/dashboard-rolebinding.yaml", vmpath.GuestAddonsDir, "dashboard-rolebinding.yaml", "0640", false), MustBinAsset("deploy/addons/dashboard/dashboard-rolebinding.yaml", TargetDirForAddon("kubernetes-dashboard"), "dashboard-rolebinding.yaml", "0640", false),
MustBinAsset("deploy/addons/dashboard/dashboard-sa.yaml", vmpath.GuestAddonsDir, "dashboard-sa.yaml", "0640", false), MustBinAsset("deploy/addons/dashboard/dashboard-sa.yaml", TargetDirForAddon("kubernetes-dashboard"), "dashboard-sa.yaml", "0640", false),
MustBinAsset("deploy/addons/dashboard/dashboard-secret.yaml", vmpath.GuestAddonsDir, "dashboard-secret.yaml", "0640", false), MustBinAsset("deploy/addons/dashboard/dashboard-secret.yaml", TargetDirForAddon("kubernetes-dashboard"), "dashboard-secret.yaml", "0640", false),
MustBinAsset("deploy/addons/dashboard/dashboard-svc.yaml", vmpath.GuestAddonsDir, "dashboard-svc.yaml", "0640", false), MustBinAsset("deploy/addons/dashboard/dashboard-svc.yaml", TargetDirForAddon("kubernetes-dashboard"), "dashboard-svc.yaml", "0640", false),
}, false, "dashboard"), }, false, "dashboard", "kubernetes-dashboard"),
"default-storageclass": NewAddon([]*BinAsset{ "default-storageclass": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/storageclass/storageclass.yaml.tmpl", "deploy/addons/storageclass/storageclass.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"storageclass.yaml", "storageclass.yaml",
"0640", "0640",
false), false),
}, true, "default-storageclass"), }, true, "default-storageclass", "kube-system"),
"storage-provisioner": NewAddon([]*BinAsset{ "storage-provisioner": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/storage-provisioner/storage-provisioner.yaml.tmpl", "deploy/addons/storage-provisioner/storage-provisioner.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"storage-provisioner.yaml", "storage-provisioner.yaml",
"0640", "0640",
true), true),
}, true, "storage-provisioner"), }, true, "storage-provisioner", "kube-system"),
"storage-provisioner-gluster": NewAddon([]*BinAsset{ "storage-provisioner-gluster": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/storage-provisioner-gluster/storage-gluster-ns.yaml.tmpl", "deploy/addons/storage-provisioner-gluster/storage-gluster-ns.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"storage-gluster-ns.yaml", "storage-gluster-ns.yaml",
"0640", "0640",
false), false),
MustBinAsset( MustBinAsset(
"deploy/addons/storage-provisioner-gluster/glusterfs-daemonset.yaml.tmpl", "deploy/addons/storage-provisioner-gluster/glusterfs-daemonset.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"glusterfs-daemonset.yaml", "glusterfs-daemonset.yaml",
"0640", "0640",
false), false),
MustBinAsset( MustBinAsset(
"deploy/addons/storage-provisioner-gluster/heketi-deployment.yaml.tmpl", "deploy/addons/storage-provisioner-gluster/heketi-deployment.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"heketi-deployment.yaml", "heketi-deployment.yaml",
"0640", "0640",
false), false),
MustBinAsset( MustBinAsset(
"deploy/addons/storage-provisioner-gluster/storage-provisioner-glusterfile.yaml.tmpl", "deploy/addons/storage-provisioner-gluster/storage-provisioner-glusterfile.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"storage-privisioner-glusterfile.yaml", "storage-privisioner-glusterfile.yaml",
"0640", "0640",
false), false),
}, false, "storage-provisioner-gluster"), }, false, "storage-provisioner-gluster", "kube-system"),
"efk": NewAddon([]*BinAsset{ "efk": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/efk/elasticsearch-rc.yaml.tmpl", "deploy/addons/efk/elasticsearch-rc.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"elasticsearch-rc.yaml", "elasticsearch-rc.yaml",
"0640", "0640",
true), true),
MustBinAsset( MustBinAsset(
"deploy/addons/efk/elasticsearch-svc.yaml.tmpl", "deploy/addons/efk/elasticsearch-svc.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"elasticsearch-svc.yaml", "elasticsearch-svc.yaml",
"0640", "0640",
false), false),
MustBinAsset( MustBinAsset(
"deploy/addons/efk/fluentd-es-rc.yaml.tmpl", "deploy/addons/efk/fluentd-es-rc.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"fluentd-es-rc.yaml", "fluentd-es-rc.yaml",
"0640", "0640",
true), true),
MustBinAsset( MustBinAsset(
"deploy/addons/efk/fluentd-es-configmap.yaml.tmpl", "deploy/addons/efk/fluentd-es-configmap.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"fluentd-es-configmap.yaml", "fluentd-es-configmap.yaml",
"0640", "0640",
false), false),
MustBinAsset( MustBinAsset(
"deploy/addons/efk/kibana-rc.yaml.tmpl", "deploy/addons/efk/kibana-rc.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"kibana-rc.yaml", "kibana-rc.yaml",
"0640", "0640",
false), false),
MustBinAsset( MustBinAsset(
"deploy/addons/efk/kibana-svc.yaml.tmpl", "deploy/addons/efk/kibana-svc.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"kibana-svc.yaml", "kibana-svc.yaml",
"0640", "0640",
false), false),
}, false, "efk"), }, false, "efk", "kube-system"),
"ingress": NewAddon([]*BinAsset{ "ingress": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/ingress/ingress-configmap.yaml.tmpl", "deploy/addons/ingress/ingress-configmap.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"ingress-configmap.yaml", "ingress-configmap.yaml",
"0640", "0640",
false), false),
MustBinAsset( MustBinAsset(
"deploy/addons/ingress/ingress-rbac.yaml.tmpl", "deploy/addons/ingress/ingress-rbac.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"ingress-rbac.yaml", "ingress-rbac.yaml",
"0640", "0640",
false), false),
MustBinAsset( MustBinAsset(
"deploy/addons/ingress/ingress-dp.yaml.tmpl", "deploy/addons/ingress/ingress-dp.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"ingress-dp.yaml", "ingress-dp.yaml",
"0640", "0640",
true), true),
}, false, "ingress"), }, false, "ingress", "kube-system"),
"istio-provisioner": NewAddon([]*BinAsset{ "istio-provisioner": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/istio-provisioner/istio-operator.yaml.tmpl", "deploy/addons/istio-provisioner/istio-operator.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("istio-operator"),
"istio-operator.yaml", "istio-operator.yaml",
"0640", "0640",
true), true),
}, false, "istio-provisioner"), }, false, "istio-provisioner", "istio-operator"),
"istio": NewAddon([]*BinAsset{ "istio": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/istio/istio-default-profile.yaml.tmpl", "deploy/addons/istio/istio-default-profile.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("istio-operator"),
"istio-default-profile.yaml", "istio-default-profile.yaml",
"0640", "0640",
false), false),
}, false, "istio"), }, false, "istio", "istio-operator"),
"metrics-server": NewAddon([]*BinAsset{ "metrics-server": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/metrics-server/metrics-apiservice.yaml.tmpl", "deploy/addons/metrics-server/metrics-apiservice.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"metrics-apiservice.yaml", "metrics-apiservice.yaml",
"0640", "0640",
false), false),
MustBinAsset( MustBinAsset(
"deploy/addons/metrics-server/metrics-server-deployment.yaml.tmpl", "deploy/addons/metrics-server/metrics-server-deployment.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"metrics-server-deployment.yaml", "metrics-server-deployment.yaml",
"0640", "0640",
true), true),
MustBinAsset( MustBinAsset(
"deploy/addons/metrics-server/metrics-server-service.yaml.tmpl", "deploy/addons/metrics-server/metrics-server-service.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"metrics-server-service.yaml", "metrics-server-service.yaml",
"0640", "0640",
false), false),
}, false, "metrics-server"), }, false, "metrics-server", "kube-system"),
"registry": NewAddon([]*BinAsset{ "registry": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/registry/registry-rc.yaml.tmpl", "deploy/addons/registry/registry-rc.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"registry-rc.yaml", "registry-rc.yaml",
"0640", "0640",
false), false),
MustBinAsset( MustBinAsset(
"deploy/addons/registry/registry-svc.yaml.tmpl", "deploy/addons/registry/registry-svc.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"registry-svc.yaml", "registry-svc.yaml",
"0640", "0640",
false), false),
MustBinAsset( MustBinAsset(
"deploy/addons/registry/registry-proxy.yaml.tmpl", "deploy/addons/registry/registry-proxy.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"registry-proxy.yaml", "registry-proxy.yaml",
"0640", "0640",
false), false),
}, false, "registry"), }, false, "registry", "kube-system"),
"registry-creds": NewAddon([]*BinAsset{ "registry-creds": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/registry-creds/registry-creds-rc.yaml.tmpl", "deploy/addons/registry-creds/registry-creds-rc.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"registry-creds-rc.yaml", "registry-creds-rc.yaml",
"0640", "0640",
false), false),
}, false, "registry-creds"), }, false, "registry-creds", "kube-system"),
"freshpod": NewAddon([]*BinAsset{ "freshpod": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/freshpod/freshpod-rc.yaml.tmpl", "deploy/addons/freshpod/freshpod-rc.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"freshpod-rc.yaml", "freshpod-rc.yaml",
"0640", "0640",
true), true),
}, false, "freshpod"), }, false, "freshpod", "kube-system"),
"nvidia-driver-installer": NewAddon([]*BinAsset{ "nvidia-driver-installer": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/gpu/nvidia-driver-installer.yaml.tmpl", "deploy/addons/gpu/nvidia-driver-installer.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"nvidia-driver-installer.yaml", "nvidia-driver-installer.yaml",
"0640", "0640",
true), true),
}, false, "nvidia-driver-installer"), }, false, "nvidia-driver-installer", "kube-system"),
"nvidia-gpu-device-plugin": NewAddon([]*BinAsset{ "nvidia-gpu-device-plugin": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/gpu/nvidia-gpu-device-plugin.yaml.tmpl", "deploy/addons/gpu/nvidia-gpu-device-plugin.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"nvidia-gpu-device-plugin.yaml", "nvidia-gpu-device-plugin.yaml",
"0640", "0640",
true), true),
}, false, "nvidia-gpu-device-plugin"), }, false, "nvidia-gpu-device-plugin", "kube-system"),
"logviewer": NewAddon([]*BinAsset{ "logviewer": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/logviewer/logviewer-dp-and-svc.yaml.tmpl", "deploy/addons/logviewer/logviewer-dp-and-svc.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"logviewer-dp-and-svc.yaml", "logviewer-dp-and-svc.yaml",
"0640", "0640",
false), false),
MustBinAsset( MustBinAsset(
"deploy/addons/logviewer/logviewer-rbac.yaml.tmpl", "deploy/addons/logviewer/logviewer-rbac.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"logviewer-rbac.yaml", "logviewer-rbac.yaml",
"0640", "0640",
false), false),
}, false, "logviewer"), }, false, "logviewer", "kube-system"),
"gvisor": NewAddon([]*BinAsset{ "gvisor": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/gvisor/gvisor-pod.yaml.tmpl", "deploy/addons/gvisor/gvisor-pod.yaml.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"gvisor-pod.yaml", "gvisor-pod.yaml",
"0640", "0640",
true), true),
MustBinAsset( MustBinAsset(
"deploy/addons/gvisor/gvisor-runtimeclass.yaml", "deploy/addons/gvisor/gvisor-runtimeclass.yaml",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"gvisor-runtimeclass.yaml", "gvisor-runtimeclass.yaml",
"0640", "0640",
false), false),
@ -309,35 +306,40 @@ var Addons = map[string]*Addon{
constants.GvisorConfigTomlTargetName, constants.GvisorConfigTomlTargetName,
"0640", "0640",
true), true),
}, false, "gvisor"), }, false, "gvisor", "kube-system"),
"helm-tiller": NewAddon([]*BinAsset{ "helm-tiller": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/helm-tiller/helm-tiller-dp.tmpl", "deploy/addons/helm-tiller/helm-tiller-dp.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"helm-tiller-dp.yaml", "helm-tiller-dp.yaml",
"0640", "0640",
true), true),
MustBinAsset( MustBinAsset(
"deploy/addons/helm-tiller/helm-tiller-rbac.tmpl", "deploy/addons/helm-tiller/helm-tiller-rbac.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"helm-tiller-rbac.yaml", "helm-tiller-rbac.yaml",
"0640", "0640",
true), true),
MustBinAsset( MustBinAsset(
"deploy/addons/helm-tiller/helm-tiller-svc.tmpl", "deploy/addons/helm-tiller/helm-tiller-svc.tmpl",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"helm-tiller-svc.yaml", "helm-tiller-svc.yaml",
"0640", "0640",
true), true),
}, false, "helm-tiller"), }, false, "helm-tiller", "kube-system"),
"ingress-dns": NewAddon([]*BinAsset{ "ingress-dns": NewAddon([]*BinAsset{
MustBinAsset( MustBinAsset(
"deploy/addons/ingress-dns/ingress-dns-pod.yaml", "deploy/addons/ingress-dns/ingress-dns-pod.yaml",
vmpath.GuestAddonsDir, TargetDirForAddon("kube-system"),
"ingress-dns-pod.yaml", "ingress-dns-pod.yaml",
"0640", "0640",
false), false),
}, false, "ingress-dns"), }, false, "ingress-dns", "kube-system"),
}
// TargetDirForAddon appends the namespace as a directory to /etc/kubernetes/addons
func TargetDirForAddon(namespace string) string {
return filepath.Join(vmpath.GuestAddonsDir, namespace)
} }
// AddMinikubeDirAssets adds all addons and files to the list // AddMinikubeDirAssets adds all addons and files to the list