cluster

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: 24 Imported by: 0

Documentation

Overview

Package cluster defines the 'create cluster' command.

The command deals with a few delicacies/spiecialties:

  • Cluster spec details, e. g. which instance type to use for workers, can be specified by the user, but don't have to. The backend will fill in missing details using defaulting.
  • Cluster spec details can be provided either using command line flags or by passing a YAML definition. When passing a YAML definition, some attributes from that definition can even be overridden using flags.
  • On AWS and Azure, starting from a certain release version, clusters will have node pools and will be created using the v5 API endpoint. On other providers as well as on AWS for older releases, the v4 API endpoint has to be used.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Command performs the "create cluster" function
	Command = &cobra.Command{
		Use:   "cluster",
		Short: "Create cluster",
		Long: `Creates a new workload cluster.

You can specify a few cluster attributes like name, owner and workload cluster
release using command line flags. Additional attributes, e. g. regarding the
worker node specification and for the use of availability zones, can be added
using a YAML definition file.

For details about the cluster definition YAML format, see

  https://docs.giantswarm.io/ui-api/gsctl/cluster-definition/

Note that you can also use command line flags to override some settings
from the YAML definition.

Defaults
--------

All parameters you don't set explicitly will be set using defaults. You can
get some information on these defaults using the 'gsctl info' command, as they
might be specific for the installation you are working with. Here are some
general defaults:

- Release: the latest workload cluster release for the given provider (AWS,
  Azure, or on-premises/KVM) is used.
- Worker nodes
  - On AWS and Azure, when using the latest workload cluster release, and when not
    specifying node pool details via a cluster definition, the cluster will be
	created with a default node pool. You may define node pools in your cluster
	definition YAML or add node pools one by one using 'gsctl create nodepool'.
  - On AWS and Azure with releases prior to node pools, and with KVM, the
    cluster will have three worker nodes by default.
  - Where autoscaling and node pools are available AWS, Azure), node pools will
    have a scaling range of min=3, max=10 configured by default.
  - All worker nodes will be in the same availability zone.
  - The cluster will have a generic name which can be changed later.

Examples:

  gsctl create cluster --owner acme

  gsctl create cluster --owner acme --name "Production Cluster"

  gsctl create cluster --file ./cluster.yaml

  gsctl create cluster --file ./staging-cluster.yaml \
    --owner acme --name Staging

  cat my-cluster.yaml | gsctl create cluster -f -

With Bash and other compatible shells, the syntax shown below can be used to
create a YAML defininition and pass it to the command in one go, without the
need for a file:

gsctl create cluster -f - <<EOF
owner: acme
name: Test cluster using two AZs
release_version: 14.0.0
availability_zones: 2
EOF

For clusters with node pool support, gsctl automatically creates a node pool
using default settings, if you don't specify your own node pools. You can
suppress the creation of the default node pool by setting the flag
--create-default-nodepool to false. Example:

  gsctl create cluster \
    --owner acme \
    --create-default-nodepool=false
`,
		PreRun: printValidation,
		Run:    printResult,
	}
)

Functions

func IsHAMastersNotSupported

func IsHAMastersNotSupported(err error) bool

IsHAMastersNotSupported asserts haMastersNotSupportedError.

func IsInvalidDefinitionYAML

func IsInvalidDefinitionYAML(err error) bool

IsInvalidDefinitionYAML asserts invalidDefinitionYAMLError.

func IsInvalidV5DefinitionYAML

func IsInvalidV5DefinitionYAML(err error) bool

IsInvalidV5DefinitionYAML asserts invalidV4DefinitionYAMLError.

func IsMustProvideSingleMasterType

func IsMustProvideSingleMasterType(err error) bool

IsMustProvideSingleMasterType asserts mustProvideSingleMasterTypeError.

func IsUnmashalToMapFailed

func IsUnmashalToMapFailed(err error) bool

IsUnmashalToMapFailed asserts unmashalToMapFailedError.

Types

type Arguments

type Arguments struct {
	APIEndpoint           string
	AuthToken             string
	CreateDefaultNodePool bool
	ClusterName           string
	FileSystem            afero.Fs
	InputYAMLFile         string
	Owner                 string
	ReleaseVersion        string
	Scheme                string
	MasterHA              *bool
	UserProvidedToken     string
	Verbose               bool
	OutputFormat          string
}

Arguments contains all possible input parameter needed (and optionally available) for creating a cluster.

type JSONOutput

type JSONOutput struct {
	// ID of the cluster
	ID string `json:"id,omitempty"`
	// Result of the command. should be 'created'
	Result string `json:"result"`
	// Error which occured
	Error error `json:"error,omitempty"`
}

JSONOutput contains the fields included in JSON output of the create cluster command when called with json output flag

Jump to

Keyboard shortcuts

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