controllers

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNutanixClient

func CreateNutanixClient(ctx context.Context, secretInformer coreinformers.SecretInformer, cmInformer coreinformers.ConfigMapInformer, nutanixCluster *infrav1.NutanixCluster) (*nutanixClientV3.Client, error)

CreateNutanixClient creates a new Nutanix client from the environment

func CreateSystemDiskSpec added in v1.1.1

func CreateSystemDiskSpec(imageUUID string, systemDiskSize int64) (*nutanixClientV3.VMDisk, error)

func DeleteCategories added in v1.1.1

func DeleteCategories(ctx context.Context, client *nutanixClientV3.Client, categoryIdentifiers, obsoleteCategoryIdentifiers []*infrav1.NutanixCategoryIdentifier) error

DeleteCategories deletes the given list of categories

func DeleteVM added in v1.1.1

func DeleteVM(ctx context.Context, client *nutanixClientV3.Client, vmName, vmUUID string) (string, error)

DeleteVM deletes a VM and is invoked by the NutanixMachineReconciler

func FindVM added in v1.1.1

func FindVM(ctx context.Context, client *nutanixClientV3.Client, nutanixMachine *infrav1.NutanixMachine, vmName string) (*nutanixClientV3.VMIntentResponse, error)

FindVM retrieves the VM with the given uuid or name

func FindVMByName added in v1.1.1

func FindVMByName(ctx context.Context, client *nutanixClientV3.Client, vmName string) (*nutanixClientV3.VMIntentResponse, error)

FindVMByName retrieves the VM with the given vm name

func FindVMByUUID added in v1.1.1

FindVMByUUID retrieves the VM with the given vm UUID. Returns nil if not found

func GenerateProviderID added in v1.1.1

func GenerateProviderID(uuid string) string

GenerateProviderID generates a provider ID for the given resource UUID

func GetCategoryVMSpec added in v1.1.1

func GetCategoryVMSpec(ctx context.Context, client *nutanixClientV3.Client, categoryIdentifiers []*infrav1.NutanixCategoryIdentifier) (map[string]string, error)

GetCategoryVMSpec returns a flatmap of categories and their values

func GetDefaultCAPICategoryIdentifiers added in v1.1.1

func GetDefaultCAPICategoryIdentifiers(clusterName string) []*infrav1.NutanixCategoryIdentifier

GetDefaultCAPICategoryIdentifiers returns the default CAPI category identifiers

func GetFailureDomain added in v1.3.0

func GetFailureDomain(failureDomainName string, nutanixCluster *infrav1.NutanixCluster) (*infrav1.NutanixFailureDomain, error)

GetFailureDomain gets the failure domain with a given name from a NutanixCluster object.

func GetGPU added in v1.2.0

GetGPUDeviceID returns the device ID of a GPU with the given name

func GetGPUList added in v1.2.0

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

GetGPUList returns a list of GPU device IDs for the given list of GPUs

func GetGPUsForPE added in v1.2.0

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

func GetImageUUID added in v1.1.1

func GetImageUUID(ctx context.Context, client *nutanixClientV3.Client, imageName, imageUUID *string) (string, error)

GetImageUUID returns the UUID of the image with the given name

func GetMibValueOfQuantity added in v1.1.1

func GetMibValueOfQuantity(quantity resource.Quantity) int64

GetMibValueOfQuantity returns the given quantity value in Mib

func GetObsoleteDefaultCAPICategoryIdentifiers added in v1.2.0

func GetObsoleteDefaultCAPICategoryIdentifiers(clusterName string) []*infrav1.NutanixCategoryIdentifier

GetObsoleteDefaultCAPICategoryIdentifiers returns the default CAPI category identifiers

func GetOrCreateCategories added in v1.1.1

func GetOrCreateCategories(ctx context.Context, client *nutanixClientV3.Client, categoryIdentifiers []*infrav1.NutanixCategoryIdentifier) ([]*nutanixClientV3.CategoryValueStatus, error)

GetOrCreateCategories returns the list of category UUIDs for the given list of category names

func GetPEUUID added in v1.1.1

func GetPEUUID(ctx context.Context, client *nutanixClientV3.Client, peName, peUUID *string) (string, error)

GetPEUUID returns the UUID of the Prism Element cluster with the given name

func GetProjectUUID added in v1.1.1

func GetProjectUUID(ctx context.Context, client *nutanixClientV3.Client, projectName, projectUUID *string) (string, error)

GetProjectUUID returns the UUID of the project with the given name

func GetSubnetUUID added in v1.1.1

func GetSubnetUUID(ctx context.Context, client *nutanixClientV3.Client, peUUID string, subnetName, subnetUUID *string) (string, error)

GetSubnetUUID returns the UUID of the subnet with the given name

func GetSubnetUUIDList added in v1.1.1

func GetSubnetUUIDList(ctx context.Context, client *nutanixClientV3.Client, machineSubnets []infrav1.NutanixResourceIdentifier, peUUID string) ([]string, error)

GetSubnetUUIDList returns a list of subnet UUIDs for the given list of subnet names

func GetTaskUUIDFromVM added in v1.1.1

func GetTaskUUIDFromVM(vm *nutanixClientV3.VMIntentResponse) (string, error)

GetTaskUUIDFromVM returns the UUID of the task that created the VM with the given UUID

func GetVMUUID added in v1.1.1

func GetVMUUID(nutanixMachine *infrav1.NutanixMachine) (string, error)

GetVMUUID returns the UUID of the VM with the given name

func HasTaskInProgress added in v1.1.1

func HasTaskInProgress(ctx context.Context, client *nutanixClientV3.Client, taskUUID string) (bool, error)

HasTaskInProgress returns true if the given task is in progress

Types

type ControllerConfig added in v1.1.3

type ControllerConfig struct {
	MaxConcurrentReconciles int
}

ControllerConfig is the configuration for cluster and machine controllers

type ControllerConfigOpts added in v1.1.3

type ControllerConfigOpts func(*ControllerConfig) error

ControllerConfigOpts is a function that can be used to configure the controller config

func WithMaxConcurrentReconciles added in v1.1.3

func WithMaxConcurrentReconciles(max int) ControllerConfigOpts

WithMaxConcurrentReconciles sets the maximum number of concurrent reconciles

type NutanixClusterReconciler

type NutanixClusterReconciler struct {
	Client            client.Client
	SecretInformer    coreinformers.SecretInformer
	ConfigMapInformer coreinformers.ConfigMapInformer
	Scheme            *runtime.Scheme
	// contains filtered or unexported fields
}

NutanixClusterReconciler reconciles a NutanixCluster object

func NewNutanixClusterReconciler added in v1.1.1

func NewNutanixClusterReconciler(client client.Client, secretInformer coreinformers.SecretInformer, configMapInformer coreinformers.ConfigMapInformer, scheme *runtime.Scheme, copts ...ControllerConfigOpts) (*NutanixClusterReconciler, error)

func (*NutanixClusterReconciler) Reconcile

func (r *NutanixClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, reterr error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the NutanixCluster object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*NutanixClusterReconciler) SetupWithManager

func (r *NutanixClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the NutanixCluster controller with the Manager.

type NutanixMachineReconciler

type NutanixMachineReconciler struct {
	client.Client
	SecretInformer    coreinformers.SecretInformer
	ConfigMapInformer coreinformers.ConfigMapInformer
	Scheme            *runtime.Scheme
	// contains filtered or unexported fields
}

NutanixMachineReconciler reconciles a NutanixMachine object

func NewNutanixMachineReconciler added in v1.1.1

func NewNutanixMachineReconciler(client client.Client, secretInformer coreinformers.SecretInformer, configMapInformer coreinformers.ConfigMapInformer, scheme *runtime.Scheme, copts ...ControllerConfigOpts) (*NutanixMachineReconciler, error)

func (*NutanixMachineReconciler) GetSubnetAndPEUUIDs added in v1.3.0

func (r *NutanixMachineReconciler) GetSubnetAndPEUUIDs(rctx *nctx.MachineContext) (string, []string, error)

func (*NutanixMachineReconciler) Reconcile

func (r *NutanixMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, reterr error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the NutanixMachine object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile

func (*NutanixMachineReconciler) SetupWithManager

func (r *NutanixMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, copts ...ControllerConfigOpts) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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