machine

package
v0.8.5-rc.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2020 License: Apache-2.0 Imports: 21 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 Config

Config returns the provided machine's configuration.

func FirstMaster

func FirstMaster(machines []*clusterv1.Machine) *clusterv1.Machine

FirstMaster scans the provided array of machines and return the first one which is a "Master" or nil if none.

func FirstMasterInArray

func FirstMasterInArray(machines []clusterv1.Machine) *clusterv1.Machine

FirstMasterInArray scans the provided array of machines and return the first one which is a "Master" or nil if none.

func GetKubernetesNamespaceFromMachines

func GetKubernetesNamespaceFromMachines() (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, 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) (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

func Parse(r io.Reader) ([]*clusterv1.Machine, error)

Parse parses the provided machines io.Reader.

func ParseAndDefaultAndValidate

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

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

func ParseManifest

func ParseManifest(file string) ([]*clusterv1.Machine, 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(manifest string) (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

func Validate(machines []*clusterv1.Machine) field.ErrorList

Validate validates the provided machines.

Types

type InvalidMachinesHandler

type InvalidMachinesHandler = func(machines []*clusterv1.Machine, errors field.ErrorList) ([]*clusterv1.Machine, 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