vmservice

package
v1.25.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClusterSelectorKey expects key/value pair {ClusterSelectorKey: <cluster name>} for target nodes: ClusterSelectorKey
	ClusterSelectorKey = "capv.vmware.com/cluster.name"
	// NodeSelectorKey expects key/value pair {NodeSelectorKey: NodeRole} for target nodes: NodeSelectorKey
	NodeSelectorKey = "capv.vmware.com/cluster.role"

	// LegacyClusterSelectorKey expects key/value pair {LegacyClusterSelectorKey: <cluster name>} for target nodes: LegacyClusterSelectorKey
	LegacyClusterSelectorKey = "capw.vmware.com/cluster.name"
	// LegacyNodeSelectorKey expects key/value pair {LegacyNodeSelectorKey: NodeRole} for target nodes: LegacyNodeSelectorKey
	LegacyNodeSelectorKey = "capw.vmware.com/cluster.role"

	// NodeRole is set by capw, we are targeting worker vms
	NodeRole = "node"

	// LabelClusterNameKey label should be added on virtual machine service with its corresponding k8s service
	LabelClusterNameKey = "run.tanzu.vmware.com/cluster.name"
	// LabelServiceNameKey label should be added on virtual machine service with its corresponding k8s service
	LabelServiceNameKey = "run.tanzu.vmware.com/service.name"
	// LabelServiceNameSpaceKey label should be added on virtual machine service with its corresponding k8s service
	LabelServiceNameSpaceKey = "run.tanzu.vmware.com/service.namespace"

	// AnnotationServiceExternalTrafficPolicyKey label is used to piggyback vSphere Paravirtual Service's
	// configuration to the supervisor cluster. AnnotationServiceExternalTrafficPolicyKey and AnnotationServiceHealthCheckNodePortKey are not part of
	// VirtualMachineService spec because they're K8s Service/Pod specific and
	// don't apply in a VirtualMachine context
	AnnotationServiceExternalTrafficPolicyKey = "virtualmachineservice.vmoperator.vmware.com/service.externalTrafficPolicy"
	// AnnotationServiceHealthCheckNodePortKey label is used to piggyback vSphere Paravirtual Service's
	// configuration to the supervisor cluster.
	AnnotationServiceHealthCheckNodePortKey = "virtualmachineservice.vmoperator.vmware.com/service.healthCheckNodePort"

	// MaxCheckSumLen is the maximum length of vmservice suffix: vsphere paravirtual name length cannot exceed 41 bytes in total, so we need to make sure vmservice suffix is 21 bytes (63 - 41 -1 = 21)
	// https://gitlab.eng.vmware.com/core-build/guest-cluster-controller/blob/master/webhooks/validation/tanzukubernetescluster_validator.go#L56
	MaxCheckSumLen = 21
)

Variables

View Source
var (
	ErrCreateVMService     = errors.New("failed to create VirtualMachineService")
	ErrUpdateVMService     = errors.New("failed to update VirtualMachineService")
	ErrGetVMService        = errors.New("failed to get VirtualMachineService")
	ErrDeleteVMService     = errors.New("failed to delete VirtualMachineService")
	ErrVMServiceIPNotFound = errors.New("VirtualMachineService IP not found")
	ErrNodePortNotFound    = errors.New("NodePort not found")
)

A list of possible error messages

View Source
var (
	// IsLegacy indicates whether legacy paravirtual mode is enabled
	// Default to false
	IsLegacy bool
)

Functions

func GetVmopClient

func GetVmopClient(config *rest.Config) (client.Client, error)

GetVmopClient gets a vm-operator-api client This is separate from NewVMService so that a fake client can be injected for testing

Types

type VMService

type VMService interface {
	GetVMServiceName(service *v1.Service, clusterName string) string
	Get(ctx context.Context, service *v1.Service, clusterName string) (*v1alpha1.VirtualMachineService, error)
	Create(ctx context.Context, service *v1.Service, clusterName string) (*v1alpha1.VirtualMachineService, error)
	CreateOrUpdate(ctx context.Context, service *v1.Service, clusterName string) (*v1alpha1.VirtualMachineService, error)
	Update(ctx context.Context, service *v1.Service, clusterName string, vmService *v1alpha1.VirtualMachineService) (*v1alpha1.VirtualMachineService, error)
	Delete(ctx context.Context, service *v1.Service, clusterName string) error
}

VMService is an interface for VirtualMachineService operations

func NewVMService

func NewVMService(vmClient client.Client, ns string, ownerRef *metav1.OwnerReference) VMService

NewVMService creates a vmService object

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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