Skip to content
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

added ability to use preemptible vms in the node pool #2518

Merged
merged 3 commits into from Dec 18, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/jx/cmd/create_cluster_gke.go
Expand Up @@ -47,6 +47,7 @@ type CreateClusterGKEFlags struct {
Namespace string
Labels string
Scopes []string
Preemptible bool
}

const clusterListHeader = "PROJECT_ID"
Expand Down Expand Up @@ -112,6 +113,7 @@ func NewCmdCreateClusterGKE(f Factory, in terminal.FileReader, out terminal.File
cmd.Flags().BoolVarP(&options.Flags.SkipLogin, "skip-login", "", false, "Skip Google auth if already logged in via gcloud auth")
cmd.Flags().StringVarP(&options.Flags.Labels, "labels", "", "", "The labels to add to the cluster being created such as 'foo=bar,whatnot=123'. Label names must begin with a lowercase character ([a-z]), end with a lowercase alphanumeric ([a-z0-9]) with dashes (-), and lowercase alphanumeric ([a-z0-9]) between.")
cmd.Flags().StringArrayVarP(&options.Flags.Scopes, "scope", "", []string{}, "The OAuth scopes to be added to the cluster")
cmd.Flags().BoolVarP(&options.Flags.Preemptible, "preemptible", "", false, "Use preemptible VMs in the node-pool")

cmd.AddCommand(NewCmdCreateClusterGKETerraform(f, in, out, errOut))

Expand Down Expand Up @@ -257,6 +259,10 @@ func (o *CreateClusterGKEOptions) createClusterGKE() error {
args = append(args, fmt.Sprintf("--scopes=%s", strings.Join(o.Flags.Scopes, ",")))
}

if o.Flags.Preemptible {
args = append(args, "--preemptible")
}

labels := o.Flags.Labels
user, err := osUser.Current()
if err == nil && user != nil {
Expand Down