check

package
v0.0.0-...-d674e6d Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatastoreInfoProperty = "info"
	SummaryProperty       = "summary"
)
View Source
const (
	// TagCategoryRegion the tag category associated with regions.
	TagCategoryRegion = "openshift-region"

	// TagCategoryZone the tag category associated with zones.
	TagCategoryZone = "openshift-zone"
)
View Source
const (
	CbtProperty = "ctkEnabled"
)

Variables

View Source
var (
	// DefaultClusterChecks is the list of all checks.
	DefaultClusterChecks map[string]ClusterCheck = map[string]ClusterCheck{
		"CheckTaskPermissions":    CheckTaskPermissions,
		"ClusterInfo":             CollectClusterInfo,
		"CheckFolderPermissions":  CheckFolderPermissions,
		"CheckDefaultDatastore":   CheckDefaultDatastore,
		"CheckStorageClasses":     CheckStorageClasses,
		"CountVolumeTypes":        CountPVTypes,
		"CheckAccountPermissions": CheckAccountPermissions,
		"CheckZoneTags":           CheckZoneTags,
	}
	DefaultNodeChecks []NodeCheck = []NodeCheck{
		&CheckNodeDiskUUID{},
		&CheckNodeProviderID{},
		&CollectNodeHWVersion{},
		&CollectNodeESXiVersion{},
		&CheckNodeDiskPerf{},
		&CheckComputeClusterPermissions{},
		&CheckResourcePoolPermissions{},
		&CollectNodeCBT{},
	}

	// NodeProperties is a list of properties that NodeCheck can rely on to be pre-filled.
	// Add a property to this list when a NodeCheck uses it.
	NodeProperties = []string{"config.extraConfig", "config.flags", "config.version", "runtime.host", "resourcePool"}
)

Functions

func CheckAccountPermissions

func CheckAccountPermissions(ctx *CheckContext) error

CheckAccountPermissions will attempt to validate that the necessary credentials are held by the account performing the installation. each group of privileges will be checked for missing privileges.

func CheckDefaultDatastore

func CheckDefaultDatastore(ctx *CheckContext) error

CheckDefaultDatastore checks that the default data store name in vSphere config file is short enough.

func CheckFolderPermissions

func CheckFolderPermissions(ctx *CheckContext) error

CheckFolderPermissions tests that OCP has permissions to list volumes in the default Datastore. This is necessary to create volumes. The check lists datastore's "/", which must exist. The check tries to list "kubevols/". It tolerates when it's missing, it will be created by OCP on the first provisioning.

func CheckStorageClasses

func CheckStorageClasses(ctx *CheckContext) error

CheckStorageClasses tests that datastore name in all StorageClasses in the cluster is short enough.

func CheckTaskPermissions

func CheckTaskPermissions(ctx *CheckContext) error

CheckFolderList tests that OCP has permissions to list volumes in Datastore. This is necessary to create volumes.

func CheckZoneTags

func CheckZoneTags(ctx *CheckContext) error

CheckZoneTags will attempt to validate that the necessary tags are present to represent the various zones defined for a cluster.

func CollectClusterInfo

func CollectClusterInfo(ctx *CheckContext) error

CollectClusterInfo grabs information about vSphere cluster and updates corresponding metrics. It's not a vSphere check per se, just using the interface.

func ConvertToPlatformSpec

func ConvertToPlatformSpec(infra *ocpv1.Infrastructure, checkContext *CheckContext)

func CountPVTypes

func CountPVTypes(ctx *CheckContext) error

func JoinErrors

func JoinErrors(errs []error) error

Types

type AuthManager

type AuthManager interface {
	FetchUserPrivilegeOnEntities(ctx context.Context, entities []types.ManagedObjectReference, userName string) ([]types.UserPrivilegeResult, error)
}

AuthManager defines an interface to an implementation of the AuthorizationManager to facilitate mocking

type CheckComputeClusterPermissions

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

CheckComputeClusterPermissions confirms that resources associated with the node maintain required privileges.

func (*CheckComputeClusterPermissions) CheckNode

func (c *CheckComputeClusterPermissions) CheckNode(ctx *CheckContext, node *v1.Node, vm *mo.VirtualMachine) error

func (*CheckComputeClusterPermissions) FinishCheck

func (c *CheckComputeClusterPermissions) FinishCheck(ctx *CheckContext)

func (*CheckComputeClusterPermissions) Name

func (*CheckComputeClusterPermissions) StartCheck

func (c *CheckComputeClusterPermissions) StartCheck() error

type CheckContext

type CheckContext struct {
	Cache            cache.VSphereCache
	MetricsCollector *metrics.Collector
	Context          context.Context
	VMConfig         *vsphere.VSphereConfig
	GovmomiClient    *govmomi.Client
	VMClient         *vim25.Client
	TagManager       *vapitags.Manager
	Username         string
	AuthManager      AuthManager
	KubeClient       KubeClient
	ClusterInfo      *util.ClusterInfo
	//Infra            *ocpv1.Infrastructure
	PlatformSpec *ocpv1.VSpherePlatformSpec
}

type CheckNodeDiskPerf

type CheckNodeDiskPerf struct{}

CheckNodeDiskPerf Checks node performance of master nodes.

func (*CheckNodeDiskPerf) BuildCounterIdMap

func (c *CheckNodeDiskPerf) BuildCounterIdMap(ctx *CheckContext, vm *mo.VirtualMachine) error

func (*CheckNodeDiskPerf) CheckNode

func (c *CheckNodeDiskPerf) CheckNode(ctx *CheckContext, node *v1.Node, vm *mo.VirtualMachine) error

func (*CheckNodeDiskPerf) FinishCheck

func (c *CheckNodeDiskPerf) FinishCheck(ctx *CheckContext)

func (*CheckNodeDiskPerf) GetPerfMetric

func (c *CheckNodeDiskPerf) GetPerfMetric(ctx *CheckContext, vm *mo.VirtualMachine, metricName string) (*types.PerfMetricId, error)

func (*CheckNodeDiskPerf) Name

func (c *CheckNodeDiskPerf) Name() string

func (*CheckNodeDiskPerf) PerformMetricCheck

func (c *CheckNodeDiskPerf) PerformMetricCheck(ctx *CheckContext, node *v1.Node, vm *mo.VirtualMachine, mcd MetricCheckDef) error

func (*CheckNodeDiskPerf) StartCheck

func (c *CheckNodeDiskPerf) StartCheck() error

type CheckNodeDiskUUID

type CheckNodeDiskUUID struct{}

CheckNodeDiskUUID makes sure that all nodes have disk.enableUUID=TRUE.

func (*CheckNodeDiskUUID) CheckNode

func (c *CheckNodeDiskUUID) CheckNode(ctx *CheckContext, node *v1.Node, vm *mo.VirtualMachine) error

func (*CheckNodeDiskUUID) FinishCheck

func (c *CheckNodeDiskUUID) FinishCheck(ctx *CheckContext)

func (*CheckNodeDiskUUID) Name

func (c *CheckNodeDiskUUID) Name() string

func (*CheckNodeDiskUUID) StartCheck

func (c *CheckNodeDiskUUID) StartCheck() error

type CheckNodeProviderID

type CheckNodeProviderID struct{}

CheckNodeProviderID makes sure that all nodes have ProviderID set.

func (*CheckNodeProviderID) CheckNode

func (c *CheckNodeProviderID) CheckNode(ctx *CheckContext, node *v1.Node, vm *mo.VirtualMachine) error

func (*CheckNodeProviderID) FinishCheck

func (c *CheckNodeProviderID) FinishCheck(ctx *CheckContext)

func (*CheckNodeProviderID) Name

func (c *CheckNodeProviderID) Name() string

func (*CheckNodeProviderID) StartCheck

func (c *CheckNodeProviderID) StartCheck() error

type CheckResourcePoolPermissions

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

CheckResourcePoolPermissions confirms that resources associated with the node maintain required privileges.

func (*CheckResourcePoolPermissions) CheckNode

func (c *CheckResourcePoolPermissions) CheckNode(ctx *CheckContext, node *v1.Node, vm *mo.VirtualMachine) error

func (*CheckResourcePoolPermissions) FinishCheck

func (c *CheckResourcePoolPermissions) FinishCheck(ctx *CheckContext)

func (*CheckResourcePoolPermissions) Name

func (*CheckResourcePoolPermissions) StartCheck

func (c *CheckResourcePoolPermissions) StartCheck() error

type ClusterCheck

type ClusterCheck func(ctx *CheckContext) error

Interface of a single vSphere cluster-level check. It gets connection to vSphere, vSphere config and connection to Kubernetes. It returns result of the check.

type CollectNodeCBT

type CollectNodeCBT struct {
}

CollectNodeCBT emits metric with CBT Config of each VM

func (*CollectNodeCBT) CheckNode

func (c *CollectNodeCBT) CheckNode(ctx *CheckContext, node *v1.Node, vm *mo.VirtualMachine) error

func (*CollectNodeCBT) FinishCheck

func (c *CollectNodeCBT) FinishCheck(ctx *CheckContext)

func (*CollectNodeCBT) Name

func (c *CollectNodeCBT) Name() string

func (*CollectNodeCBT) StartCheck

func (c *CollectNodeCBT) StartCheck() error

type CollectNodeESXiVersion

type CollectNodeESXiVersion struct {
}

CollectNodeESXiVersion emits metric with version of each ESXi host that runs at least a single VM with node.

func (*CollectNodeESXiVersion) CheckNode

func (c *CollectNodeESXiVersion) CheckNode(ctx *CheckContext, node *v1.Node, vm *mo.VirtualMachine) error

func (*CollectNodeESXiVersion) FinishCheck

func (c *CollectNodeESXiVersion) FinishCheck(ctx *CheckContext)

func (*CollectNodeESXiVersion) Name

func (c *CollectNodeESXiVersion) Name() string

func (*CollectNodeESXiVersion) StartCheck

func (c *CollectNodeESXiVersion) StartCheck() error

type CollectNodeHWVersion

type CollectNodeHWVersion struct {
}

CollectNodeHWVersion emits metric with HW version of each VM

func (*CollectNodeHWVersion) CheckNode

func (c *CollectNodeHWVersion) CheckNode(ctx *CheckContext, node *v1.Node, vm *mo.VirtualMachine) error

func (*CollectNodeHWVersion) FinishCheck

func (c *CollectNodeHWVersion) FinishCheck(ctx *CheckContext)

func (*CollectNodeHWVersion) Name

func (c *CollectNodeHWVersion) Name() string

func (*CollectNodeHWVersion) StartCheck

func (c *CollectNodeHWVersion) StartCheck() error

type KubeClient

type KubeClient interface {
	// GetInfrastructure returns current Infrastructure instance.
	GetInfrastructure(ctx context.Context) (*ocpv1.Infrastructure, error)
	// ListNodes returns list of all nodes in the cluster.
	ListNodes(ctx context.Context) ([]*v1.Node, error)
	// ListStorageClasses returns list of all storage classes in the cluster.
	ListStorageClasses(ctx context.Context) ([]*storagev1.StorageClass, error)
	// ListPVs returns list of all PVs in the cluster.
	ListPVs(ctx context.Context) ([]*v1.PersistentVolume, error)
}

KubeClient is an interface between individual vSphere check and Kubernetes.

type MetricCheckDef

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

type NodeCheck

type NodeCheck interface {
	Name() string
	// Start new round of checks. The check may initialize its internal state here.
	StartCheck() error
	// Check of a single node. It gets connection to vSphere, vSphere config, connection
	// to Kubernetes and a node to check. Returns result of the check.
	// Multiple CheckNodes can run in parallel, each for a different node!
	CheckNode(ctx *CheckContext, node *v1.Node, vm *mo.VirtualMachine) error
	// Finish current round of checks. The check may report metrics here.
	// Since it's called serially for all checks, it should not perform too
	// expensive calculations. In addition, it must respect ctx.Context.
	// It will be called after all CheckNode calls finish.
	FinishCheck(ctx *CheckContext)
}

Interface of a single vSphere node-level check. Reason for separate node-level checks: 1) We want to expose per node metrics what checks failed/succeeded. 2) When multiple checks need a VM, we want to get it only once from the vSphere API.

Every round of checks starts with a single StartCheck(), then CheckNode for each node (possibly in parallel). After all CheckNodes finish, the FinishCheck() is called. It is guaranteed that only one "round" is running at the time.

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