nutanix

package
v1.4.17 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 18 Imported by: 16

Documentation

Overview

Package nutanix contains Nutanix-specific structures for installer configuration and management.

Index

Constants

View Source
const (

	// CategoryValueOwned is the category value representing owned by the cluster.
	CategoryValueOwned = "owned"
	// CategoryValueShared is the category value representing shared by the cluster.
	CategoryValueShared = "shared"
)
View Source
const CredentialsSecretName = "nutanix-credentials"

CredentialsSecretName is the default nutanix credentials secret name.

View Source
const Name = "nutanix"

Name is the platform in the package

Variables

This section is empty.

Functions

func BootISOImageName

func BootISOImageName(infraID string) string

BootISOImageName is the image name for Bootstrap node for a given infraID.

func BootISOImagePath

func BootISOImagePath(path, infraID string) string

BootISOImagePath is the image path for Bootstrap node for a given infraID and path.

func CategoryKey added in v0.90.0

func CategoryKey(infraID string) string

CategoryKey returns the cluster specific category key name.

func CreateBootstrapISO

func CreateBootstrapISO(infraID, userData string) (string, error)

CreateBootstrapISO creates a ISO for the bootstrap node.

func CreateNutanixClient

func CreateNutanixClient(ctx context.Context, prismCentral, port, username, password string) (*nutanixclientv3.Client, error)

CreateNutanixClient creates a Nutanix V3 Client.

func CreateNutanixClientFromPlatform

func CreateNutanixClientFromPlatform(platform *Platform) (*nutanixclientv3.Client, error)

CreateNutanixClientFromPlatform creates a Nutanix V3 clinet based on the platform configuration.

func FindImageUUIDByName added in v0.90.17

func FindImageUUIDByName(ctx context.Context, ntnxclient *nutanixclientv3.Client, imageName string) (*string, error)

FindImageUUIDByName retrieves the image resource uuid by the given image name from PC.

func GetGPUFromList added in v0.90.17

func GetGPUFromList(ctx context.Context, client *nutanixclientv3.Client, gpu machinev1.NutanixGPU, gpuDevices []*nutanixclientv3.GPU) (*nutanixclientv3.VMGpu, error)

GetGPUFromList returns the VMGpu matching the input reqirements from the provided list of GPU devices.

func GetGPUList added in v0.90.17

func GetGPUList(ctx context.Context, client *nutanixclientv3.Client, gpus []machinev1.NutanixGPU, peUUID string) ([]*nutanixclientv3.VMGpu, error)

GetGPUList returns a list of VMGpus for the given list of GPU identifiers in the Prism Element (uuid).

func GetGPUsForPE added in v0.90.17

func GetGPUsForPE(ctx context.Context, client *nutanixclientv3.Client, peUUID string) ([]*nutanixclientv3.GPU, error)

GetGPUsForPE returns all the GPU devices for the given Prism Element (uuid).

func RHCOSImageName

func RHCOSImageName(infraID string) string

RHCOSImageName is the unique image name for a given cluster.

func WaitForTask

func WaitForTask(clientV3 nutanixclientv3.Service, taskUUID string) error

WaitForTask waits until a queued task has been finished or timeout has been reached.

func WaitForTasks

func WaitForTasks(clientV3 nutanixclientv3.Service, taskUUIDs []string) error

WaitForTasks is a wrapper for WaitForTask.

Types

type DataDisk added in v0.90.17

type DataDisk struct {
	// diskSize is size (in Quantity format) of the disk to attach to the VM.
	// See https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Format for the Quantity format and example documentation.
	// The minimum diskSize is 1GB.
	// +kubebuilder:validation:Required
	DiskSize resource.Quantity `json:"diskSize"`

	// deviceProperties are the properties of the disk device.
	// +optional
	DeviceProperties *machinev1.NutanixVMDiskDeviceProperties `json:"deviceProperties,omitempty"`

	// storageConfig are the storage configuration parameters of the VM disks.
	// +optional
	StorageConfig *StorageConfig `json:"storageConfig,omitempty"`

	// dataSource refers to a data source image for the VM disk.
	// +optional
	DataSourceImage *StorageResourceReference `json:"dataSourceImage,omitempty"`
}

DataDisk defines a data disk for a Machine VM.

type FailureDomain added in v0.9.153

type FailureDomain struct {
	// Name defines the unique name of a failure domain.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=64
	// +kubebuilder:validation:Pattern=`^[0-9A-Za-z_.-@/]+$`
	Name string `json:"name"`

	// prismElement holds the identification (name, uuid) and the optional endpoint address and port of the Nutanix Prism Element.
	// When a cluster-wide proxy is installed, by default, this endpoint will be accessed via the proxy.
	// Should you wish for communication with this endpoint not to be proxied, please add the endpoint to the
	// proxy spec.noProxy list.
	// +kubebuilder:validation:Required
	PrismElement PrismElement `json:"prismElement"`

	// SubnetUUIDs identifies the network subnets of the Prism Element.
	// Currently we only support one subnet for a failure domain.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +listType=set
	SubnetUUIDs []string `json:"subnetUUIDs"`

	// StorageContainers identifies the storage containers in the Prism Element.
	// +optional
	StorageContainers []StorageResourceReference `json:"storageContainers,omitempty"`

	// DataSourceImages identifies the datasource images in the Prism Element.
	// +optional
	DataSourceImages []StorageResourceReference `json:"dataSourceImages,omitempty"`
}

FailureDomain configures failure domain information for the Nutanix platform.

type MachinePool

type MachinePool struct {
	// NumCPUs is the total number of virtual processor cores to assign a vm.
	//
	// +optional
	NumCPUs int64 `json:"cpus,omitempty"`

	// NumCoresPerSocket is the number of cores per socket in a vm. The number
	// of vCPUs on the vm will be NumCPUs times NumCoresPerSocket.
	// For example: 4 CPUs and 4 Cores per socket will result in 16 VPUs.
	// The AHV scheduler treats socket and core allocation exactly the same
	// so there is no benefit to configuring cores over CPUs.
	//
	// +optional
	NumCoresPerSocket int64 `json:"coresPerSocket,omitempty"`

	// Memory is the size of a VM's memory in MiB.
	//
	// +optional
	MemoryMiB int64 `json:"memoryMiB,omitempty"`

	// OSDisk defines the storage for instance.
	//
	// +optional
	OSDisk `json:"osDisk,omitempty"`

	// BootType indicates the boot type (Legacy, UEFI or SecureBoot) the Machine's VM uses to boot.
	// If this field is empty or omitted, the VM will use the default boot type "Legacy" to boot.
	// "SecureBoot" depends on "UEFI" boot, i.e., enabling "SecureBoot" means that "UEFI" boot is also enabled.
	// +kubebuilder:validation:Enum="";Legacy;UEFI;SecureBoot
	// +optional
	BootType machinev1.NutanixBootType `json:"bootType,omitempty"`

	// Project optionally identifies a Prism project for the Machine's VM to associate with.
	// +optional
	Project *machinev1.NutanixResourceIdentifier `json:"project,omitempty"`

	// Categories optionally adds one or more prism categories (each with key and value) for
	// the Machine's VM to associate with. All the category key and value pairs specified must
	// already exist in the prism central.
	// +listType=map
	// +listMapKey=key
	// +optional
	Categories []machinev1.NutanixCategory `json:"categories,omitempty"`

	// GPUs is a list of GPU devices to attach to the machine's VM.
	// +listType=set
	// +optional
	GPUs []machinev1.NutanixGPU `json:"gpus"`

	// DataDisks holds information of the data disks to attach to the Machine's VM
	// +listType=set
	// +optional
	DataDisks []DataDisk `json:"dataDisks"`

	// FailureDomains optionally configures a list of failure domain names
	// that will be applied to the MachinePool
	// +listType=set
	// +optional
	FailureDomains []string `json:"failureDomains,omitempty"`
}

MachinePool stores the configuration for a machine pool installed on Nutanix.

func (*MachinePool) Set

func (p *MachinePool) Set(required *MachinePool)

Set sets the values from `required` to `p`.

func (*MachinePool) ValidateConfig

func (p *MachinePool) ValidateConfig(platform *Platform, role string) error

ValidateConfig validates the MachinePool configuration.

type Metadata

type Metadata struct {
	// PrismCentral is the domain name or IP address of the Prism Central.
	PrismCentral string `json:"prismCentral"`
	// Username is the name of the user to use to connect to the Prism Central.
	Username string `json:"username"`
	// Password is the password for the user to use to connect to the Prism Central.
	Password string `json:"password"`
	// Port is the port used to connect to the Prism Central.
	Port string `json:"port"`
}

Metadata contains Nutanix metadata (e.g. for uninstalling the cluster).

type OSDisk

type OSDisk struct {
	// DiskSizeGiB defines the size of disk in GiB.
	//
	// +optional
	DiskSizeGiB int64 `json:"diskSizeGiB,omitempty"`
}

OSDisk defines the system disk for a Machine VM.

type Platform

type Platform struct {
	// PrismCentral is the endpoint (address and port) and credentials to
	// connect to the Prism Central.
	// This serves as the default Prism-Central.
	PrismCentral PrismCentral `json:"prismCentral"`

	// PrismElements holds a list of Prism Elements (clusters). A Prism Element encompasses all Nutanix resources (VMs, subnets, etc.)
	// used to host the OpenShift cluster. Currently only a single Prism Element may be defined.
	// This serves as the default Prism-Element.
	PrismElements []PrismElement `json:"prismElements"`

	// ClusterOSImage overrides the url provided in rhcos.json to download the RHCOS Image.
	//
	// +optional
	ClusterOSImage string `json:"clusterOSImage,omitempty"`

	// DeprecatedAPIVIP is the virtual IP address for the api endpoint
	// Deprecated: use APIVIPs
	//
	// +kubebuilder:validation:format=ip
	// +optional
	DeprecatedAPIVIP string `json:"apiVIP,omitempty"`

	// APIVIPs contains the VIP(s) for the api endpoint. In dual stack clusters
	// it contains an IPv4 and IPv6 address, otherwise only one VIP
	//
	// +kubebuilder:validation:MaxItems=2
	// +kubebuilder:validation:UniqueItems=true
	// +kubebuilder:validation:Format=ip
	// +optional
	APIVIPs []string `json:"apiVIPs,omitempty"`

	// DeprecatedIngressVIP is the virtual IP address for ingress
	// Deprecated: use IngressVIPs
	//
	// +kubebuilder:validation:format=ip
	// +optional
	DeprecatedIngressVIP string `json:"ingressVIP,omitempty"`

	// IngressVIPs contains the VIP(s) for ingress. In dual stack clusters
	// it contains an IPv4 and IPv6 address, otherwise only one VIP
	//
	// +kubebuilder:validation:MaxItems=2
	// +kubebuilder:validation:UniqueItems=true
	// +kubebuilder:validation:Format=ip
	// +optional
	IngressVIPs []string `json:"ingressVIPs,omitempty"`

	// DefaultMachinePlatform is the default configuration used when
	// installing on Nutanix for machine pools which do not define their own
	// platform configuration.
	// +optional
	DefaultMachinePlatform *MachinePool `json:"defaultMachinePlatform,omitempty"`

	// SubnetUUIDs identifies the network subnets to be used by the cluster.
	// Currently we only support one subnet for an OpenShift cluster.
	SubnetUUIDs []string `json:"subnetUUIDs"`

	// LoadBalancer defines how the load balancer used by the cluster is configured.
	// LoadBalancer is available in TechPreview.
	// +optional
	LoadBalancer *configv1.NutanixPlatformLoadBalancer `json:"loadBalancer,omitempty"`

	// FailureDomains configures failure domains for the Nutanix platform.
	// +optional
	FailureDomains []FailureDomain `json:"failureDomains,omitempty"`
}

Platform stores any global configuration used for Nutanix platforms.

func (Platform) GetDataSourceImageFromFailureDomain added in v0.90.17

func (p Platform) GetDataSourceImageFromFailureDomain(fdName, dataSourceRefName string) (*StorageResourceReference, error)

GetDataSourceImageFromFailureDomain returns the datasource image configuration with the provided reference and failuer domain names. Returns nil and error if not found.

func (Platform) GetFailureDomainByName added in v0.9.153

func (p Platform) GetFailureDomainByName(fdName string) (*FailureDomain, error)

GetFailureDomainByName returns the NutanixFailureDomain pointer with the input name. Returns nil if not found.

func (Platform) GetStorageContainerFromFailureDomain added in v0.90.17

func (p Platform) GetStorageContainerFromFailureDomain(fdName, storageContainerRefName string) (*StorageResourceReference, error)

GetStorageContainerFromFailureDomain returns the storage container configuration with the provided reference and failuer domain names. Returns nil and error if not found.

type PrismCentral

type PrismCentral struct {
	// Endpoint holds the address and port of the Prism Central
	Endpoint PrismEndpoint `json:"endpoint"`

	// Username is the name of the user to connect to the Prism Central
	Username string `json:"username"`

	// Password is the password for the user to connect to the Prism Central
	Password string `json:"password"`
}

PrismCentral holds the endpoint and credentials data used to connect to the Prism Central

type PrismElement

type PrismElement struct {
	// UUID is the UUID of the Prism Element (cluster)
	UUID string `json:"uuid"`

	// Endpoint holds the address and port of the Prism Element
	// +optional
	Endpoint PrismEndpoint `json:"endpoint,omitempty"`

	// Name is prism endpoint Name
	Name string `json:"name,omitempty"`
}

PrismElement holds the uuid, endpoint of the Prism Element (cluster)

type PrismEndpoint

type PrismEndpoint struct {
	// address is the endpoint address (DNS name or IP address) of the Nutanix Prism Central or Element (cluster)
	Address string `json:"address"`

	// port is the port number to access the Nutanix Prism Central or Element (cluster)
	Port int32 `json:"port"`
}

PrismEndpoint holds the endpoint address and port to access the Nutanix Prism Central or Element (cluster)

type StorageConfig added in v0.90.17

type StorageConfig struct {
	// diskMode specifies the disk mode.
	// The valid values are Standard and Flash, and the default is Standard.
	// +kubebuilder:default=Standard
	// +kubebuilder:validation:Enum=Standard;Flash
	DiskMode machinev1.NutanixDiskMode `json:"diskMode"`

	// storageContainer refers to the storage_container used by the VM disk.
	// +optional
	StorageContainer *StorageResourceReference `json:"storageContainer,omitempty"`
}

StorageConfig specifies the storage configuration parameters for VM disks.

type StorageResourceReference added in v0.90.17

type StorageResourceReference struct {
	// ReferenceName is the identifier of the storage resource configured in the FailureDomain.
	// +optional
	ReferenceName string `json:"referenceName,omitempty"`

	// UUID is the UUID of the storage container resource in the Prism Element.
	// +kubebuilder:validation:Required
	UUID string `json:"uuid"`

	// Name is the name of the storage container resource in the Prism Element.
	// +optional
	Name string `json:"name,omitempty"`
}

StorageResourceReference holds reference information of a storage resource (storage container, data source image, etc.)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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