nodepool

package
v0.0.0-...-2caf503 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package nodepool implements the "create nodepool" command.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Command is the cobra command for 'gsctl create nodepool'
	Command = &cobra.Command{
		Use:     "nodepool <cluster-name/cluster-id>",
		Aliases: []string{"np"},

		Args:  cobra.ExactArgs(1),
		Short: "Create a node pool",
		Long: `Add a new node pool to a cluster.

This command allows to create a new node pool within a cluster. Node pools
are groups of worker nodes sharing a common configuration. Create different
node pools to serve workloads with different resource requirements, different
availability zone spreading etc. Node pools are also scaled independently.

Note that some attributes of node pools cannot be changed later. These are:

- ID - will be generated on creation
- Availability zone assignment
- Instance type used

When creating a node pool, all arguments (except for the cluster ID) are
optional. Where an argument is not given, a default will be applied as
follows:

- Name: will be "Unnamed node pool".
- Availability zones: the node pool will use 1 zone selected randomly.
- Instance type (AWS) / VM Size (Azure): the default machine type of the installation will be
  used. Check 'gsctl info' to find out what that is.
- Scaling settings: the minimum will be 3 and the maximum 10 nodes.

Examples:

  The simplest invocation creates a node pool with default attributes
  in the cluster specified.

    gsctl create nodepool f01r4

  We recommend to set a descriptive name, to tell the node pool apart
  from others.

    gsctl create nodepool f01r4  --name "Batch jobs"

  Assigning the node pool to availability zones can be done in several
  ways. If you only want to ensure that several zones are used, specify
  a number liker like this:

    gsctl create nodepool "Cluster name" --num-availability-zones 2

  To set one or several specific zones to use, give a list of zone names / letters (AWS), or a list of zone numbers (Azure).

  # AWS

    gsctl create nodepool f01r4 --availability-zones b,c,d

  # Azure

    gsctl create nodepool f01r4 --availability-zones 1,2,3

  Here is how you specify the instance type (AWS) to use:

    gsctl create nodepool "Cluster name" --aws-instance-type m4.2xlarge

  Here is how you specify the vm size (Azure) to use:

    gsctl create nodepool "Cluster name" --azure-vm-size Standard_D4s_v3

  # Node pool scaling:

  The initial node pool size is set by adjusting the lower and upper
  size limit like this:

    gsctl create nodepool f01r4 --nodes-min 3 --nodes-max 10

  # Spot instances:

  # AWS

  To use 50% spot instances in a node pool and making sure to always have
  three on-demand instances you can create your node pool like this:

    gsctl create nodepool f01r4 --nodes-min 3 --nodes-max 10 \
	  --aws-on-demand-base-capacity 3 \
	  --aws-spot-percentage 50

  To use similar instances in your node pool to the one that you defined
  you can create your node pool like this (the list is maintained by
  Giant Swarm for now eg. if you select m5.xlarge the node pool can fall
  back on m4.xlarge too):

    gsctl create nodepool f01r4 --aws-instance-type m4.xlarge \
	  --aws-use-alike-instance-types

  # Azure

  In order to use spot instances, specify the flag, like this:

  gsctl create nodepool f01r4 --azure-spot-instances

  Here is how you can set a maximum price that a single node pool
  VM instance can reach before it is deallocated:

  gsctl create nodepool f01r4 --azure-spot-instances --azure-spot-instances-max-price 0.00315

  By setting this value to '-1', the maximum price will be set
  to the on-demand price of the instance.

`,

		PreRun: printValidation,

		Run: printResult,
	}
)

Functions

func IsInvalidAvailabilityZones

func IsInvalidAvailabilityZones(err error) bool

IsInvalidAvailabilityZones asserts invalidAvailabilityZonesError.

Types

type Arguments

type Arguments struct {
	APIEndpoint                string
	AuthToken                  string
	AvailabilityZonesList      []string
	AvailabilityZonesNum       int
	MaxNumOfAvailabilityZones  int
	ClusterNameOrID            string
	VmSize                     string
	InstanceType               string
	UseAlikeInstanceTypes      bool
	OnDemandBaseCapacity       int64
	SpotPercentage             int64
	AzureSpotInstances         bool
	AzureSpotInstancesMaxPrice float64
	Name                       string
	Provider                   string
	ScalingMax                 int64
	ScalingMin                 int64
	ScalingMinSet              bool
	Scheme                     string
	UserProvidedToken          string
	Verbose                    bool
}

Arguments defines the arguments this command can take into consideration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL