Address lint comments, remove confusing multi-runner API
parent
521d334b6a
commit
2a39d993ea
|
@ -133,8 +133,8 @@ func initMinikubeFlags() {
|
||||||
startCmd.Flags().StringArrayVar(&config.AddonList, "addons", nil, "Enable addons. see `minikube addons list` for a list of valid addon names.")
|
startCmd.Flags().StringArrayVar(&config.AddonList, "addons", nil, "Enable addons. see `minikube addons list` for a list of valid addon names.")
|
||||||
startCmd.Flags().String(criSocket, "", "The cri socket path to be used.")
|
startCmd.Flags().String(criSocket, "", "The cri socket path to be used.")
|
||||||
startCmd.Flags().String(networkPlugin, "", "Kubelet network plug-in to use (default: auto)")
|
startCmd.Flags().String(networkPlugin, "", "Kubelet network plug-in to use (default: auto)")
|
||||||
startCmd.Flags().Bool(enableDefaultCNI, false, "DEPRECATED: Replaced by --cni=custom")
|
startCmd.Flags().Bool(enableDefaultCNI, false, "DEPRECATED: Replaced by --cni=bridge")
|
||||||
startCmd.Flags().String(cniFlag, "", "CNI plug-in to use. Valid options: auto, calico, custom, flannel, kindnet (default: auto)")
|
startCmd.Flags().String(cniFlag, "", "CNI plug-in to use. Valid options: auto, bridge, flannel, kindnet, or path to a CNI manifest (default: auto)")
|
||||||
startCmd.Flags().StringSlice(waitComponents, kverify.DefaultWaitList, fmt.Sprintf("comma separated list of Kubernetes components to verify and wait for after starting a cluster. defaults to %q, available options: %q . other acceptable values are 'all' or 'none', 'true' and 'false'", strings.Join(kverify.DefaultWaitList, ","), strings.Join(kverify.AllComponentsList, ",")))
|
startCmd.Flags().StringSlice(waitComponents, kverify.DefaultWaitList, fmt.Sprintf("comma separated list of Kubernetes components to verify and wait for after starting a cluster. defaults to %q, available options: %q . other acceptable values are 'all' or 'none', 'true' and 'false'", strings.Join(kverify.DefaultWaitList, ","), strings.Join(kverify.AllComponentsList, ",")))
|
||||||
startCmd.Flags().Duration(waitTimeout, 6*time.Minute, "max time to wait per Kubernetes core services to be healthy.")
|
startCmd.Flags().Duration(waitTimeout, 6*time.Minute, "max time to wait per Kubernetes core services to be healthy.")
|
||||||
startCmd.Flags().Bool(nativeSSH, true, "Use native Golang SSH client (default true). Set to 'false' to use the command line 'ssh' command when accessing the docker machine. Useful for the machine drivers when they will not start with 'Waiting for SSH'.")
|
startCmd.Flags().Bool(nativeSSH, true, "Use native Golang SSH client (default true). Set to 'false' to use the command line 'ssh' command when accessing the docker machine. Useful for the machine drivers when they will not start with 'Waiting for SSH'.")
|
||||||
|
|
|
@ -277,7 +277,7 @@ func (k *Bootstrapper) applyCNI(cfg config.ClusterConfig) error {
|
||||||
|
|
||||||
out.T(out.CNI, "Configuring {{.name}} (Container Networking Interface) ...", out.V{"name": cnm.String()})
|
out.T(out.CNI, "Configuring {{.name}} (Container Networking Interface) ...", out.V{"name": cnm.String()})
|
||||||
|
|
||||||
if err := cnm.Apply(k.c, []cni.Runner{k.c}); err != nil {
|
if err := cnm.Apply(k.c); err != nil {
|
||||||
return errors.Wrap(err, "cni apply")
|
return errors.Wrap(err, "cni apply")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ package cni
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -68,13 +69,20 @@ func (c Bridge) netconf() (assets.CopyableFile, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply enables the CNI
|
// Apply enables the CNI
|
||||||
func (c Bridge) Apply(_ Runner, nodes []Runner) error {
|
func (c Bridge) Apply(r Runner) error {
|
||||||
|
if len(c.cc.Nodes) > 1 {
|
||||||
|
return fmt.Errorf("bridge CNI is incompatible with multi-node clusters")
|
||||||
|
}
|
||||||
|
|
||||||
f, err := c.netconf()
|
f, err := c.netconf()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "netconf")
|
return errors.Wrap(err, "netconf")
|
||||||
}
|
}
|
||||||
|
|
||||||
return applyNetConf(nodes, f)
|
if err := r.Copy(f); err != nil {
|
||||||
|
return errors.Wrapf(err, "copy")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CIDR returns the default CIDR used by this CNI
|
// CIDR returns the default CIDR used by this CNI
|
||||||
|
|
|
@ -46,8 +46,8 @@ type Runner interface {
|
||||||
|
|
||||||
// Manager is a common interface for CNI
|
// Manager is a common interface for CNI
|
||||||
type Manager interface {
|
type Manager interface {
|
||||||
// Enable enables the CNI
|
// Apply a CNI. The provided runner is for the control plane
|
||||||
Apply(Runner, []Runner) error
|
Apply(Runner) error
|
||||||
|
|
||||||
// CIDR returns the default CIDR used by this CNI
|
// CIDR returns the default CIDR used by this CNI
|
||||||
CIDR() string
|
CIDR() string
|
||||||
|
@ -147,14 +147,3 @@ func applyManifest(cc config.ClusterConfig, r Runner, f assets.CopyableFile) err
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// applyNetConf applies a netconf file across nodes
|
|
||||||
func applyNetConf(rs []Runner, f assets.CopyableFile) error {
|
|
||||||
for _, r := range rs {
|
|
||||||
if err := r.Copy(f); err != nil {
|
|
||||||
return errors.Wrapf(err, "copy")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -51,13 +51,13 @@ func NewCustom(cc config.ClusterConfig, manifest string) (Custom, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply enables the CNI
|
// Apply enables the CNI
|
||||||
func (c Custom) Apply(master Runner, nodes []Runner) error {
|
func (c Custom) Apply(r Runner) error {
|
||||||
m, err := assets.NewFileAsset(c.manifest, path.Dir(manifestPath()), path.Base(manifestPath()), "0644")
|
m, err := assets.NewFileAsset(c.manifest, path.Dir(manifestPath()), path.Base(manifestPath()), "0644")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "manifest")
|
return errors.Wrap(err, "manifest")
|
||||||
}
|
}
|
||||||
|
|
||||||
return applyManifest(c.cc, master, m)
|
return applyManifest(c.cc, r, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CIDR returns the default CIDR used by this CNI
|
// CIDR returns the default CIDR used by this CNI
|
||||||
|
|
|
@ -33,7 +33,7 @@ func (c Disabled) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply enables the CNI
|
// Apply enables the CNI
|
||||||
func (c Disabled) Apply(master Runner, nodes []Runner) error {
|
func (c Disabled) Apply(r Runner) error {
|
||||||
if driver.IsKIC(c.cc.Driver) && c.cc.KubernetesConfig.ContainerRuntime != "docker" {
|
if driver.IsKIC(c.cc.Driver) && c.cc.KubernetesConfig.ContainerRuntime != "docker" {
|
||||||
glog.Warningf("CNI is recommended for %q driver and %q runtime - expect networking issues", c.cc.Driver, c.cc.KubernetesConfig.ContainerRuntime)
|
glog.Warningf("CNI is recommended for %q driver and %q runtime - expect networking issues", c.cc.Driver, c.cc.KubernetesConfig.ContainerRuntime)
|
||||||
}
|
}
|
||||||
|
|
|
@ -636,8 +636,8 @@ func (c Flannel) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply enables the CNI
|
// Apply enables the CNI
|
||||||
func (c Flannel) Apply(master Runner, nodes []Runner) error {
|
func (c Flannel) Apply(r Runner) error {
|
||||||
return applyManifest(c.cc, master, manifestAsset([]byte(flannelTmpl)))
|
return applyManifest(c.cc, r, manifestAsset([]byte(flannelTmpl)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CIDR returns the default CIDR used by this CNI
|
// CIDR returns the default CIDR used by this CNI
|
||||||
|
|
|
@ -167,12 +167,12 @@ func (c KindNet) manifest() (assets.CopyableFile, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply enables the CNI
|
// Apply enables the CNI
|
||||||
func (c KindNet) Apply(master Runner, nodes []Runner) error {
|
func (c KindNet) Apply(r Runner) error {
|
||||||
m, err := c.manifest()
|
m, err := c.manifest()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "manifest")
|
return errors.Wrap(err, "manifest")
|
||||||
}
|
}
|
||||||
return applyManifest(c.cc, master, m)
|
return applyManifest(c.cc, r, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CIDR returns the default CIDR used by this CNI
|
// CIDR returns the default CIDR used by this CNI
|
||||||
|
|
|
@ -191,7 +191,7 @@ func Start(starter Starter, apiServer bool) (*kubeconfig.Settings, error) {
|
||||||
return nil, errors.Wrap(err, "cni")
|
return nil, errors.Wrap(err, "cni")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cnm.Apply(cpr, []cni.Runner{cpr, starter.Runner}); err != nil {
|
if err := cnm.Apply(cpr); err != nil {
|
||||||
return nil, errors.Wrap(err, "cni apply")
|
return nil, errors.Wrap(err, "cni apply")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue