Documentation
¶
Index ¶
- Constants
- Variables
- func ClusterToInfrastructureMapFunc(gvk schema.GroupVersionKind) handler.ToRequestsFunc
- func EnsureOwnerRef(ownerReferences []metav1.OwnerReference, ref metav1.OwnerReference) []metav1.OwnerReference
- func GetCRDWithContract(ctx context.Context, c client.Client, gvk schema.GroupVersionKind, ...) (*apiextensionsv1.CustomResourceDefinition, error)
- func GetClusterByName(ctx context.Context, c client.Client, namespace, name string) (*clusterv1.Cluster, error)
- func GetClusterFromMetadata(ctx context.Context, c client.Client, obj metav1.ObjectMeta) (*clusterv1.Cluster, error)
- func GetControlPlaneMachines(machines []*clusterv1.Machine) (res []*clusterv1.Machine)
- func GetControlPlaneMachinesFromList(machineList *clusterv1.MachineList) (res []*clusterv1.Machine)
- func GetMachineByName(ctx context.Context, c client.Client, namespace, name string) (*clusterv1.Machine, error)
- func GetMachineIfExists(c client.Client, namespace, name string) (*clusterv1.Machine, error)
- func GetMachinesForCluster(ctx context.Context, c client.Client, cluster *clusterv1.Cluster) (*clusterv1.MachineList, error)
- func GetOwnerCluster(ctx context.Context, c client.Client, obj metav1.ObjectMeta) (*clusterv1.Cluster, error)
- func GetOwnerMachine(ctx context.Context, c client.Client, obj metav1.ObjectMeta) (*clusterv1.Machine, error)
- func HasOwner(refList []metav1.OwnerReference, apiVersion string, kinds []string) bool
- func HasOwnerRef(ownerReferences []metav1.OwnerReference, ref metav1.OwnerReference) bool
- func IsControlPlaneMachine(machine *clusterv1.Machine) bool
- func IsNodeReady(node *v1.Node) bool
- func IsPaused(cluster *clusterv1.Cluster, v metav1.Object) bool
- func MachineToInfrastructureMapFunc(gvk schema.GroupVersionKind) handler.ToRequestsFunc
- func ModifyImageTag(imageName, tagName string) (string, error)
- func ObjectKey(object metav1.Object) client.ObjectKey
- func PointsTo(refs []metav1.OwnerReference, target *metav1.ObjectMeta) bool
- func Poll(interval, timeout time.Duration, condition wait.ConditionFunc) error
- func PollImmediate(interval, timeout time.Duration, condition wait.ConditionFunc) error
- func RandomString(n int) string
- func Retry(fn wait.ConditionFunc, initialBackoffSec int) error
- func UnstructuredUnmarshalField(obj *unstructured.Unstructured, v interface{}, fields ...string) error
- type KubeAwareAPIVersions
- type MachinesByCreationTimestamp
Constants ¶
const (
// CharSet defines the alphanumeric set for random string generation
CharSet = "0123456789abcdefghijklmnopqrstuvwxyz"
// MachineListFormatDeprecationMessage notifies the user that the old
// MachineList format is no longer supported
MachineListFormatDeprecationMessage = "Your MachineList items must include Kind and APIVersion"
)
Variables ¶
var (
ErrNoCluster = fmt.Errorf("no %q label present", clusterv1.ClusterLabelName)
ErrUnstructuredFieldNotFound = fmt.Errorf("field not found")
)
Functions ¶
func ClusterToInfrastructureMapFunc ¶
func ClusterToInfrastructureMapFunc(gvk schema.GroupVersionKind) handler.ToRequestsFunc
ClusterToInfrastructureMapFunc returns a handler.ToRequestsFunc that watches for Cluster events and returns reconciliation requests for an infrastructure provider object.
func EnsureOwnerRef ¶
func EnsureOwnerRef(ownerReferences []metav1.OwnerReference, ref metav1.OwnerReference) []metav1.OwnerReference
EnsureOwnerRef makes sure the slice contains the OwnerReference.
func GetCRDWithContract ¶ added in v0.3.0
func GetCRDWithContract(ctx context.Context, c client.Client, gvk schema.GroupVersionKind, contract string) (*apiextensionsv1.CustomResourceDefinition, error)
GetCRDWithContract retrieves a list of CustomResourceDefinitions from using controller-runtime Client, filtering with the `contract` label passed in. Returns the first CRD in the list that matches the GroupVersionKind, otherwise returns an error.
func GetClusterByName ¶
func GetClusterByName(ctx context.Context, c client.Client, namespace, name string) (*clusterv1.Cluster, error)
GetClusterByName finds and return a Cluster object using the specified params.
func GetClusterFromMetadata ¶
func GetClusterFromMetadata(ctx context.Context, c client.Client, obj metav1.ObjectMeta) (*clusterv1.Cluster, error)
GetClusterFromMetadata returns the Cluster object (if present) using the object metadata.
func GetControlPlaneMachines ¶
func GetControlPlaneMachines(machines []*clusterv1.Machine) (res []*clusterv1.Machine)
GetControlPlaneMachines returns a slice containing control plane machines.
func GetControlPlaneMachinesFromList ¶
func GetControlPlaneMachinesFromList(machineList *clusterv1.MachineList) (res []*clusterv1.Machine)
GetControlPlaneMachinesFromList returns a slice containing control plane machines.
func GetMachineByName ¶
func GetMachineByName(ctx context.Context, c client.Client, namespace, name string) (*clusterv1.Machine, error)
GetMachineByName finds and return a Machine object using the specified params.
func GetMachineIfExists ¶
func GetMachineIfExists(c client.Client, namespace, name string) (*clusterv1.Machine, error)
GetMachineIfExists gets a machine from the API server if it exists
func GetMachinesForCluster ¶ added in v0.3.0
func GetMachinesForCluster(ctx context.Context, c client.Client, cluster *clusterv1.Cluster) (*clusterv1.MachineList, error)
GetMachinesForCluster returns a list of machines associated with the cluster.
func GetOwnerCluster ¶
func GetOwnerCluster(ctx context.Context, c client.Client, obj metav1.ObjectMeta) (*clusterv1.Cluster, error)
GetOwnerCluster returns the Cluster object owning the current resource.
func GetOwnerMachine ¶
func GetOwnerMachine(ctx context.Context, c client.Client, obj metav1.ObjectMeta) (*clusterv1.Machine, error)
GetOwnerMachine returns the Machine object owning the current resource.
func HasOwner ¶
func HasOwner(refList []metav1.OwnerReference, apiVersion string, kinds []string) bool
HasOwner checks if any of the references in the passed list match the given apiVersion and one of the given kinds
func HasOwnerRef ¶
func HasOwnerRef(ownerReferences []metav1.OwnerReference, ref metav1.OwnerReference) bool
HasOwnerRef returns true if the OwnerReference is already in the slice.
func IsControlPlaneMachine ¶
func IsControlPlaneMachine(machine *clusterv1.Machine) bool
IsControlPlaneMachine checks machine is a control plane node.
func IsNodeReady ¶
func IsNodeReady(node *v1.Node) bool
IsNodeReady returns true if a node is ready.
func IsPaused ¶ added in v0.3.0
func IsPaused(cluster *clusterv1.Cluster, v metav1.Object) bool
IsPaused returns true if the Cluster is paused or the object has the `paused` annotation.
func MachineToInfrastructureMapFunc ¶
func MachineToInfrastructureMapFunc(gvk schema.GroupVersionKind) handler.ToRequestsFunc
MachineToInfrastructureMapFunc returns a handler.ToRequestsFunc that watches for Machine events and returns reconciliation requests for an infrastructure provider object.
func ModifyImageTag ¶ added in v0.3.0
func ModifyImageTag(imageName, tagName string) (string, error)
ModifyImageTag takes an imageName (e.g., registry/repo:tag), and returns an image name with updated tag
func ObjectKey ¶ added in v0.3.0
func ObjectKey(object metav1.Object) client.ObjectKey
ObjectKey returns client.ObjectKey for the object
func PointsTo ¶
func PointsTo(refs []metav1.OwnerReference, target *metav1.ObjectMeta) bool
PointsTo returns true if any of the owner references point to the given target
func PollImmediate ¶
func PollImmediate(interval, timeout time.Duration, condition wait.ConditionFunc) error
func RandomString ¶
func RandomString(n int) string
RandomString returns a random alphanumeric string.
func UnstructuredUnmarshalField ¶
func UnstructuredUnmarshalField(obj *unstructured.Unstructured, v interface{}, fields ...string) error
UnstructuredUnmarshalField is a wrapper around json and unstructured objects to decode and copy a specific field value into an object.
Types ¶
type KubeAwareAPIVersions ¶ added in v0.3.0
type KubeAwareAPIVersions []string
KubeAwareAPIVersions is a sortable slice of kube-like version strings.
Kube-like version strings are starting with a v, followed by a major version, optional "alpha" or "beta" strings followed by a minor version (e.g. v1, v2beta1). Versions will be sorted based on GA/alpha/beta first and then major and minor versions. e.g. v2, v1, v1beta2, v1beta1, v1alpha1.
type MachinesByCreationTimestamp ¶ added in v0.3.0
type MachinesByCreationTimestamp []*clusterv1.Machine
MachinesByCreationTimestamp sorts a list of Machine by creation timestamp, using their names as a tie breaker.
func (MachinesByCreationTimestamp) Len ¶ added in v0.3.0
func (o MachinesByCreationTimestamp) Len() int