Add --container-runtime cli flag

This commit is contained in:
Ciprian Hacman 2019-12-21 14:31:29 +02:00
parent 6856358cd0
commit 8b15e5b03a
2 changed files with 10 additions and 0 deletions

View File

@ -81,6 +81,7 @@ type CreateClusterOptions struct {
EtcdStorageType string
Project string
KubernetesVersion string
ContainerRuntime string
OutDir string
Image string
VPCID string
@ -183,6 +184,8 @@ func (o *CreateClusterOptions) InitDefaults() {
o.AdminAccess = []string{"0.0.0.0/0"}
o.Authorization = AuthorizationFlagRBAC
o.ContainerRuntime = "docker"
}
var (
@ -298,6 +301,8 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
cmd.Flags().StringVar(&options.Project, "project", options.Project, "Project to use (must be set on GCE)")
cmd.Flags().StringVar(&options.KubernetesVersion, "kubernetes-version", options.KubernetesVersion, "Version of kubernetes to run (defaults to version in channel)")
cmd.Flags().StringVar(&options.ContainerRuntime, "container-runtime", options.ContainerRuntime, "Container runtime to use: containerd, docker")
cmd.Flags().StringVar(&sshPublicKey, "ssh-public-key", sshPublicKey, "SSH public key to use (defaults to ~/.ssh/id_rsa.pub on AWS)")
cmd.Flags().StringVar(&options.NodeSize, "node-size", options.NodeSize, "Set instance size for nodes")
@ -989,6 +994,10 @@ func RunCreateCluster(f *util.Factory, out io.Writer, c *CreateClusterOptions) e
cluster.Spec.KubernetesVersion = c.KubernetesVersion
}
if c.ContainerRuntime != "" {
cluster.Spec.ContainerRuntime = c.ContainerRuntime
}
cluster.Spec.Networking = &api.NetworkingSpec{}
switch c.Networking {
case "classic":

View File

@ -74,6 +74,7 @@ kops create cluster [flags]
--channel string Channel for default versions and configuration to use (default "stable")
--cloud string Cloud provider to use - gce, aws, vsphere, openstack
--cloud-labels string A list of KV pairs used to tag all instance groups in AWS (e.g. "Owner=John Doe,Team=Some Team").
--container-runtime string Container runtime to use: containerd, docker (default "docker")
--disable-subnet-tags Set to disable automatic subnet tagging
--dns string DNS hosted zone to use: public|private. (default "Public")
--dns-zone string DNS hosted zone to use (defaults to longest matching zone)