machine

package
v0.9.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoOpInvalidMachinesHandler = func(machines []*clusterv1.Machine, errors field.ErrorList) ([]*clusterv1.Machine, error) {
	return nil, nil
}

NoOpInvalidMachinesHandler does nothing when an invalid machines manifest is being provided.

Functions

func FirstMaster

FirstMaster scans the provided array of machines and return the first one which is a "Master" or nil if none. Machines and ExistingInfraMachines must be in the same order

func GetKubernetesNamespaceFromMachines

func GetKubernetesNamespaceFromMachines(ctx context.Context, c client.Client) (string, error)

GetKubernetesNamespaceFromMachines reads the namespace of the Kubernetes control plane from the applied machines. If no namespace is found, the default Kubernetes namespace will be returned.

func GetKubernetesVersion

func GetKubernetesVersion(machine *clusterv1.Machine) string

GetKubernetesVersion reads the Kubernetes version of the provided machine, or if missing, returns the default version.

func GetKubernetesVersionFromManifest

func GetKubernetesVersionFromManifest(machinesManifestPath string) (string, string, error)

GetKubernetesVersionFromManifest reads the version of the Kubernetes control plane from the provided machines' manifest. If no version is configured, the default Kubernetes version will be returned.

func GetKubernetesVersionFromMasterIn

func GetKubernetesVersionFromMasterIn(machines []*clusterv1.Machine, bl []*existinginfrav1.ExistingInfraMachine) (string, string, error)

GetKubernetesVersionFromMasterIn reads the version of the Kubernetes control plane from the provided machines. If no version is configured, the default Kubernetes version will be returned.

func GetMachinesManifest

func GetMachinesManifest(path string) (string, error)

GetMachinesManifest reads a manifest from the filesystem and updates it with generated names (see: UpdateWithGeneratedNames)

func IsMaster

func IsMaster(machine *clusterv1.Machine) bool

IsMaster returns true if the provided machine is a "Master", and false if it is a "Node" (i.e. worker node) or any other type of machine.

func IsNode

func IsNode(machine *clusterv1.Machine) bool

IsNode returns false if the provided machine is a "Master", and true if it is a "Node" (i.e. worker node) or any other type of machine.

func Parse

Parse parses the provided machines io.Reader.

func ParseAndDefaultAndValidate

func ParseAndDefaultAndValidate(machinesManifestPath string, errorsHandler InvalidMachinesHandler) ([]*clusterv1.Machine, []*existinginfrav1.ExistingInfraMachine, error)

ParseAndDefaultAndValidate parses the provided manifest, validates it and defaults values where possible.

func ParseManifest

func ParseManifest(file string) (ml []*clusterv1.Machine, bl []*existinginfrav1.ExistingInfraMachine, err error)

ParseManifest parses the provided machines manifest file.

func Populate

func Populate(machines []*clusterv1.Machine)

Populate mutates the machines manifests:

  • fill in default values

func UpdateWithGeneratedNames

func UpdateWithGeneratedNames(r io.ReadCloser) (string, error)

UpdateWithGeneratedNames generates names for machines, rather than using Kubernetes "generateName". This is necessary as:

  • one can only "kubectl create" manifests with "generateName" fields, not "kubectl apply" them,
  • WKS needs to be as idempotent as possible.

Note that if the customer updates the manifest with their own names, we'll honor those.

func Validate

Validate validates the provided machines.

func WriteMachines added in v0.10.0

func WriteMachines(w io.Writer, machines []*clusterv1.Machine, bml []*existinginfrav1.ExistingInfraMachine) error

Types

type InvalidMachinesHandler

type InvalidMachinesHandler = func(machines []*clusterv1.Machine, bl []*existinginfrav1.ExistingInfraMachine, errors field.ErrorList) ([]*clusterv1.Machine, []*existinginfrav1.ExistingInfraMachine, error)

InvalidMachinesHandler encapsulates logic to apply in case of an invalid machines manifest being provided.

Jump to

Keyboard shortcuts

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