Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertProviderIDToUUID(providerID *string) string
- func ConvertUUIDToProviderID(uuid string) string
- func CreateCluster(clusterName string) *clusterv1.Cluster
- func CreateClusterContext(cluster *clusterv1.Cluster, vsphereCluster *infrav1.VSphereCluster) *vmware.ClusterContext
- func CreateMachine(machineName, clusterName, controlPlaneLabel, k8sVersion string) *clusterv1.Machine
- func CreateMachineContext(clusterContext *vmware.ClusterContext, machine *clusterv1.Machine, ...) *vmware.SupervisorMachineContext
- func CreateVSphereCluster(clusterName string) *infrav1.VSphereCluster
- func CreateVSphereMachine(machineName, clusterName, controlPlaneLabel, className, imageName, ... string) *infrav1.VSphereMachine
- func FetchControlPlaneOwnerObject(input FetchObjectInput) (ctrlclient.Object, error)
- func FetchMachineDeploymentOwnerObject(input FetchObjectInput) (ctrlclient.Object, error)
- func GetMachineMetadata(hostname string, vsphereVM infrav1.VSphereVM, ...) ([]byte, error)
- func GetMachinePreferredIPAddress(machine *infrav1.VSphereMachine) (string, error)
- func GetNCPVersion(ctx context.Context, controllerClient client.Client) (string, error)
- func GetNamespaceNetSnatIP(ctx context.Context, controllerClient client.Client, namespace string) (string, error)
- func GetOwnerVSphereMachine(ctx context.Context, c client.Client, obj metav1.ObjectMeta) (*infrav1.VSphereMachine, error)
- func GetVSphereClusterFromVMwareMachine(ctx context.Context, c client.Client, machine *vmwarev1b1.VSphereMachine) (*vmwarev1b1.VSphereCluster, error)
- func GetVSphereClusterFromVSphereMachine(ctx context.Context, c client.Client, machine *infrav1.VSphereMachine) (*infrav1.VSphereCluster, error)
- func GetVSphereMachine(ctx context.Context, controllerClient client.Client, ...) (*vmwarev1b1.VSphereMachine, error)
- func GetVSphereMachinesInCluster(ctx context.Context, controllerClient client.Client, ...) ([]*infrav1.VSphereMachine, error)
- func IsControlPlaneMachine(machine metav1.Object) bool
- func IsNotFoundError(err error) bool
- func IsSupervisorType(input interface{}) (bool, error)
- func MachinesAsString(machines []*clusterv1.Machine) string
- func NCPSupportFW(ctx context.Context, controllerClient client.Client) (bool, error)
- func NewKubeClient(ctx context.Context, controllerClient client.Client, ...) (kubernetes.Interface, error)
- func SanitizeHostInfoLabel(info string) string
- type FetchObjectInput
Constants ¶
const ( // ProviderIDPrefix is the string data prefixed to a BIOS UUID in order // to build a provider ID. ProviderIDPrefix = "vsphere://" // ProviderIDPattern is a regex pattern and is used by ConvertProviderIDToUUID // to convert a providerID into a UUID string. ProviderIDPattern = `(?i)^` + ProviderIDPrefix + `([a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12})$` // UUIDPattern is a regex pattern and is used by ConvertUUIDToProviderID // to convert a UUID into a providerID string. UUIDPattern = `(?i)^[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}$` )
const ( NCPSNATKey = "ncp/snat_ip" NCPVersionKey = "version" NCPNamespace = "vmware-system-nsx" NCPVersionConfigMap = "nsx-ncp-version-config" // 3.0.1 is where NCP starts to support "whitelist_source_ranges" specification in VNET and enforce FW rules on GC T1. NCPVersionSupportFW = "3.0.1" // 3.1.0 is where NCP stopped to support "whitelist_source_ranges" specification in VNET. NCPVersionSupportFWEnded = "3.1.0" EmptyAnnotationErrorMsg = "annotation not found" EmptyNCPSNATKeyMsg = NCPSNATKey + " key not found" )
Variables ¶
var ErrNoMachineIPAddr = errors.New("no IP addresses found for machine")
ErrNoMachineIPAddr indicates that no valid IP addresses were found in a machine context.
Functions ¶
func ConvertProviderIDToUUID ¶
ConvertProviderIDToUUID transforms a provider ID into a UUID string. If providerID is nil, empty, or invalid, then an empty string is returned. A valid providerID should adhere to the format specified by ProviderIDPattern.
func ConvertUUIDToProviderID ¶
ConvertUUIDToProviderID transforms a UUID string into a provider ID. If the supplied UUID is empty or invalid then an empty string is returned. A valid UUID should adhere to the format specified by UUIDPattern.
func CreateCluster ¶ added in v1.1.0
func CreateClusterContext ¶ added in v1.1.0
func CreateClusterContext(cluster *clusterv1.Cluster, vsphereCluster *infrav1.VSphereCluster) *vmware.ClusterContext
func CreateMachine ¶ added in v1.1.0
func CreateMachineContext ¶ added in v1.1.0
func CreateMachineContext(clusterContext *vmware.ClusterContext, machine *clusterv1.Machine, vsphereMachine *infrav1.VSphereMachine) *vmware.SupervisorMachineContext
func CreateVSphereCluster ¶ added in v1.1.0
func CreateVSphereCluster(clusterName string) *infrav1.VSphereCluster
func CreateVSphereMachine ¶ added in v1.1.0
func CreateVSphereMachine(machineName, clusterName, controlPlaneLabel, className, imageName, storageClass string) *infrav1.VSphereMachine
func FetchControlPlaneOwnerObject ¶ added in v1.3.2
func FetchControlPlaneOwnerObject(input FetchObjectInput) (ctrlclient.Object, error)
func FetchMachineDeploymentOwnerObject ¶ added in v1.3.2
func FetchMachineDeploymentOwnerObject(input FetchObjectInput) (ctrlclient.Object, error)
func GetMachineMetadata ¶
func GetMachineMetadata(hostname string, vsphereVM infrav1.VSphereVM, networkStatuses ...infrav1.NetworkStatus) ([]byte, error)
GetMachineMetadata returns the cloud-init metadata as a base-64 encoded string for a given VSphereMachine.
func GetMachinePreferredIPAddress ¶
func GetMachinePreferredIPAddress(machine *infrav1.VSphereMachine) (string, error)
GetMachinePreferredIPAddress returns the preferred IP address for a VSphereMachine resource.
func GetNCPVersion ¶ added in v1.1.0
GetNCPVersion finds out the running ncp's version from its configmap.
func GetNamespaceNetSnatIP ¶ added in v1.1.0
func GetNamespaceNetSnatIP(ctx context.Context, controllerClient client.Client, namespace string) (string, error)
GetNamespaceNetSnatIP finds out the namespace's corresponding network's SNAT IP.
func GetOwnerVSphereMachine ¶ added in v0.7.9
func GetOwnerVSphereMachine(ctx context.Context, c client.Client, obj metav1.ObjectMeta) (*infrav1.VSphereMachine, error)
func GetVSphereClusterFromVMwareMachine ¶ added in v1.3.2
func GetVSphereClusterFromVMwareMachine(ctx context.Context, c client.Client, machine *vmwarev1b1.VSphereMachine) (*vmwarev1b1.VSphereCluster, error)
GetVSphereClusterFromVMwareMachine gets the vmware.infrastructure.cluster.x-k8s.io.VSphereCluster resource for the given VSphereMachine. TODO (srm09): Rename this to a more appropriate name.
func GetVSphereClusterFromVSphereMachine ¶ added in v1.1.0
func GetVSphereClusterFromVSphereMachine(ctx context.Context, c client.Client, machine *infrav1.VSphereMachine) (*infrav1.VSphereCluster, error)
GetVSphereClusterFromVSphereMachine gets the infrastructure.cluster.x-k8s.io.VSphereCluster resource for the given VSphereMachine.
func GetVSphereMachine ¶
func GetVSphereMachine( ctx context.Context, controllerClient client.Client, namespace, machineName string) (*vmwarev1b1.VSphereMachine, error)
GetVSphereMachine gets a vmware.infrastructure.cluster.x-k8s.io.VSphereMachine resource for the given CAPI Machine.
func GetVSphereMachinesInCluster ¶
func GetVSphereMachinesInCluster( ctx context.Context, controllerClient client.Client, namespace, clusterName string) ([]*infrav1.VSphereMachine, error)
GetVSphereMachinesInCluster gets a cluster's VSphereMachine resources.
func IsControlPlaneMachine ¶
IsControlPlaneMachine returns true if the provided resource is a member of the control plane.
func IsNotFoundError ¶ added in v1.3.2
func IsSupervisorType ¶ added in v1.1.0
func MachinesAsString ¶ added in v1.0.2
MachinesAsString constructs a string (with correct punctuations) to be used in logging and error messages.
func NCPSupportFW ¶ added in v1.1.0
NCPSupportFW checks the version of running NCP and return true if it supports FW rule enforcement on GC T1 Router.
func NewKubeClient ¶
func NewKubeClient( ctx context.Context, controllerClient client.Client, cluster *clusterv1.Cluster) (kubernetes.Interface, error)
NewKubeClient returns a new client for the target cluster using the KubeConfig secret stored in the management cluster.
func SanitizeHostInfoLabel ¶ added in v1.3.5
SanitizeHostInfoLabel ensures that the ESXi host information passed as a parameter confirms to the label value constraints documented at https://k8s.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set
The expected inputs for the object are IP addresses or FQDNs of the ESXi hosts.
Types ¶
type FetchObjectInput ¶ added in v1.3.2
type FetchObjectInput struct { context.Context ctrlclient.Client Object ctrlclient.Object }