vsphere

package
v1.4.21-pre Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: Apache-2.0 Imports: 24 Imported by: 4

Documentation

Overview

Package vsphere provides a cluster-destroyer for vsphere clusters

Package vsphere provides a cluster-destroyer for vsphere clusters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New returns an VSphere destroyer from ClusterMetadata.

Types

type API

type API interface {
	Logout()
	ListFolders(ctx context.Context, tagID string) ([]mo.Folder, error)
	ListVirtualMachines(ctx context.Context, tagID string) ([]mo.VirtualMachine, error)
	StopVirtualMachine(ctx context.Context, vmMO mo.VirtualMachine) error
	DeleteFolder(ctx context.Context, f mo.Folder) error
	DeleteVirtualMachine(ctx context.Context, vmMO mo.VirtualMachine) error
	DeleteStoragePolicy(ctx context.Context, policyName string) error
	DeleteTag(ctx context.Context, id string) error
	DeleteTagCategory(ctx context.Context, id string) error
	DeleteHostZoneObjects(ctx context.Context, infraID string) error
	DeleteCnsVolumes(ctx context.Context, volume cnstypes.CnsVolume) error
	GetCnsVolumes(ctx context.Context, infraID string) ([]cnstypes.CnsVolume, error)
	GetVCenterName() string
}

API represents the calls made to the API.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client makes calls to the Azure API.

func NewClient

func NewClient(vCenter, username, password string, logger logrus.FieldLogger) (*Client, error)

NewClient initializes a client. Logout() must be called when you are done with the client.

func (*Client) DeleteCnsVolumes

func (c *Client) DeleteCnsVolumes(ctx context.Context, volume cnstypes.CnsVolume) error

DeleteCnsVolumes deletes the CNS volume.

func (*Client) DeleteFolder

func (c *Client) DeleteFolder(ctx context.Context, f mo.Folder) error

DeleteFolder deletes a Folder.

func (*Client) DeleteHostZoneObjects

func (c *Client) DeleteHostZoneObjects(ctx context.Context, infraID string) error

DeleteHostZoneObjects removes from the vCenter cluster the associated OCP cluster's vm-host group (VirtualMachine) and the vm-host affinity rule.

func (*Client) DeleteStoragePolicy

func (c *Client) DeleteStoragePolicy(ctx context.Context, policyName string) error

DeleteStoragePolicy deletes a Storage Policy named `policyName`.

func (*Client) DeleteTag

func (c *Client) DeleteTag(ctx context.Context, id string) error

DeleteTag deletes a Tag named `id`.

func (*Client) DeleteTagCategory

func (c *Client) DeleteTagCategory(ctx context.Context, categoryName string) error

DeleteTagCategory deletes a Tag Category named `categoryName`.

func (*Client) DeleteVirtualMachine

func (c *Client) DeleteVirtualMachine(ctx context.Context, vmMO mo.VirtualMachine) error

DeleteVirtualMachine deletes a VirtualMachine.

func (*Client) GetCnsVolumes

func (c *Client) GetCnsVolumes(ctx context.Context, infraID string) ([]cnstypes.CnsVolume, error)

GetCnsVolumes returns the list of CNS volumes associated with the cluster that is being destroyed.

func (*Client) GetVCenterName

func (c *Client) GetVCenterName() string

GetVCenterName returns the name of the vcenter being queried.

func (*Client) ListFolders

func (c *Client) ListFolders(ctx context.Context, tagID string) ([]mo.Folder, error)

ListFolders returns all ManagedObjects of type "Folder".

func (*Client) ListVirtualMachines

func (c *Client) ListVirtualMachines(ctx context.Context, tagID string) ([]mo.VirtualMachine, error)

ListVirtualMachines returns ManagedObjects of type "VirtualMachine".

func (*Client) Logout

func (c *Client) Logout()

Logout logs out from the clients used.

func (*Client) StopVirtualMachine

func (c *Client) StopVirtualMachine(ctx context.Context, vmMO mo.VirtualMachine) error

StopVirtualMachine stops a VM if it's not already powered off.

type ClusterUninstaller

type ClusterUninstaller struct {
	ClusterID string
	InfraID   string

	Logger logrus.FieldLogger
	// contains filtered or unexported fields
}

ClusterUninstaller holds the various options for the cluster we want to delete.

func (*ClusterUninstaller) Run

Run is the entrypoint to start the uninstall process.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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