-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically apply CNI on multinode clusters #7930
Changes from 7 commits
f3d4db3
228c1b0
5848bbe
e2467b2
d637698
2d95ec9
747b18a
19705a4
17d7c2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ import ( | |
"os" | ||
|
||
"github.com/pkg/errors" | ||
"github.com/spf13/viper" | ||
|
||
"k8s.io/minikube/pkg/minikube/localpath" | ||
) | ||
|
@@ -200,3 +201,29 @@ func (c *simpleConfigLoader) WriteConfigToFile(profileName string, cc *ClusterCo | |
} | ||
return ioutil.WriteFile(path, contents, 0644) | ||
} | ||
|
||
// MultiNodeCNIConfig add default CNI config needed for multinode clusters and saves off the config | ||
func MultiNodeCNIConfig(cc *ClusterConfig) error { | ||
if cc.KubernetesConfig.ExtraOptions.Get("pod-network-cidr", "kubeadm") == "" { | ||
tstromberg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fmt.Println("SETTING CNI CONFIG") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove deubbing there too. |
||
cc.KubernetesConfig.NetworkPlugin = "cni" | ||
if err := cc.KubernetesConfig.ExtraOptions.Set(fmt.Sprintf("kubeadm.pod-network-cidr=%s", DefaultPodCIDR)); err != nil { | ||
return err | ||
} | ||
return SaveProfile(cc.Name, cc) | ||
} | ||
return nil | ||
} | ||
|
||
// MultiNode returns true if the cluster | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. finish comment... :) |
||
func MultiNode(cc ClusterConfig) bool { | ||
if len(cc.Nodes) > 1 { | ||
return true | ||
} | ||
|
||
if viper.GetInt("nodes") > 1 { | ||
return true | ||
} | ||
|
||
return false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ import ( | |
"strings" | ||
|
||
"github.com/golang/glog" | ||
"k8s.io/minikube/pkg/drivers/kic" | ||
"k8s.io/minikube/pkg/minikube/config" | ||
"k8s.io/minikube/pkg/minikube/registry" | ||
) | ||
|
@@ -163,9 +162,9 @@ func FlagDefaults(name string) FlagHints { | |
fh := FlagHints{} | ||
if name != None { | ||
fh.CacheImages = true | ||
// only for kic, till other run-times are available we auto-set containerd. | ||
// only for kic, until other runtimes are available we auto-set containerd. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this comment actually is no long true, we have other run-time,s we can just delete this comment. |
||
if name == Docker { | ||
fh.ExtraOptions = append(fh.ExtraOptions, fmt.Sprintf("kubeadm.pod-network-cidr=%s", kic.DefaultPodCIDR)) | ||
fh.ExtraOptions = append(fh.ExtraOptions, fmt.Sprintf("kubeadm.pod-network-cidr=%s", config.DefaultPodCIDR)) | ||
} | ||
return fh | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove debugging.