Documentation ¶
Index ¶
- Variables
- func FirstMaster(machines []*clusterv1.Machine, bl []*baremetalspecv1.BareMetalMachine) (*clusterv1.Machine, *baremetalspecv1.BareMetalMachine)
- func GetKubernetesNamespaceFromMachines(ctx context.Context, c client.Client) (string, error)
- func GetKubernetesVersion(machine *clusterv1.Machine) string
- func GetKubernetesVersionFromManifest(machinesManifestPath string) (string, string, error)
- func GetKubernetesVersionFromMasterIn(machines []*clusterv1.Machine, bl []*baremetalspecv1.BareMetalMachine) (string, string, error)
- func GetMachinesManifest(path string) (string, error)
- func IsMaster(machine *clusterv1.Machine) bool
- func IsNode(machine *clusterv1.Machine) bool
- func Parse(r io.ReadCloser) (ml []*clusterv1.Machine, bl []*baremetalspecv1.BareMetalMachine, err error)
- func ParseAndDefaultAndValidate(machinesManifestPath string, errorsHandler InvalidMachinesHandler) ([]*clusterv1.Machine, []*baremetalspecv1.BareMetalMachine, error)
- func ParseManifest(file string) (ml []*clusterv1.Machine, bl []*baremetalspecv1.BareMetalMachine, err error)
- func Populate(machines []*clusterv1.Machine)
- func UpdateWithGeneratedNames(r io.ReadCloser) (string, error)
- func Validate(machines []*clusterv1.Machine, bl []*baremetalspecv1.BareMetalMachine) field.ErrorList
- func WriteMachines(w io.Writer, machines []*clusterv1.Machine, ...) error
- type InvalidMachinesHandler
Constants ¶
This section is empty.
Variables ¶
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 ¶
func FirstMaster(machines []*clusterv1.Machine, bl []*baremetalspecv1.BareMetalMachine) (*clusterv1.Machine, *baremetalspecv1.BareMetalMachine)
FirstMaster scans the provided array of machines and return the first one which is a "Master" or nil if none. Machines and BareMetalMachines must be in the same order
func GetKubernetesNamespaceFromMachines ¶
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 ¶
GetKubernetesVersion reads the Kubernetes version of the provided machine, or if missing, returns the default version.
func GetKubernetesVersionFromManifest ¶
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 []*baremetalspecv1.BareMetalMachine) (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 ¶
GetMachinesManifest reads a manifest from the filesystem and updates it with generated names (see: UpdateWithGeneratedNames)
func IsMaster ¶
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 ¶
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.ReadCloser) (ml []*clusterv1.Machine, bl []*baremetalspecv1.BareMetalMachine, err error)
Parse parses the provided machines io.Reader.
func ParseAndDefaultAndValidate ¶
func ParseAndDefaultAndValidate(machinesManifestPath string, errorsHandler InvalidMachinesHandler) ([]*clusterv1.Machine, []*baremetalspecv1.BareMetalMachine, error)
ParseAndDefaultAndValidate parses the provided manifest, validates it and defaults values where possible.
func ParseManifest ¶
func ParseManifest(file string) (ml []*clusterv1.Machine, bl []*baremetalspecv1.BareMetalMachine, err error)
ParseManifest parses the provided machines manifest file.
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 ¶
func Validate(machines []*clusterv1.Machine, bl []*baremetalspecv1.BareMetalMachine) field.ErrorList
Validate validates the provided machines.
func WriteMachines ¶ added in v0.10.0
func WriteMachines(w io.Writer, machines []*clusterv1.Machine, bml []*baremetalspecv1.BareMetalMachine) error
Types ¶
type InvalidMachinesHandler ¶
type InvalidMachinesHandler = func(machines []*clusterv1.Machine, bl []*baremetalspecv1.BareMetalMachine, errors field.ErrorList) ([]*clusterv1.Machine, []*baremetalspecv1.BareMetalMachine, error)
InvalidMachinesHandler encapsulates logic to apply in case of an invalid machines manifest being provided.